diff --git a/app/views/branded/guidances/new_edit.html.erb b/app/views/branded/guidances/new_edit.html.erb index 45d7855..1e5d170 100644 --- a/app/views/branded/guidances/new_edit.html.erb +++ b/app/views/branded/guidances/new_edit.html.erb @@ -14,7 +14,7 @@ <%= text_area_tag("guidance-text", guidance.text, class: "form-control", 'aria-required': true, rows: 10) %> <%= render partial: 'org_admin/shared/theme_selector', - locals: { f: f, all_themes: themes, as_radio: false, required: true, + locals: { f: f, all_themes: themes, as_radio: true, required: true, popover_message: _('Select one or more themes that are relevant to this guidance. This will display your generic organisation-level guidance, or any Schools/Departments for which you create guidance groups, across all templates that have questions with the corresponding theme tags.') } %>
<%= f.label _('Guidance group'), for: :guidance_group_id, class: 'control-label' %> diff --git a/app/views/branded/org_admin/questions/_form.html.erb b/app/views/branded/org_admin/questions/_form.html.erb new file mode 100644 index 0000000..ccf2757 --- /dev/null +++ b/app/views/branded/org_admin/questions/_form.html.erb @@ -0,0 +1,79 @@ +

<%= question.id.present? ? _('Question %{number}:') % { number: question.number } : _('New question:') %>

+<%= form_for(question, url: url, namespace: question.id.present? ? question.id : 'new_question', html: { method: method, class: 'question_form' }) do |f| %> + <% current_format = question.question_format.present? ? question.question_format : QuestionFormat.find_by(formattype: QuestionFormat.formattypes[:textarea]) %> + + +
+ <%= f.label(:number, _('Question Number'), class: "control-label") %> + <%= f.number_field(:number, in: 1..50, class: "form-control", 'aria-required': true) %> +
+ +
+ <%= f.label(:text, _('Question text'), class: "control-label") %> + <%= f.text_area(:text, class: "question", 'aria-required': true) %> +
+ +
+ <%= f.label(:question_format_id, _('Answer format'), class: "control-label") %> + <%= f.select :question_format_id, + options_from_collection_for_select(QuestionFormat.all.order("title"), + :id, + :title, + question.question_format_id), + {}, + class: "form-control question_format", + 'data-toggle': 'tooltip', + 'data-html': true, + title: _("You can choose from:") + %> +
+ +
+
+ <%= render "/org_admin/question_options/option_fields", f: f, q: question %> + +
+
+ <% comment_disp = current_format.option_based? || current_format.rda_metadata? %> +
+ +
+ +
+ <%= f.label(:default_value, _('Default answer'), class: "control-label") %> +
+ + <%= f.text_field(:default_value, class: 'form-control') %> + + + <%= text_area_tag('question[default_value]', question.default_value, id: "#{question.id.present? ? question.id : 'new'}_question_default_value_area", class: "form-control question") %> + +
+
+ <%# example_answer and guidance annotations as nested fields %> + <% question.annotations_per_org(current_user.org_id).each do |annotation| %> + <%= f.fields_for(:annotations, annotation) do |annotation_fields| %> + <%= render partial: 'org_admin/annotations/form', locals: { f: annotation_fields } %> + <% end %> + <% end %> + +
+ <%= render partial: 'org_admin/shared/theme_selector', + locals: { f: f, all_themes: Theme.all.order("title"), as_radio: false, + popover_message: _('Select one or more themes that are relevant to this question. This will allow similarly themed organisation-level guidance to appear alongside your question.') } %> +
+
+
+ <%= f.submit _('Save'), class: "btn btn-default", role:'button' %> + <% if question.id.present? && !question.section.phase.template.published? %> + <% href = org_admin_template_phase_section_question_path(template_id: template.id, phase_id: question.section.phase.id, section_id: question.section.id, id: question.id) %> + <%= link_to _('Delete'), href, method: :delete, class: "btn btn-default", role:'button', 'data-confirm': _("You are about to delete question #%{question_number}. Are you sure?") % { question_number: question.number } %> + <%= link_to _('Cancel'), href, class: "btn btn-default ajaxified-question", method: 'get', remote: true %> + <% else %> + <%= link_to _('Cancel'), '#', class: "btn btn-default cancel-new-question" %> + <% end %> +
+
+<% end %> diff --git a/app/views/branded/org_admin/shared/_theme_selector.html.erb b/app/views/branded/org_admin/shared/_theme_selector.html.erb index e045317..13dd640 100644 --- a/app/views/branded/org_admin/shared/_theme_selector.html.erb +++ b/app/views/branded/org_admin/shared/_theme_selector.html.erb @@ -1,5 +1,5 @@ <%# locals: all_themes, as_radio & popover_message %> -<% as_radio ||= true %> +<% as_radio ||= false %> <% required ||= false %>