diff --git a/app/controllers/server/websites_controller.rb b/app/controllers/server/websites_controller.rb index 764ba04caef5a98a4e509fa5a989802bd4b6fe70..856ed06925a3da96d4103820a9965040a2b493a9 100644 --- a/app/controllers/server/websites_controller.rb +++ b/app/controllers/server/websites_controller.rb @@ -5,4 +5,22 @@ class Server::WebsitesController < Server::ApplicationController breadcrumb end + def edit + @website = Communication::Website.find params[:id] + breadcrumb + add_breadcrumb @website + end + + def update + @website = Communication::Website.find params[:id] + @website.update_column :theme_version, params[:communication_website][:theme_version] + redirect_to server_websites_path + end + + protected + + def breadcrumb + super + add_breadcrumb Communication::Website.model_name.human(count: 2), server_websites_path + end end \ No newline at end of file diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index 0d0c46680a18bd407b6a449bbd12112bfa741da6..fbfb3ca4af288741bc2246c2cf88908ca8a2b28c 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -14,6 +14,7 @@ # repository :string # style :text # style_updated_at :date +# theme_version :string # url :string # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/communication/website/configs/default_languages.rb b/app/models/communication/website/configs/default_languages.rb index dfaf6276250e6a2f8f410f69740b463a589956f2..59fe8171043cb2553e2140e62078890c1f926e80 100644 --- a/app/models/communication/website/configs/default_languages.rb +++ b/app/models/communication/website/configs/default_languages.rb @@ -14,6 +14,7 @@ # repository :string # style :text # style_updated_at :date +# theme_version :string # url :string # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/communication/website/configs/default_permalinks.rb b/app/models/communication/website/configs/default_permalinks.rb index cb70b44bdf719f769d4b7058da32509b5e563790..287cc69e45154237b21677063f1b003ccfba144c 100644 --- a/app/models/communication/website/configs/default_permalinks.rb +++ b/app/models/communication/website/configs/default_permalinks.rb @@ -14,6 +14,7 @@ # repository :string # style :text # style_updated_at :date +# theme_version :string # url :string # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/communication/website/configs/development_config.rb b/app/models/communication/website/configs/development_config.rb index f4f672d4507333934399bfb2196d587e7c0aee6a..d3b15c0ecb92c2bfdf2720b3fd61d1ec973026e2 100644 --- a/app/models/communication/website/configs/development_config.rb +++ b/app/models/communication/website/configs/development_config.rb @@ -14,6 +14,7 @@ # repository :string # style :text # style_updated_at :date +# theme_version :string # url :string # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/communication/website/configs/production_config.rb b/app/models/communication/website/configs/production_config.rb index e40eb7abddcc0b4e78202afdaee949e564da4798..c6eb64a6533cb745c5086090a09880ac823395fd 100644 --- a/app/models/communication/website/configs/production_config.rb +++ b/app/models/communication/website/configs/production_config.rb @@ -14,6 +14,7 @@ # repository :string # style :text # style_updated_at :date +# theme_version :string # url :string # created_at :datetime not null # updated_at :datetime not null diff --git a/app/views/admin/application/static/_design.html.erb b/app/views/admin/application/static/_design.html.erb index c6212a7be51b4b94ee4b9b0af6c2cadacdcf6ea8..fd51f2089be25efa4a3fdb1646913635ea9b03a5 100644 --- a/app/views/admin/application/static/_design.html.erb +++ b/app/views/admin/application/static/_design.html.erb @@ -6,6 +6,9 @@ toc_offcanvas = local_assigns.has_key?(:toc_offcanvas) ? local_assigns[:toc_off toc_present = local_assigns.has_key?(:toc_present) ? local_assigns[:toc_present] : @about.show_toc? %> +<% # legacy, please remove when site migrated %> +full_width: <%= full_width %> +<% # end of legacy%> design: full_width: <%= full_width %> toc: diff --git a/app/views/server/websites/edit.html.erb b/app/views/server/websites/edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..bfa63d2db391e7360408b901898067caaec2109e --- /dev/null +++ b/app/views/server/websites/edit.html.erb @@ -0,0 +1,6 @@ +<%= simple_form_for @website, url: server_website_path(@website) do |f| %> + <%= f.input :theme_version %> + <% content_for :action_bar_right do %> + <%= submit f %> + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/server/websites/index.html.erb b/app/views/server/websites/index.html.erb index e0766b309807af79a0d4acc01841e62b3287f57e..b68d7f7e6c12ca747a5ecdbb6d821722027b5463 100644 --- a/app/views/server/websites/index.html.erb +++ b/app/views/server/websites/index.html.erb @@ -9,15 +9,17 @@ <th><%= Communication::Website.human_attribute_name('name') %></th> <th><%= Communication::Website.human_attribute_name('url') %></th> <th><%= Communication::Website.human_attribute_name('in_production') %></th> + <th><%= Communication::Website.human_attribute_name('theme_version') %></th> <th><%= University.model_name.human %></th> </tr> </thead> <tbody> <% @websites.each do |website| %> <tr> - <td><%= website.name %></td> + <td><%= link_to website.name, edit_server_website_path(website) %></td> <td><%= link_to website.url, website.url, target: :_blank if website.url.present? %></td> <td><%= t website.in_production %></td> + <td><%= website.theme_version %></td> <td><%= link_to website.university, [:server, website.university] %></td> </tr> <% end %> diff --git a/db/migrate/20221226160909_add_theme_version_to_communication_websites.rb b/db/migrate/20221226160909_add_theme_version_to_communication_websites.rb new file mode 100644 index 0000000000000000000000000000000000000000..af77adc8152ab958b13ea40d5c0f0010bb12c589 --- /dev/null +++ b/db/migrate/20221226160909_add_theme_version_to_communication_websites.rb @@ -0,0 +1,5 @@ +class AddThemeVersionToCommunicationWebsites < ActiveRecord::Migration[7.0] + def change + add_column :communication_websites, :theme_version, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 2d9463fcefe58f3995bbaf38f71340916f62aec3..bb15072bff6a3779eac39867efe08e17285c82c3 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: 2022_12_22_140427) do +ActiveRecord::Schema[7.0].define(version: 2022_12_26_160909) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -383,6 +383,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_22_140427) do t.string "git_branch" t.boolean "in_production", default: false t.uuid "default_language_id", null: false + t.string "theme_version" t.index ["about_type", "about_id"], name: "index_communication_websites_on_about" t.index ["default_language_id"], name: "index_communication_websites_on_default_language_id" t.index ["university_id"], name: "index_communication_websites_on_university_id" diff --git a/test/fixtures/communication/websites.yml b/test/fixtures/communication/websites.yml index c8aedc20efbdaa52c01fe85a5a80c5760eb5b521..c88335243ca617b01c215a6c42c30c8a0f47c4c6 100644 --- a/test/fixtures/communication/websites.yml +++ b/test/fixtures/communication/websites.yml @@ -14,6 +14,7 @@ # repository :string # style :text # style_updated_at :date +# theme_version :string # url :string # created_at :datetime not null # updated_at :datetime not null diff --git a/test/fixtures/education/schools.yml b/test/fixtures/education/schools.yml index 51fbf5bc6ad6df23a3f61d479e6f7b51a28a95cf..c8a131ca199b79365c37ff32222a464da85f073b 100644 --- a/test/fixtures/education/schools.yml +++ b/test/fixtures/education/schools.yml @@ -1,3 +1,28 @@ +# == Schema Information +# +# Table name: education_schools +# +# id :uuid not null, primary key +# address :string +# city :string +# country :string +# latitude :float +# longitude :float +# name :string +# phone :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_education_schools_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_e01b37a3ad (university_id => universities.id) +# default_school: name: École de test - university: default_university \ No newline at end of file + university: default_university diff --git a/test/fixtures/languages.yml b/test/fixtures/languages.yml index 77d02342d375fad81ab817c360e53569f22ae397..314cf445ef3fed313d995e12253df4be80947e82 100644 --- a/test/fixtures/languages.yml +++ b/test/fixtures/languages.yml @@ -1,7 +1,17 @@ +# == Schema Information +# +# Table name: languages +# +# id :uuid not null, primary key +# iso_code :string +# name :string +# created_at :datetime not null +# updated_at :datetime not null +# en: name: English iso_code: en fr: name: Français - iso_code: fr \ No newline at end of file + iso_code: fr