Skip to content

Commit

Permalink
Merge pull request #131 from louis-vs/prepare-rc3
Browse files Browse the repository at this point in the history
Prepare for third 1.0.0 release candidate
  • Loading branch information
louis-vs authored Feb 2, 2022
2 parents 4be77d9 + f068314 commit 62b9656
Show file tree
Hide file tree
Showing 24 changed files with 126 additions and 70 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ AllCops:
Lint/MissingSuper:
Exclude:
- app/components/**/*

Metrics/BlockLength:
Exclude:
- config/routes.rb
- spina-admin-journal.gemspec
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
spina-admin-journal (1.0.0.rc2)
spina-admin-journal (1.0.0.rc3)
haml-rails (~> 2.0)
rails (>= 6.0, < 8)
rails-i18n (>= 6.0, < 8)
Expand Down
84 changes: 36 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,58 @@
# Spina::Admin::Journal

*Journal* is a plugin for [Spina](https://www.spinacms.com/) that provides a fully-fledged journal management package, intended to provide a more streamlined, easy-to-use, modern alternative to [OJS](https://pkp.sfu.ca/ojs/).

Spina is a content management system built in [Ruby on Rails](http://rubyonrails.org/). *Journal* augments Spina by providing an admin interface for managing an academic journal.

![Rails tests](https://github.com/louis-vs/spina-admin-journal/workflows/Verify/badge.svg?branch=master&event=push)
[![codecov](https://codecov.io/gh/louis-vs/spina-admin-journal/branch/master/graph/badge.svg?token=9TZ9QGGLAH)](https://codecov.io/gh/louis-vs/spina-admin-journal)
[![CodeFactor](https://www.codefactor.io/repository/github/louis-vs/spina-admin-journal/badge)](https://www.codefactor.io/repository/github/louis-vs/spina-admin-journal)
[![LGTM alerts](https://img.shields.io/lgtm/alerts/g/louis-vs/spina-admin-journal.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/louis-vs/spina-admin-journal/alerts/)
[![Code quality: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/louis-vs/spina-admin-journal.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/louis-vs/spina-admin-journal/context:javascript)
[![Inline docs](http://inch-ci.org/github/louis-vs/spina-admin-journal.svg?branch=master)](http://inch-ci.org/github/louis-vs/spina-admin-journal)

*Journal* is a plugin for [Spina](https://www.spinacms.com/), a content management system built in [Ruby on Rails](http://rubyonrails.org/). *Journal* augments Spina by providing an admin interface for managing an academic journal.

## Usage

The plugin adds two menus to Spina's primary navigation:

* **Journal settings** provides access to global properties of the journal. It is divided into 3 submenus:
* **Journal** allows you to change the name of the journal.
* **Institutions** allows you to add institutions, to which authors can be affiliated.
* **Authors** allows you to add authors, who can then be added to articles.
* The **journal content** menu will be named after the journal as specified in Journal Settings. It provides a means of editing the content of the journal and is divided into three submenus:
* **Volumes** allows you to add and remove volumes of the journal, and edit their respective issues.
* **Issues** allows you to add, edit and remove issues of particular volumes of the journal, and edit their respective articles.
* **Articles** allows you to add, edit and remove articles belonging to particular issues.
## Features

The plugin does not provide any public-facing frontend. However, an example implementation can be found at **[TBC]**.
The journal plugin covers many of the needs of a professional online journal publication, including:

**NB this plugin is currently a work in progress**: please wait until an official release to use this plugin in production.
- Simple, responsive, intuitive interface that builds upon Spina's own.
- Seamlessly integrate published content with other information about the journal.
- Manage volumes, issues, articles and authors in a highly structured and organised manner.
- Keep track of individual authors with multiple affiliations, e.g. if they change name or institution, connecting with [ORCID](https://orcid.org/).

## Installation

### From scratch

Make sure you have a working installation of Ruby on Rails 6.1. You can find a setup guide [here](https://guides.rubyonrails.org/getting_started.html).

Then run:

```bash
$ rails new your-app --database=postgresql
$ cd your-app
$ bin/rails db:create
$ bin/rails active_storage:install
```
Currently, a submissions management system is not included, but this is planned for a future release. This will allow you to manage the submissions process for the journal in a streamlined manner in parallel to publication.

Add this line to your new application's Gemfile:
## Usage

```ruby
gem 'spina', '~> 2.0'
```
The plugin adds two menus to Spina's primary navigation:

And then execute:
- **Journal settings** provides access to global properties of the journal. It is divided into 3 submenus:
- **Journal** allows you to change metadata such as the name of the journal, as well as content that will appear on the journal homepage.
- **Institutions** allows you to add institutions, to which authors can be affiliated.
- **Authors** allows you to add authors and their affiliations, which can then be added to articles.
- **Licences** allows you to add licences and association information, which can be associated with individual articles, representing the licence under which the content is released.
- The **journal content** menu will be named after the journal as specified in Journal Settings. It provides a means of editing the content of the journal and is divided into three submenus:
- **Volumes** allows you to add and remove volumes of the journal, and edit their respective issues.
- **Issues** allows you to add, edit and remove issues of particular volumes of the journal, and edit their respective articles.
- **Articles** allows you to add, edit and remove articles belonging to particular issues.

```bash
$ bundle install
```
**NB:** This release of the plugin does not provide any public-facing frontend or Spina theme. An example implementation can be found within the [Conferences Primer Theme](https://github.com/louis-vs/spina-conferences-primer_theme-fork). Note that this theme also contains frontends for two other Spina plugins, [Spina Conferences Blog](https://github.com/louis-vs/spina-admin-conferences-blog) and [Spina Admin Conferences](https://github.com/louis-vs/spina-admin-conferences-fork/). You can use the theme in your project as is, or copy whichever parts of the code you need.

Run the Spina install generator:
A dedicated journal theme, coupled with an automatic installer, is being planned. A system to manage submissions is also on the roadmap.

```bash
$ bin/rails g spina:install
```
## Installation

And follow the prompts. Once this is complete, follow the instructions below.
Make sure you have a working installation of Ruby on Rails 7. You can find a setup guide [here](https://guides.rubyonrails.org/getting_started.html).

### For existing Spina installations
You then need to install Spina, following the guide [on the Spina website](https://spinacms.com/docs).

Add this line to your application's Gemfile:
To install the plugin, add this line to your application's Gemfile:

```ruby
gem 'spina-admin-journal', '~> 0.1'
gem 'spina-admin-journal', '~> 1.0'
```

And then execute:
Then execute:

```bash
$ bundle install
Expand All @@ -78,7 +61,7 @@ $ bundle install
You'll then need to install and run the migrations for the journal:

```bash
$ bin/rails spina_admin_journal_engine:install:migrations
$ bin/rails spina_admin_journal:install:migrations
$ bin/rails db:migrate
```

Expand All @@ -94,6 +77,11 @@ You can manually populate the database from within the app, or alternatively you

Bug reports and feature requests are welcome in the [Issues](https://github.com/louis-vs/spina-admin-journal/issues) section. Translations are also very welcome!

### Planned features

- [ ] Submissions management
- [ ] Translations

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
6 changes: 5 additions & 1 deletion app/controllers/spina/admin/journal/articles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ArticlesController < ApplicationController

before_action :set_breadcrumb
before_action :set_tabs, except: %i[index destroy sort]
before_action :set_article, only: %i[edit update destroy]
before_action :set_article, only: %i[edit view_authors update destroy]
before_action :set_parts_attributes, only: %i[new edit]
before_action :build_parts, only: %i[edit]

Expand All @@ -43,6 +43,10 @@ def new

def edit; end

def view_authors
render layout: false
end

def create # rubocop:disable Metrics/AbcSize
@article = Article.new(article_params)
sister_articles = Article.where(issue: @article.issue_id)
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/spina/admin/journal/authors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Journal
class AuthorsController < ApplicationController
before_action :set_breadcrumb
before_action :set_tabs, except: %i[index destroy]
before_action :set_author, only: %i[edit update destroy]
before_action :set_author, only: %i[edit view_articles update destroy]

admin_section :journal_settings

Expand All @@ -23,6 +23,10 @@ def new

def edit; end

def view_articles
render layout: false
end

def create
@author = Author.new(modified_params)
if @author.save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Journal
class InstitutionsController < ApplicationController
before_action :set_breadcrumb
before_action :set_tabs, except: %i[index destroy]
before_action :set_institution, only: %i[edit update destroy]
before_action :set_institution, only: %i[edit view_affiliations update destroy]

admin_section :journal_settings

Expand All @@ -22,6 +22,10 @@ def new

def edit; end

def view_affiliations
render layout: false
end

def create
@institution = Institution.new(institution_params)

Expand Down
8 changes: 6 additions & 2 deletions app/controllers/spina/admin/journal/issues_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class IssuesController < ApplicationController

before_action :set_breadcrumb
before_action :set_tabs, except: %i[index destroy sort]
before_action :set_issue, only: %i[edit update destroy]
before_action :set_articles, only: %i[edit update]
before_action :set_issue, only: %i[edit view_articles update destroy]
before_action :set_articles, only: %i[edit view_articles update]
before_action :set_parts_attributes, only: %i[new edit]
before_action :build_parts, only: %i[edit]

Expand All @@ -48,6 +48,10 @@ def edit
add_breadcrumb t('spina.admin.journal.issues.issue_number', number: @issue.number)
end

def view_articles
render layout: false
end

def create # rubocop:disable Metrics/AbcSize
@issue = Issue.new(issue_params)
sister_issues = Issue.where(volume: @issue.volume_id)
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/spina/admin/journal/volumes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Journal
class VolumesController < ApplicationController
before_action :set_breadcrumb
before_action :set_tabs, except: %i[index destroy]
before_action :set_volume, only: %i[edit destroy]
before_action :set_volume, only: %i[edit view_issues destroy]

admin_section :journal

Expand All @@ -17,6 +17,10 @@ def index

def edit; end

def view_issues
render layout: false
end

def new
create
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.-mt-4.md:-mt-8
= render Spina::Admin::Journal::AuthorshipsListComponent.new(authorships: @article.authorships.sorted_within_article, sortable: true)
- if @article.persisted?
.-mt-4.md:-mt-8
%turbo-frame#article_authors{ src: spina.view_authors_admin_journal_article_path(@article), loading: 'lazy' }
2 changes: 2 additions & 0 deletions app/views/spina/admin/journal/articles/view_authors.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
%turbo-frame#article_authors
= render Spina::Admin::Journal::AuthorshipsListComponent.new(authorships: @article.authorships.sorted_within_article, sortable: true)
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.-mt-4.md:-mt-8
= render Spina::Admin::Journal::ArticlesListComponent.new(articles: @author.affiliations.reduce([]) { |memo, affiliation| memo << affiliation.articles.to_a }.flatten )
- if @author.persisted?
.-mt-4.md:-mt-8
%turbo-frame#author_articles{ src: spina.view_articles_admin_journal_author_path(@author), loading: 'lazy' }
2 changes: 2 additions & 0 deletions app/views/spina/admin/journal/authors/view_articles.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
%turbo-frame#author_articles
= render Spina::Admin::Journal::ArticlesListComponent.new(articles: @author.affiliations.reduce([]) { |memo, affiliation| memo << affiliation.articles.to_a }.flatten )
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.-mt-4.md:-mt-8
= render Spina::Admin::Journal::AffiliationsListComponent.new(affiliations: @institution.affiliations.sorted)
- if @institution.persisted?
.-mt-4.md:-mt-8
%turbo-frame#institution_affiliations{ src: spina.view_affiliations_admin_journal_institution_path(@institution), loading: 'lazy' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
%turbo-frame#institution_affiliations
= render Spina::Admin::Journal::AffiliationsListComponent.new(affiliations: @institution.affiliations.sorted)
5 changes: 3 additions & 2 deletions app/views/spina/admin/journal/issues/_form_articles.html.haml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.-mt-4.md:-mt-8
= render Spina::Admin::Journal::ArticlesListComponent.new(articles: @issue.articles, sortable: true)
- if @issue.persisted?
.-mt-4.md:-mt-8
%turbo-frame#issue_articles{ src: spina.view_articles_admin_journal_issue_path(@issue), loading: 'lazy' }
3 changes: 3 additions & 0 deletions app/views/spina/admin/journal/issues/view_articles.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
%turbo-frame#issue_articles
= render Spina::Admin::Journal::ArticlesListComponent.new(articles: @issue.articles, sortable: true)

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.-mt-4.md:-mt-8
= render Spina::Admin::Journal::IssuesListComponent.new(issues: @volume.issues, sortable: true)
%turbo-frame#volume_issues{ src: spina.view_issues_admin_journal_volume_path(@volume), loading: 'lazy' }
2 changes: 2 additions & 0 deletions app/views/spina/admin/journal/volumes/view_issues.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
%turbo-frame#volume_issues
= render Spina::Admin::Journal::IssuesListComponent.new(issues: @volume.issues, sortable: true)
22 changes: 21 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,38 @@
resources :journals, only: %i[edit update destroy]
resources :volumes, except: %i[show update] do
post 'sort/:journal_id' => 'volumes#sort', as: :sort, on: :collection

member do
get :view_issues
end
end
resources :issues, except: %i[show] do
post 'sort/:volume_id' => 'issues#sort', as: :sort, on: :collection

member do
get :view_articles
end
end
resources :articles, except: %i[show] do
post 'sort/:issue_id' => 'articles#sort', as: :sort, on: :collection

member do
get :view_authors
end
end
resources :authors, except: %i[show] do
post 'sort/:article_id' => 'authors#sort', as: :sort, on: :collection

member do
get :view_articles
end
end

resources :institutions, except: %i[show]
resources :institutions, except: %i[show] do
member do
get :view_affiliations
end
end
resources :licences, except: %i[show]
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/spina/admin/journal/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Spina
module Admin
module Journal
VERSION = '1.0.0.rc2'
VERSION = '1.0.0.rc3'
end
end
end
4 changes: 3 additions & 1 deletion test/system/spina/admin/journal/articles_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class ArticlesTest < ApplicationSystemTestCase

# check that authors list is empty
click_on 'Authors'
assert_text 'There are no items'
within '#authors' do
assert_no_text
end

click_on 'Save article'
assert_text 'Article saved'
Expand Down
4 changes: 3 additions & 1 deletion test/system/spina/admin/journal/authors_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class AuthorsTest < ApplicationSystemTestCase

# check that articles list is empty
click_on 'Articles'
assert_text 'There are no items.'
within '#articles' do
assert_no_text
end

click_on 'Save author'
assert_text 'Author saved.'
Expand Down
4 changes: 3 additions & 1 deletion test/system/spina/admin/journal/institutions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class InstitutionsTest < ApplicationSystemTestCase

# check that affiliations list is empty
click_button 'Affiliations', class: 'bg-transparent'
assert_text 'There are no items.'
within '#view_affiliations' do
assert_no_text
end

click_on 'Save institution'
assert_text 'Institution saved.'
Expand Down
4 changes: 3 additions & 1 deletion test/system/spina/admin/journal/issues_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class IssuesTest < ApplicationSystemTestCase

# check that articles list is empty
click_button 'Articles', class: 'bg-transparent'
assert_text 'There are no items.'
within '#articles' do
assert_no_text
end

click_on 'Save issue'
assert_text 'Issue saved'
Expand Down

0 comments on commit 62b9656

Please sign in to comment.