wco_models 3.1.0.135 → 3.1.0.137

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f667b2e3aff979297adf77e14f569164761f083784e88e6dc76735d002488f3f
4
- data.tar.gz: 5cff89fae12fb7c9f8da0bd042b17d425eda08ed5c68f7b6dea78b147b082541
3
+ metadata.gz: 632761ee3733fa6dfa80381c4e542ced567f4ef571d3bd2cc14bd649f46c91b7
4
+ data.tar.gz: c597ae263f07ce7b48a86d0f95890a159a63d0275f2f56fe1ea46108bb3380c4
5
5
  SHA512:
6
- metadata.gz: aa88ab71277a00ded9d9e864f8e44591d6ca1617fc70d04855f7d56709949652a116ff481fa279d0375ff7382a687e86b58bf99b92c2b3d1a9fca1e7f222a13c
7
- data.tar.gz: ce29ae70f121832939b6109cb86a8a5a35a5a694f56506c75580e5d64cc787b12f34ee53c9e1c551eda3d083ab36808a5397ac672489503a343a98ad8fe7fcc2
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.1em;
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
- @reports = @tag.reports.page( params[:reports_page] ).per( current_profile.per_page )
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
@@ -51,6 +51,9 @@ class Wco::Gallery
51
51
  %w| name subhead descr |
52
52
  end
53
53
 
54
+ has_and_belongs_to_many :tags
55
+
56
+
54
57
  has_many :oats, class_name: 'Wco::OfficeActionTemplate'
55
58
 
56
59
  end
@@ -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'
@@ -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 ],
@@ -6,34 +6,50 @@
6
6
 
7
7
  - galleries ||= @galleries
8
8
 
9
+
9
10
  .galleries--index.maxwidth
10
- = render 'header', galleries: galleries
11
+ = render '/wco/galleries/header', galleries: galleries
11
12
 
12
13
  .padded
13
14
  - if galleries.length > 0
14
-
15
- - if galleries.respond_to? :total_pages
16
- = paginate galleries, :param_name => :galleries_page, :views_prefix => 'wco'
17
-
18
- .row
19
- - galleries.each do |g|
20
- .col-sm-12.col-md-6
21
- .Card
22
- %h5
23
- = link_to '[~]', edit_gallery_path( g )
24
- = link_to g.name, gallery_path(g.slug)
25
- (#{g.photos.length})
26
- = render 'meta', item: g
27
- - if g.photos.length == 0
28
- No Photos
29
- - else
30
- .d-flex.flex-wrap.photos-thumbs
31
- - g.photos.limit( @current_profile.show_n_thumbs ).each do |photo|
32
- = link_to image_tag(photo.photo.url(:thumb), :alt => ''), gallery_path(g.slug)
33
-
34
- - if galleries.respond_to? :total_pages
35
- = paginate galleries, :param_name => :galleries_page, :views_prefix => 'wco'
15
+ = form_tag update_galleries_path do
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
+ &nbsp;&nbsp;
24
+ %label remove?
25
+ = check_box_tag :remove
26
+ = submit_tag 'Tags', data: { confirm: 'Are you sure?' }
27
+
28
+ - if galleries.respond_to? :total_pages
29
+ = paginate galleries, :param_name => :galleries_page, :views_prefix => 'wco'
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'
36
50
 
37
51
  - else
38
- %h5 No Galleries
52
+ .p No Galleries
53
+
54
+
39
55
 
@@ -10,6 +10,9 @@
10
10
  %i.material-icons visibility
11
11
  - else
12
12
  %i.material-icons visibility_off
13
+
14
+ = render '/wco/tags/list_mini', tags: gallery.tags
15
+
13
16
  %ul
14
17
  %li slug :: #{gallery.slug}
15
18
  %li subhead :: #{gallery.subhead}
@@ -4,7 +4,7 @@
4
4
  .mini-inputs
5
5
  .flex-row
6
6
  = f.label :per_page
7
- = f.select :per_page, options_for_select([ 10, 25, 50, 100, 250, 500, 1000], selected: @current_profile.per_page)
7
+ = f.select :per_page, options_for_select([ 2, 10, 25, 50, 100, 250, 500, 1000], selected: @current_profile.per_page)
8
8
  .d-flex
9
9
  %label show_n_thumbs
10
10
  = f.number_field :show_n_thumbs
@@ -1,10 +1,7 @@
1
1
 
2
2
 
3
- .Tags.mb-2
3
+ .Tags.chips.mb-2
4
4
  <b>Tags (#{tags.length}):</b>
5
5
  - tags.each_with_index do |tag, idx|
6
- = link_to tag.slug, wco.tag_path(tag)
7
- - if idx+1 == tags.length
8
- \.
9
- - else
10
- \,&nbsp;
6
+ .Chip
7
+ = link_to tag.slug, wco.tag_path(tag)
@@ -12,6 +12,9 @@
12
12
  %li.d-flex
13
13
  <b>Headlines (#{@tag.headlines.length}):&nbsp;</b>
14
14
  = render '/wco/headlines/index', headlines: @tag.headlines
15
+ %li.d-flex
16
+ <b>Galleries (#{@galleries.length}):&nbsp;</b>
17
+ = render 'wco/galleries/index', galleries: @galleries, config: { skip_tags: true }
15
18
  %li.d-flex
16
19
  <b>Reports (#{@reports.length}):&nbsp;</b>
17
20
  = render 'wco/reports/list', reports: @reports, config: { skip_tags: true }
data/config/routes.rb CHANGED
@@ -11,6 +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#update_many', as: :update_galleries
14
15
  resources :galleries do
15
16
  post 'multiadd', :to => 'photos#j_create', :as => :multiadd
16
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.135
4
+ version: 3.1.0.137
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-16 00:00:00.000000000 Z
11
+ date: 2024-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3