-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy path_form.html.erb
More file actions
75 lines (67 loc) · 2.89 KB
/
_form.html.erb
File metadata and controls
75 lines (67 loc) · 2.89 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<% url = @notification.new_record? ? super_admin_notifications_path : super_admin_notification_path(@notification) %>
<%= form_for @notification, url: url, html: { class: 'notification' } do |f| %>
<div class="row">
<div class="form-control mb-3 col-sm-10">
<%= f.label :title, _('Title'), class: 'form-label' %>
<%= f.text_field :title,
class: 'form-control',
value: @notification.title,
spellcheck: true,
"aria-required": true %>
</div>
<div class="form-control mb-3 col-sm-2">
<%= f.label :level, _('Level'), class: 'form-label' %>
<%= f.select :level,
Notification.levels.keys.map { |l| [l.humanize, l] },
{ value: @notification.level },
{ class: 'form-select',
data: { toggle: 'tooltip', html: true }, title: _('<strong>Info:</strong> Simple information message, displayed in blue.<br/><strong>Warning:</strong> warning message, for signaling something unusual, displayed in orange.<br/><strong>Danger:</strong> error message, for anything critical, displayed in red') } %>
</div>
</div>
<div class="row">
<div class="form-control mb-3 col-sm-12">
<%= f.check_box :dismissable, style: 'width: auto' %>
<%= f.label :dismissable, _('Dismissable'), class: 'form-label' %>
</div>
</div>
<div class="row">
<div class="form-control mb-3 col-sm-12">
<%= f.check_box :enabled, style: 'width: auto' %>
<%= f.label :enabled, _('Active'), class: 'form-label' %>
</div>
</div>
<div class="row">
<div class="form-control mb-3 col-sm-6">
<%= f.label :starts_at, _('Start'), class: 'form-label' %>
<%= f.date_field :starts_at,
class: 'form-control',
value: (@notification.starts_at || Date.today),
min: Date.today %>
</div>
<div class="form-control mb-3 col-sm-6">
<%= f.label :expires_at, _('Expiration'), class: 'form-label' %>
<%= f.date_field :expires_at,
class: 'form-control',
value: (@notification.expires_at || Date.tomorrow),
min: Date.tomorrow %>
</div>
</div>
<div class="form-control mb-3">
<%= f.label :body, _('Body'), class: 'form-label' %>
<%= f.text_area :body,
class: 'form-control notification-text',
value: @notification.body,
spellcheck: true,
"aria-required": true %>
</div>
<div class="float-end">
<%= f.button _('Save'), class: 'btn btn-secondary', type: 'submit' %>
<%= link_to(
_('Delete'),
super_admin_notification_path(@notification),
class: 'btn btn-secondary',
method: :delete,
data: { confirm: _('Are you sure you want to delete the notification "%{title}"') % { title: @notification.title }}) unless @notification.new_record? %>
<%= link_to _('Cancel'), super_admin_notifications_path, class: 'btn btn-secondary', role: 'button' %>
</div>
<% end %>