|
1 | | -<% title _('Create a new plan') %> |
2 | | -<% required_project_title_tooltip = _('This field is required.') %> |
3 | | -<% project_title_tooltip = _('If applying for funding, state the project title exactly as in the proposal.') %> |
4 | | -<% required_research_org_tooltip = _('You must select a research organisation from the list or click the checkbox.') %> |
5 | | -<% research_org_tooltip = _('Please select a valid research organisation from the list.') %> |
6 | | -<% required_primary_funding_tooltip = _('You must select a funder from the list or click the checkbox.') %> |
7 | | -<% primary_funding_tooltip = _('Please select a valid funding organisation from the list.') %> |
8 | | - |
9 | | -<div class="row"> |
10 | | - <div class="col-md-12"> |
11 | | - <h1><%= _('Create a new plan') %></h1> |
12 | | - |
13 | | - <p class="start-indent"> |
14 | | - <%= _("Before you get started, we need some information about your research project to set you up with the best DMP template for your needs.") %> |
15 | | - </p> |
| 1 | +<form action="<%= plans_path %>" method="post" class="roadmap-form"> |
| 2 | + <div class="row form-row"> |
| 3 | + <div class="col-12"> |
| 4 | + <h1><%= _('Create a new plan') %></h1> |
| 5 | + <p> |
| 6 | + <%= _("Before you get started, we need some information about your research project to set you up with the best DMP template for your needs.") %> |
| 7 | + </p> |
| 8 | + </div> |
16 | 9 | </div> |
17 | | -</div> |
18 | | - |
19 | | -<div class="row"> |
20 | | - <div class="col-md-12"> |
21 | | - <%= form_for Plan.new, url: plans_path do |f| %> |
22 | | - <!-- Plan name section --> |
23 | | - <h2 id="project-title"><span class="red" title="<%= required_project_title_tooltip %>">*<em class="sr-only"><%= required_project_title_tooltip %></em> </span><%= _('What research project are you planning?') %></h2> |
24 | | - <div class="row"> |
25 | | - <div class="form-control mb-3 col-md-8"> |
26 | | - <%= f.text_field(:title, class: 'form-control', 'aria-labelledby': 'project-title', 'aria-required': 'true', 'aria-label': 'project-title', |
27 | | - 'data-toggle': 'tooltip', |
28 | | - 'data-placement': 'bottom', |
29 | | - spellcheck: true, |
30 | | - title: project_title_tooltip ) %> |
31 | | - </div> |
32 | | - <div class="form-control mb-3 col-md-6"> |
33 | | - <div class="checkbox"> |
34 | | - <%= label_tag(:is_test) do %> |
35 | | - <%= check_box_tag(:is_test, "1", false) %> |
36 | | - <%= _('mock project for testing, practice, or educational purposes') %> |
37 | | - <% end %> |
38 | | - </div> |
39 | | - </div> |
| 10 | + <fieldset> |
| 11 | + <div class="row form-row"> |
| 12 | + <div class="col-12"> |
| 13 | + <!-- Rails form authenticity token --> |
| 14 | + <%= hidden_field_tag :authenticity_token, form_authenticity_token %> |
| 15 | + <label for="plan_title" id="project-title" class="form-label"> |
| 16 | + <%= _('Enter project title') %> |
| 17 | + </label> |
| 18 | + <input type="text" |
| 19 | + id="plan_title" |
| 20 | + name="plan[title]" |
| 21 | + class="form-control" |
| 22 | + required |
| 23 | + aria-labelledby="project-title" |
| 24 | + aria-required="true" |
| 25 | + aria-label="project-title" |
| 26 | + data-toggle="tooltip" |
| 27 | + data-placement="bottom" |
| 28 | + spellcheck="true"> |
40 | 29 | </div> |
41 | | - |
42 | | - <!-- Organisation selection --> |
43 | | - <h2 id="research-org"> |
44 | | - <span class="red" title="<%= required_research_org_tooltip %>">*<em class="sr-only"><%= required_research_org_tooltip %></em> </span> |
45 | | - <%= _('Select the primary research organisation') %> |
46 | | - </h2> |
47 | | - <div id="research-org-controls" class="row"> |
48 | | - <div class="form-control mb-3 col-md-6"> |
49 | | - <em class="sr-only"><%= research_org_tooltip %></em> |
50 | | - <% dflt = @orgs.include?(current_user.org) ? current_user.org : nil %> |
51 | | - <%= f.fields_for :org, @plan.org do |org_fields| %> |
52 | | - <%= render partial: "shared/org_selectors/local_only", |
53 | | - locals: { |
54 | | - form: org_fields, |
55 | | - id_field: :id, |
56 | | - default_org: dflt, |
57 | | - orgs: @orgs, |
58 | | - required: false |
59 | | - } %> |
60 | | - <% end %> |
61 | | - </div> |
62 | | - <div class="col-md-3 text-center"><strong>- <%= _('or') %> -</strong></div> |
63 | | - <div class="form-control mb-3 col-md-3"> |
64 | | - <div class="form-check"> |
65 | | - <% primary_research_org_message = _('No research organisation associated with this plan or my research organisation is not listed') %> |
66 | | - <%= label_tag(:plan_no_org) do %> |
67 | | - <%= check_box_tag(:plan_no_org, "0", false, class: "toggle-autocomplete") %> |
68 | | - <%= primary_research_org_message %> |
69 | | - <% end %> |
70 | | - </div> |
| 30 | + </div> |
| 31 | + <div class="row form-row"> |
| 32 | + <div class="col-12"> |
| 33 | + <div class="form-check"> |
| 34 | + <input type="checkbox" |
| 35 | + class="form-check-input" |
| 36 | + id="is_test" |
| 37 | + value="1"> |
| 38 | + <label class="form-check-label" for="is_test"> |
| 39 | + <%= _('Mock project for testing, practice, or educational purposes') %> |
| 40 | + </label> |
71 | 41 | </div> |
72 | | - </div> |
73 | | - |
74 | | - <!-- Funder selection --> |
75 | | - <h2 id="funder-org"><span class="red" title="<%= required_primary_funding_tooltip %>">* <em class="sr-only"><%= required_primary_funding_tooltip %></em> </span><%= _('Select the primary funding organisation') %></h2> |
76 | | - <div id="funder-org-controls" class="row"> |
77 | | - <div class="form-control mb-3 col-md-6"> |
78 | | - <em class="sr-only"><%= primary_funding_tooltip %></em> |
79 | | - <%= f.fields_for :funder, @plan.funder = Org.new do |funder_fields| %> |
80 | | - <%= render partial: "shared/org_selectors/local_only", |
81 | | - locals: { |
82 | | - form: funder_fields, |
83 | | - id_field: :id, |
84 | | - label: _("Funder"), |
85 | | - default_org: nil, |
86 | | - orgs: @funders, |
87 | | - required: false |
88 | | - } %> |
89 | | - <% end %> |
90 | | - </div> |
91 | | - <div class="col-md-3 text-center"><strong>- <%= _('or') %> -</strong></div> |
92 | | - <div class="form-control mb-3 col-md-3"> |
93 | | - <div class="form-check"> |
94 | | - <% primary_funding_message = _('No funder associated with this plan or my funder is not listed') %> |
95 | | - <%= label_tag(:plan_no_funder) do %> |
96 | | - <%= check_box_tag(:plan_no_funder, "0", false, class: "toggle-autocomplete") %> |
97 | | - <%= primary_funding_message %> |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + </fieldset> |
| 45 | + <fieldset class="form-group"> |
| 46 | + <legend> |
| 47 | + <%= _('Select a DMP template') %> |
| 48 | + </legend> |
| 49 | + <div class="row form-row"> |
| 50 | + <div class="col-12"> |
| 51 | + <% @templates_grouped.each do |group_label, group_templates| %> |
| 52 | + <div class="mb-3"> |
| 53 | + <div class="form-label fw-bold"> |
| 54 | + <%= group_label %> |
| 55 | + </div> |
| 56 | + <% group_templates.each do |template_title, template_id| %> |
| 57 | + <div class="form-check"> |
| 58 | + <input |
| 59 | + class="form-check-input" |
| 60 | + type="radio" |
| 61 | + id="template_<%= template_id %>" |
| 62 | + name="plan[template_id]" |
| 63 | + value="<%= template_id %>" |
| 64 | + required |
| 65 | + aria-labelledby="template_<%= template_id %>" |
| 66 | + > |
| 67 | + <label |
| 68 | + class="form-check-label fw-normal" |
| 69 | + id="template_<%= template_id %>" |
| 70 | + for="template_<%= template_id %>" |
| 71 | + > |
| 72 | + <%= template_title %> |
| 73 | + </label> |
| 74 | + </div> |
98 | 75 | <% end %> |
99 | 76 | </div> |
100 | | - </div> |
101 | | - </div> |
| 77 | + <% end %> |
102 | 78 |
|
103 | | - <!-- Template selection --> |
104 | | - <div id="available-templates" style="visibility: none;"> |
105 | | - <%= hidden_field_tag 'template-option-target', template_options_path %> |
106 | | - <h2 id="template-selection"><%= _('Which DMP template would you like to use?') %></h2> |
107 | | - <div class="form-control mb-3 row"> |
108 | | - <div class="col-md-6"> |
109 | | - <%= select_tag(:plan_template_id, "<option value=\"\">#{_('Please select a template')}</option>", name: 'plan[template_id]', |
110 | | - class: 'form-select', 'aria-labelledby': 'template-selection') %> |
111 | | - </div> |
112 | | - <div class="col-md-6"> |
113 | | - <span id="multiple-templates"> |
114 | | - <%= _('We found multiple DMP templates corresponding to your funder.') %> |
115 | | - </span> |
116 | | - </div> |
117 | | - </div> |
118 | | - </div> |
119 | | - |
120 | | - <%= f.hidden_field(:visibility, value: @is_test ? 'is_test' : Rails.configuration.x.plans.default_visibility) %> |
121 | | - <%= f.button(_('Create plan'), class: "btn btn-primary", type: "submit") %> |
122 | | - <%= link_to _('Cancel'), plans_path, class: 'btn btn-secondary' %> |
123 | | - <% end %> |
| 79 | + </div> |
| 80 | + </div> |
| 81 | + </fieldset> |
| 82 | + <div class="row form-row"> |
| 83 | + <div class="col-12"> |
| 84 | + <button type="submit" class="btn btn-primary"> |
| 85 | + <%= _('Create') %> |
| 86 | + </button> |
| 87 | + <%= link_to _('Cancel'), plans_path, class: 'btn btn-secondary' %> |
| 88 | + </div> |
124 | 89 | </div> |
125 | | -</div> |
| 90 | +</form> |
0 commit comments