wco_models 3.1.0.136 → 3.1.0.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/wco/chip.scss +2 -2
- data/app/controllers/wco/galleries_controller.rb +28 -2
- data/app/controllers/wco/tags_controller.rb +18 -1
- data/app/models/wco/gallery.rb +3 -0
- data/app/models/wco/tag.rb +2 -0
- data/app/models/wco/video.rb +3 -0
- data/app/views/wco/galleries/_index.haml +35 -24
- data/app/views/wco/galleries/_title.haml +3 -0
- data/app/views/wco/tags/_index_inline.haml +3 -6
- data/app/views/wco/tags/show.haml +3 -0
- data/config/routes.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 632761ee3733fa6dfa80381c4e542ced567f4ef571d3bd2cc14bd649f46c91b7
|
4
|
+
data.tar.gz: c597ae263f07ce7b48a86d0f95890a159a63d0275f2f56fe1ea46108bb3380c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08fdf497885da8ba2afe8ea69995a21152f565811e2d1ab584abdad2087f4ac836169d67ad489ba517c8357286d47eb17a6a0b8023afb45fb75ef05be13dccd0'
|
7
|
+
data.tar.gz: '0778143ba46e945b64d8f2da6eb52afb9486ce60e427c843e613b8535d705c98801e3b1d852bd4bbc963bc992f8aa61d17d3f3cc29adafe0954429acf8de2caf'
|
@@ -12,12 +12,12 @@
|
|
12
12
|
color: var(--wco-color-2contrast);
|
13
13
|
}
|
14
14
|
|
15
|
-
display: inline;
|
15
|
+
display: inline-block;
|
16
16
|
|
17
17
|
height: 32px;
|
18
18
|
|
19
19
|
margin-right: 32px;
|
20
|
-
margin-bottom: 0.
|
20
|
+
margin-bottom: 0.3em;
|
21
21
|
|
22
22
|
padding: 0.1em .3em;
|
23
23
|
padding: 0.2em 0.2em 0.2em 0.6em;
|
@@ -44,14 +44,15 @@ class Wco::GalleriesController < Wco::ApplicationController
|
|
44
44
|
@page_title = 'Galleries'
|
45
45
|
@galleries = Wco::Gallery.all.order_by( :created_at => :desc )
|
46
46
|
|
47
|
+
@tags = Wco::Tag.all
|
48
|
+
|
47
49
|
if params[:q]
|
48
50
|
q = URI.decode(params[:q])
|
49
51
|
@galleries = @galleries.where({ :name => /#{q}/i })
|
50
52
|
end
|
51
53
|
|
52
54
|
@galleries = @galleries.page( params[:galleries_page] ).per( current_profile.per_page )
|
53
|
-
|
54
|
-
render "_index"
|
55
|
+
render '_index'
|
55
56
|
end
|
56
57
|
|
57
58
|
def j_show
|
@@ -127,6 +128,31 @@ class Wco::GalleriesController < Wco::ApplicationController
|
|
127
128
|
end
|
128
129
|
end
|
129
130
|
|
131
|
+
def update_many
|
132
|
+
authorize! :update, Wco::Gallery
|
133
|
+
galleries = Wco::Gallery.where( :id.in => params[:gallery_ids] )
|
134
|
+
|
135
|
+
tags = Wco::Tag.where( :id.in => params[:tag_ids] )
|
136
|
+
|
137
|
+
if params[:remove]
|
138
|
+
galleries.each do |gallery|
|
139
|
+
tags.each do |tag|
|
140
|
+
gallery.tags.delete tag
|
141
|
+
end
|
142
|
+
gallery.save
|
143
|
+
end
|
144
|
+
else
|
145
|
+
galleries.each do |gallery|
|
146
|
+
gallery.tags.push tags
|
147
|
+
gallery.save
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
flash_notice 'Unknown outcome, no exception raised.'
|
152
|
+
redirect_to request.referrer
|
153
|
+
end
|
154
|
+
|
155
|
+
|
130
156
|
##
|
131
157
|
## private
|
132
158
|
##
|
@@ -1,6 +1,8 @@
|
|
1
1
|
|
2
2
|
class Wco::TagsController < Wco::ApplicationController
|
3
3
|
|
4
|
+
before_action :set_lists, only: %i| show |
|
5
|
+
|
4
6
|
def create
|
5
7
|
@tag = Wco::Tag.new params[:tag].permit!
|
6
8
|
authorize! :create, @tag
|
@@ -42,7 +44,12 @@ class Wco::TagsController < Wco::ApplicationController
|
|
42
44
|
@tag = Wco::Tag.find params[:id]
|
43
45
|
authorize! :show, @tag
|
44
46
|
|
45
|
-
@
|
47
|
+
@galleries = @tag.galleries(
|
48
|
+
).page( params[:galleries_page] ).per( current_profile.per_page )
|
49
|
+
|
50
|
+
@reports = @tag.reports(
|
51
|
+
).page( params[:reports_page] ).per( current_profile.per_page )
|
52
|
+
|
46
53
|
end
|
47
54
|
|
48
55
|
def update
|
@@ -56,4 +63,14 @@ class Wco::TagsController < Wco::ApplicationController
|
|
56
63
|
redirect_to action: 'index'
|
57
64
|
end
|
58
65
|
|
66
|
+
##
|
67
|
+
## private
|
68
|
+
##
|
69
|
+
private
|
70
|
+
|
71
|
+
def set_lists
|
72
|
+
@tags = Wco::Tag.all
|
73
|
+
end
|
74
|
+
|
75
|
+
|
59
76
|
end
|
data/app/models/wco/gallery.rb
CHANGED
data/app/models/wco/tag.rb
CHANGED
@@ -18,7 +18,9 @@ class Wco::Tag
|
|
18
18
|
has_and_belongs_to_many :headlines # , class_name: 'Headline'
|
19
19
|
has_and_belongs_to_many :leads, index: true # , class_name: 'Lead'
|
20
20
|
has_and_belongs_to_many :leadsets # , class_name: 'Leadset'
|
21
|
+
has_and_belongs_to_many :galleries
|
21
22
|
has_and_belongs_to_many :reports
|
23
|
+
has_and_belongs_to_many :videos
|
22
24
|
has_and_belongs_to_many :logs
|
23
25
|
|
24
26
|
INBOX = 'inbox'
|
data/app/models/wco/video.rb
CHANGED
@@ -32,6 +32,9 @@ class Wco::Video
|
|
32
32
|
# belongs_to :user_profile, :class_name => 'Ish::UserProfile', :inverse_of => :videos
|
33
33
|
# has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_videos
|
34
34
|
|
35
|
+
has_and_belongs_to_many :tags
|
36
|
+
|
37
|
+
|
35
38
|
has_mongoid_attached_file :video,
|
36
39
|
# styles: { :thumb => { geometry: '192x108', format: 'jpeg' }, },
|
37
40
|
# processors: [ :transcoder ],
|
@@ -8,37 +8,48 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
.galleries--index.maxwidth
|
11
|
-
= render 'header', galleries: galleries
|
11
|
+
= render '/wco/galleries/header', galleries: galleries
|
12
12
|
|
13
13
|
.padded
|
14
14
|
- if galleries.length > 0
|
15
|
-
- if galleries.respond_to? :total_pages
|
16
|
-
= paginate galleries, :param_name => :galleries_page, :views_prefix => 'wco'
|
17
|
-
|
18
15
|
= form_tag update_galleries_path do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
(#{g.photos.length})
|
31
|
-
= render 'meta', item: g
|
32
|
-
- if g.photos.length == 0
|
33
|
-
No Photos
|
34
|
-
- else
|
35
|
-
.d-flex.flex-wrap.photos-thumbs
|
36
|
-
- g.photos.limit( @current_profile.show_n_thumbs ).each do |photo|
|
37
|
-
= link_to image_tag(photo.photo.url(:thumb), :alt => ''), gallery_path(g.slug)
|
16
|
+
- @tags.each do |tag|
|
17
|
+
|
18
|
+
.Chip
|
19
|
+
= check_box_tag 'tag_ids[]', tag.id
|
20
|
+
= tag
|
21
|
+
|
22
|
+
= submit_tag 'Add Tags', data: { confirm: 'Are you sure?' }
|
23
|
+
|
24
|
+
%label remove?
|
25
|
+
= check_box_tag :remove
|
26
|
+
= submit_tag 'Tags', data: { confirm: 'Are you sure?' }
|
38
27
|
|
39
28
|
- if galleries.respond_to? :total_pages
|
40
29
|
= paginate galleries, :param_name => :galleries_page, :views_prefix => 'wco'
|
41
30
|
|
31
|
+
.row
|
32
|
+
- galleries.each do |g|
|
33
|
+
.col-sm-12.col-md-6
|
34
|
+
.Card
|
35
|
+
%h5
|
36
|
+
= check_box_tag 'gallery_ids[]', g.id
|
37
|
+
= link_to '[~]', edit_gallery_path( g )
|
38
|
+
= link_to g.name, gallery_path(g.slug)
|
39
|
+
(#{g.photos.length})
|
40
|
+
= render 'meta', item: g
|
41
|
+
- if g.photos.length == 0
|
42
|
+
No Photos
|
43
|
+
- else
|
44
|
+
.d-flex.flex-wrap.photos-thumbs
|
45
|
+
- g.photos.limit( @current_profile.show_n_thumbs ).each do |photo|
|
46
|
+
= link_to image_tag(photo.photo.url(:thumb), :alt => ''), gallery_path(g.slug)
|
47
|
+
|
48
|
+
- if galleries.respond_to? :total_pages
|
49
|
+
= paginate galleries, :param_name => :galleries_page, :views_prefix => 'wco'
|
50
|
+
|
42
51
|
- else
|
43
|
-
|
52
|
+
.p No Galleries
|
53
|
+
|
54
|
+
|
44
55
|
|
@@ -12,6 +12,9 @@
|
|
12
12
|
%li.d-flex
|
13
13
|
<b>Headlines (#{@tag.headlines.length}): </b>
|
14
14
|
= render '/wco/headlines/index', headlines: @tag.headlines
|
15
|
+
%li.d-flex
|
16
|
+
<b>Galleries (#{@galleries.length}): </b>
|
17
|
+
= render 'wco/galleries/index', galleries: @galleries, config: { skip_tags: true }
|
15
18
|
%li.d-flex
|
16
19
|
<b>Reports (#{@reports.length}): </b>
|
17
20
|
= render 'wco/reports/list', reports: @reports, config: { skip_tags: true }
|
data/config/routes.rb
CHANGED
@@ -11,7 +11,7 @@ Wco::Engine.routes.draw do
|
|
11
11
|
resources :assets
|
12
12
|
# get 'assets/:id', to: 'assets#show', as: :asset
|
13
13
|
|
14
|
-
post 'galleries/update', to: 'galleries#
|
14
|
+
post 'galleries/update', to: 'galleries#update_many', as: :update_galleries
|
15
15
|
resources :galleries do
|
16
16
|
post 'multiadd', :to => 'photos#j_create', :as => :multiadd
|
17
17
|
end
|