voluntary_survey 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/javascripts/voluntary_survey/story/adapters/application_adapter.js.coffee +5 -0
  3. data/app/assets/javascripts/voluntary_survey/story/app.js.coffee +10 -0
  4. data/app/assets/javascripts/voluntary_survey/story/application.js +9 -0
  5. data/app/assets/javascripts/voluntary_survey/story/components/page_form_component.js.coffee +59 -0
  6. data/app/assets/javascripts/voluntary_survey/story/components/task_form_component.js.coffee +63 -0
  7. data/app/assets/javascripts/voluntary_survey/story/components/task_option_form_component.js.coffee +43 -0
  8. data/app/assets/javascripts/voluntary_survey/story/controllers/pages_controller.js.coffee +54 -0
  9. data/app/assets/javascripts/voluntary_survey/story/helpers/is_equal_helper.js.coffee +2 -0
  10. data/app/assets/javascripts/voluntary_survey/story/helpers/t_helper.js.coffee +10 -0
  11. data/app/assets/javascripts/voluntary_survey/story/models/survey_page.js.coffee +3 -0
  12. data/app/assets/javascripts/voluntary_survey/story/router.js.coffee +8 -0
  13. data/app/assets/javascripts/voluntary_survey/story/routes/application_route.js.coffee +3 -0
  14. data/app/assets/javascripts/voluntary_survey/story/routes/pages_route.js.coffee +26 -0
  15. data/app/assets/javascripts/voluntary_survey/story/templates/application.js.handlebars +11 -0
  16. data/app/assets/javascripts/voluntary_survey/story/templates/components/page-form.js.handlebars +57 -0
  17. data/app/assets/javascripts/voluntary_survey/story/templates/components/task-form.js.handlebars +126 -0
  18. data/app/assets/javascripts/voluntary_survey/story/templates/components/task-option-form.js.handlebars +19 -0
  19. data/app/assets/javascripts/voluntary_survey/story/templates/pages.js.handlebars +41 -0
  20. data/app/controllers/survey_results_controller.rb +14 -0
  21. data/app/controllers/voluntary/api/v1/survey_input_options_controller.rb +63 -0
  22. data/app/controllers/voluntary/api/v1/survey_pages_controller.rb +63 -0
  23. data/app/controllers/voluntary/api/v1/survey_tasks_controller.rb +63 -0
  24. data/app/controllers/workflow/user/survey_pages_controller.rb +27 -0
  25. data/app/models/product/survey/input_option.rb +16 -0
  26. data/app/models/product/survey/page.rb +57 -0
  27. data/app/models/product/survey/result.rb +42 -0
  28. data/app/models/product/survey/story.rb +19 -0
  29. data/app/models/product/survey/task.rb +25 -0
  30. data/app/models/product/survey.rb +2 -0
  31. data/app/serializers/survey_input_option_serializer.rb +3 -0
  32. data/app/serializers/survey_page_serializer.rb +7 -0
  33. data/app/serializers/survey_story_serializer.rb +7 -0
  34. data/app/serializers/survey_task_serializer.rb +7 -0
  35. data/app/views/products/types/survey/wizard.html.erb +15 -0
  36. data/app/views/products/types/survey/workflow/user/stories/_next_task.html.erb +1 -0
  37. data/app/views/survey_results/index.html.erb +54 -0
  38. data/app/views/workflow/user/survey_pages/show.html.erb +65 -0
  39. data/config/locales/resources/survey/en.yml +36 -0
  40. data/config/locales/resources/survey_input_option/en.yml +37 -0
  41. data/config/locales/resources/survey_page/en.yml +35 -0
  42. data/config/locales/resources/survey_result/en.yml +4 -0
  43. data/config/locales/resources/survey_task/en.yml +37 -0
  44. data/config/routes.rb +20 -0
  45. data/db/migrate/20150903170909_add_product_survey.rb +14 -0
  46. data/lib/voluntary_survey/engine.rb +8 -0
  47. data/lib/voluntary_survey/navigation.rb +22 -0
  48. data/lib/voluntary_survey/version.rb +2 -2
  49. data/lib/voluntary_survey.rb +5 -1
  50. metadata +317 -35
  51. data/MIT-LICENSE +0 -20
@@ -0,0 +1,63 @@
1
+ class Voluntary::Api::V1::SurveyInputOptionsController < ActionController::Base
2
+ include Voluntary::V1::BaseController
3
+
4
+ respond_to :json
5
+
6
+ def show
7
+ resource = Product::Survey::Story.find(params[:story_id]).pages.find(params[:page_id]).tasks.find(params[:task_id]).options.find params[:id]
8
+
9
+ respond_to do |format|
10
+ format.json do
11
+ render json: resource
12
+ end
13
+ end
14
+ end
15
+
16
+ def create
17
+ story = Product::Survey::Story.find params[:survey_input_option][:story_id]
18
+
19
+ authorize! :update, story
20
+
21
+ resource = story.pages.find(params[:survey_input_option].delete(:page_id)).tasks.find(params[:survey_input_option].delete(:task_id)).options.create params[:survey_input_option]
22
+
23
+ respond_to do |format|
24
+ format.json do
25
+ render json: resource.persisted? ? resource : { errors: resource.errors.to_hash }
26
+ end
27
+ end
28
+ end
29
+
30
+ def update
31
+ story = Product::Survey::Story.find params[:survey_input_option].delete(:story_id)
32
+
33
+ authorize! :update, story
34
+
35
+ resource = story.pages.find(params[:survey_input_option].delete(:page_id)).tasks.find(params[:survey_input_option].delete(:task_id)).options.find(params[:id])
36
+ resource.update_attributes params[:survey_input_option]
37
+
38
+ respond_to do |format|
39
+ format.json do
40
+ render json: resource.valid? ? resource : { errors: resource.errors.to_hash }
41
+ end
42
+ end
43
+ end
44
+
45
+ def destroy
46
+ story = Product::Survey::Story.find(params[:story_id])
47
+
48
+ authorize! :destroy, story
49
+
50
+ resource = story.pages.find(params[:page_id]).tasks.find(params[:task_id]).options.find params[:id]
51
+ resource.destroy
52
+
53
+ respond_to do |format|
54
+ format.json do
55
+ render json: if resource.persisted?
56
+ { error: I18n.t('activerecord.errors.models.survey_page.attributes.base.deletion_failed') }
57
+ else
58
+ {}
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,63 @@
1
+ class Voluntary::Api::V1::SurveyPagesController < ActionController::Base
2
+ include Voluntary::V1::BaseController
3
+
4
+ respond_to :json
5
+
6
+ def show
7
+ resource = Product::Survey::Page.find(params[:story_id]).pages.find(params[:id])
8
+
9
+ respond_to do |format|
10
+ format.json do
11
+ render json: resource
12
+ end
13
+ end
14
+ end
15
+
16
+ def create
17
+ story = Product::Survey::Story.find(params[:survey_page].delete(:story_id))
18
+
19
+ authorize! :update, story
20
+
21
+ resource = story.pages.create params[:survey_page]
22
+
23
+ respond_to do |format|
24
+ format.json do
25
+ render json: resource.persisted? ? resource : { errors: resource.errors.to_hash }
26
+ end
27
+ end
28
+ end
29
+
30
+ def update
31
+ story = Product::Survey::Story.find(params[:survey_page].delete(:story_id))
32
+
33
+ authorize! :update, story
34
+
35
+ resource = story.pages.find(params[:id])
36
+ resource.update_attributes params[:survey_page]
37
+
38
+ respond_to do |format|
39
+ format.json do
40
+ render json: resource.valid? ? resource : { errors: resource.errors.to_hash }
41
+ end
42
+ end
43
+ end
44
+
45
+ def destroy
46
+ story = Product::Survey::Story.find(params[:story_id])
47
+
48
+ authorize! :destroy, story
49
+
50
+ resource = story.pages.find(params[:id])
51
+ resource.destroy
52
+
53
+ respond_to do |format|
54
+ format.json do
55
+ render json: if resource.persisted?
56
+ { error: I18n.t('activerecord.errors.models.survey_page.attributes.base.deletion_failed') }
57
+ else
58
+ {}
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,63 @@
1
+ class Voluntary::Api::V1::SurveyTasksController < ActionController::Base
2
+ include Voluntary::V1::BaseController
3
+
4
+ respond_to :json
5
+
6
+ def show
7
+ resource = Product::Survey::Story.find(params[:story_id]).pages.find(params[:page_id]).tasks.find(params[:id])
8
+
9
+ respond_to do |format|
10
+ format.json do
11
+ render json: resource
12
+ end
13
+ end
14
+ end
15
+
16
+ def create
17
+ story = Product::Survey::Story.find params[:survey_task][:story_id]
18
+
19
+ authorize! :update, story
20
+
21
+ resource = story.pages.find(params[:survey_task].delete(:page_id)).tasks.create params[:survey_task]
22
+
23
+ respond_to do |format|
24
+ format.json do
25
+ render json: resource.persisted? ? SurveyTaskSerializer.new(resource) : { errors: resource.errors.to_hash }
26
+ end
27
+ end
28
+ end
29
+
30
+ def update
31
+ story = Product::Survey::Story.find params[:survey_task].delete(:story_id)
32
+
33
+ authorize! :update, story
34
+
35
+ resource = story.pages.find(params[:survey_task].delete(:page_id)).tasks.find(params[:id])
36
+ resource.update_attributes params[:survey_task]
37
+
38
+ respond_to do |format|
39
+ format.json do
40
+ render json: resource.valid? ? resource : { errors: resource.errors.to_hash }
41
+ end
42
+ end
43
+ end
44
+
45
+ def destroy
46
+ story = Product::Survey::Story.find(params[:story_id])
47
+
48
+ authorize! :destroy, story
49
+
50
+ resource = story.pages.find(params[:page_id]).tasks.find(params[:id])
51
+ resource.destroy
52
+
53
+ respond_to do |format|
54
+ format.json do
55
+ render json: if resource.persisted?
56
+ { error: I18n.t('activerecord.errors.models.survey_page.attributes.base.deletion_failed') }
57
+ else
58
+ {}
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,27 @@
1
+ class Workflow::User::SurveyPagesController < ApplicationController
2
+ def show
3
+ @story = Story.find(params[:story_id])
4
+ @page = @story.pages.where(position: params[:page_position]).first
5
+ @results = Product::Survey::Result.where(task_id: { '$in' => @page.tasks.map(&:id) }, user_id: current_user.id).index_by{|r| r.task_id.to_s}
6
+ @errors = {}
7
+ end
8
+
9
+ def update
10
+ @story = Story.find(params[:story_id])
11
+ @page = @story.pages.where(position: params[:page_position]).first
12
+ @results, @errors = @page.set_results(params[:results], current_user)
13
+
14
+ if @errors.empty?
15
+ next_page_position = @story.submit_page(params[:page_position], current_user)
16
+
17
+ if next_page_position
18
+ redirect_to survey_page_workflow_user_index_path(story_id: @story.slug, page_position: next_page_position)
19
+ else
20
+ flash[:notice] = I18n.t('surveys.complete.success_message')
21
+ redirect_to workflow_user_index_path
22
+ end
23
+ else
24
+ render 'show'
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,16 @@
1
+ class Product::Survey::InputOption
2
+ include Mongoid::Document
3
+ include Mongoid::Timestamps
4
+ include ActiveModel::MassAssignmentSecurity
5
+ include Mongoid::Orderable
6
+
7
+ embedded_in :task, class_name: 'Product::Survey::Task', inverse_of: :options
8
+
9
+ field :key, type: String
10
+ field :value, type: String
11
+ field :chosen_count, type: Integer
12
+
13
+ orderable
14
+
15
+ attr_accessible :option, :key, :value
16
+ end
@@ -0,0 +1,57 @@
1
+ class Product::Survey::Page
2
+ include Mongoid::Document
3
+ include Mongoid::Timestamps
4
+ include ActiveModel::MassAssignmentSecurity
5
+ include Mongoid::Orderable
6
+
7
+ embedded_in :story, class_name: 'Product::Survey::Story', inverse_of: :pages
8
+ has_many :tasks, class_name: 'Product::Survey::Task', inverse_of: :page
9
+
10
+ field :name, type: String
11
+ field :text, type: String
12
+
13
+ orderable
14
+
15
+ attr_accessible :story_id, :position, :name, :text
16
+
17
+ def set_results(params, user)
18
+ working_tasks = tasks.index_by{|t| t.id.to_s }
19
+ results = Product::Survey::Result.where(task_id: { '$in' => tasks.map(&:id) }, user_id: user.id).index_by{|r| r.task_id.to_s }
20
+ errors = {}
21
+
22
+ params.each do |task_id, result_form|
23
+ result = if result_form['id'].present? && results[task_id].try(:user_id) == user.id
24
+ results[task_id]
25
+ else
26
+ value = Product::Survey::Result.new(task_id: task_id)
27
+ value.user_id = user.id
28
+ value
29
+ end
30
+
31
+ text = working_tasks[task_id].answer_type == 'Checkboxes' ? result_form['text'].to_json : result_form['text']
32
+
33
+ result.update_attributes text: text
34
+
35
+ results[result.task_id.to_s] = result
36
+
37
+ unless result.valid?
38
+ errors[task_id] ||= []
39
+
40
+ result.errors.full_messages.each {|message| errors[task_id] << message }
41
+ end
42
+ end
43
+
44
+ working_tasks.each do |task_id, task|
45
+ next if params.has_key? task_id
46
+
47
+ errors[task_id] ||= []
48
+ errors[task_id] << I18n.t('errors.messages.blank')
49
+ end
50
+
51
+ [results, errors]
52
+ end
53
+
54
+ protected
55
+
56
+ def with_offeror; false; end
57
+ end
@@ -0,0 +1,42 @@
1
+ class Product::Survey::Result < ::Result
2
+ belongs_to :task, class_name: 'Product::Survey::Task'
3
+
4
+ after_create :increment_chosen_count_of_option, if: 'task.with_options?'
5
+ after_update :update_chosen_count_of_options, if: 'text_changed? && task.with_options?'
6
+
7
+ def increment_chosen_count_of_option
8
+ if task.answer_type == 'Checkboxes'
9
+ task.options.where(_id: { '$in' => JSON.parse(text) }).each do |option|
10
+ option.update_attribute(:chosen_count, option.chosen_count.to_i + 1)
11
+ end
12
+ else
13
+ option = task.options.where(_id: text).first
14
+ option.update_attribute(:chosen_count, option.chosen_count.to_i + 1)
15
+ end
16
+ end
17
+
18
+ def update_chosen_count_of_options
19
+ if task.answer_type == 'Checkboxes'
20
+ option_ids = JSON.parse(text)
21
+ option_ids_was_array = JSON.parse(text_was)
22
+
23
+ options = task.options.where(_id: { '$in' => (option_ids + option_ids_was_array).uniq }).index_by{|o| o.id.to_s}
24
+
25
+ option_ids_was_array.select{|id| !option_ids.include?(id) }.each do |option_id_was|
26
+ option = options[option_id_was]
27
+ option.update_attribute(:chosen_count, option.chosen_count.to_i - 1)
28
+ end
29
+
30
+ option_ids.select{|id| !option_ids_was_array.include?(id) }.each do |option_id|
31
+ option = options[option_id]
32
+ option.update_attribute(:chosen_count, option.chosen_count.to_i + 1)
33
+ end
34
+ else
35
+ option = task.options.where(_id: text).first
36
+ option.update_attribute(:chosen_count, option.chosen_count.to_i + 1)
37
+
38
+ option = task.options.where(_id: text_was).first
39
+ option.update_attribute(:chosen_count, option.chosen_count.to_i - 1)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,19 @@
1
+ class Product::Survey::Story < Story
2
+ embeds_many :pages, class_name: 'Product::Survey::Page', inverse_of: :story
3
+
4
+ def submit_page(page_position, user)
5
+ next_page_position = pages.where(:position.gt => page_position).order_by(position: 'asc').first.try(:position)
6
+
7
+ unless next_page_position
8
+ self.users_without_tasks_ids ||= []
9
+ self.users_without_tasks_ids << user.id
10
+ save
11
+ end
12
+
13
+ return next_page_position
14
+ end
15
+
16
+ protected
17
+
18
+ def with_offeror; false; end
19
+ end
@@ -0,0 +1,25 @@
1
+ class Product::Survey::Task < ::Task
2
+ include Mongoid::Orderable
3
+
4
+ belongs_to :page, class_name: 'Product::Survey::Page', inverse_of: :tasks
5
+
6
+ embeds_many :options, class_name: 'Product::Survey::InputOption', inverse_of: :task
7
+ has_many :results, class_name: 'Product::Survey::Result', foreign_key: 'task_id', dependent: :destroy
8
+
9
+ field :answer_type, type: String
10
+
11
+ validates :name, presence: true, uniqueness: { scope: :story_id }
12
+ validates :answer_type, presence: true
13
+
14
+ orderable
15
+
16
+ attr_accessible :position, :answer_type
17
+
18
+ def with_options?
19
+ ['Multiple choice', 'Checkboxes', 'Drop-down list'].include? answer_type
20
+ end
21
+
22
+ protected
23
+
24
+ def with_offeror; false; end
25
+ end
@@ -0,0 +1,2 @@
1
+ class Product::Survey < ::Product
2
+ end
@@ -0,0 +1,3 @@
1
+ class SurveyInputOptionSerializer < ActiveModel::Serializer
2
+ attributes :id, :key, :value #, :position
3
+ end
@@ -0,0 +1,7 @@
1
+ class SurveyPageSerializer < ActiveModel::Serializer
2
+ attributes :id, :name, :text, :tasks
3
+
4
+ def tasks
5
+ object.tasks.order_by(position: 'asc').map{|a| SurveyTaskSerializer.new(a)}
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class SurveyStorySerializer < StorySerializer
2
+ attributes :pages
3
+
4
+ def pages
5
+ object.pages.order_by(position: 'asc').map{|a| SurveyPageSerializer.new(a)}
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class SurveyTaskSerializer < TaskSerializer
2
+ attributes :position, :answer_type, :options
3
+
4
+ def options
5
+ object.options.order_by(position: 'asc').map{|o| SurveyInputOptionSerializer.new(o)}
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ <div id="outlet">
2
+ </div>
3
+
4
+ <% content_for :javascript_includes do %>
5
+ <script type="text/javascript">
6
+ Volontariat = typeof Volontariat === 'undefined' ? {} : Volontariat;
7
+ Volontariat.Survey = typeof Volontariat.Survey === 'undefined' ? {} : Volontariat.Survey;
8
+ Volontariat.Survey.NewRecord = <%= @story.new_record? %>;
9
+ Volontariat.Survey.ProjectId = '<%= @project.id %>';
10
+ Volontariat.Survey.StoryId = '<%= @story.id %>';
11
+ Volontariat.Survey.StoryState = '<%= @story.state %>';
12
+ </script>
13
+ <%= javascript_include_tag 'voluntary_survey/story/application' %>
14
+ <%= render partial: 'layouts/voluntary/translations_javascript' %>
15
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= link_to t('surveys.workflow.user.take_survey'), survey_page_workflow_user_index_path(story_id: story.slug, page_position: 1) %>
@@ -0,0 +1,54 @@
1
+ <% @story.pages.each do |page| %>
2
+ <fieldset class="fieldset" style="border: 1px solid black; padding:15px; margin-top:15px;">
3
+ <legend>
4
+ <% if page.name.present? %>
5
+ <%= page.name %></h3>
6
+ <% else %>
7
+ <%= t('activerecord.models.survey_page_short') %> <%= page.position %>
8
+ <% end %>
9
+ </legend>
10
+
11
+ <% page.tasks.each do |task| %>
12
+ <h3 style="margin-top:0px;"><%= task.name %></h3>
13
+
14
+ <% if ['Short text', 'Long text'].include? task.answer_type %>
15
+ <table class="table table-striped">
16
+ <thead>
17
+ <tr>
18
+ <th><% t('general.author')%></th>
19
+ <th><% t('attributes.text')%></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <% @results[task.id.to_s].each do |result| %>
24
+ <tr>
25
+ <td><%= link_to result.user.name, user_path(result.user) %></td>
26
+ <td class="more"><%= result.text %></td>
27
+ </tr>
28
+ <% end %>
29
+ </tbody>
30
+ </table>
31
+
32
+ <%= will_paginate @results[task.id.to_s], param_name: "result_#{task.id}_page" %>
33
+ <% elsif task.with_options? %>
34
+ <table class="table table-striped">
35
+ <tbody>
36
+ <% results_count = task.results.count %>
37
+
38
+ <% task.options.order_by(chosen_count: 'desc').each do |option| %>
39
+ <tr>
40
+ <td><%= option.value %></td>
41
+ <td style="text-align:right;"><%= option.chosen_count.to_i %></td>
42
+ <td style="text-align:right;"><%= option.chosen_count.to_i > 0 && results_count > 0 ? (option.chosen_count / results_count) * 100 : 0 %> %</td>
43
+ </tr>
44
+ <% end %>
45
+ </tbody>
46
+ </table>
47
+ <% end %>
48
+ <% end %>
49
+ </fieldset>
50
+ <% end %>
51
+
52
+ <% content_for :document_ready do %>
53
+ toggleText();
54
+ <% end %>
@@ -0,0 +1,65 @@
1
+ <h2><%= @story.name %></h2>
2
+
3
+ <% if @page.name.present? %>
4
+ <h3><%= @page.name %></h3>
5
+ <% else %>
6
+ <h3><%= t('activerecord.models.survey_page_short') %> <%= @page.position %></h3>
7
+ <% end %>
8
+
9
+ <% if @page.text.present? %>
10
+ <p>
11
+ <%= @page.text %>
12
+ </p>
13
+ <% end %>
14
+
15
+ <%= form_tag survey_page_workflow_user_index_path(story_id: @story.slug, page_position: params[:page_position]), method: :put, class: 'form-vertical' do %>
16
+ <% @page.tasks.each do |task| %>
17
+ <% result = @results[task.id.to_s] %>
18
+
19
+ <%= hidden_field_tag "results[#{task.id}][id]", result.id if result %>
20
+
21
+ <div class="form-group string required <%= (@errors[task.id.to_s] ? 'has-error' : '') %>">
22
+ <label class="string required control-label control-label">
23
+ <%= task.name %>
24
+ </label>
25
+ <% if task.text.present? %>
26
+ <p>
27
+ <%= task.text %>
28
+ </p>
29
+ <% end %>
30
+
31
+ <p>
32
+ <% if task.answer_type == 'Short text' %>
33
+ <%= text_field_tag "results[#{task.id}][text]", result.try(:text), class: 'required form-control' %>
34
+ <% elsif task.answer_type == 'Long text' %>
35
+ <%= text_area_tag "results[#{task.id}][text]", result.try(:text), class: 'required form-control' %>
36
+ <% elsif task.answer_type == 'Multiple choice' %>
37
+ <% task.options.each do |option| %>
38
+ <input type="radio" name="results[<%=task.id %>][text]"
39
+ value="<%= option.id.to_s %>"<% if result.try(:text) == option.id.to_s %> checked="checked"<% end %>/>&nbsp;&nbsp;<%= option.value %><br/>
40
+ <% end %>
41
+ <% elsif task.answer_type == 'Checkboxes' %>
42
+ <% task.options.each do |option| %>
43
+ <% input = result.try(:text).present? && result.text != 'null' ? JSON.parse(result.text) : [] %>
44
+ <input type="checkbox" name="results[<%=task.id %>][text][]"
45
+ value="<%= option.id.to_s %>"<% if input.include? option.id.to_s %> checked="checked"<% end %>/>&nbsp;&nbsp;<%= option.value %><br/>
46
+ <% end %>
47
+ <% elsif task.answer_type == 'Drop-down list' %>
48
+ <select name="results[<%=task.id %>][text]">
49
+ <% task.options.each do |option| %>
50
+ <option value="<%= option.id.to_s %>"<% if result.try(:text) == option.id.to_s %> selected="selected"<% end %>><%= option.value %></option>
51
+ <% end %>
52
+ </select>
53
+ <% end %>
54
+ </p>
55
+
56
+ <% if @errors[task.id.to_s] %>
57
+ <% @errors[task.id.to_s].each do |message| %>
58
+ <span class="help-block"><%= message %></span>
59
+ <% end %>
60
+ <% end %>
61
+ </div>
62
+ <% end %>
63
+
64
+ <%= submit_tag t('general.submit'), class: 'btn btn-default' %>
65
+ <% end %>
@@ -0,0 +1,36 @@
1
+ en:
2
+ surveys:
3
+ index:
4
+ title: Surveys
5
+ empty_collection: No surveys found.
6
+ new:
7
+ title: New Survey
8
+ edit:
9
+ title: Edit Survey
10
+ save:
11
+ failed: Something went wrong at saving survey
12
+ successful: Successfully saved survey.
13
+
14
+ create:
15
+ title: Create Survey
16
+
17
+ update:
18
+ title: Update Survey
19
+
20
+ complete:
21
+ success_message: Thanks for participating in the survey!
22
+
23
+ destroy:
24
+ confirmation: Do you really want to remove this survey?
25
+
26
+ workflow:
27
+ user:
28
+ take_survey: Take survey!
29
+
30
+ activerecord:
31
+ errors:
32
+ models:
33
+ survey:
34
+ attributes:
35
+ base:
36
+ deletion_failed: Survey could not be deleted!
@@ -0,0 +1,37 @@
1
+ en:
2
+ survey_input_options:
3
+ index:
4
+ title: Input options
5
+ empty_collection: No input options found.
6
+ new:
7
+ title: New Option
8
+ edit:
9
+ title: Edit Option
10
+ save:
11
+ failed: Something went wrong at saving input option
12
+ successful: Successfully saved input option.
13
+
14
+ create:
15
+ title: Create Option
16
+ update:
17
+ title: Update Option
18
+ destroy:
19
+ title: Remove Option
20
+ confirmation: Do you really want to remove this input option?
21
+
22
+ activerecord:
23
+ models:
24
+ survey_input_option: Survey Input Option
25
+ survey_input_option_short: Option
26
+
27
+ attributes:
28
+ survey_input_option:
29
+ key: Key
30
+ value: Value
31
+
32
+ errors:
33
+ models:
34
+ survey_input_option:
35
+ attributes:
36
+ base:
37
+ deletion_failed: Input option could not be deleted!
@@ -0,0 +1,35 @@
1
+ en:
2
+ survey_pages:
3
+ index:
4
+ title: Pages
5
+ empty_collection: No pages found.
6
+ new:
7
+ title: New Page
8
+ edit:
9
+ title: Edit Page
10
+ save:
11
+ failed: Something went wrong at saving page
12
+ successful: Successfully saved page.
13
+
14
+ create:
15
+ title: Create Page
16
+ show:
17
+ untitled_page: Untitled Page
18
+ page_without_text: Put your page description here!
19
+ update:
20
+ title: Update Page
21
+ destroy:
22
+ title: Remove Page
23
+ confirmation: Do you really want to remove this page?
24
+
25
+ activerecord:
26
+ models:
27
+ survey_page: Survey Page
28
+ survey_page_short: Page
29
+
30
+ errors:
31
+ models:
32
+ survey_page:
33
+ attributes:
34
+ base:
35
+ deletion_failed: Page could not be deleted!
@@ -0,0 +1,4 @@
1
+ en:
2
+ survey_results:
3
+ index:
4
+ title: Results