Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7cc6b1f
Showing
87 changed files
with
1,202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.bundle/ | ||
log/*.log | ||
pkg/ | ||
test/dummy/db/*.sqlite3 | ||
test/dummy/log/*.log | ||
test/dummy/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rvm use ruby-1.9.2-p290@survey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
source "http://rubygems.org" | ||
|
||
# Declare your gem's dependencies in survey_says.gemspec. | ||
# Bundler will treat runtime dependencies like base dependencies, and | ||
# development dependencies will be added by default to the :development group. | ||
gemspec | ||
|
||
# jquery-rails is used by the dummy application | ||
gem "jquery-rails" | ||
|
||
# Declare any dependencies that are still in development here instead of in | ||
# your gemspec. These might include edge Rails or gems from your path or | ||
# Git. Remember to move these dependencies to your gemspec before releasing | ||
# your gem to rubygems.org. | ||
|
||
# To use debugger | ||
gem 'ruby-debug19', :require => 'ruby-debug' | ||
gem "nifty-generators", :git => 'git://github.com/drhenner/nifty-generators.git' | ||
gem 'twitter-bootstrap-rails' | ||
gem "mocha", :group => :test | ||
|
||
group :test do | ||
gem 'factory_girl_rails', "~> 1.1.0" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
GIT | ||
remote: git://github.com/drhenner/nifty-generators.git | ||
revision: fd658e6d67251d7c714ac6a32edfd3b7807f7475 | ||
specs: | ||
nifty-generators (0.4.2) | ||
|
||
PATH | ||
remote: . | ||
specs: | ||
survey_says (0.0.1pre) | ||
nifty-generators | ||
rails (~> 3.1.3) | ||
twitter-bootstrap-rails | ||
|
||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
actionmailer (3.1.3) | ||
actionpack (= 3.1.3) | ||
mail (~> 2.3.0) | ||
actionpack (3.1.3) | ||
activemodel (= 3.1.3) | ||
activesupport (= 3.1.3) | ||
builder (~> 3.0.0) | ||
erubis (~> 2.7.0) | ||
i18n (~> 0.6) | ||
rack (~> 1.3.5) | ||
rack-cache (~> 1.1) | ||
rack-mount (~> 0.8.2) | ||
rack-test (~> 0.6.1) | ||
sprockets (~> 2.0.3) | ||
activemodel (3.1.3) | ||
activesupport (= 3.1.3) | ||
builder (~> 3.0.0) | ||
i18n (~> 0.6) | ||
activerecord (3.1.3) | ||
activemodel (= 3.1.3) | ||
activesupport (= 3.1.3) | ||
arel (~> 2.2.1) | ||
tzinfo (~> 0.3.29) | ||
activeresource (3.1.3) | ||
activemodel (= 3.1.3) | ||
activesupport (= 3.1.3) | ||
activesupport (3.1.3) | ||
multi_json (~> 1.0) | ||
archive-tar-minitar (0.5.2) | ||
arel (2.2.1) | ||
builder (3.0.0) | ||
columnize (0.3.5) | ||
commonjs (0.2.0) | ||
therubyracer (~> 0.9.9) | ||
erubis (2.7.0) | ||
factory_girl (2.0.5) | ||
factory_girl_rails (1.1.0) | ||
factory_girl (~> 2.0.0) | ||
railties (>= 3.0.0) | ||
hike (1.2.1) | ||
i18n (0.6.0) | ||
jquery-rails (1.0.19) | ||
railties (~> 3.0) | ||
thor (~> 0.14) | ||
json (1.6.3) | ||
less (2.0.8) | ||
commonjs (~> 0.2.0) | ||
therubyracer (~> 0.9.9) | ||
less-rails (2.1.1) | ||
actionpack (~> 3.1.1) | ||
less (~> 2.0.7) | ||
libv8 (3.3.10.4) | ||
linecache19 (0.5.12) | ||
ruby_core_source (>= 0.1.4) | ||
mail (2.3.0) | ||
i18n (>= 0.4.0) | ||
mime-types (~> 1.16) | ||
treetop (~> 1.4.8) | ||
metaclass (0.0.1) | ||
mime-types (1.17.2) | ||
mocha (0.10.0) | ||
metaclass (~> 0.0.1) | ||
multi_json (1.0.4) | ||
polyglot (0.3.3) | ||
rack (1.3.5) | ||
rack-cache (1.1) | ||
rack (>= 0.4) | ||
rack-mount (0.8.3) | ||
rack (>= 1.0.0) | ||
rack-ssl (1.3.2) | ||
rack | ||
rack-test (0.6.1) | ||
rack (>= 1.0) | ||
rails (3.1.3) | ||
actionmailer (= 3.1.3) | ||
actionpack (= 3.1.3) | ||
activerecord (= 3.1.3) | ||
activeresource (= 3.1.3) | ||
activesupport (= 3.1.3) | ||
bundler (~> 1.0) | ||
railties (= 3.1.3) | ||
railties (3.1.3) | ||
actionpack (= 3.1.3) | ||
activesupport (= 3.1.3) | ||
rack-ssl (~> 1.3.2) | ||
rake (>= 0.8.7) | ||
rdoc (~> 3.4) | ||
thor (~> 0.14.6) | ||
rake (0.9.2.2) | ||
rdoc (3.11) | ||
json (~> 1.4) | ||
ruby-debug-base19 (0.11.25) | ||
columnize (>= 0.3.1) | ||
linecache19 (>= 0.5.11) | ||
ruby_core_source (>= 0.1.4) | ||
ruby-debug19 (0.11.6) | ||
columnize (>= 0.3.1) | ||
linecache19 (>= 0.5.11) | ||
ruby-debug-base19 (>= 0.11.19) | ||
ruby_core_source (0.1.5) | ||
archive-tar-minitar (>= 0.5.2) | ||
sprockets (2.0.3) | ||
hike (~> 1.2) | ||
rack (~> 1.0) | ||
tilt (~> 1.1, != 1.3.0) | ||
sqlite3 (1.3.5) | ||
therubyracer (0.9.9) | ||
libv8 (~> 3.3.10) | ||
thor (0.14.6) | ||
tilt (1.3.3) | ||
treetop (1.4.10) | ||
polyglot | ||
polyglot (>= 0.3.1) | ||
twitter-bootstrap-rails (1.4.1) | ||
actionpack | ||
jquery-rails (~> 1.0) | ||
less | ||
less-rails (~> 2.1.0) | ||
railties | ||
tzinfo (0.3.31) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
factory_girl_rails (~> 1.1.0) | ||
jquery-rails | ||
mocha | ||
nifty-generators! | ||
ruby-debug19 | ||
sqlite3 | ||
survey_says! | ||
twitter-bootstrap-rails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright 2011 David Henner | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
= SurveySays | ||
|
||
This project rocks and uses MIT-LICENSE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env rake | ||
begin | ||
require 'bundler/setup' | ||
rescue LoadError | ||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks' | ||
end | ||
begin | ||
require 'rdoc/task' | ||
rescue LoadError | ||
require 'rdoc/rdoc' | ||
require 'rake/rdoctask' | ||
RDoc::Task = Rake::RDocTask | ||
end | ||
|
||
RDoc::Task.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'SurveySays' | ||
rdoc.options << '--line-numbers' | ||
rdoc.rdoc_files.include('README.rdoc') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end | ||
|
||
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__) | ||
load 'rails/tasks/engine.rake' | ||
|
||
|
||
Bundler::GemHelper.install_tasks | ||
|
||
require 'rake/testtask' | ||
|
||
Rake::TestTask.new(:test) do |t| | ||
t.libs << 'lib' | ||
t.libs << 'test' | ||
t.pattern = 'test/**/*_test.rb' | ||
t.verbose = false | ||
end | ||
|
||
|
||
task :default => :test |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
$ -> | ||
$("body > .topbar").scrollSpy() | ||
$ -> | ||
$(".tabs").tabs() | ||
$ -> | ||
$("a[rel=twipsy]").twipsy live: true | ||
$ -> | ||
$("a[rel=popover]").popover offset: 10 | ||
$ -> | ||
$(".topbar-wrapper").dropdown() | ||
$ -> | ||
$(".alert-message").alert() | ||
$ -> | ||
domModal = $(".modal").modal( | ||
backdrop: true | ||
closeOnEscape: true | ||
) | ||
$(".open-modal").click -> | ||
domModal.toggle() | ||
$ -> | ||
$(".btn").button "complete" |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import "twitter/bootstrap"; | ||
|
||
// Baseline grid | ||
@basefont: 13px; | ||
@baseline: 18px; |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class SurveyAdmin::BaseController < ApplicationController | ||
before_filter :require_survey_admin | ||
|
||
private | ||
|
||
def require_survey_admin | ||
true | ||
#redirect_to login_url and return unless survey_admin? | ||
end | ||
|
||
def survey_admin? | ||
current_user && current_user.survey_admin? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
class SurveyAdmin::QuestionsController < SurveyAdmin::BaseController | ||
def index | ||
@questions = Question.all | ||
end | ||
|
||
def show | ||
@question = Question.find(params[:id]) | ||
end | ||
|
||
def new | ||
form_info | ||
@question = Question.new | ||
end | ||
|
||
def create | ||
@question = Question.new(params[:question]) | ||
if @question.save | ||
flash[:notice] = "Successfully created question." | ||
redirect_to survey_admin_question_url(@question) | ||
else | ||
form_info | ||
render :action => 'new' | ||
end | ||
end | ||
|
||
def edit | ||
form_info | ||
@question = Question.find(params[:id]) | ||
end | ||
|
||
def update | ||
@question = Question.find(params[:id]) | ||
if @question.update_attributes(params[:question]) | ||
flash[:notice] = "Successfully updated question." | ||
redirect_to survey_admin_question_url(@question) | ||
else | ||
form_info | ||
render :action => 'edit' | ||
end | ||
end | ||
|
||
def destroy | ||
@question = Question.find(params[:id]) | ||
@question.active = false | ||
@question.save | ||
flash[:notice] = "Successfully inactivated." | ||
redirect_to survey_admin_questions_url | ||
end | ||
|
||
private | ||
|
||
def form_info | ||
|
||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module SurveyAdmin::QuestionsHelper | ||
end |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Answer < ActiveRecord::Base | ||
belongs_to :question | ||
has_many :scores | ||
|
||
validates :question_id, :presence => true | ||
validates :details, :presence => true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Question < ActiveRecord::Base | ||
has_many :answers, :order => 'answers.position desc' | ||
has_many :active_answers, :class_name => 'Answer', | ||
:conditions => ["answers.active = ?", true], | ||
:order => 'answers.position desc' | ||
|
||
validates :details, :presence => true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Score < ActiveRecord::Base | ||
belongs_to :answer | ||
belongs_to :survey_property | ||
|
||
validates :value, :presence => true | ||
validates :survey_property_id, :presence => true, | ||
:uniqueness => { | ||
:scope => :answer_id, | ||
:message => "should have one score per property" | ||
} | ||
validates :answer_id, :presence => true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class SurveyProperty < ActiveRecord::Base | ||
has_many :scores | ||
|
||
validates :name, :presence => true | ||
end |
Empty file.
Oops, something went wrong.