diff --git a/app/models/question.rb b/app/models/question.rb index 7a37132..acfba1a 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -20,7 +20,7 @@ ## # Possibly needed for active_admin # -relies on protected_attributes gem as syntax depricated in rails 4.2 - attr_accessible :default_value, :dependency_id, :dependency_text, :guidance,:number, :suggested_answer, :text, :section_id, :question_format_id, :question_options_attributes, :suggested_answers_attributes, :option_comment_display, :theme_ids, :as => [:default, :admin] + attr_accessible :default_value, :dependency_id, :dependency_text, :guidance,:number, :suggested_answer, :text, :section_id, :question_format_id, :question_options_attributes, :suggested_answers_attributes, :id, :option_comment_display, :theme_ids, :as => [:default, :admin] diff --git a/app/views/templates/_edit_question.html.erb b/app/views/templates/_edit_question.html.erb index 000fb98..8ea1271 100644 --- a/app/views/templates/_edit_question.html.erb +++ b/app/views/templates/_edit_question.html.erb @@ -59,7 +59,7 @@ <% end %> <% i = 0 %> <% question.question_options.to_a.sort_by{|op| op["number"]}.each do |options_q|%> - <%= f.fields_for :options, options_q do |op|%> + <%= f.fields_for :question_options, options_q do |op|%> <% i = i + 1%> <% options_q.number = i %> <%= render "option_fields", f: op %> diff --git a/app/views/templates/_show_phases_sections.html.erb b/app/views/templates/_show_phases_sections.html.erb index 01a5492..63f5a08 100644 --- a/app/views/templates/_show_phases_sections.html.erb +++ b/app/views/templates/_show_phases_sections.html.erb @@ -18,12 +18,12 @@ <%= link_to t("helpers.submit.delete"), admin_destroyphase_template_path(phase_id: phase.id), confirm: t("org_admin.templates.phase_delete_message", phase_title: phase.title ), method: :delete, class: "btn btn-primary"%> <% end %> - <% if phase.template.org_type == constant("organisation_types.funder") && current_user.org_type != constant("organisation_types.funder")%> + <% if !phase.modifiable %> <% b_label = t('org_admin.templates.view_phase_label')%> <% else %> <% b_label = t('org_admin.templates.edit_phase_label')%> <% end %> - <%= link_to b_label, admin_phase_template_path(phase), class: "btn btn-primary" %> + <%= link_to b_label, admin_phase_template_path(id: phase.id, edit: (b_label == t('org_admin.templates.edit_phase_label'))), class: "btn btn-primary" %> <% if phase.sections.any? %> diff --git a/app/views/templates/_show_question.html.erb b/app/views/templates/_show_question.html.erb index ec97aab..122c44f 100644 --- a/app/views/templates/_show_question.html.erb +++ b/app/views/templates/_show_question.html.erb @@ -51,7 +51,7 @@ <%= q_format.title %>
<% if q_format.title == t("helpers.checkbox") || q_format.title == t("helpers.multi_select_box") || q_format.title == t("helpers.radio_buttons") || q_format.title == t("helpers.dropdown") %> - <% if question.question_option_comment_display == true %> + <% if question.option_comment_display == true %> <%= t("org_admin.questions.option_comment_display")%> <% else %> <%= t("org_admin.questions.option_comment_hide")%> @@ -120,7 +120,7 @@
- <% if (@edit == 'true' && question.modifiable) %> + <% if (@edit && question.modifiable) %>
<%= hidden_field_tag :question_id, question.id, class: "question_id" %> <%= link_to t("org_admin.questions.question_edit_button"), '# ', class: "btn btn-primary edit_question_button"%> @@ -129,7 +129,7 @@ confirm: t("org_admin.questions.delete_message", question_text: question.text ), method: :delete, class: "btn btn-primary"%> <% end %>
- <% elsif @edit == 'false' && question.modifiable %> + <% elsif !@edit && question.modifiable %> <% suggested_answer = question.get_suggested_answer(current_user.org_id) %> <% if suggested_answer.nil? %>