integral 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +4 -3
  3. data/app/assets/javascripts/integral/backend.js +86 -2
  4. data/app/assets/javascripts/integral/support/character_counter.js +13 -8
  5. data/app/assets/javascripts/integral/support/list.coffee +1 -0
  6. data/app/assets/javascripts/integral/support/record_selector.coffee +2 -0
  7. data/app/assets/javascripts/integral/support/slug_generator.coffee +1 -0
  8. data/app/assets/stylesheets/integral/backend.sass +34 -23
  9. data/app/assets/stylesheets/integral/backend/_foundation_settings.scss +2 -2
  10. data/app/assets/stylesheets/integral/backend/dashboard-layout.scss +27 -63
  11. data/app/assets/stylesheets/integral/backend/devise.sass +2 -3
  12. data/app/assets/stylesheets/integral/backend/materialize-tags.sass +1 -0
  13. data/app/assets/stylesheets/integral/backend/modules/dropdown_pane_notifications.scss +150 -0
  14. data/app/assets/stylesheets/integral/backend/modules/dropdown_pane_profile.scss +59 -0
  15. data/app/assets/stylesheets/integral/backend/shared.sass +41 -2
  16. data/app/assets/stylesheets/integral/frontend/layout.sass +10 -0
  17. data/app/assets/stylesheets/integral/support/media-query-indicator.sass +4 -4
  18. data/app/controllers/integral/backend/activities_controller.rb +21 -27
  19. data/app/controllers/integral/backend/base_controller.rb +87 -37
  20. data/app/controllers/integral/backend/images_controller.rb +26 -8
  21. data/app/controllers/integral/backend/lists_controller.rb +2 -14
  22. data/app/controllers/integral/backend/notification_subscriptions_controller.rb +23 -0
  23. data/app/controllers/integral/backend/pages_controller.rb +0 -4
  24. data/app/controllers/integral/backend/posts_controller.rb +0 -4
  25. data/app/controllers/integral/backend/settings_controller.rb +4 -0
  26. data/app/controllers/integral/backend/static_pages_controller.rb +6 -0
  27. data/app/controllers/integral/backend/users_controller.rb +43 -24
  28. data/app/controllers/integral/blog_controller.rb +12 -0
  29. data/app/controllers/integral/categories_controller.rb +17 -3
  30. data/app/controllers/integral/tags_controller.rb +5 -2
  31. data/app/decorators/integral/base_decorator.rb +16 -0
  32. data/app/decorators/integral/image_decorator.rb +2 -2
  33. data/app/decorators/integral/list_decorator.rb +1 -13
  34. data/app/decorators/integral/notification/notification_decorator.rb +74 -0
  35. data/app/decorators/integral/page_decorator.rb +1 -13
  36. data/app/decorators/integral/post_decorator.rb +1 -2
  37. data/app/decorators/integral/user_decorator.rb +1 -13
  38. data/app/decorators/integral/version_decorator.rb +8 -4
  39. data/app/helpers/integral/backend/base_helper.rb +97 -31
  40. data/app/jobs/integral/application_job.rb +1 -0
  41. data/app/jobs/integral/newsletter_signup_job.rb +0 -2
  42. data/app/mailers/integral/devise_mailer.rb +6 -0
  43. data/app/models/concerns/integral/notification/subscribable.rb +67 -0
  44. data/app/models/integral/application_record.rb +9 -0
  45. data/app/models/integral/category.rb +9 -0
  46. data/app/models/integral/image.rb +40 -3
  47. data/app/models/integral/list.rb +10 -2
  48. data/app/models/integral/list_item.rb +14 -14
  49. data/app/models/integral/list_item_connection.rb +6 -0
  50. data/app/models/integral/notification/notification.rb +28 -0
  51. data/app/models/integral/notification/subscription.rb +14 -0
  52. data/app/models/integral/page.rb +15 -8
  53. data/app/models/integral/post.rb +11 -13
  54. data/app/models/integral/user.rb +45 -2
  55. data/app/policies/integral/base_policy.rb +7 -12
  56. data/app/policies/integral/page_policy.rb +1 -0
  57. data/app/policies/integral/version_policy.rb +0 -8
  58. data/app/views/devise/invitations/edit.haml +1 -4
  59. data/app/views/devise/mailer/invitation_instructions.inky-haml +20 -0
  60. data/app/views/integral/backend/activities/grid/_dropdown_actions.haml +1 -0
  61. data/app/views/integral/backend/activities/grid/_row_content.haml +13 -0
  62. data/app/views/integral/backend/activities/index.haml +7 -13
  63. data/app/views/integral/backend/activities/shared/_grid.haml +35 -20
  64. data/app/views/integral/backend/activities/shared/index.haml +12 -12
  65. data/app/views/integral/backend/activities/shared/show.haml +7 -7
  66. data/app/views/integral/backend/activities/show.haml +1 -1
  67. data/app/views/integral/backend/categories/_modal.haml +2 -3
  68. data/app/views/integral/backend/images/_form.haml +13 -25
  69. data/app/views/integral/backend/images/edit.haml +1 -9
  70. data/app/views/integral/backend/images/grid/_dropdown_actions.haml +5 -0
  71. data/app/views/integral/backend/images/grid/_row_content.haml +5 -0
  72. data/app/views/integral/backend/images/index.haml +11 -17
  73. data/app/views/integral/backend/images/list.haml +11 -0
  74. data/app/views/integral/backend/images/show.haml +26 -0
  75. data/app/views/integral/backend/lists/_form.haml +6 -19
  76. data/app/views/integral/backend/lists/_item_modal.haml +3 -3
  77. data/app/views/integral/backend/lists/_manager.haml +11 -13
  78. data/app/views/integral/backend/lists/edit.haml +6 -20
  79. data/app/views/integral/backend/lists/grid/_dropdown_actions.haml +9 -0
  80. data/app/views/integral/backend/lists/grid/_row_content.haml +3 -0
  81. data/app/views/integral/backend/lists/index.haml +11 -17
  82. data/app/views/integral/backend/lists/list.haml +11 -0
  83. data/app/views/integral/backend/lists/show.haml +30 -0
  84. data/app/views/integral/backend/notifications/_notification.haml +21 -0
  85. data/app/views/integral/backend/pages/_form.haml +19 -43
  86. data/app/views/integral/backend/pages/edit.haml +4 -12
  87. data/app/views/integral/backend/pages/grid/_dropdown_actions.haml +11 -0
  88. data/app/views/integral/backend/pages/grid/_row_content.haml +5 -0
  89. data/app/views/integral/backend/pages/index.haml +6 -6
  90. data/app/views/integral/backend/pages/list.haml +12 -19
  91. data/app/views/integral/backend/pages/show.haml +19 -35
  92. data/app/views/integral/backend/posts/_form.haml +18 -56
  93. data/app/views/integral/backend/posts/edit.haml +4 -14
  94. data/app/views/integral/backend/posts/grid/_dropdown_actions.haml +10 -0
  95. data/app/views/integral/backend/posts/grid/_row_content.haml +6 -0
  96. data/app/views/integral/backend/posts/index.haml +6 -6
  97. data/app/views/integral/backend/posts/list.haml +11 -18
  98. data/app/views/integral/backend/posts/new.haml +0 -1
  99. data/app/views/integral/backend/posts/show.haml +18 -41
  100. data/app/views/integral/backend/shared/_breadcrumbs.haml +7 -4
  101. data/app/views/integral/backend/shared/_image_preview.haml +10 -3
  102. data/app/views/integral/backend/shared/_image_selector.haml +1 -1
  103. data/app/views/integral/backend/shared/_notification_subscription_toggle.haml +22 -0
  104. data/app/views/integral/backend/shared/action_bar/_index.haml +9 -0
  105. data/app/views/integral/backend/shared/action_bar/_show.haml +3 -0
  106. data/app/views/integral/backend/shared/cards/_at_a_glance.haml +3 -3
  107. data/app/views/integral/backend/shared/cards/_categories.haml +27 -28
  108. data/app/views/integral/backend/shared/cards/_object.haml +1 -1
  109. data/app/views/integral/backend/shared/cards/_recent_activity.haml +12 -12
  110. data/app/views/integral/backend/shared/cards/_recent_resources.haml +17 -0
  111. data/app/views/integral/backend/shared/cards/_top_post_authors.haml +14 -15
  112. data/app/views/integral/backend/shared/cards/_welcome.haml +24 -25
  113. data/app/views/integral/backend/shared/{_empty_grid.haml → grid/_empty.haml} +0 -0
  114. data/app/views/integral/backend/shared/grid/_form.haml +9 -0
  115. data/app/views/integral/backend/shared/grid/_grid.haml +21 -0
  116. data/app/views/integral/backend/shared/{_pagination.haml → grid/_pagination.haml} +0 -0
  117. data/app/views/integral/backend/shared/grid/_row_layout.haml +8 -0
  118. data/app/views/integral/backend/shared/record_selector/_collection.haml +1 -0
  119. data/app/views/integral/backend/shared/record_selector/_modal.haml +9 -10
  120. data/app/views/integral/backend/static_pages/dashboard.haml +6 -7
  121. data/app/views/integral/backend/users/_form.haml +34 -46
  122. data/app/views/integral/backend/users/grid/_dropdown_actions.haml +17 -0
  123. data/app/views/integral/backend/users/grid/_row_content.haml +8 -0
  124. data/app/views/integral/backend/users/index.haml +6 -6
  125. data/app/views/integral/backend/users/list.haml +10 -16
  126. data/app/views/integral/backend/users/show.haml +10 -1
  127. data/app/views/integral/categories/show.haml +3 -3
  128. data/app/views/integral/posts/_article_footer.haml +1 -1
  129. data/app/views/integral/posts/_card.haml +1 -1
  130. data/app/views/integral/posts/_most_read_section.haml +1 -1
  131. data/app/views/integral/posts/_post.haml +1 -1
  132. data/app/views/integral/posts/templates/default.haml +1 -1
  133. data/app/views/integral/shared/sidebar/_item.haml +1 -1
  134. data/app/views/layouts/integral/backend.html.haml +24 -5
  135. data/app/views/layouts/integral/backend/_create_dropdown.haml +1 -30
  136. data/app/views/layouts/integral/backend/_main_menu_items.haml +1 -101
  137. data/config/initializers/devise.rb +1 -1
  138. data/config/locales/en.yml +60 -2
  139. data/config/routes.rb +2 -0
  140. data/db/migrate/20200407022636_create_integral_notifications.rb +25 -0
  141. data/db/migrate/20200421223602_add_status_to_integral_users.rb +5 -0
  142. data/db/seeds.rb +15 -11
  143. data/lib/integral.rb +1 -0
  144. data/lib/integral/acts_as_integral.rb +115 -0
  145. data/lib/integral/acts_as_listable.rb +1 -1
  146. data/lib/integral/engine.rb +9 -0
  147. data/lib/integral/grids/activities_grid.rb +0 -1
  148. data/lib/integral/grids/lists_grid.rb +1 -0
  149. data/lib/integral/grids/posts_grid.rb +5 -1
  150. data/lib/integral/grids/users_grid.rb +5 -0
  151. data/lib/integral/list_renderer.rb +5 -1
  152. data/lib/integral/router.rb +20 -4
  153. data/lib/integral/version.rb +1 -1
  154. data/spec/factories.rb +15 -1
  155. metadata +45 -39
  156. data/app/decorators/integral/category_version_decorator.rb +0 -7
  157. data/app/decorators/integral/image_version_decorator.rb +0 -7
  158. data/app/decorators/integral/list_version_decorator.rb +0 -7
  159. data/app/decorators/integral/page_version_decorator.rb +0 -7
  160. data/app/decorators/integral/post_version_decorator.rb +0 -7
  161. data/app/decorators/integral/user_version_decorator.rb +0 -7
  162. data/app/views/devise/mailer/invitation_instructions.html.erb +0 -13
  163. data/app/views/integral/backend/activities/_grid.haml +0 -22
  164. data/app/views/integral/backend/images/_grid.haml +0 -16
  165. data/app/views/integral/backend/lists/_grid.haml +0 -14
  166. data/app/views/integral/backend/pages/_grid.haml +0 -46
  167. data/app/views/integral/backend/posts/_grid.haml +0 -51
  168. data/app/views/integral/backend/shared/_grid.haml +0 -18
  169. data/app/views/integral/backend/shared/cards/_recent_pages.haml +0 -19
  170. data/app/views/integral/backend/shared/cards/_recent_posts.haml +0 -18
  171. data/app/views/integral/backend/shared/cards/_recent_users.haml +0 -19
  172. data/app/views/integral/backend/users/_grid.haml +0 -36
@@ -2,20 +2,10 @@
2
2
 
3
3
  = content_for :actionbar do
4
4
  %ul.menu.horizontal
5
- %li
6
- = link_to post_url(@resource), class: 'button white' do
7
- = icon('eye')
8
- = t('integral.actions.view')
9
- - if policy(Integral::Post).duplicate?
10
- %li
11
- = link_to duplicate_backend_post_url(@resource.id), class: 'button white', method: :post, data: { confirm: t('integral.actions.confirmation.clone') } do
12
- = icon('history')
13
- = t('integral.actions.clone')
5
+ = link_to t('integral.actions.view_on_site'), post_url(@resource), class: 'button white', icon: :eye, wrapper: :li
6
+ - if policy(resource_klass).duplicate?
7
+ = link_to t('integral.actions.clone'), duplicate_backend_resource_url(@resource.id), class: 'button white', method: :post, data: { confirm: t('integral.actions.confirmation.clone') }, icon: :history, wrapper: :li
14
8
  - if policy(Integral::Version).manager?
15
- %li
16
- = link_to activities_backend_post_url(@resource.id), class: 'button white' do
17
- = icon('history')
18
- = t('integral.navigation.activity')
9
+ = link_to t('integral.navigation.activity'), activities_backend_resource_url(@resource.id), class: 'button white', icon: :history, wrapper: :li
19
10
 
20
11
  = render 'form'
21
-
@@ -0,0 +1,10 @@
1
+ - if policy(resource_klass).update?
2
+ = link_to t('integral.actions.edit'), edit_backend_resource_url(resource.id), icon: :edit, wrapper: :li
3
+ = link_to t('integral.actions.view_on_site'), post_url(resource), icon: :eye, wrapper: :li
4
+ = link_to t('integral.actions.open_in_new_tab'), backend_resource_url(resource.id), target: :blank, icon: 'external-link', wrapper: :li
5
+ - if policy(resource_klass).duplicate?
6
+ = link_to t('integral.actions.clone'), duplicate_backend_resource_url(resource.id), method: :post, data: { confirm: t('integral.actions.confirmation.clone') }, icon: :clone, wrapper: :li
7
+ - if policy(Integral::Version).manager?
8
+ = link_to t('integral.actions.view_history'), activities_backend_resource_url(resource.id), icon: :history, wrapper: :li
9
+ - if policy(resource_klass).destroy?
10
+ = link_to t('integral.actions.delete'), backend_resource_url(resource.id), method: :delete, data: { confirm: t('integral.actions.confirmation.deletion') }, icon: :remove, wrapper: :li
@@ -0,0 +1,6 @@
1
+ %td= resource.title.truncate(30)
2
+ %td= resource.category.title
3
+ %td
4
+ %span.label= t("integral.statuses.#{resource.status}")
5
+ %td= number_with_delimiter(resource.view_count)
6
+ %td= l(resource.updated_at, format: :long)
@@ -1,14 +1,14 @@
1
- .grid-x.grid-padding-x
1
+ .grid-x
2
2
  -# Left Column
3
3
  .cell.large-6
4
- .grid-x.grid-padding-x
5
- .cell= render_card(:recent_posts)
4
+ .grid-x
5
+ .cell= render_card(:recent_resources)
6
6
  .cell= render_card(:categories)
7
- .cell= render_card(:at_a_glance, { dataset: dataset_at_a_glance_posts })
7
+ .cell= render_card(:at_a_glance)
8
8
 
9
9
  -# Right Column
10
10
  .cell.large-6
11
- .grid-x.grid-padding-x
11
+ .grid-x
12
12
  .cell= render_card(:recent_activity)
13
- .cell.large-6= render_card(:recent_user_activity)
13
+ .cell.xlarge-6= render_card(:recent_user_activity)
14
14
  .cell.large-6= render_card(:top_post_authors)
@@ -1,20 +1,13 @@
1
1
  .card.listing
2
- .card-section
3
- %h2.show-for-small-only= page_title
4
- = link_to t('integral.actions.create'), new_backend_post_url, class: 'button hollow show-for-small-only create'
5
- .top-bar
6
- .top-bar-left.hide-for-small-only
7
- = link_to t('integral.actions.create'), new_backend_post_url, class: 'button hollow'
8
- .top-bar-right
9
- = simple_form_for :grid, url: list_backend_posts_url, method: :get, remote: true, html: { id: :grid_form, 'data-type' => :json } do |f|
10
- = hidden_field_tag(:gridview, true)
11
- = f.hidden_field(:descending, value: @grid.descending, class: 'desc-field')
12
- = f.hidden_field(:order, value: @grid.order, class: 'order-field')
13
- = f.hidden_field(:page, value: grid_options[:page], class: 'page-field')
2
+ %h2.show-for-small-only= page_title
3
+ = link_to t('integral.actions.create'), new_backend_resource_url, class: 'button hollow show-for-small-only create'
4
+ .top-bar
5
+ .top-bar-left.hide-for-small-only
6
+ = link_to t('integral.actions.create'), new_backend_resource_url, class: 'button hollow'
7
+ .top-bar-right
8
+ = render_resource_grid_form do |f|
9
+ %li= f.input :user, collection: Integral::User.all, label: t('integral.records.attributes.user'), wrapper_html: { class: 'filter' }, input_html: { 'data-filter' => true }, required: false
10
+ %li= f.input :status, collection: resource_klass.available_statuses, label: t('integral.records.attributes.status'), wrapper_html: { class: 'filter' }, input_html: { 'data-filter' => true }, required: false
11
+ %li= f.input :title, placeholder: t('integral.actions.search'), wrapper_html: { class: 'filter search' }, hint: false, label: false
14
12
 
15
- %ul.align-right.menu.filters
16
- %li= f.input :user, collection: Integral::User.all, label: t('integral.records.attributes.user'), wrapper_html: { class: 'filter' }, input_html: { 'data-filter' => true }, required: false
17
- %li= f.input :status, collection: Integral::Post.available_statuses, label: t('integral.records.attributes.status'), wrapper_html: { class: 'filter' }, input_html: { 'data-filter' => true }, required: false
18
- %li= f.input :title, placeholder: t('integral.actions.search'), wrapper_html: { class: 'filter search' }, hint: false, label: false
19
-
20
- = render partial: 'grid'
13
+ = render_resource_grid
@@ -1,2 +1 @@
1
1
  = render 'form'
2
-
@@ -3,52 +3,29 @@
3
3
  .grid-x
4
4
  .cell.large-6
5
5
  -# Left Column
6
- .grid-x.grid-padding-x
6
+ .grid-x
7
7
  .cell
8
8
  .card
9
- .card-section
10
- %h2= @resource.title
11
- %p.subtitle= @resource.description
12
- %hr
9
+ %h2= @resource.title
10
+ %p.subtitle= @resource.description
11
+ %hr
13
12
 
14
- .grid-x.actions
15
- .cell.xlarge-8.xxlarge-6
16
- .grid-x.small-up-2
17
- .cell
18
- = link_to post_url(@resource) do
19
- = icon('eye')
20
- = t('integral.actions.view_on_site')
21
- - if policy(Integral::Post).manager?
22
- .cell
23
- = link_to edit_backend_post_url(@resource.id) do
24
- = icon('edit')
25
- = t('integral.actions.edit')
26
- - if policy(Integral::Post).duplicate?
27
- .cell
28
- = link_to duplicate_backend_post_url(@resource.id), method: :post, data: { confirm: t('integral.actions.confirmation.clone') } do
29
- = icon('clone')
30
- = t('integral.actions.clone')
31
- - if policy(Integral::Post).manager?
32
- .cell
33
- = link_to backend_post_url(@resource.id), method: :delete, data: { confirm: t('integral.actions.confirmation.deletion') } do
34
- = icon('remove')
35
- = t('integral.actions.delete')
36
- - if policy(Integral::Version).manager?
37
- .cell
38
- = link_to activities_backend_post_url(@resource.id) do
39
- = icon('history')
40
- = t('integral.actions.view_history')
13
+ .grid-x.actions
14
+ .cell.xlarge-8.xxlarge-6
15
+ .grid-x.small-up-2
16
+ = link_to t('integral.actions.view_on_site'), post_url(@resource), icon: :eye, wrapper: :cell
17
+ - if policy(resource_klass).manager?
18
+ = link_to t('integral.actions.edit'), edit_backend_resource_url(@resource.id), icon: :edit, wrapper: :cell
19
+ - if policy(resource_klass).duplicate?
20
+ = link_to t('integral.actions.clone'), duplicate_backend_resource_url(@resource.id), method: :post, data: { confirm: t('integral.actions.confirmation.clone') }, icon: :clone, wrapper: :cell
21
+ - if policy(resource_klass).manager?
22
+ = link_to t('integral.actions.delete'), backend_resource_url(@resource.id), icon: :remove, wrapper: :cell, method: :delete, data: { confirm: t('integral.actions.confirmation.deletion') }
23
+ - if policy(resource_klass).manager?
24
+ = link_to t('integral.actions.view_history'), activities_backend_resource_url(@resource.id), icon: :history, wrapper: :cell
41
25
 
42
26
  .cell.medium-6.flex-container= render_card(:object, { title: 'Essentials', record: @resource })
43
- .cell.medium-6.flex-container= render_card(:recent_user_activity)
27
+ .cell.xlarge-6.flex-container= render_card(:recent_user_activity)
44
28
  .cell.large-6
45
29
  -# Right Column
46
- .grid-x.grid-padding-x
30
+ .grid-x
47
31
  .cell= render_card(:recent_activity)
48
- -# Could use the at_a_glance card to show user edits
49
- -# .cell= render_card(:at_a_glance, { dataset: dataset_dashboard_atg })
50
- -# .cell
51
- -# .card
52
- -# .card-section
53
- -# %h2= t('integral.backend.cards.last_week')
54
- -# = render_line_chart(dataset_dashboard_last_week)
@@ -1,9 +1,12 @@
1
- - if @breadcrumbs.present? || content_for?(:actionbar)
1
+ - if @breadcrumbs.present? || content_for?(:actionbar) || render_default_action_bar?
2
2
  #action-bar.top-bar
3
3
  - if @breadcrumbs.present?
4
4
  .top-bar-left
5
5
  %ul.breadcrumbs
6
- = render_breadcrumbs :tag => :li, :separator => ""
7
- - if content_for?(:actionbar)
6
+ = render_breadcrumbs tag: :li, separator: ""
7
+ - if content_for?(:actionbar) || render_default_action_bar?
8
8
  .top-bar-right
9
- = content_for(:actionbar)
9
+ - if content_for?(:actionbar)
10
+ = content_for(:actionbar)
11
+ - else
12
+ = render partial: "integral/backend/shared/action_bar/#{action_name}"
@@ -1,12 +1,14 @@
1
- - image = f.object.send(image_attr)
1
+ - attribute = attribute.present? ? attribute : :image
2
+ - help_text = help_text.present? ? help_text : ''
3
+ - image = f.object.send(attribute)
2
4
  - image_path = image&.file&.url(:medium)
3
5
  - unlinkHiddenClass = image.present? ? '' : 'hide'
4
6
  - placeholderHiddenClass = image.present? ? 'hide' : ''
5
7
 
6
8
  .image-select
7
- -# = f.label image_attr
9
+ = f.label attribute
8
10
  .image-container
9
- = f.hidden_field "#{image_attr}_id"
11
+ = f.hidden_field "#{attribute}_id"
10
12
  = image_tag image_url('integral/image-not-set.png'), class: "placeholder #{placeholderHiddenClass}"
11
13
  %img.actual{ src: image_path }
12
14
  %ul.menu.align-left.menu-unlinked{ class: placeholderHiddenClass }
@@ -21,3 +23,8 @@
21
23
  %li
22
24
  %button.button.clear.edit
23
25
  = icon('pencil-square-o')
26
+
27
+ - if help_text.present?
28
+ %br
29
+ %p.help-text= help_text
30
+
@@ -1,4 +1,4 @@
1
1
  - initialize = defined?(initialize) ? initialize : false
2
2
  .image-selector
3
- = render partial: 'integral/backend/shared/record_selector/modal', locals: { search_path: backend_img_index_path, title: t('integral.prompts.select_image'), name: 'Image', create_modal: '#new_image_modal', initialize: initialize, data_attributes: { 'image-selector' => true }}
3
+ = render partial: 'integral/backend/shared/record_selector/modal', locals: { search_path: list_backend_img_index_path, title: t('integral.prompts.select_image'), name: 'Image', create_modal: '#new_image_modal', initialize: initialize, data_attributes: { 'image-selector' => true }}
4
4
  = render partial: 'integral/backend/images/create_modal'
@@ -0,0 +1,22 @@
1
+ :ruby
2
+ if subscribable.is_a?(Class)
3
+ subscribable_id = nil
4
+ subscribable_type = subscribable.name
5
+ else
6
+ subscribable_id = subscribable.id
7
+ subscribable_type = subscribable.class.name
8
+ end
9
+ receives_notifications = current_user.receives_notifications_for?(subscribable)
10
+
11
+ = simple_form_for :subscription, url: backend_notification_subscription_url(id: 1), remote: true, method: :put, html: { 'data-form-unsubscribe-notifications' => true, class: receives_notifications ? '' : 'hide' } do |f|
12
+ = f.hidden_field :state, value: :unsubscribed
13
+ = f.hidden_field :subscribable_type, value: subscribable_type
14
+ = f.hidden_field :subscribable_id, value: subscribable_id
15
+ = f.button :button, class: 'clear', data: { tooltip: true, position: :left, alignment: :center }, title: t('integral.tooltips.unsubscribe') do
16
+ = icon('bell-slash-o')
17
+ = simple_form_for :subscription, url: backend_notification_subscription_url(id: 1), remote: true, method: :put, html: { 'data-form-subscribe-notifications' => true, class: receives_notifications ? 'hide' : '' } do |f|
18
+ = f.hidden_field :state, value: :subscribed
19
+ = f.hidden_field :subscribable_type, value: subscribable_type
20
+ = f.hidden_field :subscribable_id, value: subscribable_id
21
+ = f.button :button, class: 'clear', data: { tooltip: true, position: :left, alignment: :center }, title: t('integral.tooltips.subscribe') do
22
+ = icon('bell-o')
@@ -0,0 +1,9 @@
1
+ %ul.menu.horizontal
2
+ - if policy(resource_klass).new?
3
+ %li
4
+ = link_to new_backend_resource_url, class: 'button white' do
5
+ = icon('plus')
6
+ = t('integral.actions.create')
7
+ = resource_klass.model_name.human.capitalize
8
+ - if resource_klass.respond_to?(:subscribable?) && resource_klass.subscribable?
9
+ %li= render partial: 'integral/backend/shared/notification_subscription_toggle', locals: { subscribable: resource_klass }
@@ -0,0 +1,3 @@
1
+ %ul.menu.horizontal
2
+ - if @resource.respond_to?(:subscribable?) && @resource.subscribable?
3
+ %li= render partial: 'integral/backend/shared/notification_subscription_toggle', locals: { subscribable: @resource }
@@ -1,5 +1,5 @@
1
+ - dataset ||= dataset_at_a_glance
1
2
  .card
2
- .card-section
3
- %h2= t('integral.backend.cards.at_a_glance')
4
- = render_donut_chart(dataset)
3
+ %h2= t('integral.backend.cards.at_a_glance')
4
+ = render_donut_chart(dataset)
5
5
 
@@ -1,34 +1,33 @@
1
1
  .card
2
- .card-section
3
- .card-action-title
4
- %h2 Categories
5
- %button.button.hollow{ 'data-open' => 'new_category_modal' } Create
6
- %table.hover
7
- - Integral::Category.all.decorate.each do |category|
8
- %tr
9
- %td= category.title
10
- %td
11
- %span.badge= category.posts.count
12
- %td
13
- %button.button--action-pane{ 'data-toggle' => "dropdown-pane-actions-category-#{category.id}" }
14
- = icon('ellipsis-v')
15
- .dropdown-pane.dropdown-pane--actions{ id: "dropdown-pane-actions-category-#{category.id}", data: { dropdown: true, position: :bottom, alignment: :right, close_on_click: 'true' } }
16
- %ul.menu.vertical
17
- %li
18
- %button{ data: { modal_url: edit_backend_category_url(category.id), button_edit_category: "modal--category-edit-#{category.id}" } }
19
- = icon('edit')
20
- = t('integral.actions.edit')
21
- %li
22
- - if category.posts.count.zero?
23
- = link_to backend_category_url(category.id), method: :delete, data: { confirm: t('integral.actions.confirmation.deletion'), button_delete_category: true }, remote: true do
24
- = icon('remove')
25
- = t('integral.actions.delete')
2
+ .card-action-title
3
+ %h2 Categories
4
+ %button.button.hollow{ 'data-open' => 'new_category_modal' } Create
5
+ %table.hover
6
+ - Integral::Category.all.decorate.each do |category|
7
+ %tr
8
+ %td= category.title
9
+ %td
10
+ %span.badge= category.posts.count
11
+ %td
12
+ %button.button--action-pane{ 'data-toggle' => "dropdown-pane-actions-category-#{category.id}" }
13
+ = icon('ellipsis-v')
14
+ .dropdown-pane.dropdown-pane--actions{ id: "dropdown-pane-actions-category-#{category.id}", data: { dropdown: true, position: :bottom, alignment: :right, close_on_click: 'true' } }
15
+ %ul.menu.vertical
16
+ %li
17
+ %button{ data: { modal_url: edit_backend_category_url(category.id), button_edit_category: "modal--category-edit-#{category.id}" } }
18
+ = icon('edit')
19
+ = t('integral.actions.edit')
20
+ %li
21
+ - if category.posts.count.zero?
22
+ = link_to backend_category_url(category.id), method: :delete, data: { confirm: t('integral.actions.confirmation.deletion'), button_delete_category: true }, remote: true do
23
+ = icon('remove')
24
+ = t('integral.actions.delete')
26
25
 
27
26
 
28
- - else
29
- %button.disabled{ title: "Cannot delete categories which include posts.", data: { tooltip: true, position: "bottom", alignment: "center" } }
30
- = icon('remove')
31
- = t('integral.actions.delete')
27
+ - else
28
+ %button.disabled{ title: "Cannot delete categories which include posts.", data: { tooltip: true, position: "bottom", alignment: "center" } }
29
+ = icon('remove')
30
+ = t('integral.actions.delete')
32
31
 
33
32
 
34
33
  = render partial: 'integral/backend/categories/modal', locals: { title: 'Category Creation' }
@@ -1,4 +1,4 @@
1
- .card.object
1
+ .card-unpadded.object
2
2
  - if record.present?
3
3
  .card-section
4
4
  %h2= title
@@ -3,18 +3,18 @@
3
3
  - grid ||= recent_site_activity_grid
4
4
  - activities = cast_activities(grid.assets.limit(5))
5
5
 
6
- .card
7
- .card-section
8
- %h2= title
9
- - if activities.present?
10
- .timeline{ class: classes }
11
- = render partial: 'integral/backend/activities/activity', collection: activities
6
+ .card.flex-auto
7
+ %h2= title
8
+ - if activities.present?
9
+ .timeline{ class: classes }
10
+ = render partial: 'integral/backend/activities/activity', collection: activities
12
11
 
13
- - if grid.assets.count > 5
14
- %button.button.clear.expanded{ data: { recent_activity: true, recent_activity_created_at: activities.last.created_at.utc, recent_activity_user: grid.user, recent_activity_object: grid.object, recent_activity_item_id: grid.item_id, container_id: "modal--recent-activity-#{SecureRandom.hex}", recent_activity_title: title } }
15
- = t('integral.actions.view_more')
12
+ - if grid.assets.count > 5
13
+ %button.button.clear.expanded{ data: { recent_activity: true, recent_activity_created_at: activities.last.created_at.utc, recent_activity_user: grid.user, recent_activity_object: grid.object, recent_activity_item_id: grid.item_id, container_id: "modal--recent-activity-#{SecureRandom.hex}", recent_activity_title: title } }
14
+ = t('integral.actions.view_more')
16
15
 
17
- - else
18
- = t('integral.backend.graphs.data_unavailable')
19
- = image_tag image_path('integral/backend/data-unavailable.png'), class: 'data-unavailable'
16
+ - else
17
+ %p.data-unavailable
18
+ %span= t('integral.backend.graphs.data_unavailable')
19
+ = image_tag image_path('integral/backend/data-unavailable.png')
20
20
 
@@ -0,0 +1,17 @@
1
+ -# This partial could be updated to allow for customising the rows, scope and title
2
+ .card
3
+ .card-action-title
4
+ %h2
5
+ Recent
6
+ = resource_klass.model_name.human.pluralize
7
+ %table.hover
8
+ - resource_klass.limit(5).order('updated_at DESC').decorate.each do |resource|
9
+ %tr
10
+ %td= resource.title
11
+ %td
12
+ = link_to backend_resource_url(resource.id), class: 'button--action-pane' do
13
+ = icon('eye')
14
+ -# = link_to edit_backend_resource_url(resource.id), class: 'button--action-pane' do
15
+ -# = icon('edit')
16
+
17
+ = link_to t('integral.actions.view_all'), list_backend_resources_url, class: 'button clear expanded'
@@ -1,19 +1,18 @@
1
1
  - user_ids = Integral::Post.published.group(:user_id).count.sort_by(&:last).reverse.to_h
2
2
  - post_users = Integral::User.where(id: user_ids.keys).decorate.sort_by { |prod| user_ids.keys.index(prod.id) }
3
3
  .card
4
- .card-section
5
- .card-action-title
6
- %h2 Top Authors
7
- .stat-table
8
- .stat-table-heading
9
- .stat-table-header Total Authors
10
- .stat-table-header-count= user_ids.count
11
- %table.unstriped.hover
12
- - post_users.each do |record|
13
- %tr
14
- %td
15
- = image_tag record.avatar.url(:thumbnail), alt: record.name, class: 'avatar'
16
- = record.name
17
- %td
18
- %span.badge.secondary= user_ids[record.id]
4
+ .card-action-title
5
+ %h2 Top Authors
6
+ .stat-table
7
+ .stat-table-heading
8
+ .stat-table-header Total Authors
9
+ .stat-table-header-count= user_ids.count
10
+ %table.unstriped.hover
11
+ - post_users.each do |record|
12
+ %tr
13
+ %td
14
+ = image_tag record.avatar.url(:thumbnail), alt: record.name, class: 'avatar'
15
+ = record.name
16
+ %td
17
+ %span.badge.secondary= user_ids[record.id]
19
18
 
@@ -1,29 +1,28 @@
1
1
  .card
2
- .card-section
3
- %h2= t('.title')
4
- %p.subtitle= t('.get_started')
5
- %hr
6
- .grid-x.actions
7
- .cell.shrink
8
- .grid-y
2
+ %h2= t('.title')
3
+ %p.subtitle= t('.get_started')
4
+ %hr
5
+ .grid-x.actions
6
+ .cell.shrink
7
+ .grid-y
8
+ .cell.shrink
9
+ = link_to edit_backend_user_url(current_user) do
10
+ = icon('edit')
11
+ = t('integral.actions.edit_profile')
12
+ - if policy(Integral::Page).manager?
9
13
  .cell.shrink
10
- = link_to backend_account_url do
11
- = icon('edit')
12
- = t('integral.actions.edit_profile')
13
- - if policy(Integral::Page).manager?
14
- .cell.shrink
15
- = link_to new_backend_page_url do
16
- = icon('plus')
17
- = t('integral.actions.new_page')
18
- .cell.shrink
19
- .grid-y
20
- - if policy(Integral::Post).manager? && Integral.blog_enabled?
21
- .cell.shrink
22
- = link_to new_backend_post_url do
23
- = icon('plus')
24
- = t('integral.actions.new_post')
14
+ = link_to new_backend_page_url do
15
+ = icon('plus')
16
+ = t('integral.actions.new_page')
17
+ .cell.shrink
18
+ .grid-y
19
+ - if policy(Integral::Post).manager? && Integral.blog_enabled?
25
20
  .cell.shrink
26
- = link_to root_path do
27
- = icon('eye')
28
- = t('integral.actions.view_main_site')
21
+ = link_to new_backend_post_url do
22
+ = icon('plus')
23
+ = t('integral.actions.new_post')
24
+ .cell.shrink
25
+ = link_to root_path do
26
+ = icon('eye')
27
+ = t('integral.actions.view_main_site')
29
28