This repository has been archived by the owner on Jan 23, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 117
/
_form.html.erb
228 lines (210 loc) · 10.2 KB
/
_form.html.erb
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<%= error_messages_for 'issue_template' %>
<div class='box tabular box-white'>
<p><%= f.text_field :title, required: true, size: 80, label: l(:issue_template_name) %></p>
<fieldset class='issue'>
<legend class='issue'><%= l(:label_applied_for_issue) %></legend>
<p>
<% if issue_template.tracker.blank? %>
<%= f.select :tracker_id, template_target_trackers(project, issue_template),
required: true, label: l(:label_tracker), include_blank: true %>
<%= h issue_template.tracker.present? ? issue_template.tracker.name :
l(:orphaned_template, default: 'Orphaned template from tracker') %>
<% else %>
<%= f.select :tracker_id, template_target_trackers(project, issue_template),
required: true, label: l(:label_tracker), selected: issue_template.tracker.id %>
<% unless project_tracker?(issue_template.tracker, project) %><br/>
<%= non_project_tracker_msg(project_tracker?(issue_template.tracker, project)) %>
<% end %>
<% end %>
</p>
<p><%= f.text_field :issue_title, required: false, size: 80, label: l(:issue_title) %>
<a class='icon icon-help template-help' title='<%= l(:help_for_this_field) %>'
data-tooltip-area='issue_title_help_area'
data-tooltip-content='issue_title_help_content'>
<%= l(:help_for_this_field) %>
<span class='tooltip-area' id='issue_title_help_area'></span>
</a>
</p>
<p>
<%= f.text_area :description, cols: 78, rows: 12,
required: true,
label: l(:issue_description), class: 'wiki-edit', style: 'overflow: auto;' %>
</p>
<!-- for Checklist -->
<% if checklist_enabled %>
<p id='checklist_form'>
<label>Checklist</label>
<input type='text' id='checklist_text' class='edit-box'>
<span class='icon icon-add checklist-new-only save-new-by-button' onclick='addCheckList()'></span>
<ul class='checklist' style='padding-left: 180px;'>
<% issue_template.checklist.each_with_index do |content, i| %>
<li id='checklist_<%= i %>'>
<span class='text'>
<%= content %>
<i class='icon icon-del' onclick='removeCheckList(this)'></i>
</span>
<input type='hidden' name='issue_template[checklists][]'
id='issue_template_checklist' value='<%= content %>'>
</li>
<% end %>
</ul>
</p>
<% end %>
<!-- for Builtin Fields -->
<!-- buildin field Generator -->
<% if builtin_fields_enable %>
<div id="json_generator">
<p>
<label><%= l(:label_select_field, default: 'Select a field') %></label>
<select v-model='newItemTitle'>
<option v-for='(value, key) in customFields' v-bind:value='key'>
{{ value.name }}
</option>
</select>
<a class='icon icon-help template-help' title='<%= l(:help_for_this_field) %>'
data-tooltip-area='builtin_fields_help_area'
data-tooltip-content='builtin_fields_help_content'>
<%= l(:help_for_this_field) %>
<span class='tooltip-area' id='builtin_fields_help_area'></span>
</a>
</p>
<p>
<label><%= l(:field_value) %></label>
<textarea id='issue_template_json_setting_field' v-if='fieldFormat() == "text"'
rows='1' placeholder='<%= l(:enter_value, default: 'Please enter a value') %>' v-model='newItemValue'>
</textarea>
<input type='date' id='issue_template_json_setting_field' v-if='fieldFormat() == "date"' v-model='newItemValue'>
<select v-model='newItemValue' v-if='fieldFormat() == "ratio"'>
<option v-for="ratio in [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]">{{ ratio }} %</option>
</select>
<select v-model='newItemValue' v-if='fieldFormat() == "list" || fieldFormat() == "bool"'>
<option v-for="value in possibleValues()">{{ value }}</option>
</select>
<span style='margin-left: 4px;' class='icon icon-add' v-on:click='addField(newItemTitle, newItemValue)'>
<%= l(:button_add) %>
</span>
</p>
<div id='field_information' class='wiki' v-if='newItemTitle != ""'>
<b><%= l(:label_field_information, default: 'Field information') %></b>
<pre>{{ customFields[newItemTitle] }}</pre>
</div>
<div id='fields_setting_display_area'>
<ul class='json-list' v-if='items.length > 0'>
<li v-for='item in items'>
<span v-if='customFields[item.title]'>
<b>{{ customFields[item.title].name }}</b>: {{ item.value }} / {{ item.title }}
</span>
<span v-if='!customFields[item.title]'>
<i class='issue_template help_content'>
<%= l(:unavailable_fields_for_this_tracker, default: 'Unavailable field for this tarcker') %>
: {{ item.value }} / {{ item.title }}
</i>
</span>
<i class='icon icon-del' v-on:click='deleteField(item)'></i>
</li>
</ul>
<pre id='builtin_fields_data_via_vue' style='display: none;'>{{ items }}</pre>
<span class='icon icon-reload' id='reset-json' v-on:click='loadField()'><%= l(:button_reset) %></span>
<span class='icon icon-checked' id='paste-json'><%= l(:button_apply) %></span>
</div>
<!-- buildin field Generator -->
<p style='opacity: 0.6;'>
<%= f.text_area :builtin_fields,
required: false, cols: 60, rows: 4,
label: l(:label_builtin_fields_json, default: 'JSON for fields') %>
</p>
<div id='builtin_fields_help_content' class='wiki' style='display: none;'>
<%= l(:label_builtin_fields_help_message, default: 'Enter builtin filds or custom fields default values with JSON format. ') %>
</div>
</div>
<% end %>
<!-- for Builtin Fields -->
</fieldset>
<p>
<%= f.text_area :note, cols: 70, rows: 3,
required: false,
label: l(:issue_template_note), style: 'overflow:auto;' %>
</p>
<p><%= f.text_field :related_link, type: 'url',
size: 70, label: l(:issue_template_related_link, default: 'Related link') %>
<a class='icon icon-help template-help' title='<%= l(:help_for_this_field) %>'
data-template-help-target='related_link_help_content'
data-tooltip-area='related_link_help_area'
data-tooltip-content='related_link_help_content'>
<%= l(:help_for_this_field) %>
<span class='tooltip-area' id='related_link_help_area'></span>
</a>
</p>
<p id='link_title_paragraph'><%= f.text_field :link_title, size: 70, label: l(:issue_template_link_title, default: 'Link title') %>
<a class='icon icon-help template-help' title='<%= l(:help_for_this_field) %>'
data-template-help-target='link_title_help_content'
data-tooltip-area='link_title_help_area'
data-tooltip-content='link_title_help_content'>
<%= l(:help_for_this_field) %>
<span class='tooltip-area' id='link_title_help_area'></span>
</a>
</p>
<p><%= f.check_box :is_default, label: l(:field_is_default) %>
<a class='icon icon-help template-help' title='<%= l(:help_for_this_field) %>'
data-template-help-target='isdefault_help_content'
data-tooltip-area='isdefault_help_area'
data-tooltip-content='isdefault_help_content'>
<%= l(:help_for_this_field) %>
<span class='tooltip-area' id='isdefault_help_area'></span>
</a>
</p>
<p><%= f.check_box :enabled, label: l(:label_enabled) %>
<a class='icon icon-help template-help' title='<%= l(:help_for_this_field) %>'
data-template-help-target='enabled_help_content'
data-tooltip-area='enabled_help_area'
data-tooltip-content='enabled_help_content'>
<%= l(:help_for_this_field) %>
<span class='tooltip-area' id='enabled_help_area'></span>
</a>
</p>
<p>
<%= f.check_box :enabled_sharing, label: l(:label_enabled_sharing) %>
<a class='icon icon-help template-help' title='<%= l(:help_for_this_field) %>'
data-tooltip-area='enabledsharing_help_area'
data-tooltip-content='enabledsharing_help_content'>
<%= l(:help_for_this_field) %>
<span class='tooltip-area' id='enabledsharing_help_area'></span>
</a>
</p>
</div>
<%= wikitoolbar_for 'issue_template_description' %>
<!-- tooltip content -->
<div id='issue_title_help_content' class='wiki' style='display: none;'>
<%= l(:help_for_issue_title) %>
</div>
<div id='isdefault_help_content' class='wiki' style='display: none;'>
<%= l(:label_isdefault_help_message) %>
</div>
<div id='related_link_help_content' class='wiki' style='display: none;'>
<%= l(:label_related_link_help_message, default: 'If there are some example pages or sample issues which using issue template, please specify the link. So operator can see them as an usage or example for template.') %>
</div>
<div id='link_title_help_content' class='wiki' style='display: none;'>
<%= l(:label_link_title_help_message, default: 'If there are some example pages or sample issues which using issue template, please specify the link. So operator can see them as an usage or example for template.') %>
</div>
<div id='enabled_help_content' class='wiki' style='display: none;'>
<%= l(:label_enabled_help_message) %>
</div>
<div id='enabledsharing_help_content' class='wiki' style='display: none;'>
<%= l(:label_enabledshaing_help_message) %>
</div>
<!-- tooltip content -->
<script>
const baseUrl = "<%= url_for(controller: 'issue_templates', action: 'load_selectable_fields') %>"
const template_id = "<%= issue_template&.id || '' %>"
const template_type = 'issue_template'
const tracker_pulldown_id = template_type + '_tracker_id'
const base_builtin_fields = <%= issue_template.builtin_fields.html_safe %>
const base_custom_fields = <%= custom_fields.html_safe %>
</script>
<% if builtin_fields_enable %>
<%= javascript_include_tag('vue.min', plugin: 'redmine_issue_templates') %>
<%= javascript_include_tag('template_fields', plugin: 'redmine_issue_templates') %>
<% end %>
<% if checklist_enabled %>
<%= javascript_include_tag('template_checklists', plugin: 'redmine_issue_templates') %>
<% end %>