-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathnew_edit.html.erb
More file actions
54 lines (53 loc) · 2.7 KB
/
new_edit.html.erb
File metadata and controls
54 lines (53 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<%
if @guidance.id.present?
url = admin_update_guidance_path(@guidance)
method = "PUT"
else
url = admin_create_guidance_path
method = "POST"
end
%>
<% guidance_text_tooltip = _('Enter your guidance here. You can include links where needed.') %>
<% title _('Guidance') %>
<%# locals: { guidance, themes, guidance_groups, options } %>
<div class="row">
<div class="col-xs-12">
<h1><%= _('Guidance') %></h1>
<%= link_to _('View all guidance'), admin_index_guidance_path(current_user.org_id), class: 'btn btn-secondary float-end' %>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<%= form_for(@guidance, url: url, html: { method: method , id: 'new_edit_guidance'}) do |f| %>
<div class="form-control mb-3" data-toggle="tooltip" title="<%= guidance_text_tooltip %>">
<em class="sr-only"><%= guidance_text_tooltip %></em>
<%= f.label :text, class: 'form-label' %>
<%= f.text_area :text, rows: 10, class: "form-control", spellcheck: true,
aria: { required: true } %>
</div>
<%= render partial: 'org_admin/shared/theme_selector',
locals: { f: f, all_themes: Theme.all.order("title"), as_radio: false, required: true,
in_error: @guidance.errors[:themes].present?,
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.') } %>
<div class="form-control mb-3">
<%= f.label _('Guidance group'), for: :guidance_group_id, class: 'form-label' %>
<%= f.collection_select(:guidance_group_id,
GuidanceGroup.where(org_id: current_user.org_id).order("name ASC"),
:id, :name, {prompt: false}, {multiple: false, 'data-toggle': 'tooltip', title: _('Select which group this guidance relates to.'), class: 'form-select', 'aria-required': true})%>
</div>
<div class="form-check">
<%= f.label :published do %>
<%= f.check_box :published,
as: :check_boxes,
data: { toggle: 'tooltip' },
title: _("Check this box when you are ready for this guidance to appear on user's plans.") %>
<%= _('Published?') %>
<% end %>
</div>
<div class="form-control mb-3 clear-fix">
<%= f.submit _('Save'), name: "edit_guidance_submit", class: "btn btn-primary" %>
<%= link_to _('Cancel'), admin_index_guidance_path, class: "btn btn-primary", role: 'button' %>
</div>
<%end%>
</div>
</div>