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
|
<% locked_by_other = @node.locked? && @node.lock_owner != current_user %>
<div id="page_editor" class="show_node">
<h1><%= title_for_node(@node) %></h1>
<div id="content">
<div class="node_description">Status</div>
<div class="node_content node_info_group node_status">
<div class="node_info_group_items">
<div class="node_info_item">
<span class="node_info_label">Head</span>
<%= @node.head ? "#{@node.head.title} (rev #{@node.head.revision}, #{@node.head.updated_at})" : "none — never published" %>
</div>
<div class="node_info_item">
<span class="node_info_label">Draft</span>
<%= @node.draft ? "#{@node.draft.title} (rev #{@node.draft.revision}, saved #{@node.draft.updated_at})" : "none" %>
</div>
<div class="node_info_item">
<span class="node_info_label">Autosave</span>
<%= @node.autosave ? "#{@node.autosave.title} (unsaved, #{@node.autosave.updated_at})" : "none" %>
</div>
</div>
<% edit_label = @node.autosave ? "Continue Editing" : (@node.draft ? "Edit Draft" : "Edit") %>
<div class="node_info_group_items">
<div class="node_info_item">
<% if locked_by_other %>
<span class="disabled_action"><%= edit_label %></span>
<% else %>
<%= link_to (@node.autosave ? "Continue Editing" : (@node.draft ? "Edit Draft" : "Lock + Edit")), edit_node_path(@node), class: "action_button" %>
<% if !@node.draft && !@node.autosave %>
<span class="field_hint">Nothing pending — this will start a fresh draft.</span>
<% end %>
<% end %>
</div>
<% unless locked_by_other %>
<% if @node.draft && !@node.autosave %>
<div class="node_info_item">
<%= button_to 'Publish', publish_node_path(@node), method: :put,
form: { data: { confirm: "Publish this draft?" }, class: 'button_to state_changing' } %>
</div>
<% end %>
<% if @node.draft || @node.autosave %>
<div class="node_info_item">
<%= button_to (@node.draft && !@node.autosave ? 'Destroy Draft' : 'Discard changes'),
revert_node_path(@node), method: :put,
form: { data: { confirm: "This cannot be undone. Continue?" }, class: 'button_to destructive' } %>
</div>
<% end %>
<% end %>
</div>
<% if locked_by_other %>
<span class="field_hint">Locked — see People below to unlock before editing, publishing, or discarding.</span>
<% end %>
</div>
<div class="node_description">People</div>
<div class="node_content node_info_group">
<div class="node_info_group_items">
<div class="node_info_item">
<span class="node_info_label">Author</span>
<%= @page.user.try(:login) %>
</div>
<div class="node_info_item">
<span class="node_info_label">Editor</span>
<%= @page.editor.try(:login) %>
</div>
<% if @node.locked? %>
<div class="node_info_item">
<span class="node_info_label">Locked by</span>
<span class="warning"><%= @node.lock_owner.login %></span>
<%= unlock_link %>
</div>
<% end %>
</div>
</div>
<div class="node_description">Dates</div>
<div class="node_content node_info_group">
<div class="node_info_group_items">
<div class="node_info_item">
<span class="node_info_label">Last updated</span>
<%= @page.updated_at %>
</div>
<% if @page.published_at.present? %>
<div class="node_info_item">
<span class="node_info_label"><%= @page.public? ? 'Published at' : 'Will publish at' %></span>
<%= @page.published_at %>
</div>
<% end %>
</div>
</div>
<div class="node_description">Links</div>
<div class="node_content node_info_group">
<div class="node_info_group_items">
<div class="node_info_item">
<span class="node_info_label">Public</span>
<%= link_to @page.public_link, content_url(@node.unique_path) %>
</div>
<% if @node.draft %>
<div class="node_info_item">
<span class="node_info_label">Admin Preview</span>
<%= link_to preview_page_path(@node.draft), preview_page_path(@node.draft) %>
</div>
<div class="node_info_item">
<span class="node_info_label">Public Preview</span>
<% if @node.draft.preview_token.present? %>
<%= link_to shared_preview_path(token: @node.draft.preview_token), shared_preview_url(token: @node.draft.preview_token), target: "_blank", rel: "noopener" %>
<%= button_to 'Revoke', revoke_shared_preview_node_path(@node), method: :put, form: { data: { confirm: "Revoke this preview link? Anyone currently using it will immediately lose access." }, class: 'button_to state_changing' } %>
<% else %>
<%= button_to 'Create public preview link', generate_shared_preview_node_path(@node), method: :put, form: { class: 'button_to state_changing' } %>
<% end %>
</div>
<% end %>
</div>
</div>
<div class="node_description">Revisions</div>
<div class="node_content node_info_group">
<details>
<summary>
<%= pluralize(@node.pages.count, 'revision', 'revisions') %>
· <%= link_to 'full history (diff / restore)', node_revisions_path(@node) %>
</summary>
<ul>
<% @node.pages.order(:revision).each do |page| %>
<li><%= link_to "##{page.revision} — #{page.title} (#{page.user.try(:login)}, #{page.updated_at})", node_revision_path(@node, page) %></li>
<% end %>
</ul>
</details>
</div>
<div class="node_description">Tags</div>
<div class="node_content node_info_group"><%= @page.tag_list %></div>
<div class="node_description">Events</div>
<div class="node_content node_info_group">
<ul>
<% @node.events.order(:start_time).each do |event| %>
<li>
<%= event_schedule_text(event) %>
[<%= link_to 'show', event_path(event, return_to: request.path) %>
| <%= link_to 'edit', edit_event_path(event, return_to: request.path) %>]
</li>
<% end %>
</ul>
<% mapping = default_event_tag_mapping(@page) %>
<%= link_to 'add event', new_event_path(node_id: @node.id, tag_list: mapping&.last, auto_tag_source: mapping&.first, return_to: request.path) %>
</div>
<% matches = matching_node_kinds(@node) %>
<% if @node.children.any? || matches.any? %>
<div class="node_description">Children</div>
<div class="node_content node_info_group">
<% if @node.children.any? %>
<details>
<summary><%= pluralize(@node.children.count, 'child', 'children') %></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| %>
<%= " · ".html_safe if index > 0 %>
<% link_params = { kind: kind } %>
<% link_params[:parent_id] = @node.id if kind == "generic" %>
<%= link_to "add '#{resolve_kind_text(config[:label])}' child", new_node_path(link_params) %>
<% end %>
</p>
<% end %>
</div>
<% end %>
<div class="node_description">Abstract</div>
<div class="node_content"><%= sanitize(@page.abstract) %></div>
<div class="node_description">Body</div>
<div class="node_content"><%= sanitize(@page.body) %></div>
<%# Assets not yet addressed - no confirmed model/association seen for this page's attached assets %>
</div>
</div>
|