elabs 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -0
  3. data/CHANGELOG.md +83 -0
  4. data/Gemfile +3 -1
  5. data/Gemfile.lock +9 -2
  6. data/ROADMAP.md +6 -11
  7. data/app/assets/stylesheets/elabs/_icons.scss +8 -4
  8. data/app/assets/stylesheets/elabs/app/_badges.scss +11 -0
  9. data/app/assets/stylesheets/elabs/app/_layout.scss +10 -2
  10. data/app/assets/stylesheets/elabs/app/_users.scss +7 -0
  11. data/app/assets/stylesheets/elabs/app/admin-members/_indexes.scss +2 -1
  12. data/app/assets/stylesheets/elabs/app/mixins/_content-card.scss +4 -0
  13. data/app/assets/stylesheets/elabs/app/mixins/_content-full.scss +17 -5
  14. data/app/assets/stylesheets/elabs/lib/knacss/_knacss-variables.scss +16 -15
  15. data/app/assets/stylesheets/elabs/lib/knacss/_knacss.scss +1 -1
  16. data/app/assets/stylesheets/elabs/style.scss +1 -0
  17. data/app/controllers/elabs/acts_controller.rb +1 -1
  18. data/app/controllers/elabs/admin/admin_content_application_controller.rb +13 -6
  19. data/app/controllers/elabs/admin/languages_controller.rb +4 -4
  20. data/app/controllers/elabs/admin/licenses_controller.rb +2 -2
  21. data/app/controllers/elabs/admin/tags_controller.rb +3 -3
  22. data/app/controllers/elabs/concerns/elabs_controller.rb +1 -0
  23. data/app/controllers/elabs/content_application_controller.rb +1 -1
  24. data/app/controllers/elabs/elabs_application_controller.rb +0 -73
  25. data/app/controllers/elabs/elabs_public_controller.rb +80 -0
  26. data/app/controllers/elabs/languages_controller.rb +3 -3
  27. data/app/controllers/elabs/licenses_controller.rb +3 -3
  28. data/app/controllers/elabs/member/member_content_application_controller.rb +24 -14
  29. data/app/controllers/elabs/member/notifications_controller.rb +30 -0
  30. data/app/controllers/elabs/member/preferences_controller.rb +1 -1
  31. data/app/controllers/elabs/member/users_controller.rb +8 -5
  32. data/app/controllers/elabs/reports_controller.rb +2 -2
  33. data/app/controllers/elabs/tags_controller.rb +2 -2
  34. data/app/controllers/elabs/users_controller.rb +3 -3
  35. data/app/helpers/elabs/admin_content_helper.rb +8 -24
  36. data/app/helpers/elabs/application_helper.rb +1 -1
  37. data/app/helpers/elabs/content_helper.rb +39 -0
  38. data/app/helpers/elabs/form_helper.rb +22 -10
  39. data/app/helpers/elabs/member_content_helper.rb +5 -22
  40. data/app/helpers/elabs/notification_helper.rb +69 -0
  41. data/app/helpers/elabs/thumbnails_helper.rb +15 -0
  42. data/app/helpers/elabs/time_helper.rb +7 -0
  43. data/app/models/elabs/application_content_record.rb +1 -0
  44. data/app/models/elabs/application_record.rb +2 -0
  45. data/app/models/elabs/comment.rb +14 -0
  46. data/app/models/elabs/concerns/actable_entity.rb +0 -12
  47. data/app/models/elabs/concerns/content_entity.rb +23 -0
  48. data/app/models/elabs/concerns/notifiable_entity.rb +46 -0
  49. data/app/models/elabs/notification.rb +10 -0
  50. data/app/models/elabs/preference.rb +2 -0
  51. data/app/models/elabs/report.rb +10 -0
  52. data/app/models/elabs/user.rb +26 -6
  53. data/app/views/elabs/acts/_act.json.jbuilder +7 -2
  54. data/app/views/elabs/acts/index.json.jbuilder +1 -1
  55. data/app/views/elabs/admin/albums/_album.json.jbuilder +15 -2
  56. data/app/views/elabs/admin/albums/index.html.haml +1 -1
  57. data/app/views/elabs/admin/albums/index.json.jbuilder +1 -1
  58. data/app/views/elabs/admin/articles/_article.json.jbuilder +15 -2
  59. data/app/views/elabs/admin/articles/index.html.haml +1 -1
  60. data/app/views/elabs/admin/articles/index.json.jbuilder +1 -1
  61. data/app/views/elabs/admin/languages/_language.json.jbuilder +9 -2
  62. data/app/views/elabs/admin/languages/index.html.haml +1 -1
  63. data/app/views/elabs/admin/languages/index.json.jbuilder +1 -1
  64. data/app/views/elabs/admin/licenses/_license.json.jbuilder +10 -2
  65. data/app/views/elabs/admin/licenses/index.html.haml +1 -1
  66. data/app/views/elabs/admin/licenses/index.json.jbuilder +1 -1
  67. data/app/views/elabs/admin/notes/_note.json.jbuilder +13 -2
  68. data/app/views/elabs/admin/notes/index.html.haml +1 -1
  69. data/app/views/elabs/admin/notes/index.json.jbuilder +1 -1
  70. data/app/views/elabs/admin/projects/_project.json.jbuilder +20 -2
  71. data/app/views/elabs/admin/projects/index.html.haml +1 -1
  72. data/app/views/elabs/admin/projects/index.json.jbuilder +1 -1
  73. data/app/views/elabs/admin/reports/_report.json.jbuilder +10 -0
  74. data/app/views/elabs/admin/reports/index.html.haml +1 -1
  75. data/app/views/elabs/admin/reports/index.json.jbuilder +1 -1
  76. data/app/views/elabs/admin/tags/_tag.json.jbuilder +8 -2
  77. data/app/views/elabs/admin/tags/index.html.haml +1 -1
  78. data/app/views/elabs/admin/tags/index.json.jbuilder +1 -1
  79. data/app/views/elabs/admin/uploads/_upload.json.jbuilder +17 -2
  80. data/app/views/elabs/admin/uploads/index.html.haml +1 -1
  81. data/app/views/elabs/admin/uploads/index.json.jbuilder +1 -1
  82. data/app/views/elabs/admin/users/_user.json.jbuilder +14 -0
  83. data/app/views/elabs/admin/users/index.html.haml +6 -2
  84. data/app/views/elabs/admin/users/index.json.jbuilder +1 -1
  85. data/app/views/elabs/admin/users/show.html.haml +1 -1
  86. data/app/views/elabs/admin/users/show.json.jbuilder +1 -1
  87. data/app/views/elabs/albums/_album.html.haml +2 -2
  88. data/app/views/elabs/albums/_album.json.jbuilder +12 -2
  89. data/app/views/elabs/albums/index.json.jbuilder +1 -1
  90. data/app/views/elabs/albums/show.html.haml +7 -7
  91. data/app/views/elabs/albums/show.json.jbuilder +1 -1
  92. data/app/views/elabs/articles/_article.html.haml +2 -2
  93. data/app/views/elabs/articles/_article.json.jbuilder +12 -2
  94. data/app/views/elabs/articles/index.json.jbuilder +1 -1
  95. data/app/views/elabs/articles/show.html.haml +6 -6
  96. data/app/views/elabs/articles/show.json.jbuilder +1 -1
  97. data/app/views/elabs/auth/registrations/edit.html.haml +8 -5
  98. data/app/views/elabs/comments/_comment.json.jbuilder +10 -2
  99. data/app/views/elabs/comments/_comments.html.haml +2 -2
  100. data/app/views/elabs/languages/_language.json.jbuilder +9 -2
  101. data/app/views/elabs/languages/index.json.jbuilder +1 -1
  102. data/app/views/elabs/languages/show.html.haml +1 -1
  103. data/app/views/elabs/languages/show.json.jbuilder +1 -1
  104. data/app/views/elabs/layouts/_menu.html.haml +10 -5
  105. data/app/views/elabs/licenses/_license.json.jbuilder +10 -2
  106. data/app/views/elabs/licenses/index.json.jbuilder +1 -1
  107. data/app/views/elabs/licenses/show.html.haml +2 -6
  108. data/app/views/elabs/member/albums/_album.json.jbuilder +15 -2
  109. data/app/views/elabs/member/albums/index.html.haml +1 -1
  110. data/app/views/elabs/member/albums/index.json.jbuilder +1 -1
  111. data/app/views/elabs/member/articles/_article.json.jbuilder +15 -2
  112. data/app/views/elabs/member/articles/index.html.haml +1 -1
  113. data/app/views/elabs/member/articles/index.json.jbuilder +1 -1
  114. data/app/views/elabs/member/layouts/_empty.html.haml +3 -2
  115. data/app/views/elabs/member/notes/_note.json.jbuilder +13 -2
  116. data/app/views/elabs/member/notes/index.html.haml +1 -1
  117. data/app/views/elabs/member/notes/index.json.jbuilder +1 -1
  118. data/app/views/elabs/member/notifications/_notification.json.jbuilder +8 -0
  119. data/app/views/elabs/member/notifications/index.html.haml +21 -0
  120. data/app/views/elabs/member/notifications/index.json.jbuilder +1 -0
  121. data/app/views/elabs/member/preferences/_form.html.haml +6 -0
  122. data/app/views/elabs/member/preferences/edit.html.haml +2 -1
  123. data/app/views/elabs/member/projects/_project.json.jbuilder +20 -2
  124. data/app/views/elabs/member/projects/index.html.haml +1 -1
  125. data/app/views/elabs/member/projects/index.json.jbuilder +1 -1
  126. data/app/views/elabs/member/uploads/_upload.json.jbuilder +17 -2
  127. data/app/views/elabs/member/uploads/index.html.haml +1 -1
  128. data/app/views/elabs/member/uploads/index.json.jbuilder +1 -1
  129. data/app/views/elabs/member/users/_form.html.haml +14 -9
  130. data/app/views/elabs/member/users/edit.html.haml +7 -0
  131. data/app/views/elabs/notes/_note.html.haml +2 -2
  132. data/app/views/elabs/notes/_note.json.jbuilder +10 -2
  133. data/app/views/elabs/notes/index.json.jbuilder +1 -1
  134. data/app/views/elabs/notes/show.html.haml +5 -5
  135. data/app/views/elabs/notes/show.json.jbuilder +1 -1
  136. data/app/views/elabs/projects/_project.html.haml +2 -2
  137. data/app/views/elabs/projects/_project.json.jbuilder +17 -0
  138. data/app/views/elabs/projects/index.json.jbuilder +1 -1
  139. data/app/views/elabs/projects/show.html.haml +14 -11
  140. data/app/views/elabs/projects/show.json.jbuilder +1 -1
  141. data/app/views/elabs/tags/_tag.json.jbuilder +8 -2
  142. data/app/views/elabs/tags/index.json.jbuilder +1 -1
  143. data/app/views/elabs/tags/show.json.jbuilder +1 -1
  144. data/app/views/elabs/uploads/_upload.html.haml +1 -1
  145. data/app/views/elabs/uploads/_upload.json.jbuilder +14 -2
  146. data/app/views/elabs/uploads/index.json.jbuilder +1 -1
  147. data/app/views/elabs/uploads/show.html.haml +12 -3
  148. data/app/views/elabs/uploads/show.json.jbuilder +1 -1
  149. data/app/views/elabs/users/_user.html.haml +10 -3
  150. data/app/views/elabs/users/_user.json.jbuilder +14 -2
  151. data/app/views/elabs/users/index.json.jbuilder +1 -1
  152. data/app/views/elabs/users/show.html.haml +15 -10
  153. data/app/views/elabs/users/show.json.jbuilder +1 -1
  154. data/config/routes.rb +21 -16
  155. data/db/migrate/20180910000015_remove_license_timestamps.rb +6 -0
  156. data/db/migrate/20180910175012_create_notifications.rb +13 -0
  157. data/db/migrate/20180913093027_add_fields_in_preferences.rb +6 -0
  158. data/docs/migrating.md +14 -0
  159. data/docs/setup.md +1 -0
  160. data/lib/elabs.rb +3 -0
  161. data/lib/elabs/version.rb +1 -1
  162. data/lib/generators/elabs/required_assets_generator.rb +1 -1
  163. data/lib/generators/templates/elabs.rb +6 -0
  164. data/locale/app.pot +73 -14
  165. data/locale/en/app.edit.po +71 -12
  166. data/locale/en/app.po +71 -12
  167. data/locale/fr/app.edit.po +76 -17
  168. data/locale/fr/app.po +75 -16
  169. data/package.json +4 -4
  170. metadata +19 -5
  171. data/app/assets/images/elabs/preview_placeholder.png +0 -0
  172. data/app/assets/images/elabs/preview_placeholder_nsfw.png +0 -0
  173. data/app/views/elabs/admin/users/_admin_user.json.jbuilder +0 -2
@@ -0,0 +1,46 @@
1
+ module Elabs
2
+ module Concerns
3
+ module NotifiableEntity
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ before_save :create_notification?, if: :changed_by_someone_else
8
+ after_save :create_notification, if: :changed_by_someone_else
9
+
10
+ after_destroy :create_destroy_notifications, if: :changed_by_someone_else
11
+ end
12
+
13
+ private
14
+
15
+ def create_notification?
16
+ @action = if changed.include?('locked')
17
+ current_lock_action
18
+ else
19
+ :nothing
20
+ end
21
+ end
22
+
23
+ def create_notification
24
+ return if @action == :nothing
25
+
26
+ Notification.create(
27
+ content: self,
28
+ event: @action,
29
+ user: user,
30
+ source_user: changed_by
31
+ )
32
+ end
33
+
34
+ # TODO: check if used ? (dependent: destroy may do the trick.)
35
+ def create_destroy_notifications
36
+ Elabs::Notification.where(content: self).destroy_all
37
+ Elabs::Notification.create(
38
+ content: self,
39
+ event: :delete,
40
+ user: user,
41
+ source_user: changed_by
42
+ )
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,10 @@
1
+ module Elabs
2
+ class Notification < ApplicationRecord
3
+ self.table_name = 'notifications'
4
+ belongs_to :content, polymorphic: true
5
+ belongs_to :user
6
+ belongs_to :source_user, class_name: 'Elabs::User', optional: true
7
+
8
+ scope :for_user, ->(id) { where(user_id: id) }
9
+ end
10
+ end
@@ -5,5 +5,7 @@ module Elabs
5
5
  validates :locale, inclusion: { in: %w[en fr] }, allow_blank: true
6
6
 
7
7
  belongs_to :user
8
+ belongs_to :writing_language, class_name: 'Elabs::Language', optional: true
9
+ belongs_to :writing_license, class_name: 'Elabs::License', optional: true
8
10
  end
9
11
  end
@@ -7,5 +7,15 @@ module Elabs
7
7
  validates :name, presence: true, unless: :user
8
8
 
9
9
  belongs_to :user, optional: true
10
+
11
+ after_save :notify_admins
12
+
13
+ def notify_admins
14
+ User.admins.each do |admin|
15
+ Elabs::Notification.create! content: self,
16
+ event: :report,
17
+ user: admin
18
+ end
19
+ end
10
20
  end
11
21
  end
@@ -4,6 +4,7 @@ module Elabs
4
4
 
5
5
  validates :username, presence: true, uniqueness: true
6
6
  validates :role, presence: false
7
+ validate :avatar_format if Elabs.use_avatars
7
8
 
8
9
  # Username should:
9
10
  # - not start with '-', '_' or '.'
@@ -11,20 +12,39 @@ module Elabs
11
12
  # - not contain successive '.', '-' or '_'
12
13
  validates_format_of :username, with: /\A(?![_.-])(?!.*[_.]{2})[a-zA-Z0-9._-]+[^_\-.]\z/
13
14
 
14
- has_many :albums, dependent: :destroy
15
- has_many :articles, dependent: :destroy
16
- has_many :notes, dependent: :destroy
17
- has_many :projects, dependent: :destroy
18
- has_many :uploads, dependent: :destroy
19
- has_many :reports, dependent: :destroy
15
+ has_many :albums, dependent: :destroy
16
+ has_many :articles, dependent: :destroy
17
+ has_many :notes, dependent: :destroy
18
+ has_many :projects, dependent: :destroy
19
+ has_many :uploads, dependent: :destroy
20
+ has_many :reports, dependent: :destroy
21
+ has_many :notifications, dependent: :destroy
20
22
  has_one :preference, dependent: :delete
21
23
 
24
+ has_one_attached :avatar if Elabs.use_avatars
25
+
26
+ scope :admins, -> { where(role: 'admin') }
27
+
22
28
  def admin?
23
29
  role == 'admin'
24
30
  end
25
31
 
32
+ def display_name
33
+ real_name.present? ? real_name : "@#{username}"
34
+ end
35
+
26
36
  after_create do
27
37
  Preference.create! user: self, show_nsfw: false
28
38
  end
39
+
40
+ private
41
+
42
+ def avatar_format
43
+ return unless avatar.attached? # && file.blob
44
+ return if %w[image/png image/jpeg].include? avatar.blob.content_type
45
+
46
+ avatar.purge_later
47
+ errors.add(:avatar, _('needs to be a "png" or "jpg" image'))
48
+ end
29
49
  end
30
50
  end
@@ -1,2 +1,7 @@
1
- json.extract! act, :id, :content_id, :content_type, :event, :user_id, :created_at, :updated_at
2
- json.url act_url(act, format: :json)
1
+ json.extract! act, :id,
2
+ :content_id,
3
+ :content_type,
4
+ :event,
5
+ :created_at,
6
+ :updated_at,
7
+ :content
@@ -1 +1 @@
1
- json.array! @acts, partial: 'acts/act', as: :act
1
+ json.array! @acts, partial: 'act', as: :act
@@ -1,2 +1,15 @@
1
- json.extract! album, :id, :name, :description, :sfw, :published, :locked, :hidden_in_history, :user_id, :language, :license_id, :created_at, :updated_at
2
- json.url album_url(album, format: :json)
1
+ json.extract! album,
2
+ :id,
3
+ :name,
4
+ :description,
5
+ :sfw,
6
+ :published,
7
+ :locked,
8
+ :hidden_in_history,
9
+ :uploads_count,
10
+ :user_id,
11
+ :license_id,
12
+ :language_id,
13
+ :published_at,
14
+ :created_at,
15
+ :updated_at
@@ -25,7 +25,7 @@
25
25
  %td.is-icon= boolean_icon_tag album.published
26
26
  %td.is-icon= boolean_icon_tag album.locked, 'lock', 'unlock'
27
27
  %td.is-icon= boolean_icon_tag album.hidden_in_history
28
- %td= album.published_at
28
+ %td= short_date album.published_at
29
29
  %td= album.user.username
30
30
  %td= album.license.name
31
31
  %td= album.language.name
@@ -1 +1 @@
1
- json.array! @albums, partial: 'albums/album', as: :album
1
+ json.array! @albums, partial: 'album', as: :album
@@ -1,2 +1,15 @@
1
- json.extract! article, :id, :title, :excerpt, :content, :sfw, :published, :locked, :published_at, :hidden_in_history, :user_id, :license_id, :language_id, :created_at, :updated_at
2
- json.url article_url(article, format: :json)
1
+ json.extract! article,
2
+ :id,
3
+ :title,
4
+ :excerpt,
5
+ :content,
6
+ :sfw,
7
+ :published,
8
+ :locked,
9
+ :hidden_in_history,
10
+ :user_id,
11
+ :license_id,
12
+ :language_id,
13
+ :published_at,
14
+ :created_at,
15
+ :updated_at
@@ -24,7 +24,7 @@
24
24
  %td.is-icon= boolean_icon_tag article.published
25
25
  %td.is-icon= boolean_icon_tag article.locked, 'lock', 'unlock'
26
26
  %td.is-icon= boolean_icon_tag article.hidden_in_history
27
- %td= article.published_at
27
+ %td= short_date article.published_at
28
28
  %td= article.user.username
29
29
  %td= article.license.name
30
30
  %td= article.language.name
@@ -1 +1 @@
1
- json.array! @articles, partial: 'articles/article', as: :article
1
+ json.array! @articles, partial: 'article', as: :article
@@ -1,2 +1,9 @@
1
- json.extract! language, :id, :iso639_1, :name
2
- json.url language_url(language, format: :json)
1
+ json.extract! language,
2
+ :id,
3
+ :iso639_1,
4
+ :name,
5
+ :albums_count,
6
+ :articles_count,
7
+ :notes_count,
8
+ :projects_count,
9
+ :uploads_count
@@ -27,7 +27,7 @@
27
27
  %td.is-counter= language.uploads_count
28
28
  %td.actions
29
29
  .btn-group
30
- = admin_show_online_link language
30
+ = show_online_link language
31
31
  = admin_edit_link 'language', language
32
32
  = admin_destroy_link 'language', language
33
33
 
@@ -1 +1 @@
1
- json.array! @languages, partial: 'admin/languages/language', as: :language
1
+ json.array! @languages, partial: 'language', as: :language
@@ -1,2 +1,10 @@
1
- json.extract! license, :id, :name, :url, :tldr_url, :icon, :created_at, :updated_at
2
- json.url license_url(license, format: :json)
1
+ json.extract! license, :id,
2
+ :name,
3
+ :url,
4
+ :tldr_url,
5
+ :icon,
6
+ :albums_count,
7
+ :articles_count,
8
+ :notes_count,
9
+ :projects_count,
10
+ :uploads_count
@@ -37,6 +37,6 @@
37
37
  %td.is-counter= license.uploads_count
38
38
  %td.actions
39
39
  .btn-group
40
- = admin_show_online_link license
40
+ = show_online_link license
41
41
  = admin_edit_link 'license', license
42
42
  = admin_destroy_link 'license', license
@@ -1 +1 @@
1
- json.array! @licenses, partial: 'licenses/license', as: :license
1
+ json.array! @licenses, partial: 'license', as: :license
@@ -1,2 +1,13 @@
1
- json.extract! note, :id, :content, :sfw, :hidden_in_history, :user_id, :license_id, :language_id, :created_at, :updated_at
2
- json.url note_url(note, format: :json)
1
+ json.extract! note,
2
+ :id,
3
+ :content,
4
+ :sfw,
5
+ :published,
6
+ :locked,
7
+ :hidden_in_history,
8
+ :user_id,
9
+ :license_id,
10
+ :language_id,
11
+ :published_at,
12
+ :created_at,
13
+ :updated_at
@@ -24,7 +24,7 @@
24
24
  %td.is-icon= boolean_icon_tag note.published
25
25
  %td.is-icon= boolean_icon_tag note.locked
26
26
  %td.is-icon= boolean_icon_tag note.hidden_in_history
27
- %td= note.published_at
27
+ %td= short_date note.published_at
28
28
  %td= note.user.username
29
29
  %td= note.license.name
30
30
  %td= note.language.name
@@ -1 +1 @@
1
- json.array! @notes, partial: 'notes/note', as: :note
1
+ json.array! @notes, partial: 'note', as: :note
@@ -1,2 +1,20 @@
1
- json.extract! project, :id, :name, :short_description, :description, :main_url, :sfw, :published, :locked, :hidden_in_history, :license_id, :language_id, :user_id, :created_at, :updated_at
2
- json.url project_url(project, format: :json)
1
+ json.extract! project,
2
+ :id,
3
+ :name,
4
+ :short_description,
5
+ :description,
6
+ :main_url,
7
+ :sfw,
8
+ :published,
9
+ :locked,
10
+ :hidden_in_history,
11
+ :albums_count,
12
+ :articles_count,
13
+ :notes_count,
14
+ :uploads_count,
15
+ :user_id,
16
+ :license_id,
17
+ :language_id,
18
+ :published_at,
19
+ :created_at,
20
+ :updated_at
@@ -27,7 +27,7 @@
27
27
  %td.is-icon= boolean_icon_tag project.published
28
28
  %td.is-icon= boolean_icon_tag project.locked, 'lock', 'unlock'
29
29
  %td.is-icon= boolean_icon_tag project.hidden_in_history
30
- %td= project.published_at
30
+ %td= short_date project.published_at
31
31
  %td= project.user.username
32
32
  %td= project.license.name
33
33
  %td= project.language.name
@@ -1 +1 @@
1
- json.array! @projects, partial: 'projects/project', as: :project
1
+ json.array! @projects, partial: 'project', as: :project
@@ -0,0 +1,10 @@
1
+ json.extract! report,
2
+ :id,
3
+ :name,
4
+ :email,
5
+ :url,
6
+ :reason,
7
+ :allow_contact,
8
+ :user_id,
9
+ :created_at,
10
+ :updated_at
@@ -19,7 +19,7 @@
19
19
  %td= report.email
20
20
  %td= report.user&.username
21
21
  %td.is-icon= boolean_icon_tag report.allow_contact
22
- %td= report.created_at
22
+ %td= short_date report.created_at
23
23
  %td= link_to report.url, report.url, target: '_blank'
24
24
  %td= report.reason
25
25
  %td.actions
@@ -1 +1 @@
1
- json.array! @reports, partial: 'reports/report', as: :report
1
+ json.array! @reports, partial: 'report', as: :report
@@ -1,2 +1,8 @@
1
- json.extract! tag, :id, :name
2
- json.url tag_url(tag, format: :json)
1
+ json.extract! tag,
2
+ :id,
3
+ :name,
4
+ :albums_count,
5
+ :articles_count,
6
+ :notes_count,
7
+ :projects_count,
8
+ :uploads_count
@@ -22,6 +22,6 @@
22
22
  %td.is-counter= tag.uploads_count
23
23
  %td.actions
24
24
  .btn-group
25
- = admin_show_online_link tag
25
+ = show_online_link tag
26
26
  = admin_edit_link 'tag', tag
27
27
  = admin_destroy_link 'tag', tag
@@ -1 +1 @@
1
- json.array! @tags, partial: 'tags/tag', as: :tag
1
+ json.array! @tags, partial: 'tag', as: :tag
@@ -1,2 +1,17 @@
1
- json.extract! upload, :id, :title, :description, :sfw, :hide_in_history, :language_id, :user_id, :license_id, :created_at, :updated_at
2
- json.url upload_url(upload, format: :json)
1
+ json.extract! upload, :id,
2
+ :title,
3
+ :description,
4
+ :sfw,
5
+ :published,
6
+ :locked,
7
+ :hidden_in_history,
8
+ :user_id,
9
+ :license_id,
10
+ :language_id,
11
+ :published_at,
12
+ :created_at,
13
+ :updated_at
14
+ json.file content_type: upload.file.content_type,
15
+ url: main_app.url_for(upload.file),
16
+ filename: upload.file.filename,
17
+ metadata: upload.file.metadata
@@ -25,7 +25,7 @@
25
25
  %td.is-icon= boolean_icon_tag upload.published
26
26
  %td.is-icon= boolean_icon_tag upload.locked, 'lock', 'unlock'
27
27
  %td.is-icon= boolean_icon_tag upload.hidden_in_history
28
- %td= upload.published_at
28
+ %td= short_date upload.published_at
29
29
  %td= upload.user.username
30
30
  %td= upload.license.name
31
31
  %td= upload.language.name
@@ -1 +1 @@
1
- json.array! @uploads, partial: 'uploads/upload', as: :upload
1
+ json.array! @uploads, partial: 'upload', as: :upload
@@ -0,0 +1,14 @@
1
+ json.extract! user,
2
+ :id,
3
+ :confirmed_at,
4
+ :created_at,
5
+ :updated_at,
6
+ :username,
7
+ :real_name,
8
+ :biography,
9
+ :role,
10
+ :albums_count,
11
+ :articles_count,
12
+ :notes_count,
13
+ :projects_count,
14
+ :uploads_count
@@ -6,6 +6,8 @@
6
6
  %th= admin_order_by_link _('Username'), 'username'
7
7
  %th= admin_order_by_link _('Role'), 'role'
8
8
  %th= admin_order_by_link _('Since'), 'created_at'
9
+ %th= _('Active')
10
+ %th= _('Pass reset')
9
11
  %th= admin_order_by_link _('Album count'), 'albums_count'
10
12
  %th= admin_order_by_link _('Article count'), 'articles_count'
11
13
  %th= admin_order_by_link _('Note count'), 'notes_count'
@@ -18,7 +20,9 @@
18
20
  %tr.user
19
21
  %td= user.username
20
22
  %td= user.role
21
- %td= user.created_at
23
+ %td= short_date user.created_at
24
+ %td.is-icon= boolean_icon_tag user.confirmed_at.present?
25
+ %td.is-icon= boolean_icon_tag user.reset_password_sent_at.present?
22
26
  %td.is-counter= user.albums_count
23
27
  %td.is-counter= user.articles_count
24
28
  %td.is-counter= user.notes_count
@@ -26,7 +30,7 @@
26
30
  %td.is-counter= user.uploads_count
27
31
  %td.actions
28
32
  .btn-group
29
- = admin_show_online_link user
33
+ = show_online_link user
30
34
  = admin_show_link 'user', user
31
35
  = admin_destroy_link 'user', user
32
36