From 452fc34b0ecc65fd4d23c62b24161ab595138537 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Aug 2020 18:52:53 -0300 Subject: [PATCH] =?UTF-8?q?creditos=20para=20las=20plantillas=20e=20invita?= =?UTF-8?q?ci=C3=B3n=20a=20apoyar=20el=20trabajo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 5 +++++ app/models/design.rb | 1 + app/views/layouts/application.html.haml | 2 ++ app/views/posts/index.haml | 10 ++++++++-- config/locales/en.yml | 4 ++++ config/locales/es.yml | 4 ++++ db/migrate/20200811210507_add_credits_to_designs.rb | 9 +++++++++ db/schema.rb | 10 +++++----- db/seeds/designs.yml | 11 ++++++++++- 9 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 db/migrate/20200811210507_add_credits_to_designs.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8a289346..a389327a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -39,6 +39,11 @@ module ApplicationHelper tfoot em strong sup blockquote cite pre section article] end + # Genera HTML y limpia etiquetas innecesarias + # + # @param [String] + # @param [Hash] + # @return [String] def sanitize_markdown(text, options = {}) options.merge!(attributes: %w[id href alt class]) diff --git a/app/models/design.rb b/app/models/design.rb index b9251473..9509a1e6 100644 --- a/app/models/design.rb +++ b/app/models/design.rb @@ -12,6 +12,7 @@ class Design < ApplicationRecord translates :name, type: :string, locale_accessors: true translates :description, type: :text, locale_accessors: true + translates :credits, type: :text, locale_accessors: true has_many :sites diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 04af2db8..2392bb44 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -7,6 +7,8 @@ %meta{ name: 'color-scheme', content: 'light dark' }/ %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1.0' }/ + %meta{ name: 'referrer', content: 'origin' }/ + %title Sutty = csrf_meta_tags diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 6f9088ce..4ed451ec 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -7,8 +7,7 @@ %main.row %aside.menu.col-md-3 - %h1 - = link_to @site.title, @site.url + %h1= link_to @site.title, @site.url %p.lead= @site.description %h3= t('posts.new') @@ -23,6 +22,13 @@ = render 'sites/build', site: @site + - if @site.design.credits + .alert.alert-primary{ role: 'alert' } + = sanitize_markdown @site.design.credits + = link_to t('sites.donations.text'), t('sites.donations.url'), class: 'btn' + - if @site.design.designer_url + = link_to t('sites.designer_url'), @site.design.designer_url, class: 'btn' + %section.col = render 'layouts/flash' - if @posts.empty? diff --git a/config/locales/en.yml b/config/locales/en.yml index 221cb551..e5fc9b7f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -303,6 +303,10 @@ en: average: 'Average building time' maximum: 'Maximum building time' sites: + donations: + url: 'https://donaciones.sutty.nl/en/' + text: 'Support us' + designer_url: 'Support the designer' static_file_migration: 'File migration' find_and_replace: 'Search and replace' index: diff --git a/config/locales/es.yml b/config/locales/es.yml index b3b772fa..608b13a9 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -308,6 +308,10 @@ es: average: 'Tiempo promedio de generación' maximum: 'Tiempo máximo de generación' sites: + donations: + url: 'https://donaciones.sutty.nl/' + text: 'Apoyá nuestro trabajo' + designer_url: 'Apoyá a le(s) diseñadore(s)' static_file_migration: 'Migración de archivos' find_and_replace: 'Búsqueda y reemplazo' index: diff --git a/db/migrate/20200811210507_add_credits_to_designs.rb b/db/migrate/20200811210507_add_credits_to_designs.rb new file mode 100644 index 00000000..3ef597dc --- /dev/null +++ b/db/migrate/20200811210507_add_credits_to_designs.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# Agregar créditos y diseñadorxs +class AddCreditsToDesigns < ActiveRecord::Migration[6.0] + def change + add_column :designs, :credits, :text + add_column :designs, :designer_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 5d917ffa..8ca1dd40 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,8 +10,8 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20_200_810_230_944) do - # Could not dump table 'access_logs' because of following StandardError +ActiveRecord::Schema.define(version: 20_200_811_210_507) do + # Could not dump table "access_logs" because of following StandardError # Unknown type '' for column 'id' create_table 'action_text_rich_texts', force: :cascade do |t| @@ -58,7 +56,7 @@ ActiveRecord::Schema.define(version: 20_200_810_230_944) do t.index ['deploy_id'], name: 'index_build_stats_on_deploy_id' end - # Could not dump table 'csp_reports' because of following StandardError + # Could not dump table "csp_reports" because of following StandardError # Unknown type 'uuid' for column 'id' create_table 'deploys', force: :cascade do |t| @@ -80,6 +78,8 @@ ActiveRecord::Schema.define(version: 20_200_810_230_944) do t.string 'url' t.string 'license' t.boolean 'disabled', default: false + t.text 'credits' + t.string 'designer_url' end create_table 'licencias', force: :cascade do |t| diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml index 01455efe..0d638ec6 100644 --- a/db/seeds/designs.yml +++ b/db/seeds/designs.yml @@ -24,9 +24,11 @@ name_es: 'Sutty' gem: 'sutty-jekyll-theme' url: 'https://rubygems.org/gems/sutty-jekyll-theme/' - description_en: "A design with Sutty's look & feel" + description_en: "Sutty's design" description_es: 'El diseño de Sutty' license: 'https://0xacab.org/sutty/jekyll/sutty-jekyll-theme/-/blob/master/LICENSE.txt' + credits_es: 'Sutty es parte de la economía solidaria :)' + credits_en: 'Sutty is a solidarity economy project :)' - name_en: 'Self-managed Book Publisher' name_es: 'Editorial Autogestiva' gem: 'editorial-autogestiva-jekyll-theme' @@ -34,6 +36,8 @@ description_en: "A theme for self-managed book publishers." description_es: 'Una plantilla para catálogos de editoriales autogestivas.' license: 'https://0xacab.org/sutty/jekyll/editorial-autogestiva-jekyll-theme/-/blob/master/LICENSE.txt' + credits_es: 'Esta plantilla fue inspirada en el trabajo de las [editoriales autogestivas](https://sutty.nl/plantillas-para-crear-cat%C3%A1logos-de-editoriales-autogestivas/)' + credits_en: 'This theme is inspired by [independent publishing projects](https://sutty.nl/en/new-template-for-publishing-projects/)' - name_en: 'Donations' name_es: 'Donaciones' gem: 'sutty-donaciones-jekyll-theme' @@ -41,6 +45,8 @@ description_en: "Make your own donations campaign with payment buttons." description_es: 'Realizá campañas de donaciones con botones de pago.' license: 'https://0xacab.org/sutty/jekyll/sutty-donaciones-jekyll-theme/-/blob/master/LICENSE.txt' + credits_es: 'Diseñamos esta plantilla para [visibilizar campañas de donaciones](https://sutty.nl/plantilla-para-donaciones/) durante la cuarentena.' + credits_en: 'We designed this theme to increase [requests for donations visibility](https://sutty.nl/template-for-donations/) during the quarantine.' - name_en: 'Support campaign' name_es: 'Adhesiones' gem: 'adhesiones-jekyll-theme' @@ -48,6 +54,9 @@ description_en: "Make your own support campaign." description_es: 'Realizá campañas de adhesión.' license: 'https://0xacab.org/sutty/jekyll/adhesiones-jekyll-theme/-/blob/master/LICENSE.txt' + credits_es: 'Desarrollamos esta plantilla junto con [Librenauta](https://sutty.nl/plantilla-para-campa%C3%B1as-de-adhesiones/)' + credits_en: 'We made this template with Librenauta :)' + designer_url: 'https://copiona.com/donaunbit/' - name_en: 'Other themes' name_es: 'Mi propio diseño' gem: 'sutty-theme-own'