wco_models 3.1.0.134 → 3.1.0.136

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: cff4e9543401c7d5f8727374e53f03b74558a872510fc1fad25571109d1b9d3f
4
- data.tar.gz: ceae4b3cfdcafbacd7eef23acb410d544ba02c1c1d5083beea72a630d10c0773
3
+ metadata.gz: a4aca388a9b787126a677bc0a0dada925305f24381f879dc7df154179e968381
4
+ data.tar.gz: b2d6f9d703ab36d7bbdb1ce87940f516b96ff9e9c288a9f201bf8d712e3f4bb2
5
5
  SHA512:
6
- metadata.gz: 03d11aa19ec11beea9883d7b58547a165c1b08cd6f5b74f199413bf3a5961aa706db118a5c806a01c2845fa3e258a74fc4342f17604fa1cac531374d11b94255
7
- data.tar.gz: a75b5a7452753b0791dc2452d9bd9f09683d3fb1cddd9ee248b0d04a0d5fdff42efecb2cae1ea1bbacc7476a6ab88bdff5160e91665815a8296c7054feb3ac8d
6
+ metadata.gz: 102c9769aa8cff0861ca10a8a63774da3d17686dc36ffc1f2a3bcb290504c4263fcc3d2a4149ca5796fd6c5406b24ce314f5bcdb1e479ec824fc743ca7432970
7
+ data.tar.gz: c79fa5615fe7d33f5ca72b56934c71934177f9f70d3cfad6d1af54a43dc801c6eab1895a4dbe4243b960ee98fc49cdaea6b8c436dd2c344375961d3a9dda75e8
@@ -24,12 +24,12 @@ div.galleries-show {
24
24
  }
25
25
 
26
26
 
27
- // .row-thumbs .item {
28
- // margin-bottom: 1em;
29
- // img {
30
- // margin-top: 10px;
31
- // }
32
- // }
27
+ .row-thumbs {
28
+ .items {
29
+ flex-wrap: wrap;
30
+ align-items: flex-start;
31
+ }
32
+ }
33
33
 
34
34
  .row-large .item {
35
35
  // border: 1px solid red;
@@ -34,6 +34,7 @@ img.thumb {
34
34
  .photos--meta-manager {
35
35
  display: flex;
36
36
  justify-content: space-between;
37
+ align-items: flex-start;
37
38
 
38
39
  .right-hand {
39
40
  text-align: right;
@@ -174,7 +174,11 @@ textarea.monospace {
174
174
  .mini {
175
175
  font-size: 0.75em;
176
176
  }
177
-
177
+ .mini-inputs {
178
+ input[type='number'] {
179
+ width: 4em;
180
+ }
181
+ }
178
182
  /* P */
179
183
 
180
184
  .padded {
@@ -1,7 +1,7 @@
1
1
 
2
2
  class Wco::GalleriesController < Wco::ApplicationController
3
3
 
4
- # before_action :set_lists
4
+ before_action :set_lists, only: %i| show |
5
5
  before_action :set_gallery, only: %w| destroy edit j_show show update update_ordering |
6
6
 
7
7
  # Alphabetized! : )
@@ -142,5 +142,9 @@ class Wco::GalleriesController < Wco::ApplicationController
142
142
  @page_description = @gallery.subhead
143
143
  end
144
144
 
145
+ def set_lists
146
+ @galleries_list = Wco::Gallery.list
147
+ end
148
+
145
149
  end
146
150
 
@@ -8,16 +8,18 @@ class Wco::PhotosController < Wco::ApplicationController
8
8
  ## Alphabetized : )
9
9
 
10
10
  def destroy
11
- @photo = Wco::Photo.unscoped.find params[:id]
12
- authorize! :destroy, @photo
13
- @photo.gallery.touch if @photo.gallery
14
- @photo.is_trash = true
15
- flag = @photo.save
16
- if flag
17
- flash[:notice] = "Success"
18
- else
19
- flash[:alert] = "No luck: #{@photo.errors.messages}"
11
+ authorize! :destroy, Wco::Photo
12
+ if params[:id]
13
+ @photos = [ Wco::Photo.unscoped.find( params[:id] ) ]
14
+ elsif params[:ids]
15
+ @photos = Wco::Photo.where( :id.in => params[:ids] )
20
16
  end
17
+ outs = []
18
+ @photos.map do |photo|
19
+ photo.gallery.touch if photo.gallery
20
+ outs.push photo.delete
21
+ end
22
+ flash_notice "Outcomes: #{outs}"
21
23
  redirect_to request.referrer || root_path
22
24
  end
23
25
 
@@ -60,6 +62,19 @@ class Wco::PhotosController < Wco::ApplicationController
60
62
  end
61
63
  end
62
64
 
65
+ def move
66
+ authorize! :move, Wco::Photo
67
+ photos = Wco::Photo.where({ :id.in => params[:ids] })
68
+
69
+ flag = photos.update_all({ gallery_id: params[:gallery_id] })
70
+ if flag
71
+ flash_notice 'ok'
72
+ else
73
+ flash_alert 'not ok'
74
+ end
75
+ redirect_to request.referrer
76
+ end
77
+
63
78
  def new
64
79
  authorize! :new, Wco::Photo
65
80
  @photo = Wco::Photo.new
@@ -31,6 +31,7 @@ module Wco::ApplicationHelper
31
31
 
32
32
  def pp_amount a, config = { precision: 2 }
33
33
  return '-' if !a
34
+ return '-' if a.class == String
34
35
  return number_to_currency a, precision: config[:precision]
35
36
  # "$#{'%.2f' % a}"
36
37
  end
@@ -40,7 +40,9 @@ class Wco::Gallery
40
40
 
41
41
  def self.list conditions = {}
42
42
  out = self.unscoped.where( conditions ).order_by( :created_at => :desc )
43
- [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
43
+ [['', nil]] + out.map do |item|
44
+ [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ]
45
+ end
44
46
  end
45
47
 
46
48
  has_many :photos, class_name: '::Wco::Photo', order: { weight: :asc }
@@ -10,6 +10,7 @@ class Wco::Profile
10
10
  validates :email, presence: true, uniqueness: true
11
11
 
12
12
  field :per_page, type: :integer, default: 25
13
+ field :show_n_thumbs, type: :integer, default: 8
13
14
 
14
15
  belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :profile, optional: true
15
16
  has_many :newsitems, class_name: 'Wco::Newsitem'
@@ -27,11 +27,7 @@
27
27
  = pp_time Time.now
28
28
 
29
29
  .col-sm-4
30
- = form_for @current_profile, url: wco.profile_path(@current_profile), as: :profile do |f|
31
- .flex-row
32
- = f.label :per_page
33
- = f.select :per_page, options_for_select([ 10, 25, 50, 100, 250, 500, 1000], selected: @current_profile.per_page)
34
- = f.submit 'Go'
30
+ = render '/wco/profiles/form_extra', profile: @current_profile
35
31
  = link_to 'RTEditor', wco.application_tinymce_path, target: :_blank
36
32
 
37
33
  .c
@@ -0,0 +1,3 @@
1
+
2
+ %ul
3
+ %li <b>params:</b> #{params.permit!.to_h}
@@ -4,36 +4,40 @@
4
4
  -# _vp_ 2022-09-25 :: Small styling revision
5
5
  -#
6
6
 
7
- - n_thumbs ||= 8
8
7
  - galleries ||= @galleries
9
8
 
9
+
10
10
  .galleries--index.maxwidth
11
11
  = render 'header', galleries: galleries
12
12
 
13
13
  .padded
14
14
  - if galleries.length > 0
15
-
16
15
  - if galleries.respond_to? :total_pages
17
16
  = paginate galleries, :param_name => :galleries_page, :views_prefix => 'wco'
18
17
 
19
- .row
20
- - galleries.each do |g|
21
- .col-sm-12.col-md-6
22
- .Card
23
- %h5
24
- = link_to '[~]', edit_gallery_path( g )
25
- = link_to g.name, gallery_path(g.slug)
26
- (#{g.photos.length})
27
- = render 'meta', item: g
28
- - if g.photos.length == 0
29
- No Photos
30
- - else
31
- .d-flex.flex-wrap.photos-thumbs
32
- - g.photos.limit( n_thumbs ).each do |photo|
33
- = link_to image_tag(photo.photo.url(:thumb), :alt => ''), gallery_path(g.slug)
34
-
35
- - if galleries.respond_to? :total_pages
36
- = paginate galleries, :param_name => :galleries_page, :views_prefix => 'wco'
18
+ = form_tag update_galleries_path do
19
+ = select_tag 'tag_ids[]', options_for_select([ nil, 1 ]), { multiple: true }
20
+ = submit_tag 'Add Tags'
21
+
22
+ .row
23
+ - galleries.each do |g|
24
+ .col-sm-12.col-md-6
25
+ .Card
26
+ %h5
27
+ = check_box_tag 'ids[]', g.id
28
+ = link_to '[~]', edit_gallery_path( g )
29
+ = link_to g.name, gallery_path(g.slug)
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)
38
+
39
+ - if galleries.respond_to? :total_pages
40
+ = paginate galleries, :param_name => :galleries_page, :views_prefix => 'wco'
37
41
 
38
42
  - else
39
43
  %h5 No Galleries
@@ -21,17 +21,36 @@
21
21
  = link_to image_tag(photo.photo.url( :mini ), :alt => ''), "#large_#{photo.id}"
22
22
 
23
23
  .row-thumbs
24
- %p.collapse-expand#rowThumbs Thumbs
24
+ %i.fa.fa-expand.collapse-expand#rowMovableThumbs Movable Thumbs
25
25
  .orderable-items{ data: { id: @gallery.id.to_s, slug: @gallery.slug, token: form_authenticity_token } }
26
- .flex-row.items
27
- - @photos.each do |photo|
28
- .itemW
29
- %a.mvLeft &lt;
30
- %a.mvRight &gt;
31
- .item{ data: { id: photo.id.to_s } }
32
- = render 'wco/photos/meta_manager', photo: photo
33
- = image_tag photo.photo.url( :thumb )
34
- = button_tag 'Save ordering', class: 'save-ordering'
26
+ = form_tag wco.move_photos_path, { method: :post } do
27
+ .d-flex
28
+ = select_tag :gallery_id, options_for_select(@galleries_list), class: 'select2'
29
+ = submit_tag 'Move', data: { confirm: 'Are you sure?' }
30
+ .d-flex.items
31
+ - @photos.each do |photo|
32
+ .itemW
33
+ = check_box_tag 'ids[]', photo.id
34
+ .item{ data: { id: photo.id.to_s } }
35
+ = image_tag photo.photo.url( :thumb )
36
+
37
+ .row-thumbs
38
+ %i.fa.fa-expand.collapse-expand#rowOrderableThumbs Orderable, Deletable Thumbs
39
+ .orderable-items{ data: { id: @gallery.id.to_s, slug: @gallery.slug, token: form_authenticity_token } }
40
+ = form_tag wco.delete_photos_path, { method: :delete } do
41
+ = submit_tag 'Delete', data: { confirm: 'Are you sure?' }
42
+ = button_tag 'Save ordering', class: 'save-ordering'
43
+ .d-flex.items
44
+ - @photos.each do |photo|
45
+ .itemW
46
+ %a.mvLeft &lt;
47
+ %a.mvRight &gt;
48
+ .item{ data: { id: photo.id.to_s } }
49
+ = check_box_tag 'ids[]', photo.id
50
+ = render 'wco/photos/meta_manager', photo: photo
51
+ = image_tag photo.photo.url( :thumb )
52
+
53
+
35
54
 
36
55
  .row-large
37
56
  %p.collapse-expand#rowLarge Large
@@ -0,0 +1,12 @@
1
+
2
+
3
+ = form_for @current_profile, url: wco.profile_path(@current_profile), as: :profile do |f|
4
+ .mini-inputs
5
+ .flex-row
6
+ = f.label :per_page
7
+ = f.select :per_page, options_for_select([ 2, 10, 25, 50, 100, 250, 500, 1000], selected: @current_profile.per_page)
8
+ .d-flex
9
+ %label show_n_thumbs
10
+ = f.number_field :show_n_thumbs
11
+ .actions
12
+ = f.submit 'Go'
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', as: :update_galleries
14
15
  resources :galleries do
15
16
  post 'multiadd', :to => 'photos#j_create', :as => :multiadd
16
17
  end
@@ -44,6 +45,9 @@ Wco::Engine.routes.draw do
44
45
  resources :profiles
45
46
  post 'publishers/:id/do-run', to: 'publishers#do_run', as: :run_publisher
46
47
  resources :publishers
48
+
49
+ post 'photos/move', to: 'photos#move', as: :move_photos
50
+ delete 'photos/delete', to: 'photos#destroy', as: :delete_photos
47
51
  resources :photos
48
52
 
49
53
  get 'reports/deleted', to: 'reports#index', as: :deleted_reports, defaults: { deleted: true }
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.134
4
+ version: 3.1.0.136
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-15 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
@@ -571,6 +571,7 @@ files:
571
571
  - app/views/wco/products/new.haml
572
572
  - app/views/wco/products/show.haml
573
573
  - app/views/wco/products/show.jbuilder
574
+ - app/views/wco/profiles/_form_extra.haml
574
575
  - app/views/wco/publishers/_form.haml
575
576
  - app/views/wco/publishers/_header.haml
576
577
  - app/views/wco/publishers/edit.haml