Skip to content

Commit

Permalink
Add "campaigning" Citation#type
Browse files Browse the repository at this point in the history
We're missing this from our three main Pro audiences – journalists,
campaigners and researchers.
  • Loading branch information
garethrees committed Mar 11, 2024
1 parent 84cf979 commit 7af5fff
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/helpers/admin/citations_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
module Admin::CitationsHelper
ICONS = {
journalism: '🗞️',
campaigning: '📣',
academic: '🎓',
other: '🌐'
}.with_indifferent_access.freeze
Expand Down
2 changes: 1 addition & 1 deletion app/models/citation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Citation < ApplicationRecord
message: _('Source URL is too long') },
format: { with: /\Ahttps?:\/\/.*\z/,
message: _('Please enter a Source URL') }
validates :type, inclusion: { in: %w(journalism academic other),
validates :type, inclusion: { in: %w(journalism academic campaigning other),
message: _('Please select a type') }

scope :newest, ->(limit = 1) do
Expand Down
5 changes: 5 additions & 0 deletions app/views/citations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
<%= _('Journalism') %>
</label>

<label for="citation_type_campaigning" class="form_label">
<%= f.radio_button :type, 'campaigning' %>
<%= _('Campaigning') %>
</label>

<label for="citation_type_academic" class="form_label">
<%= f.radio_button :type, 'academic' %>
<%= _('Academic') %>
Expand Down
4 changes: 2 additions & 2 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## Highlighted Features

* Broaden citation type classifications to cover wider thematic areas (Gareth
Rees)
* Broaden citation type classifications to cover wider thematic areas and add
"campaigning" type (Gareth Rees)
* Reduce amount of storage related background jobs (Graeme Porteous)
* Add automatic parsing of emails contain Excel spreadsheets (Graeme Porteous)
* Improve rendering of admin hidden request prominence and explanations (Graeme
Expand Down
2 changes: 2 additions & 0 deletions spec/models/citation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ def setup_for_x_scope_data
is_expected.not_to be_valid
citation.type = 'journalism'
is_expected.to be_valid
citation.type = 'campaigning'
is_expected.to be_valid
citation.type = 'academic'
is_expected.to be_valid
citation.type = 'other'
Expand Down

0 comments on commit 7af5fff

Please sign in to comment.