fe 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +20 -0
- data/Rakefile +48 -0
- data/app/assets/images/fe/ajax-loader.gif +0 -0
- data/app/assets/images/fe/butgrad.png +0 -0
- data/app/assets/images/fe/icons/add.png +0 -0
- data/app/assets/images/fe/icons/application_form.png +0 -0
- data/app/assets/images/fe/icons/application_form_add.png +0 -0
- data/app/assets/images/fe/icons/arrow-move.png +0 -0
- data/app/assets/images/fe/icons/arrow_out.png +0 -0
- data/app/assets/images/fe/icons/asterisk_yellow.png +0 -0
- data/app/assets/images/fe/icons/book-open-list.png +0 -0
- data/app/assets/images/fe/icons/book_open.png +0 -0
- data/app/assets/images/fe/icons/briefcase.png +0 -0
- data/app/assets/images/fe/icons/calendar_view_day.png +0 -0
- data/app/assets/images/fe/icons/checkbox.png +0 -0
- data/app/assets/images/fe/icons/copy_paste.gif +0 -0
- data/app/assets/images/fe/icons/disk.png +0 -0
- data/app/assets/images/fe/icons/document--pencil.png +0 -0
- data/app/assets/images/fe/icons/document-copy.png +0 -0
- data/app/assets/images/fe/icons/map_magnify.png +0 -0
- data/app/assets/images/fe/icons/minus-button.png +0 -0
- data/app/assets/images/fe/icons/move.png +0 -0
- data/app/assets/images/fe/icons/page_error.png +0 -0
- data/app/assets/images/fe/icons/page_valid.png +0 -0
- data/app/assets/images/fe/icons/page_white.png +0 -0
- data/app/assets/images/fe/icons/page_white_add.png +0 -0
- data/app/assets/images/fe/icons/page_white_error.png +0 -0
- data/app/assets/images/fe/icons/paper-clip.png +0 -0
- data/app/assets/images/fe/icons/pencil-small.png +0 -0
- data/app/assets/images/fe/icons/pencil.png +0 -0
- data/app/assets/images/fe/icons/question-balloon.png +0 -0
- data/app/assets/images/fe/icons/radio.png +0 -0
- data/app/assets/images/fe/icons/star-small.png +0 -0
- data/app/assets/images/fe/icons/table.png +0 -0
- data/app/assets/images/fe/icons/text_align_left.png +0 -0
- data/app/assets/images/fe/icons/text_horizontalrule.png +0 -0
- data/app/assets/images/fe/icons/textfield.png +0 -0
- data/app/assets/images/fe/indent.png +0 -0
- data/app/assets/images/fe/overlay.png +0 -0
- data/app/assets/images/fe/selected_bg.jpg +0 -0
- data/app/assets/images/fe/status.gif +0 -0
- data/app/assets/images/fe/tooltip/black.png +0 -0
- data/app/assets/images/fe/tooltip/black_arrow.png +0 -0
- data/app/assets/images/fe/tooltip/black_arrow_big.png +0 -0
- data/app/assets/images/fe/tooltip/black_big.png +0 -0
- data/app/assets/images/fe/tooltip/white.png +0 -0
- data/app/assets/images/fe/tooltip/white_arrow.png +0 -0
- data/app/assets/images/fe/tooltip/white_arrow_big.png +0 -0
- data/app/assets/images/fe/tooltip/white_big.png +0 -0
- data/app/assets/images/fe/uploadify/cancel.png +0 -0
- data/app/assets/images/fe/uploadify/uploadify.swf +0 -0
- data/app/assets/javascripts/fe/admin.js +7 -0
- data/app/assets/javascripts/fe/jquery.metadata.js +122 -0
- data/app/assets/javascripts/fe/jquery.scrollTo-min.js +7 -0
- data/app/assets/javascripts/fe/jquery.uploadify.v2.1.0.js +258 -0
- data/app/assets/javascripts/fe/jquery.validate.pack.js +15 -0
- data/app/assets/javascripts/fe/qe.admin.js +115 -0
- data/app/assets/javascripts/fe/qe.common.js +57 -0
- data/app/assets/javascripts/fe/qe.public.js +331 -0
- data/app/assets/javascripts/fe/swfobject.js +4 -0
- data/app/assets/stylesheets/fe/qe.screen.css.scss.erb +552 -0
- data/app/assets/stylesheets/fe/reset.css +55 -0
- data/app/assets/stylesheets/fe/validation.css +91 -0
- data/app/controllers/fe/admin/elements_controller.rb +185 -0
- data/app/controllers/fe/admin/email_templates_controller.rb +61 -0
- data/app/controllers/fe/admin/question_pages_controller.rb +113 -0
- data/app/controllers/fe/admin/question_sheets_controller.rb +106 -0
- data/app/controllers/fe/answer_pages_controller.rb +3 -0
- data/app/controllers/fe/answer_sheets_controller.rb +3 -0
- data/app/controllers/fe/concerns/answer_pages_controller_concern.rb +80 -0
- data/app/controllers/fe/concerns/answer_sheets_controller_concern.rb +84 -0
- data/app/controllers/fe/reference_sheets_controller.rb +29 -0
- data/app/helpers/fe/answer_pages_helper.rb +19 -0
- data/app/helpers/fe/application_helper.rb +49 -0
- data/app/mailers/fe/notifier.rb +22 -0
- data/app/models/fe/answer.rb +13 -0
- data/app/models/fe/answer_pages_presenter.rb +13 -0
- data/app/models/fe/answer_sheet.rb +10 -0
- data/app/models/fe/answer_sheet_question_sheet.rb +7 -0
- data/app/models/fe/attachment_field.rb +7 -0
- data/app/models/fe/choice_field.rb +7 -0
- data/app/models/fe/concerns/answer_concern.rb +36 -0
- data/app/models/fe/concerns/answer_pages_presenter_concern.rb +99 -0
- data/app/models/fe/concerns/answer_sheet_concern.rb +61 -0
- data/app/models/fe/concerns/choice_field_concern.rb +131 -0
- data/app/models/fe/condition.rb +53 -0
- data/app/models/fe/date_field.rb +52 -0
- data/app/models/fe/element.rb +164 -0
- data/app/models/fe/email_template.rb +7 -0
- data/app/models/fe/option.rb +10 -0
- data/app/models/fe/option_group.rb +10 -0
- data/app/models/fe/page.rb +101 -0
- data/app/models/fe/page_element.rb +9 -0
- data/app/models/fe/page_link.rb +15 -0
- data/app/models/fe/paragraph.rb +10 -0
- data/app/models/fe/payment.rb +52 -0
- data/app/models/fe/payment_question.rb +22 -0
- data/app/models/fe/presenter.rb +23 -0
- data/app/models/fe/question.rb +256 -0
- data/app/models/fe/question_grid.rb +26 -0
- data/app/models/fe/question_grid_with_total.rb +11 -0
- data/app/models/fe/question_set.rb +82 -0
- data/app/models/fe/question_sheet.rb +73 -0
- data/app/models/fe/reference_question.rb +42 -0
- data/app/models/fe/reference_sheet.rb +149 -0
- data/app/models/fe/section.rb +12 -0
- data/app/models/fe/state_chooser.rb +10 -0
- data/app/models/fe/text_field.rb +29 -0
- data/app/views/fe/admin/elements/_errors.html.erb +1 -0
- data/app/views/fe/admin/elements/create.js.erb +11 -0
- data/app/views/fe/admin/elements/destroy.js.erb +4 -0
- data/app/views/fe/admin/elements/drop.js.erb +2 -0
- data/app/views/fe/admin/elements/duplicate.js.erb +2 -0
- data/app/views/fe/admin/elements/edit.js.erb +4 -0
- data/app/views/fe/admin/elements/error.js.erb +4 -0
- data/app/views/fe/admin/elements/new.js.erb +10 -0
- data/app/views/fe/admin/elements/reorder.js.erb +0 -0
- data/app/views/fe/admin/elements/update.js.erb +9 -0
- data/app/views/fe/admin/email_templates/_form.html.erb +8 -0
- data/app/views/fe/admin/email_templates/edit.html.erb +13 -0
- data/app/views/fe/admin/email_templates/index.html.erb +20 -0
- data/app/views/fe/admin/email_templates/new.html.erb +11 -0
- data/app/views/fe/admin/panels/_advanced_options.html.erb +16 -0
- data/app/views/fe/admin/panels/_common_fields.html.erb +24 -0
- data/app/views/fe/admin/panels/_condition.html.erb +6 -0
- data/app/views/fe/admin/panels/_insert.html.erb +39 -0
- data/app/views/fe/admin/panels/_nav_controls.html.erb +6 -0
- data/app/views/fe/admin/panels/_page.html.erb +3 -0
- data/app/views/fe/admin/panels/_pages_list.html.erb +16 -0
- data/app/views/fe/admin/panels/_prop_attachment_field.html.erb +2 -0
- data/app/views/fe/admin/panels/_prop_choice_field.html.erb +46 -0
- data/app/views/fe/admin/panels/_prop_date_field.html.erb +7 -0
- data/app/views/fe/admin/panels/_prop_element.html.erb +30 -0
- data/app/views/fe/admin/panels/_prop_page.html.erb +21 -0
- data/app/views/fe/admin/panels/_prop_paragraph.html.erb +32 -0
- data/app/views/fe/admin/panels/_prop_question_grid.html.erb +23 -0
- data/app/views/fe/admin/panels/_prop_question_grid_with_total.html.erb +14 -0
- data/app/views/fe/admin/panels/_prop_reference_question.html.erb +12 -0
- data/app/views/fe/admin/panels/_prop_section.html.erb +2 -0
- data/app/views/fe/admin/panels/_prop_sheet.html.erb +17 -0
- data/app/views/fe/admin/panels/_prop_text_field.html.erb +20 -0
- data/app/views/fe/admin/question_pages/_element.html.erb +18 -0
- data/app/views/fe/admin/question_pages/_element_show.html.erb +10 -0
- data/app/views/fe/admin/question_pages/_errors.html.erb +1 -0
- data/app/views/fe/admin/question_pages/_question_page.html.erb +13 -0
- data/app/views/fe/admin/question_pages/create.js.erb +11 -0
- data/app/views/fe/admin/question_pages/destroy.js.erb +5 -0
- data/app/views/fe/admin/question_pages/edit.js.erb +3 -0
- data/app/views/fe/admin/question_pages/error.js.erb +4 -0
- data/app/views/fe/admin/question_pages/show.js.erb +8 -0
- data/app/views/fe/admin/question_pages/show_panel.js.erb +3 -0
- data/app/views/fe/admin/question_pages/update.js.erb +2 -0
- data/app/views/fe/admin/question_sheets/_errors.html.erb +1 -0
- data/app/views/fe/admin/question_sheets/edit.js.erb +3 -0
- data/app/views/fe/admin/question_sheets/error.js.erb +5 -0
- data/app/views/fe/admin/question_sheets/index.html.erb +41 -0
- data/app/views/fe/admin/question_sheets/new.html.erb +15 -0
- data/app/views/fe/admin/question_sheets/show.html.erb +27 -0
- data/app/views/fe/admin/question_sheets/update.js.erb +2 -0
- data/app/views/fe/answer_pages/_answer_page.html.erb +56 -0
- data/app/views/fe/answer_pages/_element.html.erb +9 -0
- data/app/views/fe/answer_pages/update.js.erb +5 -0
- data/app/views/fe/answer_sheets/_answer_sheet.html.erb +24 -0
- data/app/views/fe/answer_sheets/_element.html.erb +54 -0
- data/app/views/fe/answer_sheets/_incomplete.html.erb +10 -0
- data/app/views/fe/answer_sheets/_page_link.html.erb +7 -0
- data/app/views/fe/answer_sheets/_pages_list.html.erb +11 -0
- data/app/views/fe/answer_sheets/_title.html.erb +1 -0
- data/app/views/fe/answer_sheets/edit.html.erb +60 -0
- data/app/views/fe/answer_sheets/incomplete.js.erb +5 -0
- data/app/views/fe/answer_sheets/index.html.erb +18 -0
- data/app/views/fe/answer_sheets/send_reference_invite.js.erb +8 -0
- data/app/views/fe/answer_sheets/show.html.erb +13 -0
- data/app/views/fe/help/builder.html +33 -0
- data/app/views/fe/help/question_grid.html +18 -0
- data/app/views/fe/questions/_acceptance.html.erb +13 -0
- data/app/views/fe/questions/_attachment_field.html.erb +42 -0
- data/app/views/fe/questions/_checkbox_field.html.erb +49 -0
- data/app/views/fe/questions/_country.html.erb +7 -0
- data/app/views/fe/questions/_date_field.html.erb +7 -0
- data/app/views/fe/questions/_date_field_mmyy.html.erb +9 -0
- data/app/views/fe/questions/_drop_down_field.html.erb +7 -0
- data/app/views/fe/questions/_paragraph.html.erb +1 -0
- data/app/views/fe/questions/_question_grid.html.erb +65 -0
- data/app/views/fe/questions/_question_grid_with_total.html.erb +57 -0
- data/app/views/fe/questions/_questions.html.erb +9 -0
- data/app/views/fe/questions/_radio_button_field.html.erb +41 -0
- data/app/views/fe/questions/_rating.html.erb +25 -0
- data/app/views/fe/questions/_reference_discipler.html.erb +1 -0
- data/app/views/fe/questions/_reference_friend.html.erb +1 -0
- data/app/views/fe/questions/_reference_parent.html.erb +1 -0
- data/app/views/fe/questions/_reference_peer.html.erb +1 -0
- data/app/views/fe/questions/_reference_question.html.erb +38 -0
- data/app/views/fe/questions/_reference_roommate.html.erb +1 -0
- data/app/views/fe/questions/_reference_spiritual.html.erb +1 -0
- data/app/views/fe/questions/_reference_staff.html.erb +1 -0
- data/app/views/fe/questions/_section.html.erb +1 -0
- data/app/views/fe/questions/_state_chooser.html.erb +7 -0
- data/app/views/fe/questions/_text_area_field.html.erb +6 -0
- data/app/views/fe/questions/_text_field.html.erb +8 -0
- data/app/views/fe/questions/_yes_no.html.erb +17 -0
- data/app/views/fe/questions/_yes_no_field.erb +17 -0
- data/app/views/fe/reference_sheets/not_found.html.erb +5 -0
- data/app/views/layouts/fe/application.html.erb +31 -0
- data/app/views/layouts/fe/qe.admin.html.erb +30 -0
- data/config/routes.rb +49 -0
- data/db/migrate/20131003041856_core.rb +91 -0
- data/db/migrate/20131003044250_create_reference_sheets.rb +23 -0
- data/db/migrate/20131003044436_add_element_and_answer_fields.rb +10 -0
- data/db/migrate/20131003044518_create_email_templates.rb +17 -0
- data/db/migrate/20131003044621_add_max_lengths.rb +8 -0
- data/db/migrate/20131003044714_create_join_table.rb +11 -0
- data/db/migrate/20131016162128_remove_question_id_from_element.rb +9 -0
- data/lib/fe.rb +22 -0
- data/lib/fe/engine.rb +19 -0
- data/lib/fe/version.rb +3 -0
- data/lib/generators/fe/install_generator.rb +132 -0
- data/lib/tasks/qe_tasks.rake +4 -0
- data/spec/controllers/fe/admin/elements_controller_spec.rb +4 -0
- data/spec/controllers/fe/admin/email_templates_controller_spec.rb +4 -0
- data/spec/controllers/fe/admin/question_pages_controller_spec.rb +4 -0
- data/spec/controllers/fe/admin/question_sheets_controller_spec.rb +4 -0
- data/spec/controllers/fe/answer_pages_controller_spec.rb +4 -0
- data/spec/controllers/fe/answer_sheets_controller_spec.rb +4 -0
- data/spec/controllers/fe/reference_sheets_controller_spec.rb +4 -0
- data/spec/factories/answer_sheets.rb +5 -0
- data/spec/factories/answers.rb +4 -0
- data/spec/factories/paragraphs.rb +4 -0
- data/spec/factories/question_sheet.rb +5 -0
- data/spec/factories/reference_questions.rb +4 -0
- data/spec/models/fe/answer_sheet_question_sheet_spec.rb +6 -0
- data/spec/models/fe/answer_sheet_spec.rb +8 -0
- data/spec/models/fe/answer_spec.rb +13 -0
- data/spec/models/fe/attachment_field_spec.rb +4 -0
- data/spec/models/fe/choice_field_spec.rb +5 -0
- data/spec/models/fe/condition_spec.rb +8 -0
- data/spec/models/fe/date_field_spec.rb +49 -0
- data/spec/models/fe/element_spec.rb +12 -0
- data/spec/models/fe/email_template_spec.rb +5 -0
- data/spec/models/fe/option_group_spec.rb +4 -0
- data/spec/models/fe/option_spec.rb +4 -0
- data/spec/models/fe/page_element_spec.rb +6 -0
- data/spec/models/fe/page_link_spec.rb +4 -0
- data/spec/models/fe/page_spec.rb +14 -0
- data/spec/models/fe/paragraph_spec.rb +17 -0
- data/spec/models/fe/question_grid_spec.rb +4 -0
- data/spec/models/fe/question_grid_with_total_spec.rb +4 -0
- data/spec/models/fe/question_set_spec.rb +4 -0
- data/spec/models/fe/question_sheet_spec.rb +8 -0
- data/spec/models/fe/question_spec.rb +20 -0
- data/spec/models/fe/reference_question_spec.rb +17 -0
- data/spec/models/fe/reference_sheet_spec.rb +11 -0
- data/spec/models/fe/section_spec.rb +4 -0
- data/spec/models/fe/state_chooser_spec.rb +4 -0
- data/spec/models/fe/text_field_spec.rb +17 -0
- data/spec/spec_helper.rb +66 -0
- data/spec/support/database.txt +28 -0
- metadata +508 -0
data/lib/fe/engine.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Fe
|
|
2
|
+
class Engine < ::Rails::Engine
|
|
3
|
+
isolate_namespace Fe
|
|
4
|
+
|
|
5
|
+
config.to_prepare do
|
|
6
|
+
Dir.glob(File.join(File.dirname(__FILE__), "..", "..", "app", "**", "*_concern.rb")).each do |c|
|
|
7
|
+
require_dependency(c)
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
config.generators do |g|
|
|
12
|
+
g.test_framework :rspec, :fixture => false
|
|
13
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
|
14
|
+
g.assets false
|
|
15
|
+
g.helper false
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/fe/version.rb
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
module Fe
|
|
2
|
+
class InstallGenerator < Rails::Generators::Base
|
|
3
|
+
|
|
4
|
+
class_option :migrate, :type => :boolean, :default => true, :banner => 'Run Form migrations'
|
|
5
|
+
class_option :lib_name, :type => :string, :default => 'fe'
|
|
6
|
+
class_option :quite, :type => :boolean, :default => false
|
|
7
|
+
|
|
8
|
+
# def self.source_paths
|
|
9
|
+
# paths << File.expand_path('../templates', "../../#{__FILE__}")
|
|
10
|
+
# paths << File.expand_path('../templates', "../#{__FILE__}")
|
|
11
|
+
# paths << File.expand_path('../templates', __FILE__)
|
|
12
|
+
# paths.flatten
|
|
13
|
+
# end
|
|
14
|
+
|
|
15
|
+
def prepare_options
|
|
16
|
+
@run_migrations = options[:migrate]
|
|
17
|
+
@lib_name = options[:lib_name]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# def config_questionnaire_yml
|
|
21
|
+
# end
|
|
22
|
+
|
|
23
|
+
# def additional_tweaks
|
|
24
|
+
# end
|
|
25
|
+
|
|
26
|
+
def install_migrations
|
|
27
|
+
say_status :copying, "migrations"
|
|
28
|
+
silence_stream(STDOUT) do
|
|
29
|
+
silence_warnings { rake 'fe_engine:install:migrations' }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def create_database
|
|
34
|
+
say_status :creating, "database"
|
|
35
|
+
silence_stream(STDOUT) do
|
|
36
|
+
silence_stream(STDERR) do
|
|
37
|
+
silence_warnings { rake 'db:create' }
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def run_migrations
|
|
43
|
+
if @run_migrations
|
|
44
|
+
say_status :running, "migrations"
|
|
45
|
+
quietly { rake 'db:migrate' }
|
|
46
|
+
else
|
|
47
|
+
say_status :skipping, "migrations (don't forget to run rake db:migrate)"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def notify_about_routes
|
|
52
|
+
insert_into_file File.join('config', 'routes.rb'),
|
|
53
|
+
:after => "pplication.routes.draw do\n" do
|
|
54
|
+
%Q{
|
|
55
|
+
# == Questionnaire
|
|
56
|
+
# This line mounts QuestionnaireEngine's routes at the root of your application.
|
|
57
|
+
# This means, any requests to URLs such as http://localhost:3000/admin/forms,
|
|
58
|
+
# will go to Fe::Admin::FormsController.
|
|
59
|
+
#
|
|
60
|
+
# If you would like to change where this engine is mounted, simply change the
|
|
61
|
+
# `:at` option to something different.
|
|
62
|
+
|
|
63
|
+
mount Fe::Engine, :at => '/'
|
|
64
|
+
\n
|
|
65
|
+
} end
|
|
66
|
+
unless options[:quiet]
|
|
67
|
+
puts "*" * 75
|
|
68
|
+
puts "We added the following line to your application's config/routes.rb file:"
|
|
69
|
+
puts " "
|
|
70
|
+
puts " mount Fe::Engine, :at => '/'"
|
|
71
|
+
puts " "
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def noify_about_javascripts
|
|
76
|
+
insert_into_file File.join('app', 'assets', 'javascripts', 'application.js'),
|
|
77
|
+
:before => "//= require_tree ." do
|
|
78
|
+
%Q{//= require fe/application \n}
|
|
79
|
+
end
|
|
80
|
+
unless options[:quiet]
|
|
81
|
+
puts "*" * 75
|
|
82
|
+
puts "Added this to app's application.js file,"
|
|
83
|
+
puts " "
|
|
84
|
+
puts " //= require fe/application"
|
|
85
|
+
puts " "
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def notify_about_stylesheets
|
|
90
|
+
insert_into_file File.join('app', 'assets', 'stylesheets', 'application.css'),
|
|
91
|
+
:before => "*= require_tree ." do
|
|
92
|
+
%Q{*= require fe/application \n }
|
|
93
|
+
end
|
|
94
|
+
unless options[:quiet]
|
|
95
|
+
puts "*" * 75
|
|
96
|
+
puts "Added this to app's stylesheets file,"
|
|
97
|
+
puts " "
|
|
98
|
+
puts " *= require fe/application"
|
|
99
|
+
puts " "
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def notify_about_stylesheets
|
|
104
|
+
insert_into_file File.join('app', 'assets', 'stylesheets', 'application.css'),
|
|
105
|
+
:before => "*= require_tree ." do
|
|
106
|
+
%Q{*= require fe/application \n }
|
|
107
|
+
end
|
|
108
|
+
unless options[:quiet]
|
|
109
|
+
puts "*" * 75
|
|
110
|
+
puts "Added this to app's stylesheets file,"
|
|
111
|
+
puts " "
|
|
112
|
+
puts " *= require fe/application"
|
|
113
|
+
puts " "
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# TODO figure out image refernces
|
|
118
|
+
# def notify_about_images
|
|
119
|
+
# insert_into_file File.join('app', 'assets', 'images', 'application.css')
|
|
120
|
+
# end
|
|
121
|
+
|
|
122
|
+
def complete
|
|
123
|
+
unless options[:quiet]
|
|
124
|
+
puts "*" * 75
|
|
125
|
+
puts " "
|
|
126
|
+
puts ">> Fe successfully installed. You're all ready to go!"
|
|
127
|
+
puts ">> Enjoy!"
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
end
|
|
132
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Fe::Answer do
|
|
4
|
+
it { should belong_to :answer_sheet }
|
|
5
|
+
it { should belong_to :question }
|
|
6
|
+
it { should ensure_length_of :short_value }
|
|
7
|
+
|
|
8
|
+
it '#to_s' do
|
|
9
|
+
answer = Fe::Answer.new
|
|
10
|
+
answer.value = "abc"
|
|
11
|
+
answer.to_s.should == "abc"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Fe::DateField do
|
|
4
|
+
describe '#ptemplate' do
|
|
5
|
+
it 'mmyy style' do
|
|
6
|
+
date_field = Fe::DateField.new
|
|
7
|
+
date_field.style = "mmyy"
|
|
8
|
+
date_field.ptemplate.should == "date_field_mmyy"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'default' do
|
|
12
|
+
date_field = Fe::DateField.new
|
|
13
|
+
date_field.ptemplate.should == "date_field"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe '#validation_class' do
|
|
18
|
+
it 'mmyy style' do
|
|
19
|
+
date_field = Fe::DateField.new
|
|
20
|
+
date_field.style = "mmyy"
|
|
21
|
+
date_field.validation_class.should == "validate-selection "
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'default' do
|
|
25
|
+
date_field = Fe::DateField.new
|
|
26
|
+
date_field.validation_class.should == "validate-date "
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe '#response' do
|
|
31
|
+
let(:answer_sheet) { create(:answer_sheet) }
|
|
32
|
+
let(:date_field) { Fe::DateField.create }
|
|
33
|
+
|
|
34
|
+
it 'converts db string format to Time' do
|
|
35
|
+
answer = create(:answer, answer_sheet: answer_sheet, question: date_field, value: Time.zone.now)
|
|
36
|
+
date_field.response(answer_sheet).should == Time.parse(answer.reload.value)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'converts US date format format to Time' do
|
|
40
|
+
create(:answer, answer_sheet: answer_sheet, question: date_field, value: '1/12/2013')
|
|
41
|
+
date_field.response(answer_sheet).should == Time.parse('2013-01-12')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'returns empty string if an invalid date is passed in' do
|
|
45
|
+
create(:answer, answer_sheet: answer_sheet, question: date_field, value: '13/12/2013')
|
|
46
|
+
date_field.response(answer_sheet).should == ''
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Fe::Element do
|
|
4
|
+
it { should belong_to :question_grid }
|
|
5
|
+
it { should belong_to :choice_field }
|
|
6
|
+
it { should have_many :page_elements }
|
|
7
|
+
it { should have_many :pages }
|
|
8
|
+
it { should validate_presence_of :kind }
|
|
9
|
+
# it { should validate_presence_of :style } # this isn't working
|
|
10
|
+
it { should ensure_length_of :kind }
|
|
11
|
+
it { should ensure_length_of :style }
|
|
12
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Fe::Page do
|
|
4
|
+
it { should belong_to :question_sheet }
|
|
5
|
+
it { should have_many :page_elements }
|
|
6
|
+
it { should have_many :elements }
|
|
7
|
+
it { should have_many :questions }
|
|
8
|
+
it { should have_many :question_grids }
|
|
9
|
+
it { should have_many :question_grid_with_totals }
|
|
10
|
+
# it { should validate_presence_of :label } # this isn't working
|
|
11
|
+
# it { should validate_presence_of :number } # this isn't working
|
|
12
|
+
it { should ensure_length_of :label }
|
|
13
|
+
it { should validate_numericality_of :number }
|
|
14
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Fe::Paragraph do
|
|
4
|
+
describe '#validate_presence_of :content on update' do
|
|
5
|
+
it 'successfully saves with content' do
|
|
6
|
+
paragraph = build(:paragraph)
|
|
7
|
+
paragraph.content = "abc"
|
|
8
|
+
paragraph.save.should be_true
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'saves with default content' do
|
|
12
|
+
paragraph = build(:paragraph)
|
|
13
|
+
paragraph.save.should be_true
|
|
14
|
+
paragraph.content.should == "Lorem ipsum..."
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|