Skip to content

Commit

Permalink
Merge pull request #2641 from tvdeyen/page-sitemap-lock-icons
Browse files Browse the repository at this point in the history
Show page locked status in page status
  • Loading branch information
tvdeyen authored Dec 14, 2023
2 parents 48b00c1 + 5068b37 commit a51a933
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/alchemy/templates/page_folder.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<a class="page_folder" data-page-id="{{ page.id }}">
<i class="ri-arrow-{{#if page.folded }}right{{else}}down{{/if}}-s-line ri-fw"></i>
<a class="page_folder icon_button" data-page-id="{{ page.id }}">
<i class="icon ri-arrow-{{#if page.folded }}right{{else}}down{{/if}}-s-line ri-fw"></i>
</a>
3 changes: 2 additions & 1 deletion app/serializers/alchemy/page_tree_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def page_permissions(page, ability)
def page_status_titles(page)
{
public: page.status_title(:public),
restricted: page.status_title(:restricted)
restricted: page.status_title(:restricted),
locked: page.status_title(:locked)
}
end
end
Expand Down
20 changes: 13 additions & 7 deletions app/views/alchemy/admin/pages/_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<%= page_layout_missing_warning %>
{{else}}
{{#if permissions.edit_content}}
{{#if locked}}
<sl-tooltip content="{{locked_notice}}" class="like-hint-tooltip" placement="bottom-start">
<i class="icon ri-file-edit-fill ri-fw ri-xl"></i>
</sl-tooltip>
{{else}}
<span class="{{#unless root}}handle{{/unless}}">
<i class="icon ri-file-line ri-fw ri-xl"></i>
{{#if locked}}
<sl-tooltip content="{{locked_notice}}" class="like-hint-tooltip" placement="bottom-start">
<i class="icon ri-file-edit-line ri-fw ri-xl"></i>
</sl-tooltip>
{{else}}
<i class="icon ri-file-line ri-fw ri-xl"></i>
{{/if}}
</span>
{{/if}}
{{else}}
<sl-tooltip content="<%= Alchemy.t("Your user role does not allow you to edit this page") %>" class="like-hint-tooltip" placement="bottom-start">
<i class="icon ri-file-forbid-line ri-fw ri-xl"></i>
Expand Down Expand Up @@ -123,6 +123,12 @@
{{/if}}
</div>
<div class="page_infos">
{{#if locked}}
<span class="page_status">
<i class="icon ri-fw ri-1x ri-edit-line"></i>
{{status_titles.locked}}
</span>
{{/if}}
{{#if restricted}}
<span class="page_status">
<i class="icon ri-fw ri-1x ri-lock-line"></i>
Expand Down
8 changes: 7 additions & 1 deletion app/views/alchemy/admin/pages/_table_row.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% if can?(:edit_content, page) %>
<% if page.locked? %>
<sl-tooltip class="like-hint-tooltip" content="<%= Alchemy.t("This page is locked", name: page.locker_name) %>" placement="bottom-start">
<i class="icon ri-file-edit-fill ri-fw ri-xl"></i>
<i class="icon ri-file-edit-line ri-fw ri-xl"></i>
</sl-tooltip>
<% else %>
<i class="icon ri-file-line ri-fw ri-xl"></i>
Expand Down Expand Up @@ -37,6 +37,12 @@
<%= l(page.updated_at, format: :"alchemy.default") %>
</td>
<td class="status right">
<% if page.locked? %>
<span class="page_status">
<%= render_icon(:edit, size: "1x") %>
<%= page.status_title(:locked) %>
</span>
<% end %>
<% if page.restricted? %>
<span class="page_status">
<%= render_icon(:lock, size: "1x") %>
Expand Down
13 changes: 7 additions & 6 deletions app/views/alchemy/admin/pages/info.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
<div class="value">
<label><%= Alchemy.t(:page_status) %></label>
<p>
<% if @page.locked? %>
<span class="page_status">
<%= render_icon(:edit, size: "1x") %>
<%= Alchemy.t(:currently_edited_by) %>
<%= @page.locker_name %>
</span>
<% end %>
<span class="page_status">
<% if @page.public? %>
<%= render_icon(:cloud, size: "1x") %>
Expand All @@ -46,10 +53,4 @@
<label><%= Alchemy.t(:page_was_updated) %></label>
<p><%= Alchemy.t(:from_at) % {by: @page.updater_name, at: l(@page.updated_at, format: :'alchemy.page_status')} %></p>
</div>
<% if @page.locked? %>
<div class="value">
<label><%= Alchemy.t(:currently_edited_by) %></label>
<p><%= @page.locker_name %></p>
</div>
<% end %>
</div>

0 comments on commit a51a933

Please sign in to comment.