wco_models 3.1.0.134 → 3.1.0.135

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: cff4e9543401c7d5f8727374e53f03b74558a872510fc1fad25571109d1b9d3f
4
- data.tar.gz: ceae4b3cfdcafbacd7eef23acb410d544ba02c1c1d5083beea72a630d10c0773
3
+ metadata.gz: f667b2e3aff979297adf77e14f569164761f083784e88e6dc76735d002488f3f
4
+ data.tar.gz: 5cff89fae12fb7c9f8da0bd042b17d425eda08ed5c68f7b6dea78b147b082541
5
5
  SHA512:
6
- metadata.gz: 03d11aa19ec11beea9883d7b58547a165c1b08cd6f5b74f199413bf3a5961aa706db118a5c806a01c2845fa3e258a74fc4342f17604fa1cac531374d11b94255
7
- data.tar.gz: a75b5a7452753b0791dc2452d9bd9f09683d3fb1cddd9ee248b0d04a0d5fdff42efecb2cae1ea1bbacc7476a6ab88bdff5160e91665815a8296c7054feb3ac8d
6
+ metadata.gz: aa88ab71277a00ded9d9e864f8e44591d6ca1617fc70d04855f7d56709949652a116ff481fa279d0375ff7382a687e86b58bf99b92c2b3d1a9fca1e7f222a13c
7
+ data.tar.gz: ce29ae70f121832939b6109cb86a8a5a35a5a694f56506c75580e5d64cc787b12f34ee53c9e1c551eda3d083ab36808a5397ac672489503a343a98ad8fe7fcc2
@@ -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,7 +4,6 @@
4
4
  -# _vp_ 2022-09-25 :: Small styling revision
5
5
  -#
6
6
 
7
- - n_thumbs ||= 8
8
7
  - galleries ||= @galleries
9
8
 
10
9
  .galleries--index.maxwidth
@@ -29,7 +28,7 @@
29
28
  No Photos
30
29
  - else
31
30
  .d-flex.flex-wrap.photos-thumbs
32
- - g.photos.limit( n_thumbs ).each do |photo|
31
+ - g.photos.limit( @current_profile.show_n_thumbs ).each do |photo|
33
32
  = link_to image_tag(photo.photo.url(:thumb), :alt => ''), gallery_path(g.slug)
34
33
 
35
34
  - if galleries.respond_to? :total_pages
@@ -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([ 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
@@ -44,6 +44,9 @@ Wco::Engine.routes.draw do
44
44
  resources :profiles
45
45
  post 'publishers/:id/do-run', to: 'publishers#do_run', as: :run_publisher
46
46
  resources :publishers
47
+
48
+ post 'photos/move', to: 'photos#move', as: :move_photos
49
+ delete 'photos/delete', to: 'photos#destroy', as: :delete_photos
47
50
  resources :photos
48
51
 
49
52
  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.135
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-16 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