wco_models 3.1.0.140 → 3.1.0.142

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa9e988a7e44625ce410a082ccf9055608a690320c5d2e5d4fe86a3d95284a5d
4
- data.tar.gz: ab13367e43002f64bac72f54c668a2dfcbcc9296359c651273c6c0c8fd645564
3
+ metadata.gz: 416492ad97851c4301c4bf4554ad88bf6f98b0c98a87fa47666b6958c3bab337
4
+ data.tar.gz: 2288a79fef2d8c98e9bc9587e459515e802d2cf4e393976f9c810254cc0d0296
5
5
  SHA512:
6
- metadata.gz: 24ee85d5971e231eb4607794fe7d75d7f1780f310bbfc15e6e0888888edc88dcdf0b593cf4d6dfdc461e5ed845c6bd27bbd5042127fa6a1c4202b11e28d5d61f
7
- data.tar.gz: effca0d00789c5649feed0ac7e3313adab6e0f904cd167eb42916e3417c2e87e5814f0e199c2f88433c6851e86a7561d7ab95052bdb7f67f8dd54305427666f9
6
+ metadata.gz: '08e838000f036f91ff65b33e261a5559000c5683c1ec246ab16011cbe85af8aa90491cc1654635ac2e288a47d3697ced7e52b2db95e0b581c53277f6ddd63745'
7
+ data.tar.gz: fb84b9bdbdae14145fee0f1773512019db8f73b1b9c0ebb02af6662c93502bf3b5607b8371f59ece21fff747a8b2d43230b82b8b61d59755ba6df784b618dae6
@@ -15,6 +15,7 @@
15
15
  display: inline-block;
16
16
 
17
17
  height: 32px;
18
+ line-height: 32px;
18
19
 
19
20
  margin-right: 32px;
20
21
  margin-bottom: 0.3em;
@@ -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
@@ -37,8 +37,8 @@ module Wco::ApplicationHelper
37
37
  end
38
38
  def pp_money a; pp_amount a; end
39
39
  def pp_currency a; pp_amount a; end
40
- def pp_percent a
41
- "#{(a*100).round(2)}%"
40
+ def pp_percent a, config = { precision: 2}
41
+ "#{(a*100).round( config[:precision] )}%" rescue '@TODO'
42
42
  end
43
43
 
44
44
  end
@@ -29,6 +29,7 @@
29
29
  .col-sm-4
30
30
  = render '/wco/profiles/form_extra', profile: @current_profile
31
31
  = link_to 'RTEditor', wco.application_tinymce_path, target: :_blank
32
+ = render 'wco/application/debug' if !Rails.env.production?
32
33
 
33
34
  .c
34
- = render 'wco/application/debug' if !Rails.env.production?
35
+
@@ -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,5 +1,5 @@
1
1
 
2
2
  .d-flex
3
- .label Select All
3
+ .label.mini All
4
4
  = check_box_tag :select_all
5
5
  .n-selected -
@@ -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,16 +8,13 @@
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
15
15
  = form_tag update_galleries_path do
16
- - @tags.each do |tag|
17
16
 
18
- .Chip
19
- = check_box_tag 'tag_ids[]', tag.id
20
- = tag
17
+ = render '/wco/tags/list_mini', tags: @tags
21
18
 
22
19
  = submit_tag 'Add Tags', data: { confirm: 'Are you sure?' }
23
20
  &nbsp;&nbsp;
@@ -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
 
@@ -0,0 +1,18 @@
1
+
2
+
3
+ -# <b>Tags (#{tags.length}):</b>
4
+ -# - cache cache_key do
5
+ .Tags.chips.mb-2
6
+ - tags.each do |tag|
7
+ .Chip{ data: { tag: { id: tag.id.to_s } } }
8
+ - if !config&.without_checkbox
9
+ = check_box_tag 'tag_ids[]', tag.id
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?' }
18
+
@@ -40,7 +40,7 @@
40
40
  -# = render '/wco_email/contexts/form_reply_mini', lead_id: msg.lead_id, message: msg, ctx: WcoEmail::Context.new({ from_email: msg.to&.downcase, subject: msg.subject, email_template_id: ET.find_by( slug: 'blank').id })
41
41
 
42
42
  %td.tags.mini
43
- = render '/wco/tags/chips', tags: conv.tags, cache_key: conv.cache_key
43
+ = render '/wco/tags/list_mini', tags: conv.tags, cache_key: conv.cache_key, config: OpenStruct.new( without_checkbox: true )
44
44
  %td.latest-at
45
45
  = pp_date conv.latest_at
46
46
  = pp_time conv.latest_at
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.140
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
@@ -591,11 +591,9 @@ files:
591
591
  - app/views/wco/sites/edit.haml
592
592
  - app/views/wco/sites/index.haml
593
593
  - app/views/wco/sites/new.haml
594
- - app/views/wco/tags/_chips.haml
595
594
  - app/views/wco/tags/_form.haml
596
595
  - app/views/wco/tags/_header.haml
597
596
  - app/views/wco/tags/_index.haml
598
- - app/views/wco/tags/_index_inline.haml
599
597
  - app/views/wco/tags/_list_mini.haml
600
598
  - app/views/wco/tags/edit.haml
601
599
  - app/views/wco/tags/index.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
@@ -1,6 +0,0 @@
1
-
2
- - cache cache_key do
3
- .tags--chips
4
- - tags.each do |tag|
5
- .mb-1
6
- .Chip{ data: { tag: { id: tag.id.to_s } } }= tag.slug
@@ -1,7 +0,0 @@
1
-
2
-
3
- .Tags.chips.mb-2
4
- <b>Tags (#{tags.length}):</b>
5
- - tags.each_with_index do |tag, idx|
6
- .Chip
7
- = link_to tag.slug, wco.tag_path(tag)
@@ -1 +0,0 @@
1
- app/views/wco/tags/_index_inline.haml