elabs 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/CHANGELOG.md +83 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +9 -2
- data/ROADMAP.md +6 -11
- data/app/assets/stylesheets/elabs/_icons.scss +8 -4
- data/app/assets/stylesheets/elabs/app/_badges.scss +11 -0
- data/app/assets/stylesheets/elabs/app/_layout.scss +10 -2
- data/app/assets/stylesheets/elabs/app/_users.scss +7 -0
- data/app/assets/stylesheets/elabs/app/admin-members/_indexes.scss +2 -1
- data/app/assets/stylesheets/elabs/app/mixins/_content-card.scss +4 -0
- data/app/assets/stylesheets/elabs/app/mixins/_content-full.scss +17 -5
- data/app/assets/stylesheets/elabs/lib/knacss/_knacss-variables.scss +16 -15
- data/app/assets/stylesheets/elabs/lib/knacss/_knacss.scss +1 -1
- data/app/assets/stylesheets/elabs/style.scss +1 -0
- data/app/controllers/elabs/acts_controller.rb +1 -1
- data/app/controllers/elabs/admin/admin_content_application_controller.rb +13 -6
- data/app/controllers/elabs/admin/languages_controller.rb +4 -4
- data/app/controllers/elabs/admin/licenses_controller.rb +2 -2
- data/app/controllers/elabs/admin/tags_controller.rb +3 -3
- data/app/controllers/elabs/concerns/elabs_controller.rb +1 -0
- data/app/controllers/elabs/content_application_controller.rb +1 -1
- data/app/controllers/elabs/elabs_application_controller.rb +0 -73
- data/app/controllers/elabs/elabs_public_controller.rb +80 -0
- data/app/controllers/elabs/languages_controller.rb +3 -3
- data/app/controllers/elabs/licenses_controller.rb +3 -3
- data/app/controllers/elabs/member/member_content_application_controller.rb +24 -14
- data/app/controllers/elabs/member/notifications_controller.rb +30 -0
- data/app/controllers/elabs/member/preferences_controller.rb +1 -1
- data/app/controllers/elabs/member/users_controller.rb +8 -5
- data/app/controllers/elabs/reports_controller.rb +2 -2
- data/app/controllers/elabs/tags_controller.rb +2 -2
- data/app/controllers/elabs/users_controller.rb +3 -3
- data/app/helpers/elabs/admin_content_helper.rb +8 -24
- data/app/helpers/elabs/application_helper.rb +1 -1
- data/app/helpers/elabs/content_helper.rb +39 -0
- data/app/helpers/elabs/form_helper.rb +22 -10
- data/app/helpers/elabs/member_content_helper.rb +5 -22
- data/app/helpers/elabs/notification_helper.rb +69 -0
- data/app/helpers/elabs/thumbnails_helper.rb +15 -0
- data/app/helpers/elabs/time_helper.rb +7 -0
- data/app/models/elabs/application_content_record.rb +1 -0
- data/app/models/elabs/application_record.rb +2 -0
- data/app/models/elabs/comment.rb +14 -0
- data/app/models/elabs/concerns/actable_entity.rb +0 -12
- data/app/models/elabs/concerns/content_entity.rb +23 -0
- data/app/models/elabs/concerns/notifiable_entity.rb +46 -0
- data/app/models/elabs/notification.rb +10 -0
- data/app/models/elabs/preference.rb +2 -0
- data/app/models/elabs/report.rb +10 -0
- data/app/models/elabs/user.rb +26 -6
- data/app/views/elabs/acts/_act.json.jbuilder +7 -2
- data/app/views/elabs/acts/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/albums/_album.json.jbuilder +15 -2
- data/app/views/elabs/admin/albums/index.html.haml +1 -1
- data/app/views/elabs/admin/albums/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/articles/_article.json.jbuilder +15 -2
- data/app/views/elabs/admin/articles/index.html.haml +1 -1
- data/app/views/elabs/admin/articles/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/languages/_language.json.jbuilder +9 -2
- data/app/views/elabs/admin/languages/index.html.haml +1 -1
- data/app/views/elabs/admin/languages/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/licenses/_license.json.jbuilder +10 -2
- data/app/views/elabs/admin/licenses/index.html.haml +1 -1
- data/app/views/elabs/admin/licenses/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/notes/_note.json.jbuilder +13 -2
- data/app/views/elabs/admin/notes/index.html.haml +1 -1
- data/app/views/elabs/admin/notes/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/projects/_project.json.jbuilder +20 -2
- data/app/views/elabs/admin/projects/index.html.haml +1 -1
- data/app/views/elabs/admin/projects/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/reports/_report.json.jbuilder +10 -0
- data/app/views/elabs/admin/reports/index.html.haml +1 -1
- data/app/views/elabs/admin/reports/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/tags/_tag.json.jbuilder +8 -2
- data/app/views/elabs/admin/tags/index.html.haml +1 -1
- data/app/views/elabs/admin/tags/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/uploads/_upload.json.jbuilder +17 -2
- data/app/views/elabs/admin/uploads/index.html.haml +1 -1
- data/app/views/elabs/admin/uploads/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/users/_user.json.jbuilder +14 -0
- data/app/views/elabs/admin/users/index.html.haml +6 -2
- data/app/views/elabs/admin/users/index.json.jbuilder +1 -1
- data/app/views/elabs/admin/users/show.html.haml +1 -1
- data/app/views/elabs/admin/users/show.json.jbuilder +1 -1
- data/app/views/elabs/albums/_album.html.haml +2 -2
- data/app/views/elabs/albums/_album.json.jbuilder +12 -2
- data/app/views/elabs/albums/index.json.jbuilder +1 -1
- data/app/views/elabs/albums/show.html.haml +7 -7
- data/app/views/elabs/albums/show.json.jbuilder +1 -1
- data/app/views/elabs/articles/_article.html.haml +2 -2
- data/app/views/elabs/articles/_article.json.jbuilder +12 -2
- data/app/views/elabs/articles/index.json.jbuilder +1 -1
- data/app/views/elabs/articles/show.html.haml +6 -6
- data/app/views/elabs/articles/show.json.jbuilder +1 -1
- data/app/views/elabs/auth/registrations/edit.html.haml +8 -5
- data/app/views/elabs/comments/_comment.json.jbuilder +10 -2
- data/app/views/elabs/comments/_comments.html.haml +2 -2
- data/app/views/elabs/languages/_language.json.jbuilder +9 -2
- data/app/views/elabs/languages/index.json.jbuilder +1 -1
- data/app/views/elabs/languages/show.html.haml +1 -1
- data/app/views/elabs/languages/show.json.jbuilder +1 -1
- data/app/views/elabs/layouts/_menu.html.haml +10 -5
- data/app/views/elabs/licenses/_license.json.jbuilder +10 -2
- data/app/views/elabs/licenses/index.json.jbuilder +1 -1
- data/app/views/elabs/licenses/show.html.haml +2 -6
- data/app/views/elabs/member/albums/_album.json.jbuilder +15 -2
- data/app/views/elabs/member/albums/index.html.haml +1 -1
- data/app/views/elabs/member/albums/index.json.jbuilder +1 -1
- data/app/views/elabs/member/articles/_article.json.jbuilder +15 -2
- data/app/views/elabs/member/articles/index.html.haml +1 -1
- data/app/views/elabs/member/articles/index.json.jbuilder +1 -1
- data/app/views/elabs/member/layouts/_empty.html.haml +3 -2
- data/app/views/elabs/member/notes/_note.json.jbuilder +13 -2
- data/app/views/elabs/member/notes/index.html.haml +1 -1
- data/app/views/elabs/member/notes/index.json.jbuilder +1 -1
- data/app/views/elabs/member/notifications/_notification.json.jbuilder +8 -0
- data/app/views/elabs/member/notifications/index.html.haml +21 -0
- data/app/views/elabs/member/notifications/index.json.jbuilder +1 -0
- data/app/views/elabs/member/preferences/_form.html.haml +6 -0
- data/app/views/elabs/member/preferences/edit.html.haml +2 -1
- data/app/views/elabs/member/projects/_project.json.jbuilder +20 -2
- data/app/views/elabs/member/projects/index.html.haml +1 -1
- data/app/views/elabs/member/projects/index.json.jbuilder +1 -1
- data/app/views/elabs/member/uploads/_upload.json.jbuilder +17 -2
- data/app/views/elabs/member/uploads/index.html.haml +1 -1
- data/app/views/elabs/member/uploads/index.json.jbuilder +1 -1
- data/app/views/elabs/member/users/_form.html.haml +14 -9
- data/app/views/elabs/member/users/edit.html.haml +7 -0
- data/app/views/elabs/notes/_note.html.haml +2 -2
- data/app/views/elabs/notes/_note.json.jbuilder +10 -2
- data/app/views/elabs/notes/index.json.jbuilder +1 -1
- data/app/views/elabs/notes/show.html.haml +5 -5
- data/app/views/elabs/notes/show.json.jbuilder +1 -1
- data/app/views/elabs/projects/_project.html.haml +2 -2
- data/app/views/elabs/projects/_project.json.jbuilder +17 -0
- data/app/views/elabs/projects/index.json.jbuilder +1 -1
- data/app/views/elabs/projects/show.html.haml +14 -11
- data/app/views/elabs/projects/show.json.jbuilder +1 -1
- data/app/views/elabs/tags/_tag.json.jbuilder +8 -2
- data/app/views/elabs/tags/index.json.jbuilder +1 -1
- data/app/views/elabs/tags/show.json.jbuilder +1 -1
- data/app/views/elabs/uploads/_upload.html.haml +1 -1
- data/app/views/elabs/uploads/_upload.json.jbuilder +14 -2
- data/app/views/elabs/uploads/index.json.jbuilder +1 -1
- data/app/views/elabs/uploads/show.html.haml +12 -3
- data/app/views/elabs/uploads/show.json.jbuilder +1 -1
- data/app/views/elabs/users/_user.html.haml +10 -3
- data/app/views/elabs/users/_user.json.jbuilder +14 -2
- data/app/views/elabs/users/index.json.jbuilder +1 -1
- data/app/views/elabs/users/show.html.haml +15 -10
- data/app/views/elabs/users/show.json.jbuilder +1 -1
- data/config/routes.rb +21 -16
- data/db/migrate/20180910000015_remove_license_timestamps.rb +6 -0
- data/db/migrate/20180910175012_create_notifications.rb +13 -0
- data/db/migrate/20180913093027_add_fields_in_preferences.rb +6 -0
- data/docs/migrating.md +14 -0
- data/docs/setup.md +1 -0
- data/lib/elabs.rb +3 -0
- data/lib/elabs/version.rb +1 -1
- data/lib/generators/elabs/required_assets_generator.rb +1 -1
- data/lib/generators/templates/elabs.rb +6 -0
- data/locale/app.pot +73 -14
- data/locale/en/app.edit.po +71 -12
- data/locale/en/app.po +71 -12
- data/locale/fr/app.edit.po +76 -17
- data/locale/fr/app.po +75 -16
- data/package.json +4 -4
- metadata +19 -5
- data/app/assets/images/elabs/preview_placeholder.png +0 -0
- data/app/assets/images/elabs/preview_placeholder_nsfw.png +0 -0
- 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
|
data/app/models/elabs/report.rb
CHANGED
@@ -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
|
data/app/models/elabs/user.rb
CHANGED
@@ -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,
|
15
|
-
has_many :articles,
|
16
|
-
has_many :notes,
|
17
|
-
has_many :projects,
|
18
|
-
has_many :uploads,
|
19
|
-
has_many :reports,
|
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 +1 @@
|
|
1
|
-
json.array! @acts, partial: '
|
1
|
+
json.array! @acts, partial: 'act', as: :act
|
@@ -1,2 +1,15 @@
|
|
1
|
-
json.extract! album,
|
2
|
-
|
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: '
|
1
|
+
json.array! @albums, partial: 'album', as: :album
|
@@ -1,2 +1,15 @@
|
|
1
|
-
json.extract! article,
|
2
|
-
|
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: '
|
1
|
+
json.array! @articles, partial: 'article', as: :article
|
@@ -1 +1 @@
|
|
1
|
-
json.array! @languages, partial: '
|
1
|
+
json.array! @languages, partial: 'language', as: :language
|
@@ -1,2 +1,10 @@
|
|
1
|
-
json.extract! license, :id,
|
2
|
-
|
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
|
@@ -1 +1 @@
|
|
1
|
-
json.array! @licenses, partial: '
|
1
|
+
json.array! @licenses, partial: 'license', as: :license
|
@@ -1,2 +1,13 @@
|
|
1
|
-
json.extract! note,
|
2
|
-
|
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: '
|
1
|
+
json.array! @notes, partial: 'note', as: :note
|
@@ -1,2 +1,20 @@
|
|
1
|
-
json.extract! project,
|
2
|
-
|
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: '
|
1
|
+
json.array! @projects, partial: 'project', as: :project
|
@@ -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: '
|
1
|
+
json.array! @reports, partial: 'report', as: :report
|
@@ -1 +1 @@
|
|
1
|
-
json.array! @tags, partial: '
|
1
|
+
json.array! @tags, partial: 'tag', as: :tag
|
@@ -1,2 +1,17 @@
|
|
1
|
-
json.extract! upload, :id,
|
2
|
-
|
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: '
|
1
|
+
json.array! @uploads, partial: 'upload', as: :upload
|
@@ -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
|
-
=
|
33
|
+
= show_online_link user
|
30
34
|
= admin_show_link 'user', user
|
31
35
|
= admin_destroy_link 'user', user
|
32
36
|
|