Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/assets/stylesheets/pageflow/editor/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
@import "./files";
@import "./confirm_encoding";
@import "./files_gallery";
@import "./mark_button";
@import "./filtered_files";
@import "./file_type_pills";
@import "./folder_breadcrumb";
Expand Down
10 changes: 10 additions & 0 deletions app/assets/stylesheets/pageflow/editor/composables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
@include icon-button;
}

.secondary_button {
@include simple-button;
}

.destructive_icon_button {
@include icon-button("destructive");
}

// Defined last to override the padding of the buttons above.
.compact_button {
padding-top: space(1);
padding-bottom: space(1);
}
34 changes: 2 additions & 32 deletions app/assets/stylesheets/pageflow/editor/files_gallery.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,49 +40,19 @@ ul.files_gallery {
background-color: var(--ui-selection-color-lighter);
}

> li:hover .explorer_file_item-mark,
.explorer_file_item-mark:focus-visible {
opacity: 0.8;
}

> li.marking .explorer_file_item-mark {
@include fa-circle-icon;
> li:hover .mark_button:not(.marked) {
opacity: 0.8;
}

> li.marking:not(.marked):hover {
background-color: transparent;
}

> li.marking .explorer_file_item-mark:hover {
@include fa-check-circle-icon;
}

> li.marked .explorer_file_item-mark {
@include fa-check-circle-icon;

opacity: 1;
}

// Top right corner of the 100px wide thumbnail centered in the item.
.explorer_file_item-mark {
@include fa-check-circle-icon;

.mark_button {
position: absolute;
top: space(3);
left: calc(50% + 50px - #{space(7)});
width: space(6);
height: space(6);
padding: 0;
border: none;
background-color: transparent;
color: var(--ui-on-primary-color);
filter: drop-shadow(0 0 2px #00000077);
font-size: 22px;
font-weight: bold;
line-height: space(6);
cursor: pointer;
opacity: 0;
}

> li.blank_slate,
Expand Down
36 changes: 36 additions & 0 deletions app/assets/stylesheets/pageflow/editor/mark_button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.mark_button {
@include fa-check-circle-icon;

width: space(6);
height: space(6);
padding: 0;
border: none;
background-color: transparent;
color: var(--ui-on-primary-color);
filter: drop-shadow(0 0 2px #00000077);
font-size: 22px;
font-weight: bold;
line-height: space(6);
cursor: pointer;
opacity: 0;

&:focus-visible {
opacity: 0.8;
}

&.marking {
@include fa-circle-icon;

opacity: 0.8;
}

&.marking:hover {
@include fa-check-circle-icon;
}

&.marked {
@include fa-check-circle-icon;

opacity: 1;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module PageflowScrolled
module Editor
# @api private
class SectionFragmentExtractionsController < ActionController::Base
include Pageflow::EditorController

before_action do
head :not_found unless @entry.feature_state('fragments')
end

def create
library = FragmentLibrary.shared_for_account(@entry.account)

authorize!(:update, library)
library.extract_sections_from(entry: @entry,
sections: find_sections,
title: params[:title])

head :created
rescue ActiveRecord::RecordNotFound
head :not_found
end

private

def find_sections
ids = Array(params[:section_ids]).map(&:to_i).uniq
sections = Section.all_for_revision(@entry.draft).where(id: ids).to_a

raise ActiveRecord::RecordNotFound if ids.empty? || sections.size < ids.size

sections
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module PageflowScrolled
module Editor
# @api private
class FragmentInsertionsController < ActionController::Base
class SectionFragmentInsertionsController < ActionController::Base
include Pageflow::EditorController

before_action do
Expand All @@ -13,7 +13,7 @@ def create

@sections = authorized_scope(:read, FragmentLibrary)
.find(fragment_params[:entry_id])
.copy_fragment_to(fragment_perma_id: fragment_params[:chapter_perma_id],
.copy_sections_to(fragment_perma_id: fragment_params[:chapter_perma_id],
entry: @entry,
chapter:)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def content
@content ||= RevisionContent.new(entry.draft, include_hidden: true)
end

def copy_fragment_to(fragment_perma_id:, entry:, chapter:)
def copy_sections_to(fragment_perma_id:, entry:, chapter:)
SectionsCopy
.new(source_entry: self.entry, destination_entry: entry)
.perform(fragment_chapter(fragment_perma_id).sections, chapter:)
Expand All @@ -57,13 +57,13 @@ def prepare_content_elements_for(fragment_perma_id:, entry:)
end
end

def extract_fragment_from(entry:, chapter:, title: nil)
def extract_sections_from(entry:, sections:, title: nil)
ActiveRecord::Base.transaction do
@entry ||= create_entry(locale: entry.locale)

SectionsCopy
.new(source_entry: entry, destination_entry: self.entry)
.perform(chapter.sections, chapter: create_fragment_chapter(chapter, title))
.perform(sections, chapter: create_chapter({'title' => title.presence&.strip}.compact))
end
end

Expand Down Expand Up @@ -107,10 +107,6 @@ def create_entry(locale:)
)
end

def create_fragment_chapter(chapter, title)
create_chapter(fragment_configuration(chapter, title))
end

def create_content_elements_fragment_section(title)
chapter = create_chapter({
'title' => title.presence&.strip,
Expand All @@ -127,11 +123,6 @@ def create_chapter(configuration)
configuration:)
end

def fragment_configuration(chapter, title)
title = title.presence&.strip
title ? chapter.configuration.merge('title' => title) : chapter.configuration
end

# @api private
class Query
include Enumerable
Expand Down
21 changes: 16 additions & 5 deletions entry_types/scrolled/config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1287,11 +1287,6 @@ de:
save: Speichern
chapter_menu_items:
copy_permalink: Permalink kopieren
extract_fragment: Zu geteilten Fragmenten hinzufügen...
extract_fragment_failed: Das Kapitel konnte nicht zu den geteilten Fragmenten hinzugefügt werden.
extract_fragment_forbidden: Sie dürfen den geteilten Fragmenten dieses Kontos keine Kapitel hinzufügen.
extracted_fragment: Zu geteilten Fragmenten hinzugefügt
extracting_fragment: Wird zu geteilten Fragmenten hinzugefügt...
move_to_main: In Kapitel umwandeln
move_to_excursions: In Exkurs umwandeln
destroy_chapter_menu_item:
Expand Down Expand Up @@ -1445,9 +1440,14 @@ de:
remove: Entfernen
entry_outline:
add_chapter: Neues Kapitel
end_selection: Auswahl beenden
header: Gliederung
finish_reorder_chapters: Umsortieren beenden
reorder_chapters: "Kapitel umsortieren..."
select_sections: "Abschnitte auswählen..."
selected_sections:
one: 1 Abschnitt ausgewählt
other: "%{count} Abschnitte ausgewählt"
trash: Gelöschte Inhalte
entry_select:
no_matches: Keine passenden Beiträge
Expand All @@ -1467,6 +1467,12 @@ de:
name: Name des Fragments
shared_hint: Fragmente werden mit allen Beiträgen des Kontos und allen Mitgliedern mit Bearbeitungsrechten geteilt.
submit: Hinzufügen
extract_sections_fragment_menu_item:
extracted: Zu geteilten Fragmenten hinzugefügt
extracting: Wird zu geteilten Fragmenten hinzugefügt...
failed: Die Abschnitte konnten nicht zu den geteilten Fragmenten hinzugefügt werden.
forbidden: Sie dürfen den geteilten Fragmenten dieses Kontos keine Abschnitte hinzufügen.
label: Zu geteilten Fragmenten hinzufügen...
fragment_library:
blank_slate: Noch keine Fragmente vorhanden.
cancel: Abbrechen
Expand All @@ -1493,6 +1499,7 @@ de:
cutoff: Paywall Grenze
drag_hint: Ziehen, um den Abschnitt zu verschieben
hidden: Nur im Editor sichtbar
mark: Abschnitt markieren
save_error: Beim Speichern des Abschnitts ist ein Fehler aufgetreten.
transitions:
beforeAfter: Statische Hintergründe
Expand Down Expand Up @@ -1555,6 +1562,8 @@ de:
header_insertPosition: Abschnitt verschieben
header_sectionPart: Element verschieben
hint: Wähle die Position aus, an die verschoben werden soll.
select_multiple_content_elements_menu_item:
label: "Mehrere auswählen..."
selectable_storyline_item:
blank_slate: Keine Kapitel
blank_slate_excursions: Keine Exkurse
Expand Down Expand Up @@ -1805,6 +1814,8 @@ de:
tabs:
activity: Letzte Aktivität
multi_selection_view:
end_selection_mode: Fertig
selection_mode_hint: Elemente in der Vorschau anklicken, um sie zur Auswahl hinzuzufügen oder daraus zu entfernen.
tab:
one: 1 Element
other: "%{count} Elemente"
Expand Down
21 changes: 16 additions & 5 deletions entry_types/scrolled/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1269,11 +1269,6 @@ en:
save: Save
chapter_menu_items:
copy_permalink: Copy permalink
extract_fragment: Add to shared fragments...
extract_fragment_failed: The chapter could not be added to the shared fragments.
extract_fragment_forbidden: You are not allowed to add chapters to the shared fragments of this account.
extracted_fragment: Added to shared fragments
extracting_fragment: Adding to shared fragments...
move_to_main: Turn into chapter
move_to_excursions: Turn into excursion
destroy_chapter_menu_item:
Expand Down Expand Up @@ -1427,9 +1422,14 @@ en:
remove: Remove
entry_outline:
add_chapter: New chapter
end_selection: End selection
header: Outline
finish_reorder_chapters: Finish reordering
reorder_chapters: "Reorder chapters..."
select_sections: "Select sections..."
selected_sections:
one: 1 section selected
other: "%{count} sections selected"
trash: Deleted content
entry_select:
no_matches: No matching stories
Expand All @@ -1449,6 +1449,12 @@ en:
name: Name of the fragment
shared_hint: Fragments are shared across all entries of the account and all its members with editor access.
submit: Add
extract_sections_fragment_menu_item:
extracted: Added to shared fragments
extracting: Adding to shared fragments...
failed: The sections could not be added to the shared fragments.
forbidden: You are not allowed to add sections to the shared fragments of this account.
label: Add to shared fragments...
fragment_library:
blank_slate: No fragments yet.
cancel: Cancel
Expand All @@ -1475,6 +1481,7 @@ en:
cutoff: Paywall cutoff
drag_hint: Drag to move section
hidden: Only visible in editor
mark: Mark section
save_error: There was an error while saving this section.
transitions:
beforeAfter: Static Backgrounds
Expand Down Expand Up @@ -1537,6 +1544,8 @@ en:
header_insertPosition: Move section
header_sectionPart: Move element
hint: Select the position to move to.
select_multiple_content_elements_menu_item:
label: "Select multiple..."
selectable_storyline_item:
blank_slate: No chapters
blank_slate_excursions: No excursions
Expand Down Expand Up @@ -1785,6 +1794,8 @@ en:
tabs:
activity: Latest activity
multi_selection_view:
end_selection_mode: Done
selection_mode_hint: Click elements in the preview to add them to or remove them from the selection.
tab:
one: 1 Element
other: "%{count} Elements"
Expand Down
4 changes: 2 additions & 2 deletions entry_types/scrolled/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
resources :fragment_libraries, only: [:index]
resources :content_element_fragment_extractions, only: [:create]
resources :content_element_fragment_preparations, only: [:create]
resources :section_fragment_extractions, only: [:create]
resources :linkable_entries, only: [:index, :show]
resources :trash_items, only: [:index, :destroy] do
member do
Expand All @@ -29,8 +30,7 @@
put :order
end

resources :fragment_insertions, only: [:create]
resources :fragment_extractions, only: [:create]
resources :section_fragment_insertions, only: [:create]

resources :sections, only: [:create, :update, :destroy] do
collection do
Expand Down
Loading
Loading