wco_models 3.1.0.133 → 3.1.0.135

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: '08e95dc229ad1424fb5712f08008e7c36011c34d1185ea68ab62d427d2165459'
4
- data.tar.gz: a315d6d0595e141555526012f89a0e9548c0a61f5107441b29ba0f8161414b28
3
+ metadata.gz: f667b2e3aff979297adf77e14f569164761f083784e88e6dc76735d002488f3f
4
+ data.tar.gz: 5cff89fae12fb7c9f8da0bd042b17d425eda08ed5c68f7b6dea78b147b082541
5
5
  SHA512:
6
- metadata.gz: 0fc514ec8dffd6b0be83fd5362f512828bfe0b0bd7f199f51c1f6221a5114049c45b12334e59d4277c4f0e21ea73d0d48d7e58b33259aa2caca4218daf04ba62
7
- data.tar.gz: f8f51784b26e0230d815dd68de3230ed5329eb94754c9c6a23b084e6b1c3dcdd973d4909781b5cf9ed65b7f2180a452e9a9828a365a9bce378d4ef1fa055266a
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;
@@ -123,6 +123,30 @@ textarea.monospace {
123
123
  }
124
124
 
125
125
  /* H */
126
+
127
+
128
+ .h-20px {
129
+ min-height: 20px;
130
+ }
131
+ .h-30px {
132
+ min-height: 30px;
133
+ }
134
+ .h-50px {
135
+ min-height: 50px;
136
+ }
137
+
138
+ .h-300px {
139
+ min-height: 300px;
140
+ }
141
+
142
+ .h-400px {
143
+ min-height: 400px;
144
+ }
145
+
146
+ .h-500px {
147
+ min-height: 500px;
148
+ }
149
+
126
150
  .header {
127
151
  display: flex;
128
152
 
@@ -135,10 +159,11 @@ textarea.monospace {
135
159
  }
136
160
  }
137
161
 
138
- .h-500px {
139
- min-height: 500px;
162
+ .hide, .hidden {
163
+ display: none;
140
164
  }
141
165
 
166
+
142
167
  /* M */
143
168
 
144
169
  .maxwidth {
@@ -149,7 +174,11 @@ textarea.monospace {
149
174
  .mini {
150
175
  font-size: 0.75em;
151
176
  }
152
-
177
+ .mini-inputs {
178
+ input[type='number'] {
179
+ width: 4em;
180
+ }
181
+ }
153
182
  /* P */
154
183
 
155
184
  .padded {
@@ -159,6 +188,11 @@ textarea.monospace {
159
188
  width: calc( 100% - 1em );
160
189
  }
161
190
 
191
+ /* S */
192
+ .spacer-small {
193
+ height: 20px;
194
+ }
195
+
162
196
  /* T */
163
197
 
164
198
  .title {
@@ -167,6 +201,21 @@ textarea.monospace {
167
201
 
168
202
  /* W */
169
203
 
204
+ .w-20px {
205
+ width: 20px;
206
+ }
207
+ .w-30px {
208
+ width: 30px;
209
+ }
210
+ .w-50px {
211
+ width: 50px;
212
+ }
213
+ .w-150px {
214
+ width: 150px;
215
+ }
216
+ .w-200px {
217
+ width: 200px;
218
+ }
170
219
  .w-300px {
171
220
  width: 300px;
172
221
  }
@@ -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
@@ -29,9 +29,11 @@ module Wco::ApplicationHelper
29
29
  return date.in_time_zone( Rails.application.config.time_zone ).strftime('%l:%M%P %Z')
30
30
  end
31
31
 
32
- def pp_amount a
32
+ def pp_amount a, config = { precision: 2 }
33
33
  return '-' if !a
34
- "$ #{'%.2f' % a}"
34
+ return '-' if a.class == String
35
+ return number_to_currency a, precision: config[:precision]
36
+ # "$#{'%.2f' % a}"
35
37
  end
36
38
  def pp_money a; pp_amount a; end
37
39
  def pp_currency a; pp_amount a; 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
@@ -10,9 +10,12 @@
10
10
  .flex-row
11
11
  %ul
12
12
  %li= link_to 'ROOT', '/'
13
- %li= link_to '/email', '/email'
14
- %li= link_to '/hosting', '/hosting'
15
- %li= link_to '/trading', '/trading'
13
+ - if defined? wco_email
14
+ %li= link_to '/email', '/email'
15
+ - if defined? wco_hosting
16
+ %li= link_to '/hosting', '/hosting'
17
+ - if defined? iro
18
+ %li= link_to '/trading', '/trading'
16
19
 
17
20
  %ul
18
21
  %li= render '/wco/invoices/header'
@@ -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.133
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-08 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