spina-admin-journal 0.6.2 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/spina_admin_journal_manifest.js +5 -2
  3. data/app/assets/javascripts/spina/admin/journal/application.js +0 -0
  4. data/app/components/spina/admin/journal/affiliations_list_component.rb +32 -0
  5. data/app/components/spina/admin/journal/application_component.rb +11 -0
  6. data/app/components/spina/admin/journal/articles_list_component.rb +54 -0
  7. data/app/components/spina/admin/journal/authors_list_component.rb +37 -0
  8. data/app/components/spina/admin/journal/authorships_list_component.rb +45 -0
  9. data/app/components/spina/admin/journal/empty_list_component.html.haml +1 -0
  10. data/app/components/spina/admin/journal/empty_list_component.rb +14 -0
  11. data/app/components/spina/admin/journal/institutions_list_component.rb +32 -0
  12. data/app/components/spina/admin/journal/issues_list_component.rb +47 -0
  13. data/app/components/spina/admin/journal/licences_list_component.rb +32 -0
  14. data/app/components/spina/admin/journal/list_component.html.haml +10 -0
  15. data/app/components/spina/admin/journal/list_component.rb +22 -0
  16. data/app/components/spina/admin/journal/list_item_component.html.haml +17 -0
  17. data/app/components/spina/admin/journal/list_item_component.rb +23 -0
  18. data/app/components/spina/admin/journal/volumes_list_component.rb +34 -0
  19. data/app/controllers/spina/admin/journal/application_controller.rb +1 -1
  20. data/app/controllers/spina/admin/journal/articles_controller.rb +11 -23
  21. data/app/controllers/spina/admin/journal/authors_controller.rb +10 -24
  22. data/app/controllers/spina/admin/journal/institutions_controller.rb +6 -4
  23. data/app/controllers/spina/admin/journal/issues_controller.rb +12 -25
  24. data/app/controllers/spina/admin/journal/journals_controller.rb +2 -1
  25. data/app/controllers/spina/admin/journal/licences_controller.rb +6 -4
  26. data/app/controllers/spina/admin/journal/volumes_controller.rb +9 -20
  27. data/app/views/spina/admin/hooks/journal/_primary_navigation.html.haml +35 -26
  28. data/app/views/spina/admin/journal/articles/_form.html.haml +23 -24
  29. data/app/views/spina/admin/journal/articles/_form_authors.html.haml +1 -15
  30. data/app/views/spina/admin/journal/articles/_form_details.html.haml +27 -56
  31. data/app/views/spina/admin/journal/articles/index.html.haml +7 -17
  32. data/app/views/spina/admin/journal/authors/_form.html.haml +24 -24
  33. data/app/views/spina/admin/journal/authors/_form_affiliation.html.haml +8 -20
  34. data/app/views/spina/admin/journal/authors/_form_articles.html.haml +1 -18
  35. data/app/views/spina/admin/journal/authors/_form_details.html.haml +2 -6
  36. data/app/views/spina/admin/journal/authors/index.html.haml +7 -15
  37. data/app/views/spina/admin/journal/institutions/_form.html.haml +24 -24
  38. data/app/views/spina/admin/journal/institutions/_form_details.html.haml +2 -8
  39. data/app/views/spina/admin/journal/institutions/_form_view_affiliations.html.haml +1 -10
  40. data/app/views/spina/admin/journal/institutions/index.html.haml +7 -15
  41. data/app/views/spina/admin/journal/issues/_form.html.haml +23 -23
  42. data/app/views/spina/admin/journal/issues/_form_articles.html.haml +1 -14
  43. data/app/views/spina/admin/journal/issues/_form_details.html.haml +13 -28
  44. data/app/views/spina/admin/journal/issues/index.html.haml +7 -16
  45. data/app/views/spina/admin/journal/journals/_form.html.haml +22 -32
  46. data/app/views/spina/admin/journal/licences/_form.html.haml +19 -34
  47. data/app/views/spina/admin/journal/licences/index.html.haml +7 -16
  48. data/app/views/spina/admin/journal/volumes/_form.html.haml +25 -12
  49. data/app/views/spina/admin/journal/volumes/_form_details.html.haml +4 -10
  50. data/app/views/spina/admin/journal/volumes/_form_issues.html.haml +1 -13
  51. data/app/views/spina/admin/journal/volumes/index.html.haml +7 -16
  52. data/config/locales/en.yml +25 -3
  53. data/config/routes.rb +5 -5
  54. data/lib/spina/admin/journal/engine.rb +12 -0
  55. data/lib/spina/admin/journal/version.rb +1 -1
  56. data/lib/spina/admin/journal.rb +1 -0
  57. metadata +47 -65
  58. data/app/assets/javascripts/spina/admin/journal/application.es6 +0 -72
  59. data/app/views/layouts/spina/admin/journal/articles.html.haml +0 -10
  60. data/app/views/layouts/spina/admin/journal/authors.html.haml +0 -10
  61. data/app/views/layouts/spina/admin/journal/institutions.html.haml +0 -10
  62. data/app/views/layouts/spina/admin/journal/issues.html.haml +0 -10
  63. data/app/views/layouts/spina/admin/journal/journals.html.haml +0 -10
  64. data/app/views/layouts/spina/admin/journal/licences.html.haml +0 -10
  65. data/app/views/layouts/spina/admin/journal/volumes.html.haml +0 -10
  66. data/app/views/spina/admin/journal/affiliations/_affiliation.html.haml +0 -8
  67. data/app/views/spina/admin/journal/application/_empty_list.html.haml +0 -3
  68. data/app/views/spina/admin/journal/articles/_article.html.haml +0 -10
  69. data/app/views/spina/admin/journal/authors/_author.html.haml +0 -8
  70. data/app/views/spina/admin/journal/authorships/_authorship.html.haml +0 -9
  71. data/app/views/spina/admin/journal/institutions/_institution.html.haml +0 -9
  72. data/app/views/spina/admin/journal/issues/_issue.html.haml +0 -9
  73. data/app/views/spina/admin/journal/journals/index.html.haml +0 -27
  74. data/app/views/spina/admin/journal/licences/_licence.html.haml +0 -11
  75. data/app/views/spina/admin/journal/volumes/_volume.html.haml +0 -7
  76. data/vendor/assets/javascripts/spina/admin/journal/html5sortable.js +0 -1295
@@ -1,9 +1,3 @@
1
- .page-form
2
- .page-form-group
3
- .page-form-label
4
- = ::Spina::Admin::Journal::Institution.human_attribute_name :name
5
- .page-form-content
6
- = f.text_field :name
1
+ = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Institution.human_attribute_name(:name)) do
2
+ = render Spina::Forms::TextFieldComponent.new(f, :name)
7
3
 
8
- - unless @institution.new_record?
9
- .pull-right= link_to t('spina.permanently_delete'), admin_journal_institution_path(@institution), method: :delete, data: { confirm: t('.delete_confirmation', name: @institution.name) }, class: 'button button-link button-danger'
@@ -1,10 +1 @@
1
- .table-container
2
- %table.table
3
- %thead
4
- %tr
5
- %th= ::Spina::Admin::Journal::Affiliation.human_attribute_name :name
6
- %th= ::Spina::Admin::Journal::Affiliation.human_attribute_name :institution
7
- %th= t '.number_of_articles'
8
- %th
9
- %tbody
10
- = render @institution.affiliations.any? ? @institution.affiliations : 'empty_list', message: t('.no_affiliations')
1
+ = render Spina::Admin::Journal::AffiliationsListComponent.new(affiliations: @institution.affiliations.sorted)
@@ -1,16 +1,8 @@
1
- - content_for(:header_actions) do
2
- = link_to new_admin_journal_institution_path, class: 'button button-primary' do
3
- = icon 'plus'
4
- = t '.new'
1
+ = render Spina::UserInterface::HeaderComponent.new do |header|
2
+ - header.actions do
3
+ .ml-3
4
+ = link_to new_admin_journal_institution_path, class: 'btn btn-primary w-full' do
5
+ = heroicon 'plus', style: :solid, class: 'w-7 h-7 -m1-2'
6
+ = t '.new'
5
7
 
6
- .well
7
- .table-container
8
- %table.table
9
- %thead
10
- %tr
11
- %th= ::Spina::Admin::Journal::Institution.human_attribute_name :name
12
- %th= t '.number_of_affiliations'
13
- %th
14
-
15
- %tbody
16
- = render @institutions.any? ? @institutions : 'empty_list', message: t('.empty')
8
+ = render Spina::Admin::Journal::InstitutionsListComponent.new(institutions: @institutions)
@@ -1,29 +1,29 @@
1
- - if @issue.errors.any?
2
- - content_for :notifications do
3
- .notification.notification-danger.animated.fadeInRight
4
- = icon 'exclamation'
5
- .notification-message
6
- = t 'spina.notifications.alert'
7
- %small= @issue.errors.full_messages.join('<br />').html_safe
8
- = link_to '#', data: { close_notification: true } do
9
- = icon 'cross'
1
+ %div{ data: { controller: 'tabs',
2
+ tabs: { active: 'cursor-default text-gray-900 bg-spina-dark bg-opacity-10',
3
+ inactive: 'cursor-pointer bg-transparent text-gray-400 border-transparent' } } }
4
+ = render Spina::UserInterface::HeaderComponent.new do |header|
5
+ - header.actions do
6
+ - if @issue.persisted?
7
+ = render Spina::UserInterface::DropdownComponent.new do |dropdown|
8
+ - dropdown.button(classes: "btn btn-default px-3") do
9
+ = heroicon('dots-horizontal', style: :solid, class: "w-5 h-5 text-gray-600")
10
10
 
11
- = form_for [:admin_journal, @issue], html: { autocomplete: 'off' } do |f|
12
- %header#header
13
- = render partial: 'spina/admin/shared/breadcrumbs'
11
+ - dropdown.menu do
12
+ = button_to t('spina.permanently_delete'), admin_journal_issue_path(@issue), method: :delete, class: "block w-full text-left px-4 py-2 text-sm leading-5 font-medium text-red-500 cursor-pointer bg-white hover:bg-red-100 hover:bg-opacity-50 hover:text-red-500 focus:outline-none focus:bg-gray-100 focus:text-gray-900", form: {data: { controller: 'confirm', confirm_message: t('.delete_confirmation', number: @issue.number) } }
14
13
 
15
- #header_actions
16
- %button.button.button-primary{ type: 'submit', style: 'margin-right: 0', data: { disable_with: t('spina.pages.saving') } }
17
- = icon 'check'
14
+ = button_tag type: :submit, form: dom_id(@issue), class: 'btn btn-primary', data: { controller: 'button', action: 'button#loading', loading_message: t('spina.ui.saving')} do
15
+ = heroicon('check', style: :solid, class: 'w-5 h-5 mr-1 -ml-2')
18
16
  = t '.save'
19
17
 
20
- .button{style: 'margin-right: 0'}= link_to t('spina.cancel'), admin_journal_institutions_path
18
+ - header.navigation do
19
+ %nav.-mb-3.mt-4
20
+ %ul.inline-flex.w-auto.rounded-md.bg-white
21
+ - @tabs.each do |tab|
22
+ %button.block.px-3.leading-relaxed.py-1.hover:text-gray-800.rounded-md.text-gray-400.font-medium.text-sm.flex.items-center.whitespace-nowrap{ type: 'button', data: { action: 'tabs#show', 'tabs-target': 'button', 'pane-id': "#{tab}" } }
23
+ = t ".#{tab}"
21
24
 
22
- %nav#secondary.tabs
23
- %ul
24
- - @tabs.each_with_index do |tab, i|
25
- %li{ class: ('active' if i == 0) }
26
- = link_to t(".#{tab}"), "##{tab}"
25
+ .p-4.md:p-8
26
+ - @tabs.each_with_index do |tab, i|
27
+ %div{ 'data-tabs-target': 'pane', id: tab, hidden: i != 0 }
28
+ = render "form_#{tab}"
27
29
 
28
- #details.tab-content.active= render 'form_details', f: f
29
- #articles.tab-content= render 'form_articles', f: f
@@ -1,14 +1 @@
1
- .sort-message
2
- .well
3
- .table-container
4
- %table.table
5
- %thead
6
- %tr
7
- %th= ::Spina::Admin::Journal::Volume.human_attribute_name :number
8
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :number
9
- %th= ::Spina::Admin::Journal::Article.human_attribute_name :number
10
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :date
11
- %th= ::Spina::Admin::Journal::Article.human_attribute_name :title
12
- %th
13
- %tbody.html5sortable{ data: { id: @issue.id, sorted_collection: 'admin_journal_articles', sort_url: !@issue.id.nil? && sort_admin_journal_articles_url(@issue) } }
14
- = render @articles && @articles.any? ? @articles : 'empty_list', message: t('.no_articles')
1
+ = render Spina::Admin::Journal::ArticlesListComponent.new(articles: @issue.articles, sortable: true)
@@ -1,32 +1,17 @@
1
- .page-form
2
- .page-form-group
3
- .page-form-label
4
- = ::Spina::Admin::Journal::Volume.human_attribute_name :number
5
- .page-form-content
6
- = f.collection_select :volume_id, ::Spina::Admin::Journal::Volume.sorted_desc, :id, :number
7
- .page-form-group
8
- .page-form-label
9
- = ::Spina::Admin::Journal::Issue.human_attribute_name :number
10
- %small= t '.issue_unchangeable'
11
- .page-form-content
12
- = f.number_field :number, disabled: true
13
- .page-form-group
14
- .page-form-label
15
- = ::Spina::Admin::Journal::Issue.human_attribute_name :title
16
- .page-form-content
17
- = f.text_field :title
18
- .page-form-group
19
- .page-form-label
20
- = ::Spina::Admin::Journal::Issue.human_attribute_name :date
21
- .page-form-content
22
- = f.date_field :date
1
+ = form_with model: [spina, :admin_journal, @issue], id: dom_id(@issue), html: { autocomplete: 'off' } do |f|
2
+ = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Volume.human_attribute_name(:number)) do
3
+ = f.collection_select :volume_id, ::Spina::Admin::Journal::Volume.sorted_desc, :id, :number
4
+ = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Issue.human_attribute_name(:number),
5
+ description: t('.issue_unchangeable')) do
6
+ = f.number_field :number, disabled: true
7
+ = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Issue.human_attribute_name(:title)) do
8
+ = render Spina::Forms::TextFieldComponent.new(f, :title)
9
+ = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Issue.human_attribute_name(:date)) do
10
+ = f.date_field :date
11
+
23
12
  = f.fields_for :"#{@locale}_content", @parts do |ff|
24
- = ff.hidden_field :type, value: ff.object.class.name
13
+ = ff.hidden_field :type, value: ff.object.class
25
14
  = ff.hidden_field :title
26
15
  = ff.hidden_field :name
27
16
 
28
- .page-form-group.page-part{ data: { name: ff.object.name } }
29
- = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.name)}/form", f: ff
30
-
31
- - unless @issue.new_record?
32
- .pull-right= link_to t('spina.permanently_delete'), admin_journal_issue_path(@issue), method: :delete, data: { confirm: t('.delete_confirmation', number: @issue.number) }, class: 'button button-link button-danger'
17
+ = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
@@ -1,18 +1,9 @@
1
- - content_for(:header_actions) do
2
- = link_to new_admin_journal_issue_path, class: 'button button-primary' do
3
- = icon 'plus'
4
- = t '.new'
1
+ = render Spina::UserInterface::HeaderComponent.new do |header|
2
+ - header.actions do
3
+ .ml-3
4
+ = link_to new_admin_journal_issue_path, class: 'btn btn-primary w-full' do
5
+ = heroicon 'plus', style: :solid, class: 'w-7 h-7 -m1-2'
6
+ = t '.new'
5
7
 
6
- .well
7
- .table-container
8
- %table.table
9
- %thead
10
- %tr
11
- %th= ::Spina::Admin::Journal::Volume.human_attribute_name :number
12
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :number
13
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :title
14
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :date
15
- %th
8
+ = render Spina::Admin::Journal::IssuesListComponent.new(issues: @issues, sortable: false)
16
9
 
17
- %tbody
18
- = render @issues.any? ? @issues : 'empty_list', message: t('.empty')
@@ -1,35 +1,25 @@
1
- - if @journal.errors.any?
2
- - content_for :notifications do
3
- .notification.notification-danger.animated.fadeInRight
4
- = icon 'exclamation'
5
- .notification-message
6
- = t 'spina.notifications.alert'
7
- %small= @journal.errors.full_messages.join('<br />').html_safe
8
- = link_to '#', data: { close_notification: true } do
9
- = icon 'cross'
1
+ = render Spina::UserInterface::HeaderComponent.new do |header|
2
+ - header.actions do
3
+ - if @journal.persisted?
4
+ = render Spina::UserInterface::DropdownComponent.new do |dropdown|
5
+ - dropdown.button(classes: "btn btn-default px-3") do
6
+ = heroicon('dots-horizontal', style: :solid, class: "w-5 h-5 text-gray-600")
10
7
 
11
- = form_for [:admin_journal, @journal], html: { autocomplete: "off" } do |f|
12
- %header#header
13
- .breadcrumbs
14
- = render_breadcrumbs
15
- #header_actions
16
- %button.button.button-primary{ type: 'submit', style: 'margin-right: 0', data: { disable_with: t('spina.pages.saving') } }
17
- = icon 'check'
18
- = t '.save'
19
- .tab-content.active
20
- .page-form
21
- .page-form-group
22
- .page-form-label
23
- = ::Spina::Admin::Journal::Journal.human_attribute_name :name
24
- .page-form-content
25
- = f.text_field :name
26
- = f.fields_for :"#{@locale}_content", @parts do |ff|
27
- = ff.hidden_field :type, value: ff.object.class.name
28
- = ff.hidden_field :title
29
- = ff.hidden_field :name
8
+ - dropdown.menu do
9
+ = button_to t('spina.permanently_delete'), admin_journal_journal_path(@journal), method: :delete, class: "block w-full text-left px-4 py-2 text-sm leading-5 font-medium text-red-500 cursor-pointer bg-white hover:bg-red-100 hover:bg-opacity-50 hover:text-red-500 focus:outline-none focus:bg-gray-100 focus:text-gray-900", form: {data: { controller: 'confirm', confirm_message: t('.delete_confirmation', name: @journal.name) } }
30
10
 
31
- .page-form-group.page-part{ data: { name: ff.object.name } }
32
- = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.name)}/form", f: ff
11
+ = button_tag type: :submit, form: dom_id(@journal), class: 'btn btn-primary', data: { controller: 'button', action: 'button#loading', loading_message: t('spina.ui.saving')} do
12
+ = heroicon('check', style: :solid, class: 'w-5 h-5 mr-1 -ml-2')
13
+ = t '.save'
33
14
 
34
- - unless @journal.new_record?
35
- .pull-right= link_to t('spina.permanently_delete'), admin_journal_journal_path(@journal), method: :delete, data: { confirm: t('.delete_confirmation', name: @journal.name) }, class: 'button button-link button-danger'
15
+ .p-4.md:p-8
16
+ = form_with model: [spina, :admin_journal, @journal], id: dom_id(@journal), html: { autocomplete: 'off' } do |f|
17
+ = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Journal.human_attribute_name(:name)) do
18
+ = render Spina::Forms::TextFieldComponent.new(f, :name)
19
+
20
+ = f.fields_for :"#{@locale}_content", @parts do |ff|
21
+ = ff.hidden_field :type, value: ff.object.class
22
+ = ff.hidden_field :title
23
+ = ff.hidden_field :name
24
+
25
+ = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
@@ -1,43 +1,28 @@
1
- - if @licence.errors.any?
2
- - content_for :notifications do
3
- .notification.notification-danger.animated.fadeInRight
4
- = icon 'exclamation'
5
- .notification-message
6
- = t 'spina.notifications.alert'
7
- %small= @licence.errors.full_messages.join('<br />').html_safe
8
- = link_to '#', data: { close_notification: true } do
9
- = icon 'cross'
1
+ = render Spina::UserInterface::HeaderComponent.new do |header|
2
+ - header.actions do
3
+ - if @licence.persisted?
4
+ = render Spina::UserInterface::DropdownComponent.new do |dropdown|
5
+ - dropdown.button(classes: "btn btn-default px-3") do
6
+ = heroicon('dots-horizontal', style: :solid, class: "w-5 h-5 text-gray-600")
10
7
 
11
- = form_for [:admin_journal, @licence], html: { autocomplete: 'off' } do |f|
12
- %header#header
13
- = render partial: 'spina/admin/shared/breadcrumbs'
8
+ - dropdown.menu do
9
+ = button_to t('spina.permanently_delete'), admin_journal_licence_path(@licence), method: :delete, class: "block w-full text-left px-4 py-2 text-sm leading-5 font-medium text-red-500 cursor-pointer bg-white hover:bg-red-100 hover:bg-opacity-50 hover:text-red-500 focus:outline-none focus:bg-gray-100 focus:text-gray-900", form: {data: { controller: 'confirm', confirm_message: t('.delete_confirmation', name: @licence.name) } }
14
10
 
15
- #header_actions
16
- %button.button.button-primary{ type: 'submit', style: 'margin-right: 0', data: { disable_with: t('spina.pages.saving') } }
17
- = icon 'check'
18
- = t '.save'
11
+ = button_tag type: :submit, form: dom_id(@licence), class: 'btn btn-primary', data: { controller: 'button', action: 'button#loading', loading_message: t('spina.ui.saving')} do
12
+ = heroicon('check', style: :solid, class: 'w-5 h-5 mr-1 -ml-2')
13
+ = t '.save'
19
14
 
20
- .button{ style: 'margin-right: 0' }= link_to t('spina.cancel'), admin_journal_licences_path
21
-
22
- .page-form
23
- .page-form-group
24
- .page-form-label
25
- = ::Spina::Admin::Journal::Licence.human_attribute_name :name
26
- .page-form-content
27
- = f.text_field :name
28
- .page-form-group
29
- .page-form-label
30
- = ::Spina::Admin::Journal::Licence.human_attribute_name :abbreviated_name
31
- .page-form-content
32
- = f.text_field :abbreviated_name
15
+ .p-4.md:p-8
16
+ = form_with model: [spina, :admin_journal, @licence], id: dom_id(@licence), html: { autocomplete: 'off' } do |f|
17
+ = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Licence.human_attribute_name(:name)) do
18
+ = render Spina::Forms::TextFieldComponent.new(f, :name)
19
+ = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Licence.human_attribute_name(:abbreviated_name)) do
20
+ = render Spina::Forms::TextFieldComponent.new(f, :abbreviated_name)
33
21
 
34
22
  = f.fields_for :"#{@locale}_content", @parts do |ff|
35
- = ff.hidden_field :type, value: ff.object.class.name
23
+ = ff.hidden_field :type, value: ff.object.class
36
24
  = ff.hidden_field :title
37
25
  = ff.hidden_field :name
38
26
 
39
- .page-form-group.page-part{ data: { name: ff.object.name } }
40
- = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.name)}/form", f: ff
27
+ = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
41
28
 
42
- - unless @licence.new_record?
43
- .pull-right= link_to t('spina.permanently_delete'), admin_journal_licence_path(@licence), method: :delete, data: { confirm: t('.delete_confirmation', name: @licence.name) }, class: 'button button-link button-danger'
@@ -1,17 +1,8 @@
1
- - content_for(:header_actions) do
2
- = link_to new_admin_journal_licence_path, class: 'button button-primary' do
3
- = icon 'plus'
4
- = t '.new'
1
+ = render Spina::UserInterface::HeaderComponent.new do |header|
2
+ - header.actions do
3
+ .ml-3
4
+ = link_to new_admin_journal_licence_path, class: 'btn btn-primary w-full' do
5
+ = heroicon 'plus', style: :solid, class: 'w-7 h-7 -m1-2'
6
+ = t '.new'
5
7
 
6
- .well
7
- .table-container
8
- %table.table
9
- %thead
10
- %tr
11
- %th= ::Spina::Admin::Journal::Licence.human_attribute_name :name
12
- %th= ::Spina::Admin::Journal::Licence.human_attribute_name :abbreviated_name
13
- %th= t '.num_articles'
14
- %th
15
-
16
- %tbody
17
- = render @licences.any? ? @licences : 'empty_list', message: t('.empty')
8
+ = render Spina::Admin::Journal::LicencesListComponent.new(licences: @licences)
@@ -1,15 +1,28 @@
1
- = form_for [:admin_journal, @volume], html: { autocomplete: 'off' } do |f|
2
- %header#header
3
- = render partial: 'spina/admin/shared/breadcrumbs'
1
+ %div{ data: { controller: 'tabs',
2
+ tabs: { active: 'cursor-default text-gray-900 bg-spina-dark bg-opacity-10',
3
+ inactive: 'cursor-pointer bg-transparent text-gray-400 border-transparent' } } }
4
+ = render Spina::UserInterface::HeaderComponent.new do |header|
5
+ - header.actions do
6
+ - if @volume.persisted?
7
+ = render Spina::UserInterface::DropdownComponent.new do |dropdown|
8
+ - dropdown.button(classes: "btn btn-default px-3") do
9
+ = heroicon('dots-horizontal', style: :solid, class: "w-5 h-5 text-gray-600")
4
10
 
5
- #header_actions
6
- .button{ style: 'margin-right: 0' }= link_to t('spina.cancel'), admin_journal_volumes_path
11
+ - dropdown.menu do
12
+ = button_to t('spina.permanently_delete'), admin_journal_volume_path(@volume), method: :delete, class: "block w-full text-left px-4 py-2 text-sm leading-5 font-medium text-red-500 cursor-pointer bg-white hover:bg-red-100 hover:bg-opacity-50 hover:text-red-500 focus:outline-none focus:bg-gray-100 focus:text-gray-900", form: {data: { controller: 'confirm', confirm_message: t('.delete_confirmation', number: @volume.number) } }
7
13
 
8
- %nav#secondary.tabs
9
- %ul
10
- - @tabs.each_with_index do |tab, i|
11
- %li{ class: ('active' if i == 0) }
12
- = link_to t(".#{tab}"), "##{tab}"
14
+ = button_tag type: :submit, form: dom_id(@volume), class: 'btn btn-primary', data: { controller: 'button', action: 'button#loading', loading_message: t('spina.ui.saving')} do
15
+ = heroicon('check', style: :solid, class: 'w-5 h-5 mr-1 -ml-2')
16
+ = t '.save'
13
17
 
14
- #details.tab-content.active= render 'form_details', f: f
15
- #issues.tab-content= render 'form_issues', f: f
18
+ - header.navigation do
19
+ %nav.-mb-3.mt-4
20
+ %ul.inline-flex.w-auto.rounded-md.bg-white
21
+ - @tabs.each do |tab|
22
+ %button.block.px-3.leading-relaxed.py-1.hover:text-gray-800.rounded-md.text-gray-400.font-medium.text-sm.flex.items-center.whitespace-nowrap{ type: 'button', data: { action: 'tabs#show', 'tabs-target': 'button', 'pane-id': "#{tab}" } }
23
+ = t ".#{tab}"
24
+
25
+ .p-4.md:p-8
26
+ - @tabs.each_with_index do |tab, i|
27
+ %div{ 'data-tabs-target': 'pane', id: tab, hidden: i != 0 }
28
+ = render "form_#{tab}"
@@ -1,10 +1,4 @@
1
- .page-form
2
- .page-form-group
3
- .page-form-label
4
- = ::Spina::Admin::Journal::Volume.human_attribute_name :number
5
- %small= t '.unchangeable'
6
- .page-form-content
7
- = f.number_field :number, disabled: true
8
-
9
- - unless @volume.new_record?
10
- .pull-right= link_to t('spina.permanently_delete'), admin_journal_volume_path(@volume), method: :delete, data: { confirm: t('.delete_confirmation', number: @volume.number) }, class: 'button button-link button-danger'
1
+ = form_with model: [spina, :admin_journal, @volume], id: dom_id(@volume), html: { autocomplete: 'off' } do |f|
2
+ = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Volume.human_attribute_name(:number),
3
+ description: t('.unchangeable')) do
4
+ = f.number_field :number, disabled: true
@@ -1,13 +1 @@
1
- .sort-message
2
- .well
3
- .table-container
4
- %table.table
5
- %thead
6
- %tr
7
- %th= ::Spina::Admin::Journal::Volume.human_attribute_name :number
8
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :number
9
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :title
10
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :date
11
- %th
12
- %tbody.html5sortable{ data: { id: @volume.id, sorted_collection: 'admin_journal_issues', sort_url: sort_admin_journal_issues_url(@volume) } }
13
- = render @volume.issues.any? ? @volume.issues.sorted_asc : 'empty_list', message: t('.no_issues')
1
+ = render Spina::Admin::Journal::IssuesListComponent.new(issues: @volume.issues, sortable: true)
@@ -1,17 +1,8 @@
1
- - content_for(:header_actions) do
2
- = link_to admin_journal_volumes_path, method: :post, class: 'button button-primary' do
3
- = icon 'plus'
4
- = t '.new'
1
+ = render Spina::UserInterface::HeaderComponent.new do |header|
2
+ - header.actions do
3
+ .ml-3
4
+ = link_to new_admin_journal_volume_path, class: 'btn btn-primary w-full' do
5
+ = heroicon 'plus', style: :solid, class: 'w-7 h-7 -m1-2'
6
+ = t '.new'
5
7
 
6
- .sort-message
7
- .well
8
- .table-container
9
- %table.table
10
- %thead
11
- %tr
12
- %th= ::Spina::Admin::Journal::Volume.human_attribute_name :number
13
- %th= t '.date'
14
- %th
15
-
16
- %tbody.html5sortable{ data: { id: ::Spina::Admin::Journal::Journal.instance.id, sorted_collection: 'admin_journal_volumes', sort_url: sort_admin_journal_volumes_url(::Spina::Admin::Journal::Journal.instance.id) } }
17
- = render @volumes.any? ? @volumes : 'empty_list', message: t('.empty')
8
+ = render Spina::Admin::Journal::VolumesListComponent.new(volumes: @volumes)
@@ -4,12 +4,16 @@ en:
4
4
  journal:
5
5
  navigation_title: Journal settings
6
6
  unnamed_journal: Unnamed journal
7
+ edit: Edit
8
+ sort_info: "NB: item numbers will only update after you refresh the page."
9
+ empty_list: There are no items.
7
10
  journals:
8
11
  index:
9
12
  new: New journal
10
13
  no_journals: There are currently no journals saved.
11
14
  update:
12
15
  saved: Journal saved.
16
+ failed: Failed to save journal.
13
17
  destroy:
14
18
  deleted: Journal deleted.
15
19
  form:
@@ -26,13 +30,17 @@ en:
26
30
  date: Year
27
31
  view: View
28
32
  empty: There are no volumes.
33
+ new:
34
+ created: Volume %{number} created.
29
35
  create:
30
36
  created: Volume <strong>%{number}</strong> created.
31
37
  update:
32
38
  saved: Volume saved.
39
+ form:
40
+ save: Save
41
+ delete_confirmation: "Are you sure you want to delete Volume <strong>#%{number}</strong>?"
33
42
  form_details:
34
43
  unchangeable: The volume number can be changed by clicking 'Change Order' in the index view.
35
- delete_confirmation: "Are you sure you want to delete Volume <strong>#%{number}</strong>?"
36
44
  form_issues:
37
45
  volume_number: "Volume #"
38
46
  issue_number: "Issue #"
@@ -42,6 +50,7 @@ en:
42
50
  sort_success: Sorted successfully!
43
51
  sort_error: There was an error when sorting. Check the server logs for more information.
44
52
  issues:
53
+ volume_issue: "Volume %{volume_number} Issue %{issue_number}"
45
54
  issue_number: "Issue #%{number}"
46
55
  index:
47
56
  new: New issue
@@ -50,19 +59,23 @@ en:
50
59
  new: New issue
51
60
  create:
52
61
  saved: Issue saved.
62
+ failed: Failed to create issue.
53
63
  update:
54
64
  saved: Issue saved.
65
+ failed: Failed to save issue.
55
66
  destroy:
56
67
  deleted: Issue deleted.
57
68
  form:
58
69
  save: Save issue
70
+ delete_confirmation: "Are you sure you want to delete Issue <strong>#%{number}</strong>?"
59
71
  form_details:
60
72
  issue_unchangeable: The issue order can be changed in the 'Volumes' tab.
61
- delete_confirmation: "Are you sure you want to delete Issue <strong>#%{number}</strong>?"
62
73
  sort:
63
74
  sort_success: Sorted successfully!
64
75
  sort_error: There was an error when sorting. Check the server logs for more information.
65
76
  articles:
77
+ article_number: "Vol. %{volume_number}(%{issue_number}) Article #%{article_number}"
78
+ title_author: "%{title} (%{author})"
66
79
  index:
67
80
  new: New article
68
81
  empty: There are no articles.
@@ -70,16 +83,18 @@ en:
70
83
  new: New article
71
84
  create:
72
85
  saved: Article saved.
86
+ failed: Failed to create article.
73
87
  update:
74
88
  saved: Article saved.
89
+ failed: Failed to save article.
75
90
  destroy:
76
91
  deleted: Article deleted.
77
92
  form:
78
93
  save: Save article
94
+ delete_confirmation: "Are you sure you want to delete '<strong>%{title}</strong>'?"
79
95
  form_details:
80
96
  volume_issue: "Volume %{volume_number} Issue %{issue_number}"
81
97
  unchangeable: Article order can be changed in the issue.
82
- delete_confirmation: "Are you sure you want to delete '<strong>%{title}</strong>'?"
83
98
  form_authors:
84
99
  no_authors: There are no authors.
85
100
  number_of_articles: "# Articles"
@@ -89,6 +104,7 @@ en:
89
104
  sort_success: Sorted successfully!
90
105
  sort_error: There was an error when sorting. Check the server logs for more information.
91
106
  authors:
107
+ name_institution: "%{name} (%{institution})"
92
108
  index:
93
109
  new: New author
94
110
  number_of_articles: "# Articles"
@@ -96,8 +112,10 @@ en:
96
112
  new: New author
97
113
  create:
98
114
  saved: Author saved.
115
+ failed: Failed to create author.
99
116
  update:
100
117
  saved: Author saved.
118
+ failed: Failed to save author.
101
119
  destroy:
102
120
  deleted: Author deleted.
103
121
  sort:
@@ -121,8 +139,10 @@ en:
121
139
  new: New institution
122
140
  create:
123
141
  saved: Institution saved.
142
+ failed: Failed to create institution.
124
143
  update:
125
144
  saved: Institution saved.
145
+ failed: Failed to save institution.
126
146
  destroy:
127
147
  deleted: Institution deleted.
128
148
  form:
@@ -139,8 +159,10 @@ en:
139
159
  new: New licence
140
160
  create:
141
161
  saved: Licence saved.
162
+ failed: Failed to create licence.
142
163
  update:
143
164
  saved: Licence saved.
165
+ failed: Failed to save licence.
144
166
  destroy:
145
167
  deleted: Licence deleted.
146
168
  form:
data/config/routes.rb CHANGED
@@ -4,17 +4,17 @@ Spina::Engine.routes.draw do
4
4
  namespace :admin, path: Spina.config.backend_path do
5
5
  namespace :journal do
6
6
  resources :journals, only: %i[edit update destroy]
7
- resources :volumes, except: %i[show new update] do
8
- patch 'sort/:journal_id' => 'volumes#sort', as: :sort, on: :collection
7
+ resources :volumes, except: %i[show update] do
8
+ post 'sort/:journal_id' => 'volumes#sort', as: :sort, on: :collection
9
9
  end
10
10
  resources :issues, except: %i[show] do
11
- patch 'sort/:volume_id' => 'issues#sort', as: :sort, on: :collection
11
+ post 'sort/:volume_id' => 'issues#sort', as: :sort, on: :collection
12
12
  end
13
13
  resources :articles, except: %i[show] do
14
- patch 'sort/:issue_id' => 'articles#sort', as: :sort, on: :collection
14
+ post 'sort/:issue_id' => 'articles#sort', as: :sort, on: :collection
15
15
  end
16
16
  resources :authors, except: %i[show] do
17
- patch 'sort/:article_id' => 'authors#sort', as: :sort, on: :collection
17
+ post 'sort/:article_id' => 'authors#sort', as: :sort, on: :collection
18
18
  end
19
19
 
20
20
  resources :institutions, except: %i[show]
@@ -7,6 +7,18 @@ module Spina
7
7
  class Engine < ::Rails::Engine
8
8
  isolate_namespace Spina::Admin::Journal
9
9
 
10
+ initializer 'spina.admin.journal.assets' do
11
+ Spina.config.importmap.draw do
12
+ pin_all_from Spina::Admin::Journal::Engine.root.join('app/assets/javascripts/spina/admin/journal/controllers'), # rubocop:disable Layout/LineLength
13
+ under: 'controllers', to: 'spina/admin/journal/controllers'
14
+ end
15
+
16
+ Spina.config.tailwind_content.concat(["#{Spina::Admin::Journal::Engine.root}/app/views/**/*.*",
17
+ "#{Spina::Admin::Journal::Engine.root}/app/components/**/*.*",
18
+ "#{Spina::Admin::Journal::Engine.root}/app/helpers/**/*.*",
19
+ "#{Spina::Admin::Journal::Engine.root}/app/assets/javascripts/**/*.js"])
20
+ end
21
+
10
22
  config.before_initialize do
11
23
  ::Spina::Plugin.register do |plugin|
12
24
  plugin.name = 'journal'
@@ -3,7 +3,7 @@
3
3
  module Spina
4
4
  module Admin
5
5
  module Journal
6
- VERSION = '0.6.2'
6
+ VERSION = '1.0.0.rc1'
7
7
  end
8
8
  end
9
9
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'haml-rails'
3
4
  require 'spina'
4
5
  require 'spina/admin/journal/engine'
5
6
  require 'rails-i18n'