diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index ff2f7325..889d8e34 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -80,7 +80,7 @@ class DeployDistributedPress < Deploy # Devuelve las URLs de todos los protocolos def urls - protocol_urls + gateway_urls + gateway_urls end private @@ -94,15 +94,6 @@ class DeployDistributedPress < Deploy end || [] end - # @return [Array] - def protocol_urls - remote_info.dig(:distributed_press, :protocols)&.select do |_, enabled| - enabled - end&.map do |protocol, _| - "#{protocol}://#{site.hostname}" - end || [] - end - # El cliente de la API # # TODO: cuando soportemos más, tiene que haber una relación entre diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index dd0bf052..7f9658af 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -5,6 +5,8 @@ - cache_if @usuarie, [@site, I18n.locale] do = render 'sites/status', site: @site + = render 'sites/build', site: @site, class: 'btn-block' + %h3= t('posts.new') %table.mb-3 - @site.layouts.sort_by(&:humanized_name).each do |layout| @@ -33,8 +35,6 @@ type: 'info', link: site_usuaries_path(@site) - = render 'sites/build', site: @site - - if @site.design.credits = render 'bootstrap/alert' do = sanitize_markdown @site.design.credits @@ -49,7 +49,8 @@ - next if param == 'q' %input{ type: 'hidden', name: param, value: value } .form-group.flex-grow-0.m-0 - %input.form-control.border.border-magenta{ type: 'search', placeholder: 'Buscar', name: 'q', value: @filter_params[:q] } + %label.sr-only{for: 'q'}= t('.search') + %input#q.form-control.border.border-magenta{ type: 'search', placeholder: t('.search'), name: 'q', value: @filter_params[:q] } %input.sr-only{ type: 'submit' } - if @site.locales.size > 1 diff --git a/app/views/sites/_build.haml b/app/views/sites/_build.haml index 6bc4d11b..5911e908 100644 --- a/app/views/sites/_build.haml +++ b/app/views/sites/_build.haml @@ -3,7 +3,7 @@ method: :post, class: 'form-inline inline' do = submit_tag site.enqueued? ? t('sites.enqueued') : t('sites.enqueue'), - class: 'btn no-border-radius', + class: "btn no-border-radius #{local_assigns[:class]}", title: site.enqueued? ? t('help.sites.enqueued') : t('help.sites.enqueue'), data: { disable_with: t('sites.enqueued') }, disabled: site.enqueued? diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 001f542e..69997ffa 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -55,7 +55,7 @@ layouts: site.incompatible_layouts.to_sentence) .row.row-cols-1.row-cols-md-2.designs -# Demasiado complejo para un f.collection_radio_buttons - - Design.all.find_each do |design| + - Design.all.order(priority: :desc).each do |design| .design.col.d-flex.flex-column .custom-control.custom-radio = f.radio_button :design_id, design.id, diff --git a/config/locales/en.yml b/config/locales/en.yml index 2423ab61..8cf3297d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -430,7 +430,7 @@ en: title: 'Design' actions: 'Information about this design' url: 'Demo' - licencia: 'License' + license: 'License' licencia: title: 'License for the site and everything published on it' url: 'Read the license' @@ -544,7 +544,8 @@ en: remove_filter: 'Back' remove_filter_help: 'Remove the filter: %{filter}' categories: 'Everything' - index: 'Posts' + index: + search: 'Search' edit: 'Edit' preview: btn: 'Preliminary version' diff --git a/config/locales/es.yml b/config/locales/es.yml index f4c579f1..fadb08fc 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -552,7 +552,8 @@ es: filter: 'Filtrar' remove_filter: 'Volver' remove_filter_help: 'Quitar este filtro: %{filter}' - index: 'Artículos' + index: + search: 'Buscar' edit: 'Editar' preview: btn: 'Versión preliminar' diff --git a/db/migrate/20230415153231_add_priority_to_designs.rb b/db/migrate/20230415153231_add_priority_to_designs.rb new file mode 100644 index 00000000..7fc45558 --- /dev/null +++ b/db/migrate/20230415153231_add_priority_to_designs.rb @@ -0,0 +1,5 @@ +class AddPriorityToDesigns < ActiveRecord::Migration[6.1] + def change + add_column :designs, :priority, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index a395329d..fd82d447 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_10_22_225449) do +ActiveRecord::Schema.define(version: 2023_04_15_153231) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" @@ -217,6 +217,7 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.boolean "disabled", default: false t.text "credits" t.string "designer_url" + t.integer "priority" end create_table "indexed_posts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -380,6 +381,7 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" + create_trigger("indexed_posts_before_insert_update_row_tr", :compatibility => 1). on("indexed_posts"). before(:insert, :update) do diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml index b1508b84..a04c99c1 100644 --- a/db/seeds/designs.yml +++ b/db/seeds/designs.yml @@ -6,6 +6,7 @@ disabled: true description_en: "Upload your own theme. [This feature is in development, help us!](https://sutty.nl/en/#contact)" description_es: "Subir tu propio diseño. [Esta posibilidad está en desarrollo, ¡ayudanos!](https://sutty.nl/#contacto)" + priority: '0' - name_en: 'I want you to develop a site for me' name_es: 'Quiero que desarrollen mi sitio' gem: 'sutty-theme-custom' @@ -13,6 +14,7 @@ disabled: true description_en: "If you want us to develop your site, you're welcome to [contact us!](https://sutty.nl/en/#contact) :)" description_es: "Si querés que desarrollemos tu sitio, [escribinos](https://sutty.nl/#contacto) :)" + priority: '2' - name_en: 'Minima' name_es: 'Mínima' gem: 'sutty-minima' @@ -20,6 +22,7 @@ description_en: "Sutty Minima is based on [Minima](https://jekyll.github.io/minima/), a blog-focused theme for Jekyll." description_es: 'Sutty Mínima es una plantilla para blogs basada en [Mínima](https://jekyll.github.io/minima/).' license: 'https://0xacab.org/sutty/jekyll/minima/-/blob/master/LICENSE.txt' + priority: '100' - name_en: 'Sutty' name_es: 'Sutty' gem: 'sutty-jekyll-theme' @@ -29,6 +32,7 @@ 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!' + priority: '90' - name_en: 'Self-managed Book Publisher' name_es: 'Editorial Autogestiva' gem: 'editorial-autogestiva-jekyll-theme' @@ -38,6 +42,7 @@ 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/)' + priority: '50' - name_en: 'Donations' name_es: 'Donaciones' gem: 'sutty-donaciones-jekyll-theme' @@ -47,6 +52,7 @@ 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 [visibility for donation requests](https://sutty.nl/template-for-donations/) during the quarantine.' + priority: '80' - name_en: 'Support campaign' name_es: 'Adhesiones' gem: 'adhesiones-jekyll-theme' @@ -57,6 +63,7 @@ credits_es: 'Desarrollamos esta plantilla junto con [Librenauta](https://sutty.nl/plantilla-para-campa%C3%B1as-de-adhesiones/)' credits_en: 'This template was made in collaboration with Librenauta' designer_url: 'https://copiona.com/donaunbit/' + priority: '60' - name_en: 'Community Radio' name_es: 'Radio comunitaria' gem: 'radios-comunitarias-jekyll-theme' @@ -67,6 +74,7 @@ credits_es: 'Desarrollamos esta plantilla junto con Librenauta en 15 horas :)' credits_en: 'This template was made in collaboration with Librenauta in 15 hours!' designer_url: 'https://copiona.com/donaunbit/' + priority: '70' - name_en: 'Resource toolkit' name_es: 'Recursero' gem: 'recursero-jekyll-theme' @@ -74,10 +82,12 @@ disabled: true description_en: "We're working towards adding more themes for you to use. [Contact us!](https://sutty.nl/en/#contact)" description_es: "Estamos trabajando para que puedas tener más diseños. [¡Escribinos!](https://sutty.nl/#contacto)" -- name_en: 'Other themes' - name_es: 'Mi propio diseño' + priority: '3' +- name_en: 'More themes' + name_es: 'Más plantillas' gem: 'sutty-theme-own' url: 'https://jekyllthemes.org' disabled: true description_en: "We're working towards adding more themes for you to use. [Contact us!](https://sutty.nl/en/#contact)" description_es: "Estamos trabajando para que puedas tener más diseños. [¡Escribinos!](https://sutty.nl/#contacto)" + priority: '1'