From deb0b4ed28af7719588ad39f35af7b530f01bd90 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 6 Oct 2023 12:05:44 +0100 Subject: [PATCH 1/3] Fix changelog typo Duplicate heading. --- doc/CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/CHANGES.md b/doc/CHANGES.md index f8e1dd306a..5e6dfab6ff 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -5,7 +5,7 @@ * Add support for [Cookieless Google Analytics 4](https://github.com/mysociety/alaveteli/wiki/Cookieless-Google-Analytics-4) (Alex Parsons, Graeme Porteous) -* Updated translations from Transifex (Graeme Porteous)# 0.43.0.2 +* Updated translations from Transifex (Graeme Porteous) # 0.43.0.2 From 66bead8cb37c70cbee2da1f486c7a1180c6a2b7c Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 6 Oct 2023 12:10:02 +0100 Subject: [PATCH 2/3] Render the changelog in the admin interface Make it easier for admins to read about new features that have been added to Alaveteli from within Alaveteli itself. --- Gemfile | 1 + Gemfile.lock | 2 ++ app/controllers/admin/changelog_controller.rb | 9 +++++++++ app/views/admin/changelog/index.html.erb | 17 +++++++++++++++++ app/views/layouts/admin.html.erb | 5 ++++- config/routes.rb | 6 ++++++ .../admin/changelog_controller_spec.rb | 15 +++++++++++++++ 7 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 app/controllers/admin/changelog_controller.rb create mode 100644 app/views/admin/changelog/index.html.erb create mode 100644 spec/controllers/admin/changelog_controller_spec.rb diff --git a/Gemfile b/Gemfile index 104a6e8f43..c808b66827 100644 --- a/Gemfile +++ b/Gemfile @@ -114,6 +114,7 @@ gem 'recaptcha', '~> 5.15.0', require: 'recaptcha/rails' gem 'matrix', '~> 0.4.2' gem 'mini_magick', '~> 4.12.0' gem 'net-protocol', '~> 0.1.3' +gem 'redcarpet', '~> 3.6.0' gem 'redis', '~> 4.8.1' gem 'rolify', '~> 6.0.1' gem 'ruby-msg', '~> 1.5.0', git: 'https://github.com/mysociety/ruby-msg.git', branch: 'ascii-encoding' diff --git a/Gemfile.lock b/Gemfile.lock index e4fdcf8c60..9671e813a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -420,6 +420,7 @@ GEM rainbow (3.1.1) rake (13.0.6) recaptcha (5.15.0) + redcarpet (3.6.0) redis (4.8.1) redlock (1.3.2) redis (>= 3.0.0, < 6.0) @@ -627,6 +628,7 @@ DEPENDENCIES rails-controller-testing rails-i18n (~> 7.0.5) recaptcha (~> 5.15.0) + redcarpet (~> 3.6.0) redis (~> 4.8.1) rolify (~> 6.0.1) routing-filter (~> 0.7.0) diff --git a/app/controllers/admin/changelog_controller.rb b/app/controllers/admin/changelog_controller.rb new file mode 100644 index 0000000000..6a897f1f7e --- /dev/null +++ b/app/controllers/admin/changelog_controller.rb @@ -0,0 +1,9 @@ +# Controller to render the changelog notes in a more human-friendly way within +# the admin interface. +class Admin::ChangelogController < AdminController + def index + markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new) + text = File.read(Rails.root + 'doc/CHANGES.md') + @changelog = markdown.render(text).html_safe + end +end diff --git a/app/views/admin/changelog/index.html.erb b/app/views/admin/changelog/index.html.erb new file mode 100644 index 0000000000..4c57a74983 --- /dev/null +++ b/app/views/admin/changelog/index.html.erb @@ -0,0 +1,17 @@ +<% @title = 'Alaveteli Changelog' %> + +

<%= @title %>

+ +

+ The changelog documents the features and upgrade notes for each versioned + release of Alaveteli. Here you will see the changelog for the version of + Alaveteli you have installed. You can check GitHub for + newer releases of + Alaveteli and preview upcoming changes in the + + development version of the changelog. +

+ +
+ +<%= @changelog %> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index a41cb0cc97..1d2bdce0a7 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -44,13 +44,16 @@