Skip to content

Commit

Permalink
Merge pull request #2033 from tf/inline-file-rights
Browse files Browse the repository at this point in the history
Inline file rights
  • Loading branch information
tf authored Dec 11, 2023
2 parents fcfed93 + 508342b commit 79b79a1
Show file tree
Hide file tree
Showing 106 changed files with 2,422 additions and 450 deletions.
54 changes: 48 additions & 6 deletions app/assets/stylesheets/pageflow/editor/drop_down_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
.drop_down_button_item {
a,
.label {
padding: 7px 15px;
padding: 5px 15px;
line-height: 1.75;
}

a {
Expand All @@ -64,6 +65,11 @@

.label {
cursor: default;
font-weight: 500;
}

&.is_hidden {
display: none;
}

&.is_selectable {
Expand All @@ -84,13 +90,49 @@
}
}

&.is_checked a {
@include background-icon-left($left: 15px, $font-size: 15px);
@include fa-check-icon;
&.has_radio,
&.has_check_box {
a {
display: flex;
align-items: center;
justify-content: space-between;

&:after {
content: "";
flex-shrink: 0;
display: block;
box-sizing: border-box;
border: solid 1px var(--ui-on-surface-color-light);
width: 1rem;
height: 1rem;
}
}

&.is_checked a:after {
background-color: var(--ui-primary-color);
background-size: 100% 100%;
background-position: center;
}
}

.drop_down_button_item a {
padding-left: 39px;
&.has_check_box {
a:after {
border-radius: size(1);
}

&.is_checked a:after {
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
}
}

&.has_radio {
a:after {
border-radius: 100%;
}

&.is_checked a:after {
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
}
}

ul {
Expand Down
13 changes: 12 additions & 1 deletion app/assets/stylesheets/pageflow/editor/file_meta_data.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,24 @@
}

td {
padding: 5px 5px 5px 0;
padding: 5px 0;
max-width: 0;
}

a {
text-decoration: underline;
}

.value_wrapper {
display: flex;
}

.value {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
}

.edit {
@include background-icon-center($font-size: 15px,
$color: var(--ui-primary-color-light));
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/pageflow/editor/file_import_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def files_params
:content_type,
:file_size,
:url,
configuration: :alt])
configuration: [:alt, :source_url]])
.require(:files)
end

Expand Down
1 change: 1 addition & 0 deletions app/views/pageflow/editor/config/_seeds.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ json.call(Pageflow.config,
:default_published_until_duration_in_months,
:available_locales,
:available_public_locales,
:available_file_licenses,
:available_text_track_kinds,
:available_share_providers)
json.file_types Pageflow.config_for(entry).file_types do |file_type|
Expand Down
44 changes: 44 additions & 0 deletions config/locales/new/inline_file_rights.de.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
de:
pageflow:
editor:
files:
common_attributes:
source_url:
label: "Quell-URL"
inline_help: |-
Rechteangabe mit einem Link zur ursprünglichen Quelle
oder zum Author der Datei versehen.
license:
label: "Lizenz"
blank: "(Nicht angegeben)"
inline_help: |-
Fügt der Rechteangabe im Beitrag einen Link zur Lizenz hinzu.
rights_display:
label: "Rechte anzeigen"
inline_help: |-
Lege fest, ob die Rechteangabe der Datei in der
zusammenfassenden Liste in der Info-Box angezeigt werden
soll oder unmittelbar an der Stelle im Beitrag, wo die
Datei verwendet wird.
values:
credits: "In der Info-Box"
inline: "Am verwendenden Element"
file_licenses:
cc_by_4:
name: "CC-BY 4.0"
url: "https://creativecommons.org/licenses/by/4.0/"
cc_by_sa_4:
name: "CC-BY-SA 4.0"
url: "https://creativecommons.org/licenses/by-sa/4.0/"
cc_by_nc_4:
name: "CC-BY-NC 4.0"
url: "https://creativecommons.org/licenses/by-nc/4.0/"
cc_by_nc_sa_4:
name: "CC-BY-NC-SA 4.0"
url: "https://creativecommons.org/licenses/by-sa-nc/4.0/"
cc_by_nd_4:
name: "CC-BY-ND 4.0"
url: "https://creativecommons.org/licenses/by-nd/4.0/"
cc_by_nc_nd_4:
name: "CC-BY-NC-ND 4.0"
url: "https://creativecommons.org/licenses/by-nc-nd/4.0/"
43 changes: 43 additions & 0 deletions config/locales/new/inline_file_rights.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
en:
pageflow:
editor:
files:
common_attributes:
source_url:
label: "Source URL"
inline_help: |-
Turns the credit note into a link to the original source
or to the author of the file.
license:
label: "License"
blank: "(Not specified)"
inline_help: |-
Adds a link to the license in the credit note.
rights_display:
label: "Display rights"
inline_help: |-
Decide if the file's credit note should be displayed in
the summary list in the info box, or right at the place
in the entry where the file is used.
values:
credits: "In the info box"
inline: "At the element where it is used"
file_licenses:
cc_by_4:
name: "CC-BY 4.0"
url: "https://creativecommons.org/licenses/by/4.0/"
cc_by_sa_4:
name: "CC-BY-SA 4.0"
url: "https://creativecommons.org/licenses/by-sa/4.0/"
cc_by_nc_4:
name: "CC-BY-NC 4.0"
url: "https://creativecommons.org/licenses/by-nc/4.0/"
cc_by_nc_sa_4:
name: "CC-BY-NC-SA 4.0"
url: "https://creativecommons.org/licenses/by-sa-nc/4.0/"
cc_by_nd_4:
name: "CC-BY-ND 4.0"
url: "https://creativecommons.org/licenses/by-nd/4.0/"
cc_by_nc_nd_4:
name: "CC-BY-NC-ND 4.0"
url: "https://creativecommons.org/licenses/by-nc-nd/4.0/"
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ def scrolled_editor_javascript_packs_tag(entry)
end

def scrolled_frontend_packs(entry, widget_scope:)
widget_types = scrolled_frontend_pack_widget_types(entry, widget_scope)

['pageflow-scrolled-frontend'] +
scrolled_frontend_content_element_packs(entry, widget_scope) +
widget_types.map(&:pack)
scrolled_frontend_widget_type_packs(entry, widget_scope)
end

def scrolled_editor_packs(entry)
['pageflow-scrolled-editor'] +
Pageflow.config_for(entry).additional_editor_packs.paths
Pageflow.config_for(entry).additional_editor_packs.paths +
scrolled_frontend_widget_type_packs(entry, :editor)
end

private
Expand All @@ -49,6 +48,10 @@ def scrolled_frontend_content_element_packs(entry, widget_scope)
)
end

def scrolled_frontend_widget_type_packs(entry, widget_scope)
scrolled_frontend_pack_widget_types(entry, widget_scope).map(&:pack)
end

def scrolled_frontend_pack_widget_types(entry, widget_scope)
if widget_scope == :editor
ReactWidgetType.all_for(entry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ json.config do

json.partial! 'pageflow_scrolled/entry_json_seed/consent_vendors',
entry: entry, entry_config: entry_config

json.file_licenses(
I18n.t('pageflow.file_licenses', default: {}).slice(*entry_config.available_file_licenses)
)
end

unless options[:skip_i18n]
Expand Down
20 changes: 20 additions & 0 deletions entry_types/scrolled/config/locales/new/inline_file_rights.de.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
de:
pageflow:
iconInlineFileRights:
widget_type_name: Copyright-Icons
textInlineFileRights:
widget_type_name: Text am Element
widgets:
roles:
inlineFileRights: Inline-Datei-Rechte
pageflow_scrolled:
public:
inline_file_rights_labels:
video: Video
poster: Poster
atmo: Atmo
image: Bild
audio: Audio
after: Nachher-Bild
before: Vorher-Bild
media: Medien
20 changes: 20 additions & 0 deletions entry_types/scrolled/config/locales/new/inline_file_rights.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
en:
pageflow:
iconInlineFileRights:
widget_type_name: Copyright icons
textInlineFileRights:
widget_type_name: Text at element
widgets:
roles:
inlineFileRights: Inline file rights
pageflow_scrolled:
public:
inline_file_rights_labels:
video: Video
poster: Poster
atmo: Atmo
image: Image
audio: Audio
after: After image
before: Before image
media: Media
5 changes: 5 additions & 0 deletions entry_types/scrolled/lib/pageflow_scrolled/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ def configure(config)
role: 'consent'),
default: true)

c.widget_types.register(ReactWidgetType.new(name: 'iconInlineFileRights',
role: 'inlineFileRights'))
c.widget_types.register(ReactWidgetType.new(name: 'textInlineFileRights',
role: 'inlineFileRights'))

c.features.register('datawrapper_chart_embed_opt_in')
c.features.enable_by_default('datawrapper_chart_embed_opt_in')
c.features.register('iframe_embed_content_element')
Expand Down
5 changes: 1 addition & 4 deletions entry_types/scrolled/package/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
/contentElements-frontend.js
/contentElements-frontend.css
/testHelpers.js
/widgets/defaultNavigation.js
/widgets/defaultNavigation.css
/widgets/consentBar.js
/widgets/consentBar.css
/widgets
/.storybook/out/
/.storybook/seed.json
/.storybook/preview-head.html
12 changes: 12 additions & 0 deletions entry_types/scrolled/package/config/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ module.exports = {
'pageflow-scrolled/widgets/consentBar',
'pageflow-scrolled/widgets/consentBar.css'
]
},
'pageflow-scrolled/widgets/iconInlineFileRights': {
import: [
'pageflow-scrolled/widgets/iconInlineFileRights',
'pageflow-scrolled/widgets/iconInlineFileRights.css'
]
},
'pageflow-scrolled/widgets/textInlineFileRights': {
import: [
'pageflow-scrolled/widgets/textInlineFileRights',
'pageflow-scrolled/widgets/textInlineFileRights.css'
]
}
}
};
Loading

0 comments on commit 79b79a1

Please sign in to comment.