c80_yax 0.1.0.3 → 0.1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/admin/c80_yax/cats.rb +5 -1
- data/app/helpers/c80_yax/cats/cat_view_helper.rb +15 -0
- data/app/models/c80_yax/cat.rb +20 -16
- data/app/uploaders/c80_yax/icat_uploader.rb +23 -0
- data/db/migrate/20170620111100_create_c80_yax_cats.rb +1 -0
- data/lib/c80_yax/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8896703e173f7ebc35c9c9bb777b505e3cd76d3
|
4
|
+
data.tar.gz: 14fe702299e0a2057d8bfa37cfe20a270415c363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11abc62b900d27625364db159894c648727086b793d6550e2955b5540b6a2fbc91df9aed4137352bc246442ae03e5c3edfe90020a1f3446fe5f96c93b1e450bf
|
7
|
+
data.tar.gz: 9117242d0ecf263ebd5dd09b4483c79f5a17346ff73e7bf2fcee3f059714332668c0007e98fe874679d6d30c8e5ace6681e21787430133c88d5d29981843376c
|
data/app/admin/c80_yax/cats.rb
CHANGED
@@ -8,6 +8,7 @@ ActiveAdmin.register C80Yax::Cat, as: 'Cat' do
|
|
8
8
|
permit_params :title,
|
9
9
|
:slug,
|
10
10
|
:ord,
|
11
|
+
:image,
|
11
12
|
:strsubcat_ids => []
|
12
13
|
|
13
14
|
config.batch_actions = false
|
@@ -18,7 +19,9 @@ ActiveAdmin.register C80Yax::Cat, as: 'Cat' do
|
|
18
19
|
id_column
|
19
20
|
column :ord
|
20
21
|
column :title
|
21
|
-
|
22
|
+
column :image do |cat|
|
23
|
+
cat_image(cat)
|
24
|
+
end
|
22
25
|
column :strsubcats do |cat|
|
23
26
|
res = '-'
|
24
27
|
if cat.strsubcats.count > 0
|
@@ -38,6 +41,7 @@ ActiveAdmin.register C80Yax::Cat, as: 'Cat' do
|
|
38
41
|
f.inputs 'Свойства категории' do
|
39
42
|
f.input :title
|
40
43
|
f.input :ord
|
44
|
+
f.input :image, :as => :file, :hint => cat_image(f.object)
|
41
45
|
f.input :strsubcats, :as => :check_boxes
|
42
46
|
end
|
43
47
|
|
data/app/models/c80_yax/cat.rb
CHANGED
@@ -1,25 +1,29 @@
|
|
1
1
|
require 'babosa'
|
2
2
|
|
3
|
-
|
3
|
+
module C80Yax
|
4
|
+
class Cat < ActiveRecord::Base
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
validates :title,
|
7
|
+
presence: true,
|
8
|
+
uniqueness: true,
|
9
|
+
length: { in: 6..50 }
|
9
10
|
|
10
|
-
|
11
|
+
has_and_belongs_to_many :strsubcats
|
12
|
+
mount_uploader :image, IcatUploader
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
extend FriendlyId
|
15
|
+
friendly_id :slug_candidates, :use => :slugged
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
def slug_candidates
|
18
|
+
[:title] + Array.new(6) {|index| [:title, index+2]}
|
19
|
+
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
def normalize_friendly_id(input)
|
22
|
+
input.to_s.to_slug.normalize(transliterations: :russian).to_s
|
23
|
+
end
|
22
24
|
|
23
|
-
|
25
|
+
scope :menu_order, -> {order(:ord => :asc)}
|
26
|
+
|
27
|
+
end
|
24
28
|
|
25
|
-
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module C80Yax
|
2
|
+
|
3
|
+
# грузит картинку категории
|
4
|
+
class IcatUploader < BaseFileUploader
|
5
|
+
|
6
|
+
process :resize_to_limit => [1024,768]
|
7
|
+
|
8
|
+
version :thumb_md do
|
9
|
+
begin
|
10
|
+
p = C80Yax::Prop.first
|
11
|
+
process :resize_to_fill => [p.thumb_md_width, p.thumb_md_height]
|
12
|
+
rescue => e
|
13
|
+
Rails.logger.debug "[TRACE] <icat_uploader.thumb_md> [ERROR] #{e}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def store_dir
|
18
|
+
'uploads/cats'
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/lib/c80_yax/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c80_yax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- app/assets/stylesheets/c80_yax_backend.scss
|
154
154
|
- app/controllers/c80_yax/admin_data_controller.rb
|
155
155
|
- app/controllers/c80_yax/app_controller.rb
|
156
|
+
- app/helpers/c80_yax/cats/cat_view_helper.rb
|
156
157
|
- app/helpers/c80_yax/data_helper.rb
|
157
158
|
- app/helpers/c80_yax/items/asterix_helper.rb
|
158
159
|
- app/helpers/c80_yax/items/buy_options_helper.rb
|
@@ -181,6 +182,7 @@ files:
|
|
181
182
|
- app/models/c80_yax/strsubcat_observer.rb
|
182
183
|
- app/models/c80_yax/uom.rb
|
183
184
|
- app/models/c80_yax/vendor.rb
|
185
|
+
- app/uploaders/c80_yax/icat_uploader.rb
|
184
186
|
- app/uploaders/c80_yax/iphoto_uploader.rb
|
185
187
|
- app/views/admin/strsubcats/_view.html.erb
|
186
188
|
- app/views/c80_yax/items/_buy_options.html.erb
|