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 @@