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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
<% locked_by_other = @node.locked? && @node.lock_owner != current_user %>
<div id="admin_layout" class="show_node">
<h1><%= title_for_node(@node) %> <small>(<%= I18n.default_locale.to_s.upcase %>)</small></h1>
<div id="content">
<div class="layout_row_label"><%= t(".status") %></div>
<div class="layout_row_content info_group node_status">
<div class="info_group_items">
<div class="info_item">
<span class="info_label"><%= t(".head") %></span>
<%= @node.head ? t(".head_line", :title => @node.head.title, :rev => @node.head.revision, :time => @node.head.updated_at) : t(".never_published") %>
</div>
<div class="info_item">
<span class="info_label"><%= t(".draft") %></span>
<%= @node.draft ? t(".draft_line", :title => @node.draft.title, :rev => @node.draft.revision, :time => @node.draft.updated_at) : t(".none") %>
</div>
<div class="info_item">
<span class="info_label"><%= t(".autosave") %></span>
<%= @node.autosave ? t(".autosave_line", :title => @node.autosave.title, :time => @node.autosave.updated_at) : t(".none") %>
</div>
</div>
<% edit_label = @node.autosave ? t(".continue_editing") : (@node.draft ? t(".edit_draft") : t(".lock_edit")) %>
<div class="info_group_items">
<div class="info_item">
<% if locked_by_other %>
<span class="disabled_action"><%= edit_label %></span>
<% else %>
<%= link_to edit_node_path(@node), class: "action_button" do %>
<%= icon("edit", library: "tabler", "aria-hidden": true) %>
<%= edit_label %>
<% end %>
<% if !@node.draft && !@node.autosave %>
<span class="field_hint"><%= t(".fresh_draft_hint") %></span>
<% end %>
<% end %>
</div>
<% @node.available_layer_pairs.each do |pair| %>
<div class="info_item">
<%= button_to t(".diff_layers", :from => t(".layer_#{pair.first}"), :to => t(".layer_#{pair.last}")),
diff_node_revisions_path(@node),
method: :get,
params: { start_revision: pair.first, end_revision: pair.last },
form: { class: 'button_to computation' } %>
</div>
<% end %>
<% unless locked_by_other %>
<% if @node.draft && !@node.autosave && !@node.in_trash? && !@node.trash_node? %>
<div class="info_item">
<%= button_to t(".publish"), publish_node_path(@node), method: :put,
form: { data: { confirm: t(".confirm_publish") }, class: 'button_to state_changing' } %>
</div>
<% end %>
<% if @node.autosave || (@node.draft && @node.head) %>
<div class="info_item">
<%= button_to revert_node_path(@node), method: :put,
params: { return_to: request.path },
form: { data: { confirm: t("admin.common.confirm_irreversible") }, class: 'button_to destructive' } do %>
<%= icon("trash", library: "tabler", "aria-hidden": true) %>
<%= @node.draft && !@node.autosave ? t(".destroy_draft") : t(".discard_autosave") %>
<% end %>
</div>
<% end %>
<% unless @node.trash_node? || @node.in_trash? || @node.root? %>
<div class="info_item">
<%= button_to trash_node_path(@node), method: :put,
form: { data: { confirm: t(".confirm_trash") }, class: 'button_to destructive' } do %>
<%= icon("trash", library: "tabler", "aria-hidden": true) %>
<%= t(".move_to_trash") %>
<% end %>
</div>
<% end %>
<% end %>
</div>
<% if locked_by_other %>
<span class="field_hint"><%= t(".locked_hint") %></span>
<% end %>
</div>
<% if @node.in_trash? %>
<div class="layout_row_label"><%= t(".trash") %></div>
<div class="layout_row_content info_group">
<div class="info_group_items">
<% if (entry = @node.last_trash_entry) && entry.metadata.dig("path", "from") %>
<div class="info_item">
<span class="info_label"><%= t(".was_at") %></span>
<%= entry.metadata.dig("path", "from") %>
</div>
<% end %>
<div class="info_item">
<span class="info_label"><%= t(".restore_to") %></span>
<% suggestion = @node.suggested_restore_parent %>
<%= form_tag restore_from_trash_node_path(@node), :method => :put, :class => "aligned_action_row" do %>
<div class="restore_picker">
<%= text_field_tag :restore_search_term,
suggestion && (suggestion.head&.title || suggestion.draft&.title || suggestion.slug),
:placeholder => t(".restore_placeholder") %>
<div id="restore_search_results" class="search_results"></div>
</div>
<%= hidden_field_tag :parent_id, suggestion&.id %>
<%= submit_tag t(".restore_here"), :class => "action_button action_button_no_margin_top" %>
<% end %>
<span class="field_hint"><%= t(".restore_hint") %></span>
</div>
</div>
<div class="info_group_items">
<div class="info_item">
<% doomed_below = @node.descendants.count %>
<%= button_to node_path(@node), method: :delete,
form: { data: { confirm: t(".confirm_delete", :count => doomed_below) },
class: 'button_to destructive' } do %>
<%= icon("trash-x", library: "tabler", "aria-hidden": true) %>
<%= t(".delete_permanently") %><%= " " + t(".including_beneath", :count => doomed_below) if doomed_below > 0 %>
<% end %>
</div>
</div>
</div>
<% end %>
<div class="layout_row_label"><%= t(".translations") %></div>
<div class="layout_row_content info_group">
<div class="info_group_items">
<% @translations.each do |translation| %>
<div class="info_item">
<span class="info_label"><%= translation[:locale].to_s.upcase %></span>
<div class="aligned_action_row">
<% if translation[:exists] %>
<%= link_to translation[:title], node_translation_path(@node, translation[:locale]) %> <%= t(".updated", :time => translation[:updated_at]) %>
<% if translation[:outdated] %>
<span class="warning"><%= t(".may_be_outdated") %></span>
<% end %>
<% else %>
<span class="field_hint"><%= t(".not_yet_translated") %></span>
<% end %>
<% if locked_by_other %>
<span class="disabled_action"><%= translation[:exists] ? t(".lock_edit") : t(".create_translation") %></span>
<% else %>
<%= link_to edit_node_translation_path(@node, translation[:locale]), class: "action_button" do %>
<%= icon(translation[:exists] ? "edit" : "language", library: "tabler", "aria-hidden": true) %>
<%= translation[:exists] ? t(".lock_edit") : t(".create_translation") %>
<% end %>
<% if translation[:exists] %>
<%= button_to node_translation_path(@node, translation[:locale]), method: :delete,
form: { data: { confirm: t("admin.common.confirm_irreversible") }, class: 'button_to destructive' } do %>
<%= icon("trash", library: "tabler", "aria-hidden": true) %>
<%= t(".destroy_translation") %>
<% end %>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>
</div>
<div class="layout_row_label"><%= t(".people") %></div>
<div class="layout_row_content info_group">
<div class="info_group_items">
<div class="info_item">
<span class="info_label"><%= t(".author") %></span>
<%= @page.user.try(:login) %>
</div>
<div class="info_item">
<span class="info_label"><%= t(".editor") %></span>
<%= @page.editor.try(:login) %>
</div>
<% if @node.locked? %>
<div class="info_item">
<span class="info_label"><%= t("admin.columns.locked_by") %></span>
<span class="warning"><%= @node.lock_owner.login %></span>
<%= unlock_link %>
</div>
<% end %>
</div>
</div>
<div class="layout_row_label"><%= t(".dates") %></div>
<div class="layout_row_content info_group">
<div class="info_group_items">
<div class="info_item">
<span class="info_label"><%= t(".last_updated") %></span>
<%= @page.updated_at %>
</div>
<% if @page.published_at.present? %>
<div class="info_item">
<span class="info_label"><%= @page.public? ? t(".published_at") : t(".will_publish_at") %></span>
<%= @page.published_at %>
</div>
<% end %>
</div>
</div>
<div class="layout_row_label"><%= t(".links") %></div>
<div class="layout_row_content info_group">
<div class="info_group_items">
<div class="info_item">
<span class="info_label"><%= t(".public") %></span>
<%= link_to @page.public_link, content_url(@node.unique_path) %>
</div>
<% if @node.draft %>
<div class="info_item">
<span class="info_label"><%= t(".admin_preview") %></span>
<%= link_to preview_page_path(@node.draft), preview_page_path(@node.draft) %>
</div>
<div class="info_item">
<span class="info_label"><%= t(".public_preview") %></span>
<% if @node.draft.preview_token.present? %>
<div class="aligned_action_row">
<%= link_to shared_preview_path(token: @node.draft.preview_token), shared_preview_url(token: @node.draft.preview_token), target: "_blank", rel: "noopener" %>
<%= button_to t(".revoke"), revoke_shared_preview_node_path(@node), method: :put, form: { data: { confirm: t(".confirm_revoke") }, class: 'button_to state_changing' } %>
</div>
<% else %>
<%= button_to t(".create_preview_link"), generate_shared_preview_node_path(@node), method: :put, form: { class: 'button_to state_changing' } %>
<% end %>
</div>
<% end %>
</div>
</div>
<div class="layout_row_label"><%= t(".history") %></div>
<div class="layout_row_content info_group">
<details>
<summary>
<%= t(".published_revisions", :count => @node.pages.count) %>
</summary>
<ul>
<% @node.pages.order(:revision).each do |page| %>
<li>
<%= link_to "##{page.revision} — #{page.title} (#{page.editor.try(:login)}, #{page.updated_at})", node_revision_path(@node, page) %>
<span class="revision_lifecycle"><%= revision_lifecycle_badges(@page_actions[page.id]) %></span>
</li>
<% end %>
</ul>
</details>
<p class="revisions_full_history_link"><%= link_to t(".revision_history"), node_revisions_path(@node) %> | <%= link_to t("node_actions.heading"), admin_log_path(:node_id => @node.id) %></p>
</div>
<div class="layout_row_label"><%= t(".tags") %></div>
<div class="layout_row_content info_group">
<% if @page.tag_list.any? %>
<ul class="tag_pill_list">
<% @page.tag_list.sort.each do |tag| %>
<li class="tag_pill"><%= tag %></li>
<% end %>
</ul>
<% else %>
<span class="field_hint"><%= t(".no_tags") %></span>
<% end %>
</div>
<div class="layout_row_label"><%= t(".attachments") %></div>
<div class="layout_row_content info_group">
<% if @page.assets.any? %>
<% headline_asset_id = @page.headline_asset&.id %>
<ul class="thumbnail_list">
<% @page.assets.each do |asset| %>
<li class="<%= "is_headline" if asset.id == headline_asset_id %>">
<%= link_to image_tag(asset.upload.url(:thumb)), asset_path(asset) %>
<% if asset.id == headline_asset_id %>
<span class="headline_indicator" title="<%= t('.headline_title')%>">
<%= icon("star", library: "tabler", "aria-hidden": true) %>
</span>
<% end %>
</li>
<% end %>
</ul>
<% end %>
<p class="add_attachments">
<%= link_to new_asset_path(:node_id => @node.id), class: 'action_button' do %>
<%= icon("paperclip", library: "tabler", "aria-hidden": true) %> <%= t(".upload_attachment") %>
<% end %>
<span class="field_hint"><%= t(".attachments_hint") %></span>
</p>
</div>
<div class="layout_row_label"><%= t(".events") %></div>
<div class="layout_row_content info_group">
<ul>
<% @node.events.order(:start_time).each do |event| %>
<li>
<%= event_schedule_text(event) %>
[<%= link_to t(".show_link"), event_path(event, return_to: request.path) %>
| <%= link_to t(".edit_link"), edit_event_path(event, return_to: request.path) %>]
</li>
<% end %>
</ul>
<% mapping = default_event_tag_mapping(@page) %>
<p class="add_events">
<%= link_to new_event_path(node_id: @node.id, tag_list: mapping&.last, auto_tag_source: mapping&.first, return_to: request.path), class: 'action_button' do %>
<%= icon("calendar-plus", library: "tabler", "aria-hidden": true) %> <%= t(".add_event") %>
<% end %>
</p>
</div>
<% matches = matching_node_kinds(@node) %>
<% if @node.children.any? || matches.any? %>
<div class="layout_row_label"><%= t(".children") %></div>
<div class="layout_row_content info_group">
<% if @node.children.any? %>
<details>
<summary><%= t(".children_count", :count => @node.children.count) %></summary>
<ul>
<% @node.children.order(:slug).each do |child| %>
<li><%= link_to (child.head&.title || child.draft&.title || child.slug), node_path(child) %></li>
<% end %>
</ul>
</details>
<% end %>
<% if matches.any? %>
<p class="add_child_links">
<% matches.each_with_index do |(kind, config), index| %>
<% link_params = { kind: kind } %>
<% link_params[:parent_id] = @node.id if kind == "generic" %>
<%= link_to new_node_path(link_params), class: 'action_button' do %>
<%= icon("text-plus", library: "tabler", "aria-hidden": true) %> <%= t(".add_child", :kind => resolve_kind_text(config[:label])) %>
<% end %>
<% end %>
</p>
<% end %>
</div>
<% end %>
<div class="layout_row_label"><%= t(".abstract_locale", :lang => I18n.default_locale.to_s.upcase) %></div>
<div class="layout_row_content"><%= sanitize(@page.abstract) %></div>
<div class="layout_row_label"><%= t(".body_locale", :lang => I18n.default_locale.to_s.upcase) %></div>
<div class="layout_row_content"><%= sanitize(@page.body) %></div>
</div>
</div>
|