wco_models 3.1.0.141 → 3.1.0.142

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: 0ba532da884be707b7fac5365a23c346df65965efa7a6b53a16d50d73f7fe476
4
- data.tar.gz: 50f746e36a2a6c4cb6cf1526905027d60169c394e8bb9c95f496d836e3059667
3
+ metadata.gz: 416492ad97851c4301c4bf4554ad88bf6f98b0c98a87fa47666b6958c3bab337
4
+ data.tar.gz: 2288a79fef2d8c98e9bc9587e459515e802d2cf4e393976f9c810254cc0d0296
5
5
  SHA512:
6
- metadata.gz: dbc25645c7e5ee4e3749a4ea996461d0fd4a8d7a66710660b487e84819b506abece3a0545d8b7e27303b69656115a30e1ca46b6c542bf114fc969ff325ee9016
7
- data.tar.gz: 214a60d7d891227dbcfd6442e34fb19651e09c272ebfda3d5867e388c7fda7f01d4e557dba6599571623411f7c00a603fdb4c64bb0a272cadcc7c341c8584ccf
6
+ metadata.gz: '08e838000f036f91ff65b33e261a5559000c5683c1ec246ab16011cbe85af8aa90491cc1654635ac2e288a47d3697ced7e52b2db95e0b581c53277f6ddd63745'
7
+ data.tar.gz: fb84b9bdbdae14145fee0f1773512019db8f73b1b9c0ebb02af6662c93502bf3b5607b8371f59ece21fff747a8b2d43230b82b8b61d59755ba6df784b618dae6
@@ -170,6 +170,7 @@ class Wco::GalleriesController < Wco::ApplicationController
170
170
 
171
171
  def set_lists
172
172
  @galleries_list = Wco::Gallery.list
173
+ @tags_list = Wco::Tag.list
173
174
  end
174
175
 
175
176
  end
@@ -40,6 +40,28 @@ class Wco::TagsController < Wco::ApplicationController
40
40
  @new_tag = Wco::Tag.new
41
41
  end
42
42
 
43
+ def add_to
44
+ @tag = Wco::Tag.find params[:id]
45
+ resource = params[:resource].constantize.find params[:resource_id]
46
+ authorize! :update, @tag
47
+
48
+ resource.tags.push @tag
49
+ flag = resource.save
50
+ flash_notice 'maybe?'
51
+ redirect_to request.referrer
52
+ end
53
+
54
+ def remove_from
55
+ @tag = Wco::Tag.find params[:id]
56
+ resource = params[:resource].constantize.find params[:resource_id]
57
+ authorize! :update, @tag
58
+
59
+ resource.tags.delete @tag
60
+ flag = resource.save
61
+ flash_notice 'maybe?'
62
+ redirect_to request.referrer
63
+ end
64
+
43
65
  def show
44
66
  @tag = Wco::Tag.find params[:id]
45
67
  authorize! :show, @tag
@@ -33,7 +33,7 @@
33
33
  %li= render '/wco/sites/header'
34
34
  %li= render '/wco/headlines/header'
35
35
  %li= render '/wco/publishers/header'
36
- %li= render '/wco/galleries/header'
36
+ %li= render '/wco/galleries/header_mini'
37
37
  %li= render '/wco/reports/header'
38
38
  %li= render '/wco/videos/header'
39
39
 
@@ -1,8 +1,22 @@
1
1
 
2
- - galleries ||= Wco::Gallery.all
2
+ .galleries--header
3
+ %h2.title
4
+ Gallery
5
+ = link_to gallery.name, gallery_path(gallery)
6
+ (#{gallery.photos.length})
7
+ = link_to '[~]', edit_gallery_path( gallery )
8
+ .d-inline-block= button_to 'x', gallery_path(gallery), method: :delete, data: { confirm: 'Are you sure?' }
9
+ - if gallery.is_public
10
+ %i.material-icons visibility
11
+ - else
12
+ %i.material-icons visibility_off
13
+ = render 'meta', :item => gallery
14
+
15
+ = render '/wco/tags/list_mini', tags: gallery.tags, resource: gallery
16
+
17
+ %ul
18
+ %li slug :: #{gallery.slug}
19
+ %li subhead :: #{gallery.subhead}
20
+ %li deleted_at ::#{gallery.deleted_at}
21
+
3
22
 
4
- = link_to "Galleries (#{galleries.length})", wco.galleries_path
5
- .d-inline-block
6
- = form_tag wco.galleries_path, method: :get do
7
- = text_field_tag :q
8
- = link_to '[+]', wco.new_gallery_path
@@ -0,0 +1,8 @@
1
+
2
+ - galleries ||= Wco::Gallery.all
3
+
4
+ = link_to "Galleries (#{galleries.length})", wco.galleries_path
5
+ .d-inline-block
6
+ = form_tag wco.galleries_path, method: :get do
7
+ = text_field_tag :q
8
+ = link_to '[+]', wco.new_gallery_path
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
  .galleries--index.maxwidth
11
- = render '/wco/galleries/header', galleries: galleries
11
+ = render '/wco/galleries/header_mini', galleries: galleries
12
12
 
13
13
  .padded
14
14
  - if galleries.length > 0
@@ -5,7 +5,7 @@
5
5
  .galleries-show.padded
6
6
  .row
7
7
  .col-md-6
8
- = render 'title', gallery: @gallery
8
+ = render 'header', gallery: @gallery
9
9
  .col-md-6
10
10
  = render 'wco/photos/multinew', gallery: @gallery
11
11
 
@@ -8,4 +8,11 @@
8
8
  - if !config&.without_checkbox
9
9
  = check_box_tag 'tag_ids[]', tag.id
10
10
  = link_to tag.slug, wco.tag_path( tag )
11
+ - if defined? resource
12
+ .mini.d-inline-block= button_to 'x', remove_tag_from_path(id: tag.id, resource: resource.class, resource_id: resource.id, ), method: 'delete', data: { confirm: 'Are you sure?' }
13
+
14
+ - if defined? resource
15
+ = form_tag add_tag_to_path( resource: resource.class, resource_id: resource.id ) do
16
+ = select_tag :id, options_for_select( @tags_list )
17
+ = submit_tag '+Tag', data: { confirm: 'Are you sure?' }
11
18
 
data/config/routes.rb CHANGED
@@ -56,6 +56,8 @@ Wco::Engine.routes.draw do
56
56
  resources :sites
57
57
  resources :subscriptions
58
58
 
59
+ delete 'tags/remove/:id/from/:resource/:resource_id', to: 'tags#remove_from', as: :remove_tag_from
60
+ post 'tags/add-to/:resource/:resource_id', to: 'tags#add_to', as: :add_tag_to
59
61
  resources :tags
60
62
 
61
63
  ## In order to have unsubscribes_url , unsubscribes must be in wco .
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.141
4
+ version: 3.1.0.142
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
@@ -492,10 +492,10 @@ files:
492
492
  - app/views/wco/application/tinymce.html.erb
493
493
  - app/views/wco/galleries/_form.haml
494
494
  - app/views/wco/galleries/_header.haml
495
+ - app/views/wco/galleries/_header_mini.haml
495
496
  - app/views/wco/galleries/_index.haml
496
497
  - app/views/wco/galleries/_menu_secondary.haml
497
498
  - app/views/wco/galleries/_thumbs.haml
498
- - app/views/wco/galleries/_title.haml
499
499
  - app/views/wco/galleries/edit.haml
500
500
  - app/views/wco/galleries/new.haml
501
501
  - app/views/wco/galleries/show.haml
@@ -1,19 +0,0 @@
1
-
2
- .galleries--title
3
- %h2
4
- Gallery
5
- = link_to gallery.name, gallery_path(gallery)
6
- (#{gallery.photos.length})
7
- = link_to '[~]', edit_gallery_path( gallery )
8
- .d-inline-block= button_to 'x', gallery_path(gallery), method: :delete, data: { confirm: 'Are you sure?' }
9
- - if gallery.is_public
10
- %i.material-icons visibility
11
- - else
12
- %i.material-icons visibility_off
13
-
14
- = render '/wco/tags/list_mini', tags: gallery.tags
15
-
16
- %ul
17
- %li slug :: #{gallery.slug}
18
- %li subhead :: #{gallery.subhead}
19
- %li= render 'meta', :item => gallery