Permalink
Browse files

adding questionaire

  • Loading branch information...
1 parent 6040a0c commit 0c0d668842bb1c62bb62c7330ca8fac63af5b3bc Geoff Massanek committed Jun 8, 2011
@@ -0,0 +1,87 @@
+class QuestionairesController < ApplicationController
+ before_filter :login_required, :only => [:show, :update, :edit, :destroy]
+ # GET /questionaires
+ # GET /questionaires.xml
+ def index
+ @questionaires = Questionaire.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @questionaires }
+ end
+ end
+
+ # GET /questionaires/1
+ # GET /questionaires/1.xml
+ def show
+ @questionaire = Questionaire.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @questionaire }
+ end
+ end
+
+ # GET /questionaires/new
+ # GET /questionaires/new.xml
+ def new
+ @questionaire = Questionaire.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @questionaire }
+ end
+ end
+
+ # GET /questionaires/1/edit
+ def edit
+ @questionaire = Questionaire.find(params[:id])
+ end
+
+ # POST /questionaires
+ # POST /questionaires.xml
+ def create
+ @questionaire = Questionaire.new(params[:questionaire])
+
+ respond_to do |format|
+ if @questionaire.save
+ flash[:notice] = "Thanks for participating in our survey."
+ format.html {
+ render :action => "show"
+ }
+ format.xml { render :xml => @questionaire, :status => :created, :location => @questionaire }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @questionaire.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /questionaires/1
+ # PUT /questionaires/1.xml
+ def update
+ @questionaire = Questionaire.find(params[:id])
+
+ respond_to do |format|
+ if @questionaire.update_attributes(params[:questionaire])
+ format.html { redirect_to(@questionaire, :notice => 'Questionaire was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @questionaire.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /questionaires/1
+ # DELETE /questionaires/1.xml
+ def destroy
+ @questionaire = Questionaire.find(params[:id])
+ @questionaire.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(questionaires_url) }
+ format.xml { head :ok }
+ end
+ end
+end
@@ -0,0 +1,2 @@
+module QuestionairesHelper
+end
View
@@ -0,0 +1,13 @@
+class Questionaire < ActiveRecord::Base
+ email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
+
+ attr_accessible :name, :email, :q1, :q2, :q3, :q4, :q5, :q6, :q7, :q8, :q9
+
+ validates :name,
+ :length => { :within => 4..40 }
+
+ validates :email,
+ :format => {:with => email_regex}
+
+end
+
@@ -3,6 +3,8 @@
<h2>Admin Home</h2>
<h3> <%= link_to "Registrations", registrations_path %> </h3>
<h3><%= link_to "Announcements", announcements_path %></h3>
+ <h3><%= link_to "Contacts", contacts_path %></h3>
+ <h3><%= link_to "Surveys", questionaires_path %></h3>
<!--<h3>#<%= link_to "Users", users_path %></h3>-->
</div>
</div>
@@ -1,27 +1,31 @@
-<h1>Listing contacts</h1>
+<div id="container">
+ <div id="content">
+ <h1>Listing contacts</h1>
-<table>
- <tr>
- <th>Name</th>
- <th>Email</th>
- <th>Message</th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
+ <table>
+ <tr>
+ <th>Name</th>
+ <th>Email</th>
+ <th>Message</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
-<% @contacts.each do |contact| %>
- <tr>
- <td><%= contact.name %></td>
- <td><%= contact.email %></td>
- <td><%= contact.message %></td>
- <td><%= link_to 'Show', contact %></td>
- <td><%= link_to 'Edit', edit_contact_path(contact) %></td>
- <td><%= link_to 'Destroy', contact, :confirm => 'Are you sure?', :method => :delete %></td>
- </tr>
-<% end %>
-</table>
+ <% @contacts.each do |contact| %>
+ <tr>
+ <td><%= contact.name %></td>
+ <td><%= contact.email %></td>
+ <td><%= contact.message %></td>
+ <td><%= link_to 'Show', contact %></td>
+ <td><%= link_to 'Edit', edit_contact_path(contact) %></td>
+ <td><%= link_to 'Destroy', contact, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+ <% end %>
+ </table>
-<br />
+ <br />
-<%= link_to 'New Contact', new_contact_path %>
+ <%= link_to 'New Contact', new_contact_path %>
+ </div>
+</div>
@@ -12,4 +12,8 @@
<p>
Registration is open for the 2011 conference. Make sure to reserve your spot now.
</p>
+ <h3><%= link_to "Participant Survey", questionaire_path%></h3>
+ <p>
+ Give us some feedback about you, your practice, and your interest in the coference by participating in our survey
+ </p>
</div>
@@ -0,0 +1,19 @@
+<%= simple_form_for(@questionaire) do |f| %>
+ <%= f.error_notification %>
+
+ <div class="inputs">
+ <%= f.input :name %>
+ <%= f.input :email %>
+ <br/>
+ <%= f.input :q1, :class=>'question', :label => 'What is your practice setting and role?' %>
+ <%= f.input :q2, :label => 'What do you consider the biggest challenges in your current practice setting?' %>
+ <%= f.input :q3, :label => 'Do you have any staff reporting to you?' %>
+ <%= f.input :q4, :label => 'Are you billing for your services?' %>
+ <%= f.input :q5, :label => 'What do you hope to gain from attending this conference?' %>
+ <%= f.input :q6, :label => 'Are you willing to have your name and contact info available to other attendees?' %>
+ </div>
+
+ <div class="actions">
+ <%= f.button :submit %>
+ </div>
+<% end %>
@@ -0,0 +1,6 @@
+<h1>Editing questionaire</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @questionaire %> |
+<%= link_to 'Back', questionaires_path %>
@@ -0,0 +1,41 @@
+<div id="container">
+ <div id="content">
+ <h1>Listing questionaires</h1>
+
+ <table>
+ <tr>
+ <th>Name</th>
+ <th>Email</th>
+ <th>Q1</th>
+ <th>Q2</th>
+ <th>Q3</th>
+ <th>Q4</th>
+ <th>Q5</th>
+ <th>Q6</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+ <% @questionaires.each do |questionaire| %>
+ <tr>
+ <td><%= questionaire.name %></td>
+ <td><%= questionaire.email %></td>
+ <td><%= questionaire.q1 %></td>
+ <td><%= questionaire.q2 %></td>
+ <td><%= questionaire.q3 %></td>
+ <td><%= questionaire.q4 %></td>
+ <td><%= questionaire.q5 %></td>
+ <td><%= questionaire.q6 %></td>
+ <td><%= link_to 'Show', questionaire %></td>
+ <td><%= link_to 'Edit', edit_questionaire_path(questionaire) %></td>
+ <td><%= link_to 'Destroy', questionaire, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+ <% end %>
+ </table>
+
+ <br />
+
+ <%= link_to 'New Questionaire', new_questionaire_path %>
+ </div>
+</div>
@@ -0,0 +1,7 @@
+<div id="container">
+ <div id="content">
+ <h3>Participant Survey</h3>
+ <p>Let us know more about you, your practice, and your interest in the coference by participating in our survey below.</p>
+ <%= render 'form' %>
+ </div>
+</div>
@@ -0,0 +1,52 @@
+<div id="container">
+ <div id="content">
+ <p id="notice"><%= notice %></p>
+
+ <p>
+ <b>Name:</b>
+ <%= @questionaire.name %>
+ </p>
+
+ <p>
+ <b>Email:</b>
+ <%= @questionaire.email %>
+ </p>
+
+ <p>
+ <b>What is your practice setting and role?:</b>
+ <br/>
+ <%= @questionaire.q1 %>
+ </p>
+
+ <p>
+ <b>What do you consider the biggest challenges in your current practice setting?:</b>
+ <br/>
+ <%= @questionaire.q2 %>
+ </p>
+
+ <p>
+ <b>Do you have any staff reporting to you?:</b>
+ <br/>
+ <%= @questionaire.q3 %>
+ </p>
+
+ <p>
+ <b>Are you billing for your services?:</b>
+ <br/>
+ <%= @questionaire.q4 %>
+ </p>
+
+ <p>
+ <b>What do you hope to gain from attending this conference?:</b>
+ <br/>
+ <%= @questionaire.q5 %>
+ </p>
+
+ <p>
+ <b>Are you willing to have your name and contact info available to other attendees?:</b>
+ <br/>
+ <%= @questionaire.q6 %>
+ </p>
+
+ </div>
+</div>
@@ -1,4 +1,7 @@
-<div id="container"> <div id="content"> <h2>Register Now</h2> <p>Fill out the registration below to secure your spot for the upcoming summit. Please note, your spot will
+<div id="container">
+ <div id="content">
+ <h2>Register Now</h2>
+ <p>Fill out the registration below to secure your spot for the upcoming summit. Please note, your spot will
not be saved until payment has been received.</p>
<p>There is a $110 per person attendance fee for the 2011 conference. Payments should be made via check once the following registration form has been submitted. Find payment details below as well as in your registration confirmation email.</p>
<hr>
View
@@ -1,6 +1,7 @@
MarthaApp::Application.routes.draw do
+
get "users/reset_password"
get "admin/index"
get "admin/registrations"
@@ -23,13 +24,13 @@
match '/history', :to => 'pages#history'
match '/faq', :to => 'pages#faq'
match '/contact', :to => 'contacts#new'
-
+ match '/questionaire', :to => 'questionaires#new'
resources :subscriptions
resources :contacts
resources :announcements
resources :registrations
resources :users
-
+ resources :questionaires
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -0,0 +1,23 @@
+class CreateQuestionaires < ActiveRecord::Migration
+ def self.up
+ create_table :questionaires do |t|
+ t.string :name
+ t.string :email
+ t.text :q1
+ t.text :q2
+ t.text :q3
+ t.text :q4
+ t.text :q5
+ t.text :q6
+ t.text :q7
+ t.text :q8
+ t.text :q9
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :questionaires
+ end
+end
View
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110607011907) do
+ActiveRecord::Schema.define(:version => 20110608014121) do
create_table "announcements", :force => true do |t|
t.string "title"
@@ -29,6 +29,22 @@
t.datetime "updated_at"
end
+ create_table "questionaires", :force => true do |t|
+ t.string "name"
+ t.string "email"
+ t.text "q1"
+ t.text "q2"
+ t.text "q3"
+ t.text "q4"
+ t.text "q5"
+ t.text "q6"
+ t.text "q7"
+ t.text "q8"
+ t.text "q9"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
create_table "registrations", :force => true do |t|
t.string "name"
t.string "email"
Oops, something went wrong.

0 comments on commit 0c0d668

Please sign in to comment.