intesys_asset_manager 1.0.0 → 1.1.0
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 +4 -4
- data/README.rdoc +8 -9
- data/lib/asset_manager/engine.rb +4 -0
- data/lib/formtastic/inputs/asset_manager_input.rb +30 -0
- data/lib/intesys_asset_manager/version.rb +1 -1
- data/lib/simple_form/inputs/asset_manager_input.rb +34 -0
- metadata +4 -3
- data/app/inputs/asset_manager_input.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9680fcc0e8479a771eeb7a34fefe56a015a50daf
|
4
|
+
data.tar.gz: 0344a1489f4c6d662ecdcf8417fe047503e94759
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28464f909d68bf44764d94583c9e1966aea7427b19d511f9a2f3097312144eda7df01d75dcee992d57353895f0b5d8d1ba29809412068043340a9dd4a1dbace0
|
7
|
+
data.tar.gz: 29aed6be737a4d1134361f301374ae9d914fe55a8f3d036a0becfae10fd853ca5fc58dfa998cb6fb18588692b7deec3d721a0078a01d291d8d2bb9e62208c1f4
|
data/README.rdoc
CHANGED
@@ -28,7 +28,7 @@ Since Asset Manager is a Rails engine you need to mount it in your application:
|
|
28
28
|
|
29
29
|
Once mounted you can access the administration interface by visiting /asset_manager in a browser.
|
30
30
|
|
31
|
-
{http://www.intesys.it/asset_manager/docs/
|
31
|
+
{http://www.intesys.it/asset_manager/docs/repository.jpg}[http://www.intesys.it/asset_manager/docs/repository.jpg]
|
32
32
|
|
33
33
|
From here you can manage all your application's assets: jpg, png, pdf, zip, etc.
|
34
34
|
For the images that you upload a series of (customizable) versions will be created automatically.
|
@@ -44,7 +44,7 @@ If, for example, we have a Product that has a main image and a series of picture
|
|
44
44
|
|
45
45
|
You have two methods to choose from: has_file when the association is singular and has_files when multiple files need to be associated. These methods accept a series of parameters to specify which file types are accepted, how many files can be associated (for has_files), etc.
|
46
46
|
|
47
|
-
Once you have your models configured you can connect assets with your records. Asset Manager provides
|
47
|
+
Once you have your models configured you can connect assets with your records. Asset Manager provides Formtastic and SimpleForm input types to make it easier to manage your forms:
|
48
48
|
= semantic_form_for @product do |f|
|
49
49
|
= f.inputs do
|
50
50
|
= f.input :title
|
@@ -54,7 +54,7 @@ Once you have your models configured you can connect assets with your records. A
|
|
54
54
|
= f.input :pictures, as: :asset_manager
|
55
55
|
= f.input :downloads, as: :asset_manager
|
56
56
|
|
57
|
-
The Asset Manager will be opened in a modal window so
|
57
|
+
The Asset Manager will be opened in a modal window so your application needs to provide one. For example, if you're using Fancybox you need to add the following to your application.js:
|
58
58
|
//= require fancybox2
|
59
59
|
$ ->
|
60
60
|
$(".asset_manager_iframe").fancybox
|
@@ -68,14 +68,14 @@ The Asset Manager will be opened in a modal window so you application needs to p
|
|
68
68
|
|
69
69
|
Then you will have something similar to:
|
70
70
|
|
71
|
-
{http://www.intesys.it/asset_manager/docs/
|
72
|
-
{http://www.intesys.it/asset_manager/docs/
|
73
|
-
{http://www.intesys.it/asset_manager/docs/
|
71
|
+
{http://www.intesys.it/asset_manager/docs/main_image-ass.jpg}[http://www.intesys.it/asset_manager/docs/main_image-ass.jpg]
|
72
|
+
{http://www.intesys.it/asset_manager/docs/pictures-ass.jpg}[http://www.intesys.it/asset_manager/docs/pictures-ass.jpg]
|
73
|
+
{http://www.intesys.it/asset_manager/docs/downloads-ass.jpg}[http://www.intesys.it/asset_manager/docs/downloads-ass.jpg]
|
74
74
|
|
75
75
|
Now that we have associated assets with our records we can use one of the view helpers provided by Asset Manager to present them to the end-user:
|
76
76
|
= am_render(@product, :main_image)
|
77
77
|
= am_render(@product, :pictures)
|
78
|
-
= am_render(@product, :
|
78
|
+
= am_render(@product, :downloads)
|
79
79
|
|
80
80
|
== Options
|
81
81
|
|
@@ -89,7 +89,7 @@ By default all your assets will be public. It's also possible to have private as
|
|
89
89
|
config.asset_types = [:public, :private]
|
90
90
|
|
91
91
|
=== Categories and Tags
|
92
|
-
|
92
|
+
By default all your assets can be categorized and tagged to keep things organized. You can disable this option.
|
93
93
|
config.with_categories = false
|
94
94
|
config.with_tags = false
|
95
95
|
|
@@ -115,7 +115,6 @@ There is also a rake task to re-process already existing images when you add a n
|
|
115
115
|
== Project Roadmap
|
116
116
|
|
117
117
|
- FCKEditor (Rich) integration
|
118
|
-
- Input for SimpleForm
|
119
118
|
- Evaluate dragonfly
|
120
119
|
- Test :)
|
121
120
|
|
data/lib/asset_manager/engine.rb
CHANGED
@@ -15,6 +15,10 @@ module AssetManager
|
|
15
15
|
include AssetManager::AssetsHelper
|
16
16
|
include AssetManager::AssetInstancesHelper
|
17
17
|
end
|
18
|
+
ActiveSupport.on_load :active_record do
|
19
|
+
Formtastic::Inputs.autoload(:AssetManagerInput, 'formtastic/inputs/asset_manager_input')
|
20
|
+
SimpleForm::Inputs.autoload(:AssetManagerInput, 'simple_form/inputs/asset_manager_input')
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
if Rails.version > '3.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Formtastic
|
2
|
+
module Inputs
|
3
|
+
class AssetManagerInput
|
4
|
+
include Formtastic::Inputs::Base
|
5
|
+
|
6
|
+
def to_html
|
7
|
+
no_items_label = I18n.t('not_available', scope: [object.class.i18n_scope, object.class.name.demodulize.tableize, :show], default: 'N/A')
|
8
|
+
input_wrapping do
|
9
|
+
result = label_html
|
10
|
+
result << template.content_tag(:div, class: 'asset_manager_container') do
|
11
|
+
template.controller.view_context.am_select_link(object, method) <<
|
12
|
+
template.content_tag(:div, id: "dinamyc_assets_#{method}", no_items_label: no_items_label) do
|
13
|
+
cr = object.send(method)
|
14
|
+
unless cr.blank?
|
15
|
+
if cr.kind_of?(Array)
|
16
|
+
template.controller.view_context.render(partial: '/admin/asset_manager/assets/assets', locals: { collection: cr })
|
17
|
+
else
|
18
|
+
template.controller.view_context.render(partial: '/admin/asset_manager/assets/asset', locals: { resource: cr })
|
19
|
+
end
|
20
|
+
else
|
21
|
+
no_items_label
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
result
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module SimpleForm
|
2
|
+
module Inputs
|
3
|
+
class AssetManagerInput < SimpleForm::Inputs::Base
|
4
|
+
|
5
|
+
def input
|
6
|
+
template.content_tag(:div, class: 'asset_manager_container') do
|
7
|
+
template.concat select_link
|
8
|
+
template.concat dynamic_preview
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def select_link
|
13
|
+
template.controller.view_context.am_select_link(object, attribute_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
def dynamic_preview
|
17
|
+
no_items_label = I18n.t('not_available', scope: [object.class.i18n_scope, object.class.name.demodulize.tableize, :show], default: 'N/A')
|
18
|
+
template.content_tag(:div, id: "dinamyc_assets_#{attribute_name}", no_items_label: no_items_label) do
|
19
|
+
cr = object.send(attribute_name)
|
20
|
+
unless cr.blank?
|
21
|
+
if cr.kind_of?(Array)
|
22
|
+
template.controller.view_context.render(partial: '/admin/asset_manager/assets/assets', locals: { collection: cr })
|
23
|
+
else
|
24
|
+
template.controller.view_context.render(partial: '/admin/asset_manager/assets/asset', locals: { resource: cr })
|
25
|
+
end
|
26
|
+
else
|
27
|
+
no_items_label
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intesys_asset_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Intesys S.r.l.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: acts-as-taggable-on
|
@@ -409,7 +409,6 @@ files:
|
|
409
409
|
- app/models/asset_manager/asset.rb
|
410
410
|
- app/models/asset_manager/asset_public_instance.rb
|
411
411
|
- app/models/asset_manager/asset_category.rb
|
412
|
-
- app/inputs/asset_manager_input.rb
|
413
412
|
- app/helpers/asset_manager/asset_instances_helper.rb
|
414
413
|
- app/helpers/asset_manager/application_helper.rb
|
415
414
|
- app/helpers/asset_manager/assets_helper.rb
|
@@ -448,8 +447,10 @@ files:
|
|
448
447
|
- lib/custom_versions.rb
|
449
448
|
- lib/deprecated.rb
|
450
449
|
- lib/translations.rb
|
450
|
+
- lib/formtastic/inputs/asset_manager_input.rb
|
451
451
|
- lib/tasks/asset_manager_tasks.rake
|
452
452
|
- lib/asset_manager.rb
|
453
|
+
- lib/simple_form/inputs/asset_manager_input.rb
|
453
454
|
- lib/intesys_asset_manager.rb
|
454
455
|
- lib/asset_manager/engine.rb
|
455
456
|
- lib/asset_manager/all.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
class AssetManagerInput
|
2
|
-
include Formtastic::Inputs::Base
|
3
|
-
|
4
|
-
def to_html
|
5
|
-
no_items_label = I18n.t('not_available', scope: [object.class.i18n_scope, object.class.name.demodulize.tableize, :show], default: 'N/A')
|
6
|
-
|
7
|
-
input_wrapping do
|
8
|
-
result = label_html
|
9
|
-
result << template.content_tag(:div, class: 'asset_manager_container') do
|
10
|
-
template.controller.view_context.am_select_link(object, method) <<
|
11
|
-
template.content_tag(:div, id: "dinamyc_assets_#{method}", no_items_label: no_items_label) do
|
12
|
-
cr = object.send(method)
|
13
|
-
unless cr.blank?
|
14
|
-
if cr.kind_of?(Array)
|
15
|
-
template.controller.view_context.render(partial: '/admin/asset_manager/assets/assets', locals: { collection: cr })
|
16
|
-
else
|
17
|
-
template.controller.view_context.render(partial: '/admin/asset_manager/assets/asset', locals: { resource: cr })
|
18
|
-
end
|
19
|
-
else
|
20
|
-
no_items_label
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
result
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|