Skip to content

Commit

Permalink
add validations and faq
Browse files Browse the repository at this point in the history
  • Loading branch information
kakawka committed Dec 6, 2014
1 parent 7c296d7 commit 01026b8
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 10 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ gem 'omniauth-facebook'
gem 'bootstrap-sass'
gem 'medium-editor-rails'
gem "cocoon"
gem "dogstatsd-ruby"

# Use mysql as the database for Active Record
gem 'mysql2'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ GEM
thread_safe (~> 0.1)
warden (~> 1.2.3)
dimensions (1.3.0)
dogstatsd-ruby (1.4.1)
erubis (2.7.0)
execjs (2.2.2)
faraday (0.9.0)
Expand Down Expand Up @@ -176,6 +177,7 @@ DEPENDENCIES
cocoon
coffee-rails (~> 4.0.0)
devise
dogstatsd-ruby
jbuilder (~> 2.0)
jquery-rails
medium-editor-rails
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
class WelcomeController < ApplicationController
def index
end

def faq
@questions = Question.all
end
end
2 changes: 2 additions & 0 deletions app/models/license_agreement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ class LicenseAgreement < ActiveRecord::Base
belongs_to :user
has_many :license_agreement_terms
accepts_nested_attributes_for :license_agreement_terms

validates :name, :domain, :user_id, presence: true
end
2 changes: 2 additions & 0 deletions app/models/license_agreement_term.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class LicenseAgreementTerm < ActiveRecord::Base
has_many :term_acceptances
belongs_to :license_agreement

validates :text, :license_agreement_id, :code, presence: true
end
2 changes: 2 additions & 0 deletions app/models/question.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Question < ActiveRecord::Base
end
2 changes: 2 additions & 0 deletions app/models/visitor.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
class Visitor < ActiveRecord::Base
has_many :term_acceptances

validates :uid, presence: true
end
8 changes: 4 additions & 4 deletions app/views/devise/registrations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<%= devise_error_messages! %>

<div class="form-group">
<%= f.label :name %><br />
<%= f.text_field :name, autofocus: true, class: "form-control" %>
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, class: "form-control" %>
</div>

<div class="form-group">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, class: "form-control" %>
<%= f.label :name %><br />
<%= f.text_field :name, autofocus: true, class: "form-control" %>
</div>

<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
Expand Down
8 changes: 4 additions & 4 deletions app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<%= devise_error_messages! %>

<div class="form-group">
<%= f.label :name %><br />
<%= f.text_field :name, autofocus: true, class: "form-control" %>
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, class: "form-control" %>
</div>

<div class="form-group">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, class: "form-control" %>
<%= f.label :name %><br />
<%= f.text_field :name, autofocus: true, class: "form-control" %>
</div>

<div class="form-group">
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_navigation.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ nav.navbar.navbar-default role="navigation"
#bs-example-navbar-collapse-1.collapse.navbar-collapse
ul.nav.navbar-nav
li.active
a href="#" FAQ
= link_to "FAQ", faq_path
li
a href="#" Documentation
ul.nav.navbar-nav.navbar-right
Expand Down
12 changes: 12 additions & 0 deletions app/views/welcome/faq.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
h3 Frequently asked questions
#accordion.panel-group
- @questions.each_with_index do |question, i|
.panel.panel-default
.panel-heading
h4.panel-title
a data-parent="#accordion" data-toggle="collapse" href="#collapse-#{question.id}"
- i += 1
= "#{i}. #{question.question}"
.panel-collapse.collapse id="collapse-#{question.id}"
.panel-body
= raw question.answer
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks", :registrations => "registrations", }

root 'welcome#index'
get '/faq' => 'welcome#faq'
get '/demo' => 'markup#demo'
resources :license_agreements
# The priority is based upon order of creation: first created -> highest priority.
Expand Down
10 changes: 10 additions & 0 deletions db/migrate/20141206151753_create_questions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateQuestions < ActiveRecord::Migration
def change
create_table :questions do |t|
t.string :question
t.text :answer

t.timestamps
end
end
end
9 changes: 8 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20141206095114) do
ActiveRecord::Schema.define(version: 20141206151753) do

create_table "license_agreement_terms", force: true do |t|
t.string "code"
Expand All @@ -34,6 +34,13 @@

add_index "license_agreements", ["user_id"], name: "index_license_agreements_on_user_id", using: :btree

create_table "questions", force: true do |t|
t.string "question"
t.text "answer"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "term_acceptances", force: true do |t|
t.integer "visitor_id"
t.integer "license_agreement_term_id"
Expand Down
15 changes: 15 additions & 0 deletions ddagent-install.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

* Installing APT package sources for Datadog

sh: 1: cannot create /etc/apt/sources.list.d/datadog.list: Directory nonexistent

It looks like you hit an issue when trying to install the Agent.

Troubleshooting and basic usage information for the Agent are available at:

http://docs.datadoghq.com/guides/basic_agent_usage/

If you're still having problems, please send an email to [email protected]
with the contents of ddagent-install.log and we'll do our very best to help you
solve your problem.


0 comments on commit 01026b8

Please sign in to comment.