helena_administration 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rubocop.yml +18 -0
  4. data/.travis.yml +6 -0
  5. data/Gemfile +44 -0
  6. data/Gemfile.lock +309 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +82 -0
  9. data/Rakefile +28 -0
  10. data/app/assets/images/helena_administration/.keep +0 -0
  11. data/app/assets/javascripts/helena_administration.js.coffee +20 -0
  12. data/app/assets/javascripts/polyfills.js +10 -0
  13. data/app/assets/stylesheets/_dashboard.sass +4 -0
  14. data/app/assets/stylesheets/_layout.sass +50 -0
  15. data/app/assets/stylesheets/_media_queries.scss +18 -0
  16. data/app/assets/stylesheets/_variables.sass +19 -0
  17. data/app/assets/stylesheets/helena_administration.css.sass +27 -0
  18. data/app/controllers/helena_administration/application_controller.rb +19 -0
  19. data/app/controllers/helena_administration/dashboard_controller.rb +11 -0
  20. data/app/controllers/helena_administration/import_surveys_controller.rb +40 -0
  21. data/app/controllers/helena_administration/question_groups_controller.rb +68 -0
  22. data/app/controllers/helena_administration/questions/checkbox_groups_controller.rb +15 -0
  23. data/app/controllers/helena_administration/questions/checkbox_matrix_controller.rb +7 -0
  24. data/app/controllers/helena_administration/questions/long_texts_controller.rb +11 -0
  25. data/app/controllers/helena_administration/questions/radio_groups_controller.rb +15 -0
  26. data/app/controllers/helena_administration/questions/radio_matrix_controller.rb +7 -0
  27. data/app/controllers/helena_administration/questions/short_texts_controller.rb +11 -0
  28. data/app/controllers/helena_administration/questions/static_texts_controller.rb +11 -0
  29. data/app/controllers/helena_administration/questions_controller.rb +96 -0
  30. data/app/controllers/helena_administration/sessions_controller.rb +60 -0
  31. data/app/controllers/helena_administration/surveys_controller.rb +71 -0
  32. data/app/controllers/helena_administration/versions_controller.rb +82 -0
  33. data/app/helpers/helena_administration/application_helper.rb +14 -0
  34. data/app/models/helena_administration/import_survey_form.rb +9 -0
  35. data/app/views/helena_administration/application/_chromeframe.html.slim +4 -0
  36. data/app/views/helena_administration/application/_flash_messages.html.haml +5 -0
  37. data/app/views/helena_administration/application/_head.html.slim +13 -0
  38. data/app/views/helena_administration/application/_header.html.slim +16 -0
  39. data/app/views/helena_administration/dashboard/index.html.slim +14 -0
  40. data/app/views/helena_administration/import_surveys/_form.html.slim +11 -0
  41. data/app/views/helena_administration/import_surveys/new.html.slim +1 -0
  42. data/app/views/helena_administration/kaminari/_first_page.html.slim +2 -0
  43. data/app/views/helena_administration/kaminari/_gap.html.slim +2 -0
  44. data/app/views/helena_administration/kaminari/_last_page.html.slim +2 -0
  45. data/app/views/helena_administration/kaminari/_next_page.html.slim +2 -0
  46. data/app/views/helena_administration/kaminari/_page.html.slim +2 -0
  47. data/app/views/helena_administration/kaminari/_paginator.html.slim +11 -0
  48. data/app/views/helena_administration/kaminari/_prev_page.html.slim +2 -0
  49. data/app/views/helena_administration/layouts/application.html.slim +13 -0
  50. data/app/views/helena_administration/question_groups/_form.html.slim +5 -0
  51. data/app/views/helena_administration/question_groups/edit.html.slim +1 -0
  52. data/app/views/helena_administration/question_groups/new.html.slim +1 -0
  53. data/app/views/helena_administration/question_groups/show.html.slim +60 -0
  54. data/app/views/helena_administration/questions/_form.html.slim +15 -0
  55. data/app/views/helena_administration/questions/_labels.html.slim +24 -0
  56. data/app/views/helena_administration/questions/_sub_questions.html.slim +32 -0
  57. data/app/views/helena_administration/questions/edit.html.slim +1 -0
  58. data/app/views/helena_administration/questions/new.html.slim +1 -0
  59. data/app/views/helena_administration/questions/show.html.slim +26 -0
  60. data/app/views/helena_administration/sessions/_form.html.slim +8 -0
  61. data/app/views/helena_administration/sessions/edit.html.slim +1 -0
  62. data/app/views/helena_administration/surveys/_form.html.slim +5 -0
  63. data/app/views/helena_administration/surveys/edit.html.slim +1 -0
  64. data/app/views/helena_administration/surveys/index.html.slim +34 -0
  65. data/app/views/helena_administration/surveys/new.html.slim +1 -0
  66. data/app/views/helena_administration/surveys/show.html.slim +120 -0
  67. data/app/views/helena_administration/versions/_form.html.slim +14 -0
  68. data/app/views/helena_administration/versions/edit.html.slim +1 -0
  69. data/app/views/helena_administration/versions/new.html.slim +1 -0
  70. data/app/views/helena_administration/versions/show.html.slim +68 -0
  71. data/app/views/layouts/helena_administration/application.html.slim +10 -0
  72. data/bin/rails +12 -0
  73. data/config/compass.rb +2 -0
  74. data/config/html5_rails.yml +26 -0
  75. data/config/locales/en.yml +21 -0
  76. data/config/locales/views/dashboard.en.yml +6 -0
  77. data/config/locales/views/import_surveys.en.yml +11 -0
  78. data/config/locales/views/question_groups.en.yml +5 -0
  79. data/config/locales/views/questions.en.yml +5 -0
  80. data/config/locales/views/surveys.en.yml +10 -0
  81. data/config/locales/views/versions.en.yml +11 -0
  82. data/config/routes.rb +24 -0
  83. data/coverage/.resultset.json.lock +0 -0
  84. data/coverage/assets/0.8.0/application.css +799 -0
  85. data/coverage/assets/0.8.0/application.js +1559 -0
  86. data/coverage/assets/0.8.0/colorbox/border.png +0 -0
  87. data/coverage/assets/0.8.0/colorbox/controls.png +0 -0
  88. data/coverage/assets/0.8.0/colorbox/loading.gif +0 -0
  89. data/coverage/assets/0.8.0/colorbox/loading_background.png +0 -0
  90. data/coverage/assets/0.8.0/favicon_green.png +0 -0
  91. data/coverage/assets/0.8.0/favicon_red.png +0 -0
  92. data/coverage/assets/0.8.0/favicon_yellow.png +0 -0
  93. data/coverage/assets/0.8.0/loading.gif +0 -0
  94. data/coverage/assets/0.8.0/magnify.png +0 -0
  95. data/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  96. data/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  97. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  98. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  99. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  100. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  101. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  102. data/coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  103. data/coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
  104. data/coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  105. data/coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
  106. data/coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
  107. data/coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  108. data/helena_administration.gemspec +37 -0
  109. data/lib/helena_administration/engine.rb +13 -0
  110. data/lib/helena_administration/version.rb +3 -0
  111. data/lib/helena_administration.rb +15 -0
  112. data/lib/tasks/helena_administration_tasks.rake +4 -0
  113. data/spec/controllers/dashboard_controller_spec.rb +11 -0
  114. data/spec/controllers/sessions_controller_spec.rb +102 -0
  115. data/spec/controllers/survey_controller_spec.rb +36 -0
  116. data/spec/dummy/README.rdoc +28 -0
  117. data/spec/dummy/Rakefile +6 -0
  118. data/spec/dummy/app/assets/images/.keep +0 -0
  119. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  120. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  121. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  122. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  123. data/spec/dummy/app/decorators/controllers/helena_administration/application_controller_decorator.rb +5 -0
  124. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  125. data/spec/dummy/app/mailers/.keep +0 -0
  126. data/spec/dummy/app/models/.keep +0 -0
  127. data/spec/dummy/app/models/concerns/.keep +0 -0
  128. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  129. data/spec/dummy/bin/bundle +3 -0
  130. data/spec/dummy/bin/rails +4 -0
  131. data/spec/dummy/bin/rake +4 -0
  132. data/spec/dummy/config/application.rb +27 -0
  133. data/spec/dummy/config/boot.rb +5 -0
  134. data/spec/dummy/config/environment.rb +5 -0
  135. data/spec/dummy/config/environments/development.rb +34 -0
  136. data/spec/dummy/config/environments/production.rb +78 -0
  137. data/spec/dummy/config/environments/test.rb +39 -0
  138. data/spec/dummy/config/initializers/assets.rb +9 -0
  139. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  140. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  141. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  142. data/spec/dummy/config/initializers/inflections.rb +16 -0
  143. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  144. data/spec/dummy/config/initializers/session_store.rb +3 -0
  145. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  146. data/spec/dummy/config/locales/en.yml +23 -0
  147. data/spec/dummy/config/mongoid.yml +13 -0
  148. data/spec/dummy/config/routes.rb +4 -0
  149. data/spec/dummy/config/secrets.yml +22 -0
  150. data/spec/dummy/config.ru +4 -0
  151. data/spec/dummy/lib/assets/.keep +0 -0
  152. data/spec/dummy/log/.keep +0 -0
  153. data/spec/dummy/public/404.html +67 -0
  154. data/spec/dummy/public/422.html +67 -0
  155. data/spec/dummy/public/500.html +66 -0
  156. data/spec/dummy/public/favicon.ico +0 -0
  157. data/spec/features/dashboard/index.html.slim_spec.rb +9 -0
  158. data/spec/features/question_groups/manage_question_groups_spec.rb +97 -0
  159. data/spec/features/questions/manage_questions_spec.rb +108 -0
  160. data/spec/features/questions/question_types/manage_checkbox_group_question_spec.rb +53 -0
  161. data/spec/features/questions/question_types/manage_long_text_question_spec.rb +22 -0
  162. data/spec/features/questions/question_types/manage_radio_group_question_spec.rb +57 -0
  163. data/spec/features/questions/question_types/manage_radio_matrix_question_spec.rb +78 -0
  164. data/spec/features/questions/question_types/manage_short_text_question_spec.rb +20 -0
  165. data/spec/features/questions/question_types/manage_static_text_question_spec.rb +18 -0
  166. data/spec/features/sessions/manage_sessions_spec.rb +51 -0
  167. data/spec/features/surveys/manage_survey_spec.rb +95 -0
  168. data/spec/features/versions/manage_version_spec.rb +113 -0
  169. data/spec/helpers/applicatin_helper_spec.rb +17 -0
  170. data/spec/rails_helper.rb +23 -0
  171. data/spec/spec_helper.rb +63 -0
  172. data/spec/support/.keep +0 -0
  173. metadata +455 -0
@@ -0,0 +1,60 @@
1
+ module HelenaAdministration
2
+ class SessionsController < ApplicationController
3
+ respond_to :html
4
+
5
+ before_filter :load_survey, :add_breadcrumbs
6
+ before_filter :load_session, only: [:edit, :update, :destroy]
7
+
8
+ def index
9
+ respond_to do |format|
10
+ @sessions = @survey.sessions.desc(:created_at)
11
+ format.json { render json: @sessions }
12
+ format.csv { render text: @sessions.to_csv }
13
+ end
14
+ end
15
+
16
+ def new
17
+ @survey.sessions.create version: @survey.newest_version
18
+ flash[:success] = t 'shared.actions.created'
19
+ redirect_to survey_path(@survey)
20
+ end
21
+
22
+ def edit
23
+ add_breadcrumb "#{@session.model_name.human}: #{@session.token_was}", @survey
24
+ end
25
+
26
+ def update
27
+ if @session.update_attributes session_params
28
+ flash[:success] = t 'shared.actions.updated'
29
+ else
30
+ flash.now[:danger] = t 'shared.actions.error'
31
+ add_breadcrumb "#{@session.model_name.human}: #{@session.token_was}", @survey
32
+ end
33
+ respond_with @survey
34
+ end
35
+
36
+ def destroy
37
+ flash[:success] = t 'shared.actions.deleted' if @session.destroy
38
+ redirect_to survey_path(@survey)
39
+ end
40
+
41
+ private
42
+
43
+ def add_breadcrumbs
44
+ add_breadcrumb t('shared.navigation.dashboard'), dashboard_index_path
45
+ add_breadcrumb Helena::Survey.model_name.human(count: 2), surveys_path
46
+ end
47
+
48
+ def load_survey
49
+ @survey = Helena::Survey.find params['survey_id']
50
+ end
51
+
52
+ def load_session
53
+ @session = @survey.sessions.find params[:id]
54
+ end
55
+
56
+ def session_params
57
+ params.require(:session).permit :token, :view_token, :answers_as_yaml, :completed, :last_question_group_id
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,71 @@
1
+ module HelenaAdministration
2
+ class SurveysController < ApplicationController
3
+ respond_to :html
4
+
5
+ before_action :add_breadcrumbs
6
+
7
+ before_action :load_resources, only: [:destroy, :edit, :update, :show]
8
+
9
+ def index
10
+ @surveys = Helena::Survey.asc(:position)
11
+ end
12
+
13
+ def new
14
+ @survey = Helena::Survey.new
15
+ add_breadcrumb t('shared.actions.new'), new_survey_path
16
+ end
17
+
18
+ def create
19
+ add_breadcrumb t('shared.actions.new')
20
+
21
+ @survey = Helena::Survey.new survey_params
22
+ if @survey.save
23
+ flash[:success] = t 'shared.actions.created'
24
+ else
25
+ flash.now[:danger] = t 'shared.actions.error'
26
+ end
27
+ respond_with @survey
28
+ end
29
+
30
+ def show
31
+ add_breadcrumb @survey.name
32
+ @sessions = Helena::Session.where(survey_id: @survey.id).desc(:updated_at).page(params[:page]).per(100)
33
+ end
34
+
35
+ def edit
36
+ add_breadcrumb @survey.name
37
+ end
38
+
39
+ def update
40
+ if @survey.update_attributes survey_params
41
+ flash[:success] = t 'shared.actions.updated'
42
+ else
43
+ flash.now[:danger] = t 'shared.actions.error'
44
+ add_breadcrumb @survey.name_was
45
+ end
46
+ respond_with @survey
47
+ end
48
+
49
+ def destroy
50
+ flash.now[:success] = t 'shared.actions.deleted' if @survey.destroy
51
+ respond_with @survey
52
+ end
53
+
54
+ private
55
+
56
+ def load_resources
57
+ @survey = Helena::Survey.find params[:id]
58
+ end
59
+
60
+ def add_breadcrumbs
61
+ add_breadcrumb t('shared.navigation.dashboard'), dashboard_index_path
62
+ add_breadcrumb Helena::Survey.model_name.human(count: 2), surveys_path
63
+ end
64
+
65
+ private
66
+
67
+ def survey_params
68
+ params.require(:survey).permit(:name, :tag_list, :language)
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,82 @@
1
+ module HelenaAdministration
2
+ class VersionsController < ApplicationController
3
+ respond_to :html
4
+
5
+ before_action :load_survey, :add_breadcrumbs
6
+ before_action :load_version, only: [:edit, :update, :show]
7
+
8
+ def show
9
+ add_breadcrumb t 'helena_administration.versions.version', version: @version.version
10
+ end
11
+
12
+ def new
13
+ @version = @survey.versions.any? ? @survey.versions.build(source_version.attributes) : @survey.versions.build
14
+ @version.survey_detail = (@version.try(:survey_detail) || Helena::SurveyDetail.new)
15
+ @version.notes = ''
16
+ add_breadcrumb t('.new'), new_survey_version_path(@survey)
17
+ end
18
+
19
+ def create
20
+ build_version && @version.update_attributes(version_params)
21
+ if @version.save
22
+ flash[:success] = t 'shared.actions.created'
23
+ else
24
+ flash.now[:danger] = t 'shared.actions.error'
25
+ end
26
+ respond_with [@survey, @version]
27
+ end
28
+
29
+ def edit
30
+ @version.survey_detail ||= Helena::SurveyDetail.new
31
+ add_breadcrumb t 'helena_administration.versions.version', version: @version.version
32
+ end
33
+
34
+ def update
35
+ if @version.update_attributes version_params
36
+ flash[:success] = t 'shared.actions.updated'
37
+ else
38
+ flash.now[:danger] = t 'shared.actions.error'
39
+ add_breadcrumb t 'helena_administration.versions.version', version: @version.version
40
+ end
41
+ respond_with [@survey, @version], location: [:edit, @survey, @version]
42
+ end
43
+
44
+ def destroy
45
+ @version = @survey.versions.find params[:id]
46
+ flash[:success] = t 'shared.actions.deleted' if @version.destroy
47
+ redirect_to survey_path(@survey)
48
+ end
49
+
50
+ private
51
+
52
+ def load_survey
53
+ @survey = Helena::Survey.find params[:survey_id]
54
+ end
55
+
56
+ def load_version
57
+ @version = @survey.versions.find params[:id]
58
+ end
59
+
60
+ def add_breadcrumbs
61
+ add_breadcrumb t('shared.navigation.dashboard'), dashboard_index_path
62
+ add_breadcrumb Helena::Survey.model_name.human(count: 2), surveys_path
63
+ add_breadcrumb @survey.name, @survey
64
+ end
65
+
66
+ def version_params
67
+ params.require(:version).permit(:notes, :session_report, :active, settings: [:display_progressbar], survey_detail_attributes: [:title, :description])
68
+ end
69
+
70
+ def build_version
71
+ if source_version
72
+ @version = Helena::VersionPublisher.publish(source_version)
73
+ else
74
+ @version = @survey.versions.build
75
+ end
76
+ end
77
+
78
+ def source_version
79
+ @survey.newest_version
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,14 @@
1
+ module HelenaAdministration
2
+ module ApplicationHelper
3
+ def title(page_title)
4
+ content_for :title, page_title.to_s
5
+ page_title
6
+ end
7
+
8
+ # adds ... in between like if you have to long names in apple finder so you can i.e see the beginning and the suffix
9
+ def truncate_between(str, after = 30)
10
+ str = '' if str.nil?
11
+ str.length > after ? "#{str[0..(after / 2) - 2]}...#{str[(str.length - ((after / 2) - 2))..str.length]}" : str
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ module HelenaAdministration
2
+ class ImportSurveyForm
3
+ include ActiveModel::Model
4
+
5
+ attr_accessor :script
6
+
7
+ validates :script, presence: true
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ /[if lt IE 7 ]
2
+ p.chromeframe
3
+ | You are using an <strong>outdated</strong> browser.
4
+ | Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.
@@ -0,0 +1,5 @@
1
+ - if flash.any?
2
+ #flashes
3
+ - flash.each do |type, message|
4
+ %div{class: "alert alert-#{type} fade in"}
5
+ = message
@@ -0,0 +1,13 @@
1
+ head
2
+ meta charset='utf-8'
3
+ meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'
4
+ title
5
+ = content_for(:title)
6
+ meta content='' name='description'
7
+ meta content='width=device-width' name='viewport'
8
+
9
+ = stylesheet_link_tag 'helena_administration'
10
+
11
+ = javascript_include_tag 'helena_administration'
12
+
13
+ = csrf_meta_tag
@@ -0,0 +1,16 @@
1
+ header#header
2
+ nav.navbar.navbar-default role="navigation"
3
+ .container-fluid
4
+ .navbar-header
5
+ button.navbar-toggle.collapsed data-target="#navbar-collapse" data-toggle="collapse" type="button"
6
+ span.sr-only Toggle navigation
7
+ span.icon-bar
8
+ span.icon-bar
9
+ span.icon-bar
10
+ = link_to 'Helena Admin', root_path, class: 'navbar-brand'
11
+ #navbar-collapse.collapse.navbar-collapse
12
+ ul.nav.navbar-nav.breadcrumbs
13
+ = render_breadcrumbs tag: :li, separator: ''
14
+ ul.nav.navbar-nav.navbar-right
15
+ li
16
+ a href="https://github.com/gurix/helena-admin" target='_blank' About
@@ -0,0 +1,14 @@
1
+ - title = t('shared.navigation.dashboard')
2
+ .row
3
+ .col-xs-12.col-sm-4
4
+ .decision.text-center
5
+ = link_to surveys_path do
6
+ div
7
+ i.fa.fa-files-o
8
+ = t('.manage_surveys')
9
+ .col-xs-12.col-sm-4
10
+ .decision.text-center
11
+ = link_to new_import_survey_path do
12
+ div
13
+ i.fa.fa-cloud-upload
14
+ = t('.import_survey')
@@ -0,0 +1,11 @@
1
+ - if @error
2
+ .alert.alert-danger
3
+ strong = @error.message
4
+ br
5
+ - @error.backtrace.each do |backtrace|
6
+ = backtrace
7
+ br
8
+
9
+ = simple_form_for @import_survey_form, url: import_survey_path do |f|
10
+ = f.input :script, as: :text, hint: t('shared.yaml_lang_hint_html'), input_html: { cols: 60, rows: 30, class: 'yaml_lang' }
11
+ = f.submit value: t('.import'), class: 'btn btn-success'
@@ -0,0 +1 @@
1
+ = render 'form'
@@ -0,0 +1,2 @@
1
+ li.first
2
+ == link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, remote: remote
@@ -0,0 +1,2 @@
1
+ li.page.gap
2
+ == t('views.pagination.truncate').html_safe
@@ -0,0 +1,2 @@
1
+ li.last
2
+ == link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, remote: remote
@@ -0,0 +1,2 @@
1
+ li.next
2
+ == link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, rel: 'next', remote: remote
@@ -0,0 +1,2 @@
1
+ li class="#{'active' if page.current?}"
2
+ == link_to page, url, { remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil}
@@ -0,0 +1,11 @@
1
+ == paginator.render do
2
+ ul.pagination
3
+ == first_page_tag unless current_page.first?
4
+ == prev_page_tag unless current_page.first?
5
+ - each_page do |page|
6
+ - if page.left_outer? || page.right_outer? || page.inside_window?
7
+ == page_tag page
8
+ - elsif !page.was_truncated?
9
+ == gap_tag
10
+ == next_page_tag unless current_page.last?
11
+ == last_page_tag unless current_page.last?
@@ -0,0 +1,2 @@
1
+ li.prev
2
+ == link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, rel: 'prev', remote: remote
@@ -0,0 +1,13 @@
1
+ doctype html
2
+ html
3
+ = render 'head'
4
+
5
+ body class=controller.controller_name
6
+ = render 'header'
7
+
8
+ .container-fluid
9
+ = render 'flash_messages'
10
+ = yield
11
+
12
+ / Javascript at the bottom for fast page loading
13
+ = render 'javascripts'
@@ -0,0 +1,5 @@
1
+ = simple_form_for [@survey, @version, question_group] do | f |
2
+ = f.input :position
3
+ = f.input :title
4
+ = f.input :allow_to_go_back, as: :boolean
5
+ = f.submit t('shared.save'), class: 'btn btn-success'
@@ -0,0 +1 @@
1
+ = render 'form', question_group: @question_group
@@ -0,0 +1 @@
1
+ = render 'form', question_group: @question_group
@@ -0,0 +1,60 @@
1
+ div id="#{dom_id(@question_group)}"
2
+ .row
3
+ .col-md-10
4
+ dl.dl-horizontal
5
+ dt = Helena::QuestionGroup.human_attribute_name :position
6
+ dd = @question_group.position
7
+
8
+ - if @question_group.allow_to_go_back
9
+ dt
10
+ dd = Helena::QuestionGroup.human_attribute_name(:allow_to_go_back)
11
+
12
+ dt = Helena::QuestionGroup.human_attribute_name :title
13
+ dd = @question_group.title
14
+
15
+ dt = Helena::QuestionGroup.human_attribute_name :created_at
16
+ dd = distance_of_time_in_words_to_now(@question_group.created_at)
17
+
18
+ .col-md-2
19
+ .pull-right
20
+ = link_to [:edit, @survey, @version, @question_group], class: "btn btn-default #{'disabled' if @version.active}", role: 'button' do
21
+ i.fa.fa-pencil-square-o
22
+ = t('shared.actions.edit')
23
+ = link_to [@survey, @version, @question_group], class: "btn btn-danger #{'disabled' if @version.active}", method: :delete, data: { confirm: t('shared.actions.ask_for_deletion') } do
24
+ i.fa.fa-remove
25
+ = t('shared.actions.delete')
26
+
27
+ hr
28
+ h3 = Helena::Question.model_name.human(count: 2)
29
+
30
+ table.table.table-striped.questions
31
+ thead
32
+ tr
33
+ th.position width='5%' = Helena::Question.human_attribute_name(:position)
34
+ th.code width='10%' = Helena::Question.human_attribute_name(:code)
35
+ th.question_text = Helena::Question.human_attribute_name(:question_text)
36
+ th.type width='10%' = Helena::Question.human_attribute_name(:type)
37
+ th.created_at width='10%' = Helena::Question.human_attribute_name(:created_at)
38
+ th width='20%'
39
+ = link_to [:new, @survey, @version, @question_group, :question], class: "btn btn-default pull-right #{'disabled' if @version.active}", role: 'button' do
40
+ i.fa.fa-plus-square-o
41
+ = t('shared.actions.new')
42
+ tbody
43
+ - @question_group.questions.asc(:position).each do |question|
44
+ tr id="#{dom_id(question)}"
45
+ td.position = question.position
46
+ td.code = question.code
47
+ td.question_text = question.question_text
48
+ td.type = question.class.model_name.human
49
+ td.create_at = distance_of_time_in_words_to_now(question.created_at)
50
+ td.actions
51
+ .pull-right
52
+ = link_to [@survey, @version, @question_group, question], class: 'btn btn-default', role: 'button' do
53
+ i.fa.fa-angle-right
54
+ = t('shared.actions.view')
55
+ = link_to [:edit, @survey, @version, @question_group, question], class: "btn btn-default #{'disabled' if @version.active}", role: 'button' do
56
+ i.fa.fa-pencil-square-o
57
+ = t('shared.actions.edit')
58
+ = link_to [@survey, @version, @question_group, question], class: "btn btn-danger #{'disabled' if @version.active}", method: :delete, data: { confirm: t('shared.actions.ask_for_deletion') } do
59
+ i.fa.fa-remove
60
+ = t('shared.actions.delete')