This commit is contained in:
9
app/views/leaves/_being_edited_by.turbo_stream.erb
Normal file
9
app/views/leaves/_being_edited_by.turbo_stream.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<%= turbo_stream.append dom_id(leaf, :being_edited) do %>
|
||||
<%= tag.div id: dom_id(user, :being_edited_by),
|
||||
class: "flex-inline align-center justify-center margin-block-end-double txt-medium gap being-edited-by",
|
||||
data: { controller: "autoremove", action: "animationend->autoremove#remove", hide_from_user_id: user.id } do %>
|
||||
<strong class="margin-inline-end-half"><%= user.name %></strong>
|
||||
<span class="spinner txt-small flex-inline"></span>
|
||||
<%= image_tag "write.svg", aria: { hidden: true }, size: 18, class: "colorize--white margin-inline-start" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
2
app/views/leaves/_being_edited_indicator.html.erb
Normal file
2
app/views/leaves/_being_edited_indicator.html.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
<%= turbo_stream_from leaf, :being_edited %>
|
||||
<%= tag.div id: dom_id(leaf, :being_edited), class: "being-edited-indicator" %>
|
||||
4
app/views/leaves/_delete.html.erb
Normal file
4
app/views/leaves/_delete.html.erb
Normal file
@@ -0,0 +1,4 @@
|
||||
<%= button_to leafable_path(leaf), method: :delete, data: { turbo_confirm: "Are you sure you want to delete this page?" }, class: "btn btn--negative txt-small min-width", form_class: "leaf__delete" do %>
|
||||
<%= image_tag "minus.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Delete <%= leaf.title %></span>
|
||||
<% end %>
|
||||
38
app/views/leaves/_edit.html.erb
Normal file
38
app/views/leaves/_edit.html.erb
Normal file
@@ -0,0 +1,38 @@
|
||||
<%= leaf_item_tag(leaf) do %>
|
||||
<span class="btn btn--link arrangement__handle txt-small">
|
||||
<%= image_tag "handle.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Move <%= leaf.title %></span>
|
||||
</span>
|
||||
|
||||
<%= link_to leafable_path(leaf), class: "toc__thumbnail", data: { turbo_frame: "_top" } do %>
|
||||
<%= leaf.section.body if leaf.section? %>
|
||||
<%= leaf.leafable.body.to_html if leaf.page? %>
|
||||
<%= image_tag leaf.leafable.image.variant(:large) if leaf.picture&.image&.attached? %>
|
||||
<% end %>
|
||||
|
||||
<div class="toc__title flex align-center min-width">
|
||||
<%= form_with model: [ leaf.book, leaf ], url: leafable_path(leaf), class: "flex align-center max-width min-width", id: dom_id(leaf, "form") do |form| %>
|
||||
<%= form.text_field :title, class: "input full-width", autofocus: true, autocomplete: "off", data: { controller: "autoselect" } %>
|
||||
<% end %>
|
||||
|
||||
<span class="flex align-center gap-half">
|
||||
<button type="submit" class="btn txt-small btn--positive" form="<%= dom_id(leaf, "form") %>">
|
||||
<%= image_tag "check.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Save</span>
|
||||
</button>
|
||||
|
||||
<%= button_to leafable_path(leaf), method: :delete, class: "btn btn--negative txt-small" do %>
|
||||
<%= image_tag "trash.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Delete this page</span>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<small class="toc__wordcount">
|
||||
<% if leaf.page? %>
|
||||
<%= word_count(leaf.leafable.body.content) %>
|
||||
<% end %>
|
||||
</small>
|
||||
|
||||
<%= yield if block_given? %>
|
||||
<% end %>
|
||||
16
app/views/leaves/_edit_footer.html.erb
Normal file
16
app/views/leaves/_edit_footer.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<% content_for :footer do %>
|
||||
<nav class="book__nav flex align-center gap">
|
||||
<span class="btn btn--placeholder flex-item-justify-start"></span>
|
||||
|
||||
<%= link_to_next_leafable(leaf, hotkey: false, for_edit: true) %>
|
||||
|
||||
<span class="flex-item-justify-end">
|
||||
<%= form_with url: leafable_path(leaf, format: :html), class: "flex align-center gap-half", method: :delete do |form| %>
|
||||
<%= form.button class: "btn btn--negative txt-small min-width", data: { turbo_confirm: "Are you sure you want to delete this page?" } do %>
|
||||
<%= image_tag "minus.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Delete <%= @leaf.title %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
</nav>
|
||||
<% end %>
|
||||
26
app/views/leaves/_header.html.erb
Normal file
26
app/views/leaves/_header.html.erb
Normal file
@@ -0,0 +1,26 @@
|
||||
<% content_for :header do %>
|
||||
<%= leaf_nav_tag(leaf) do %>
|
||||
<%= link_to_previous_leafable(leaf) %>
|
||||
|
||||
<div class="breadcrumbs">
|
||||
<%= render "books/index_link" %>
|
||||
<span class="flex-item-no-shrink">▸</span>
|
||||
<%= link_to book.title, book_slug_path(book) %>
|
||||
<span class="flex-item-no-shrink">▸</span>
|
||||
<strong><%= leaf.leafable.title %></strong>
|
||||
</div>
|
||||
|
||||
<button class="btn" data-action="fullscreen#toggle" data-fullscreen-target="button">
|
||||
<%= image_tag "expand.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Enter fullscreen</span>
|
||||
</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :toolbar do %>
|
||||
<% if book.editable? %>
|
||||
<div class="page-toolbar fill-shade">
|
||||
<%= editing_mode_toggle_switch(@leaf, checked: false) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
6
app/views/leaves/_history.html.erb
Normal file
6
app/views/leaves/_history.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<% if leaf.edits.any? %>
|
||||
<%= link_to page_edit_path(leaf, "latest"), class: "btn flex-item-no-shrink txt-small" do %>
|
||||
<%= image_tag "history.svg", aria: { hidden: "true" }, size: "24" %>
|
||||
<span class="for-screen-reader">Editing history</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
60
app/views/leaves/_leaf.html.erb
Normal file
60
app/views/leaves/_leaf.html.erb
Normal file
@@ -0,0 +1,60 @@
|
||||
<% cache [ leaf, leaf.book, leaf.book.editable? ] do %>
|
||||
<%= leaf_item_tag(leaf) do %>
|
||||
<span class="btn btn--link arrangement__handle txt-small">
|
||||
<%= image_tag "handle.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Move <%= leaf.title %></span>
|
||||
</span>
|
||||
|
||||
<%= render "leaves/delete", leaf: leaf %>
|
||||
|
||||
<div class="toc__thumbnail <%= "toc__thumbnail--dark" if leaf.section&.theme == "dark" %>">
|
||||
<% if leaf.book.editable? %>
|
||||
<%= link_to edit_leafable_path(leaf), class: "toc__link hide_from_reading_mode", data: { turbo_frame: "_top" } do %>
|
||||
<span class="for-screen-reader">Edit <%= leaf.title %></span>
|
||||
<% end %>
|
||||
|
||||
<%= link_to leafable_slug_path(leaf), class: "toc__link hide_from_edit_mode", data: { turbo_frame: "_top" } do %>
|
||||
<span class="for-screen-reader">Open <%= leaf.title %></span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to leafable_slug_path(leaf), class: "toc__link", data: { turbo_frame: "_top" } do %>
|
||||
<span class="for-screen-reader">Open <%= leaf.title %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= tag.span(simple_format(leaf.section.body), class: "txt-align-center") if leaf.section? %>
|
||||
|
||||
<%= sanitize_content leaf.page.html_preview if leaf.page? %>
|
||||
|
||||
<% if leaf.picture? %>
|
||||
<%= image_tag leaf.leafable.image.attached? ? leaf.leafable.image.variant(:large) : "default-picture.webp" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if leaf.book.editable? %>
|
||||
<%= link_to edit_leafable_path(leaf), class: "toc__title min-width hide_from_reading_mode", data: { turbo_frame: "_top" } do %>
|
||||
<span class="overflow-ellipsis"><%= leaf.title %></span>
|
||||
<% end %>
|
||||
|
||||
<%= link_to leafable_slug_path(leaf), class: "toc__title min-width hide_from_edit_mode", data: { turbo_frame: "_top" } do %>
|
||||
<span class="overflow-ellipsis"><%= leaf.title %></span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to leafable_slug_path(leaf), class: "toc__title min-width", data: { turbo_frame: "_top" } do %>
|
||||
<span class="overflow-ellipsis"><%= leaf.title %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<span class="toc__bookmark">
|
||||
<svg viewBox="0 0 64 64" width="64px" height="64px" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m17.01 54.01v-42.98.00000045c-.00000025-1.65685 1.34315-3 3-3h24-.00000013c1.65685-.00000007 3 1.34315 3 3v42.98.0001206c0 1.10457-.895431 2-2 2-.34994 0-.693756-.0918173-.997105-.266281l-11.5039-6.61564c-.308638-.17748-.688362-.17748-.997 0l-11.5046 6.6153.00000011-.00000006c-.957413.550849-2.1801.221264-2.73095-.736149-.174564-.303405-.266442-.647312-.266451-.997351z" fill-rule="evenodd" fill="var(--color-marker)" />
|
||||
</svg>
|
||||
</span>
|
||||
|
||||
<small class="toc__wordcount txt-small--responsive">
|
||||
<% if leaf.page? %>
|
||||
<%= word_count(leaf.leafable.body.content) %>
|
||||
<% end %>
|
||||
</small>
|
||||
<% end %>
|
||||
<% end %>
|
||||
3
app/views/leaves/_navigation.html.erb
Normal file
3
app/views/leaves/_navigation.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<nav class="book__nav flex align-center gap justify-center">
|
||||
<%= link_to_next_leafable(leaf) %>
|
||||
</nav>
|
||||
Reference in New Issue
Block a user