From a33c59fb88dae9524ec517966d6c81490f31277d Mon Sep 17 00:00:00 2001 From: Ronan Limon Duparcmeur Date: Sat, 18 Nov 2023 12:32:58 +0100 Subject: [PATCH 1/3] Added a priority attribute to talks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we're starting to add low-priority talks (i.e. talks that are mostly proposed to fill in a short line-up, if need be), having a clear wat to point them out could be useful. And while we're at it, why not an the option of marking a talk as "high priority" so that room could be made for it (e.g. for an special guest). Note that this attribute is not user-facing – only admins should have the ability to decide that a talk as is low- or high-priority. By default, the priority of a talk is "normal", and this level should be kept most of time. --- app/models/talk.rb | 4 ++++ config/locales/fr.yml | 5 +++++ db/migrate/20231118111323_add_priority_to_talks.rb | 5 +++++ db/schema.rb | 3 ++- 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20231118111323_add_priority_to_talks.rb diff --git a/app/models/talk.rb b/app/models/talk.rb index 59e66e17..65a244fd 100644 --- a/app/models/talk.rb +++ b/app/models/talk.rb @@ -16,6 +16,7 @@ # speaker_twitter :string # preferred_month_talk :string # time_position :datetime +# priority :string # # Indexes # @@ -65,6 +66,9 @@ def self.propose_upcoming_months end ALL_MONTHS = months_iterator(1..12) + + enumerize :priority, + in: [:low, :normal, :high], default: :normal enumerize :preferred_month_talk, in: ALL_MONTHS.keys.map(&:to_sym) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index a7d38c8e..4cbec917 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -20,6 +20,7 @@ fr: happened_at: Date level: Difficulté lineup: Ajouter au lineup + priority: Priorité slides: Slides speaker_email: Email speaker_name: Speaker @@ -65,6 +66,10 @@ fr: easy: Débutant intermediate: Moyen expert: Expert + priority: + low: Basse + normal: Normale + high: Haute helpers: submit: diff --git a/db/migrate/20231118111323_add_priority_to_talks.rb b/db/migrate/20231118111323_add_priority_to_talks.rb new file mode 100644 index 00000000..ec3bed67 --- /dev/null +++ b/db/migrate/20231118111323_add_priority_to_talks.rb @@ -0,0 +1,5 @@ +class AddPriorityToTalks < ActiveRecord::Migration[7.0] + def change + add_column :talks, :priority, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index a93465a9..ec71f0e9 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[7.0].define(version: 2023_03_22_213633) do +ActiveRecord::Schema[7.0].define(version: 2023_11_18_111323) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -50,6 +50,7 @@ t.string "speaker_twitter" t.string "preferred_month_talk" t.datetime "time_position", precision: nil + t.string "priority" t.index ["happened_at"], name: "index_talks_on_happened_at" end From 0dbd636bfe0bea01d37548319d52868e3a299ea8 Mon Sep 17 00:00:00 2001 From: Ronan Limon Duparcmeur Date: Sat, 18 Nov 2023 12:48:50 +0100 Subject: [PATCH 2/3] Admin: added the priority to the list of talks I believe that we could do something fancy, like changing the text color for low- or high-priority talks, instead of, or in addition to, an extra column in the table, but this should be enough for now. --- config/initializers/rails_admin.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/initializers/rails_admin.rb b/config/initializers/rails_admin.rb index 475048a4..5ee06ade 100644 --- a/config/initializers/rails_admin.rb +++ b/config/initializers/rails_admin.rb @@ -35,6 +35,7 @@ end field :title field :speaker_name + field :priority field :speaker_twitter field :preferred_month_talk field :time_position From be3a965a091c75979ccbf02c163adbc272a646ae Mon Sep 17 00:00:00 2001 From: Ronan Limon Duparcmeur Date: Sat, 25 Nov 2023 18:07:17 +0100 Subject: [PATCH 3/3] Added a special hint for the priority field --- config/locales/fr.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 4cbec917..1c9ddcb1 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -8,6 +8,11 @@ fr: site_name: Paris.rb + admin: + help: + talk: + priority: Optionnel. Une priorité 'basse' peut servir à mettre de côté un talk pour combler un programme, une priorité 'haute' pour les invités spéciaux. + activerecord: attributes: user: