diff --git a/app/assets/images/communication/blocks/templates/license.jpg b/app/assets/images/communication/blocks/templates/license.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3422b1697e0aa442a8490e0b22d1fb9fd4f4912b Binary files /dev/null and b/app/assets/images/communication/blocks/templates/license.jpg differ diff --git a/app/models/communication/block.rb b/app/models/communication/block.rb index e3484e18e1130fca39b69316050a564528933214..293d4d1388b3622b6fdf15a715aaf845a36fcf8a 100644 --- a/app/models/communication/block.rb +++ b/app/models/communication/block.rb @@ -80,14 +80,15 @@ class Communication::Block < ApplicationRecord posts: 500, pages: 600, contact: 57, - programs: 58 + programs: 58, + license: 4040 } CATEGORIES = { basic: [:chapter, :image, :video, :sound, :datatable], storytelling: [:key_figures, :features, :gallery, :call_to_action, :testimonials, :timeline], references: [:pages, :posts, :organization_chart, :partners, :programs], - utilities: [:files, :definitions, :contact, :embed] + utilities: [:files, :definitions, :contact, :license, :embed] } scope :published, -> { where(published: true) } diff --git a/app/models/communication/block/component/hash.rb b/app/models/communication/block/component/hash.rb new file mode 100644 index 0000000000000000000000000000000000000000..150562989a8026676c04ce0719a8b0b32671c671 --- /dev/null +++ b/app/models/communication/block/component/hash.rb @@ -0,0 +1,7 @@ +class Communication::Block::Component::Hash < Communication::Block::Component::Base + + def default_data + {} + end + +end diff --git a/app/models/communication/block/template/license.rb b/app/models/communication/block/template/license.rb new file mode 100644 index 0000000000000000000000000000000000000000..42137dd87b3c49d72a1d0126c4654aef8012530d --- /dev/null +++ b/app/models/communication/block/template/license.rb @@ -0,0 +1,4 @@ +class Communication::Block::Template::License < Communication::Block::Template::Base + has_component :kind, :option, options: [:creative_commons] + has_component :creative_commons, :hash +end diff --git a/app/views/admin/communication/blocks/templates/license/_edit.html.erb b/app/views/admin/communication/blocks/templates/license/_edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..29c85b223b0cf71ea62461e49ec153ddd9a728b0 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/license/_edit.html.erb @@ -0,0 +1,28 @@ + +<%= block_component_edit block, :kind %> + +<div v-show="data.kind == 'creative_commons'"> + <div class="mb-5"> + <%= t('admin.communication.blocks.templates.license.creative_commons.about_html') %> + </div> + <div class="row pure__row--small"> + <% t('admin.communication.blocks.templates.license.creative_commons.questions').each do |question| %> + <div class="col-lg-6 mb-5"> + <p><%= question[:label] %></p> + <% question[:answers].each do |answer| %> + <div class="form-check"> + <input class="form-check-input" + type="radio" + name="question-<%= question[:key] %>" + v-model="data.creative_commons.<%= question[:key] %>" + value="<%= answer[:key] %>" + id="question-<%= question[:key] %>-<%= answer[:key] %>"> + <label for="question-<%= question[:key] %>-<%= answer[:key] %>"> + <%= answer[:label] %> + </label> + </div> + <% end %> + </div> + <% end %> + </div> +</div> diff --git a/app/views/admin/communication/blocks/templates/license/_show.html.erb b/app/views/admin/communication/blocks/templates/license/_show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/license/_snippet.html.erb b/app/views/admin/communication/blocks/templates/license/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/license/_static.html.erb b/app/views/admin/communication/blocks/templates/license/_static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 26797550fe7ac8b5f2ccf23727d6ba3184eb7246..958fd522041784970b4c468f5efabc30464f681d 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -470,6 +470,41 @@ fr: description: label: Description placeholder: Entrer la description + license: + description: Une licence juridique de type Creative Commons, avec son explication. + creative_commons: + about_html: Utilisez les licences <a href="https://creativecommons.org" target="_blank" rel="noreferrer">Creative Commons</a> pour partager votre travail. Le sélecteur de licence est basé sur <a href="https://chooser-beta.creativecommons.org"target="_blank" rel="noreferrer">chooser-beta.creativecommons.org.org</a> + questions: + - key: attribution + label: Do you want attribution for your work? + answers: + - key: yes + label: Yes. Anyone using my work must include proper attribution. + - key: no + label: No. Anyone can use my work, even without giving me attribution. + - key: commercial_use + label: Do you want to allow others to use your work commercially? + answers: + - key: yes + label: Yes. Others can use my work, even for commercial purposes. + - key: no + label: No. Others can not use my work for commercial purposes. + - key: derivatives + label: Do you want to allow others to remix, adapt, or build upon your work? + answers: + - key: yes + label: Yes. Others can remix, adapt, or build upon my work. + - key: no + label: No. Others may only use my work in unadapted form. + - key: sharing + label: Do you want to allow others to share adaptations of your work under any terms? + answers: + - key: yes + label: Yes. Others can share adaptations of my work under any terms. + - key: no + label: No. Others must use the same CC license if they adapt my work. + edit: + organization_chart: description: Une liste de personnes, avec photo, fonction et lien vers la page de la personne. edit: @@ -813,6 +848,7 @@ fr: gallery: Galerie image: Image key_figures: Chiffres-clés + license: Licence organization_chart: Personnes pages: Pages partners: Organisations