ecm_pictures2_backend 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/ecm/pictures/backend/galleries_controller.rb +5 -1
- data/app/controllers/ecm/pictures/backend/pictures_controller.rb +43 -50
- data/app/views/ecm/pictures/backend/galleries/_form.html.haml +1 -0
- data/app/views/ecm/pictures/backend/galleries/_show.haml +1 -1
- data/app/views/ecm/pictures/backend/galleries/_table.html.haml +10 -6
- data/app/views/ecm/pictures/backend/pictures/_form.html.haml +3 -0
- data/app/views/ecm/pictures/backend/pictures/_show.html.haml +1 -0
- data/app/views/ecm/pictures/backend/pictures/_table.html.haml +11 -6
- data/config/routes.rb +8 -2
- data/lib/ecm/pictures/backend/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e34db79ab78f1d829cae81c7b8d7d19ae57a33c
|
4
|
+
data.tar.gz: 2a25ce6e82d1b243dd86d1ac4fe5ccce1bff0678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e65e8f5c05cd16cc26d6c492e37ad39b91feda7e282ebceb75233093ee7211eaac80e4fbe1b9906edc7ed751ccbf5d3bab23dc54b8509a313363cc501131e84
|
7
|
+
data.tar.gz: 38b5631ba0c2862e3ab5bea37c2d4016a5c8c9ae33877e21a54819327ad97602e47bc42f7363c26628f9993adf21b63e479ad42626e20480bfb45d3d8de95156
|
@@ -1,4 +1,8 @@
|
|
1
1
|
class Ecm::Pictures::Backend::GalleriesController < Itsf::Backend::Resource::BaseController
|
2
|
+
include ResourcesController::Sorting
|
3
|
+
include ResourcesController::ActsAsListConcern
|
4
|
+
include ResourcesController::ActsAsPublishedConcern
|
5
|
+
|
2
6
|
def self.resource_class
|
3
7
|
Ecm::Pictures::Gallery
|
4
8
|
end
|
@@ -8,6 +12,6 @@ class Ecm::Pictures::Backend::GalleriesController < Itsf::Backend::Resource::Bas
|
|
8
12
|
def permitted_params
|
9
13
|
params
|
10
14
|
.require(:gallery)
|
11
|
-
.permit(:name, :markup_language, :description, :link_images, :tag_list, picture_images: [])
|
15
|
+
.permit(:name, :markup_language, :description, :link_images, :tag_list, :published, picture_images: [])
|
12
16
|
end
|
13
17
|
end
|
@@ -1,53 +1,46 @@
|
|
1
|
-
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
p = processed_params.require(:picture).permit(:gallery_id, :name, :markup_language, :description, :tag_list, :image)
|
46
|
-
|
47
|
-
if image_base64.present?
|
48
|
-
p.merge(image: extract_image_base64(image_base64) )
|
49
|
-
else
|
50
|
-
p
|
1
|
+
module Ecm
|
2
|
+
module Pictures
|
3
|
+
module Backend
|
4
|
+
class PicturesController < Itsf::Backend::Resource::BaseController
|
5
|
+
include ResourcesController::Sorting
|
6
|
+
include ResourcesController::ActsAsListConcern
|
7
|
+
include ResourcesController::ActsAsPublishedConcern
|
8
|
+
|
9
|
+
def self.resource_class
|
10
|
+
Ecm::Pictures::Picture
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def load_collection_scope
|
16
|
+
super.includes(:gallery)
|
17
|
+
end
|
18
|
+
|
19
|
+
def extract_image_base64(encoded_image)
|
20
|
+
decoded_image = Base64.decode64(encoded_image.gsub(/^data\:image\/\w+\;base64\,/, '')).force_encoding('UTF-8')
|
21
|
+
content_type = encoded_image.split(';').first.split(':').last
|
22
|
+
basename = 'image'
|
23
|
+
extension = '.jpg'
|
24
|
+
|
25
|
+
image = Tempfile.new([basename, extension])
|
26
|
+
image.write decoded_image
|
27
|
+
image.rewind
|
28
|
+
image
|
29
|
+
end
|
30
|
+
|
31
|
+
def permitted_params
|
32
|
+
processed_params = params.deep_dup
|
33
|
+
image_base64 = processed_params[:picture].try(:delete, :image_base64)
|
34
|
+
|
35
|
+
p = processed_params.require(:picture).permit(:gallery_id, :name, :markup_language, :description, :tag_list, :image, :published)
|
36
|
+
|
37
|
+
if image_base64.present?
|
38
|
+
p.merge(image: extract_image_base64(image_base64))
|
39
|
+
else
|
40
|
+
p
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
51
44
|
end
|
52
45
|
end
|
53
46
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
= table.row :pictures_count
|
5
5
|
= table.row :position
|
6
6
|
= table.row :markup_language
|
7
|
-
= table.row :
|
7
|
+
= table.row :published
|
8
8
|
= table.row(:tenant, as: :association) if table.resource.respond_to?(:tenant)
|
9
9
|
= table.row(:tag_list) if table.resource.respond_to?(:tag_list)
|
10
10
|
= table.row :display_code_for_erb
|
@@ -1,6 +1,10 @@
|
|
1
|
-
= table.
|
2
|
-
= table.column :
|
3
|
-
= table.column :
|
4
|
-
= table.
|
5
|
-
|
6
|
-
|
1
|
+
= table.acts_as_list_actions
|
2
|
+
= table.column :name, sort: true, class: 'truncate-chars truncate-chars-30'
|
3
|
+
= table.column :description, sort: true, class: 'truncate-chars truncate-chars-30'
|
4
|
+
= table.boolean :link_images, sort: true
|
5
|
+
= table.column :pictures_count do |gallery|
|
6
|
+
- capture_haml do
|
7
|
+
%span.label.label-default
|
8
|
+
= gallery.pictures_count
|
9
|
+
= table.timestamps(sort: true)
|
10
|
+
= table.acts_as_published_actions
|
@@ -8,6 +8,9 @@
|
|
8
8
|
= form.input :markup_language, collection: Ecm::Pictures::markup_languages
|
9
9
|
= form.input :description, input_html: { 'data-add-editor': Itsf::Backend.features?(:'ace-rails-ap'), 'data-editor-syntax': :textile }
|
10
10
|
|
11
|
+
.well
|
12
|
+
= form.input :published, as: :boolean
|
13
|
+
|
11
14
|
.well
|
12
15
|
= form.input :image
|
13
16
|
= image_tag(form.object.image.url(:default_thumb)) if form.object.image.present?
|
@@ -1,7 +1,12 @@
|
|
1
|
-
= table.
|
1
|
+
= table.acts_as_list_actions
|
2
|
+
= table.association :gallery, sort: { column_name: 'ecm_pictures_galleries.name' }
|
2
3
|
= table.column(:preview_picture) do |picture|
|
3
|
-
|
4
|
-
|
5
|
-
= table.column :
|
6
|
-
= table.column
|
7
|
-
= table.
|
4
|
+
- capture_haml do
|
5
|
+
%img.img-responsive.bottom-margin-2{ src: picture.image.url(:default_thumb) }
|
6
|
+
= table.column :name, sort: true, class: 'truncate-chars truncate-chars-30'
|
7
|
+
= table.column :description, sort: true, class: 'truncate-chars truncate-chars-30'
|
8
|
+
= table.column(:image_file_size, sort: true) do |picture|
|
9
|
+
- capture_haml do
|
10
|
+
= number_to_human_size(picture.image_file_size)
|
11
|
+
= table.timestamps(sort: true)
|
12
|
+
= table.acts_as_published_actions
|
data/config/routes.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Ecm::Pictures::Backend::Engine.routes.draw do
|
2
|
-
backend_resources :galleries
|
3
|
-
|
2
|
+
backend_resources :galleries do
|
3
|
+
post :reposition, on: :member
|
4
|
+
post :toggle_published, on: :member
|
5
|
+
end
|
6
|
+
backend_resources :pictures do
|
7
|
+
post :reposition, on: :member
|
8
|
+
post :toggle_published, on: :member
|
9
|
+
end
|
4
10
|
|
5
11
|
root to: 'home#index'
|
6
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecm_pictures2_backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|