Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import changelog #7940

Merged
merged 4 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions app/controllers/admin/changelog_controller.rb
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions app/views/admin/changelog/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<% @title = 'Alaveteli Changelog' %>

<h1><%= @title %></h1>

<p>
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
<a href="https://github.com/mysociety/alaveteli/releases">newer releases of
Alaveteli</a> and preview upcoming changes in the
<a href="https://github.com/mysociety/alaveteli/blob/develop/doc/CHANGES.md">
development version of the changelog</a>.
</p>

<hr />

<%= @changelog %>
5 changes: 4 additions & 1 deletion app/views/layouts/admin.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@
<div class="admin-footer">
<div class="container">
<div class="row">
<span class="span4 offset8">
<span class="span5 offset7">
<ul class="nav nav-pills">
<li>
<a href="http://alaveteli.org/docs/running/admin_manual/">
Admin Manual
</a>
</li>
<li>
<%= link_to 'Changelog', admin_changelog_index_path %>
</li>
<li>
<a href="http://alaveteli.org/community/">
Alaveteli Community
Expand Down
6 changes: 6 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,12 @@ def matches?(request)
end
####

#### Admin::Changelog controller
namespace :admin do
resources :changelog, only: [:index]
end

####
#### AdminTag controller
namespace :admin do
resources :tags, param: :tag, only: [:index, :show]
Expand Down
2 changes: 1 addition & 1 deletion doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 15 additions & 0 deletions spec/controllers/admin/changelog_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'spec_helper'

RSpec.describe Admin::ChangelogController do
describe 'GET index' do
render_views

before do
get :index
end

it 'renders the changelog as HTML' do
expect(response.body).to match('<h2>Highlighted Features</h2>')
end
end
end
Loading