effective_assets 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/effective/snippets/effective_asset.js.coffee +54 -35
- data/app/assets/javascripts/effective_assets/s3_uploader.js.coffee +4 -3
- data/app/assets/stylesheets/effective_assets/_asset_box_input.scss +54 -3
- data/app/assets/stylesheets/effective_assets/_iframe_bootstrap.scss +1 -1710
- data/app/assets/stylesheets/effective_assets/_input_bootstrap.scss +1 -1
- data/app/assets/stylesheets/effective_assets_iframe.scss +4 -14
- data/app/controllers/effective/assets_controller.rb +1 -1
- data/app/models/effective/snippets/effective_asset.rb +5 -0
- data/app/models/inputs/asset_box.rb +17 -8
- data/app/views/asset_box_input/_attachment_as_table.html.haml +3 -2
- data/app/views/asset_box_input/_uploader.html.haml +11 -5
- data/app/views/effective/assets/iframe.html.haml +1 -1
- data/app/views/effective/snippets/_effective_asset.html.haml +1 -0
- data/lib/effective_assets/engine.rb +1 -1
- data/lib/effective_assets/version.rb +1 -1
- metadata +2 -2
@@ -4,20 +4,10 @@ body {
|
|
4
4
|
padding: 10px;
|
5
5
|
}
|
6
6
|
|
7
|
-
.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
min-width: 50%;
|
12
|
-
margin-left: 10px;
|
13
|
-
}
|
14
|
-
|
15
|
-
.asset-box-input.dragin {
|
16
|
-
border: 1px solid blue;
|
17
|
-
border-radius: 4px;
|
18
|
-
border-color: #66afe9;
|
19
|
-
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
|
20
|
-
outline: 0 none;
|
7
|
+
.asset-box-input {
|
8
|
+
td.attachment-title {
|
9
|
+
max-width: 400px;
|
10
|
+
}
|
21
11
|
}
|
22
12
|
|
23
13
|
@import "effective_assets/iframe_bootstrap";
|
@@ -16,7 +16,7 @@ module Effective
|
|
16
16
|
@aws_acl = 'public-read' # The CKEditor Insert Image functionality needs a public-read image here
|
17
17
|
elsif params[:only] == 'nonimages'
|
18
18
|
@assets = @assets.nonimages
|
19
|
-
@file_types = [:pdf, :zip, :doc, :docx, :xls, :xlsx, :txt, :avi, :m4v, :m2v, :mov, :mp3, :mp4]
|
19
|
+
@file_types = [:pdf, :zip, :doc, :docx, :xls, :xlsx, :txt, :csv, :avi, :m4v, :m2v, :mov, :mp3, :mp4, :eml]
|
20
20
|
end
|
21
21
|
|
22
22
|
@user_uploads = UserUploads.new(@assets)
|
@@ -5,6 +5,7 @@ if defined?(EffectiveRegions)
|
|
5
5
|
attribute :asset_id, Integer
|
6
6
|
attribute :html_class, String
|
7
7
|
attribute :link_title, String
|
8
|
+
attribute :private_url, Boolean
|
8
9
|
|
9
10
|
def asset
|
10
11
|
@asset ||= (Effective::Asset.where(:id => asset_id).first if asset_id)
|
@@ -14,6 +15,10 @@ if defined?(EffectiveRegions)
|
|
14
15
|
:span
|
15
16
|
end
|
16
17
|
|
18
|
+
def is_private?
|
19
|
+
private_url == true || (asset.try(:aws_acl) == 'authenticated-read')
|
20
|
+
end
|
21
|
+
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
@@ -12,10 +12,16 @@ module Inputs
|
|
12
12
|
def to_html
|
13
13
|
output = ''
|
14
14
|
output += header_html
|
15
|
-
output += attachments_html
|
16
15
|
|
17
|
-
|
18
|
-
|
16
|
+
if @options[:uploader] == :top
|
17
|
+
output += uploader_html
|
18
|
+
output += attachments_html
|
19
|
+
output += dialog_html if @options[:dialog]
|
20
|
+
else
|
21
|
+
output += attachments_html
|
22
|
+
output += dialog_html if @options[:dialog]
|
23
|
+
output += uploader_html if @options[:uploader]
|
24
|
+
end
|
19
25
|
|
20
26
|
output += footer_html
|
21
27
|
|
@@ -33,6 +39,7 @@ module Inputs
|
|
33
39
|
data-attachable-type='#{@options[:attachable_type]}'
|
34
40
|
data-attachable-object-name='#{@object_name}'
|
35
41
|
data-attachment-style='#{@options[:attachment_style]}'
|
42
|
+
data-attachment-add-to='#{@options[:attachment_add_to]}'
|
36
43
|
data-attachment-actions='#{@options[:attachment_actions].to_json()}'
|
37
44
|
data-aws-acl='#{@options[:aws_acl]}'
|
38
45
|
>".html_safe
|
@@ -44,10 +51,9 @@ module Inputs
|
|
44
51
|
content_tag(:thead) do
|
45
52
|
content_tag(:tr) do
|
46
53
|
[
|
47
|
-
content_tag(:th, '
|
48
|
-
content_tag(:th, '
|
49
|
-
content_tag(:th, '
|
50
|
-
content_tag(:th)
|
54
|
+
content_tag(:th, ''),
|
55
|
+
content_tag(:th, ''),
|
56
|
+
content_tag(:th, (@options[:table_filter_bar] ? filter_bar_html : ''), :colspan => 2)
|
51
57
|
].join().html_safe
|
52
58
|
end
|
53
59
|
end + content_tag(:tbody, build_values_html, :class => 'attachments')
|
@@ -77,6 +83,7 @@ module Inputs
|
|
77
83
|
:disabled => @options[:disabled],
|
78
84
|
:file_types => @options[:file_types],
|
79
85
|
:progress_bar_partial => @options[:progress_bar_partial],
|
86
|
+
:drop_files => @options[:uploader_drop_files],
|
80
87
|
:aws_acl => @options[:aws_acl]
|
81
88
|
}
|
82
89
|
).html_safe
|
@@ -129,9 +136,11 @@ module Inputs
|
|
129
136
|
|
130
137
|
def initialize_options(method, opts)
|
131
138
|
{
|
132
|
-
:uploader => true,
|
139
|
+
:uploader => true, # :top, :bottom, true or false
|
140
|
+
:uploader_drop_files => false,
|
133
141
|
:progress_bar_partial => 'asset_box_input/progress_bar_template',
|
134
142
|
:attachment_style => :thumbnail, # :thumbnail, :table, or :list
|
143
|
+
:attachment_add_to => :bottom, # :bottom or :top (of attachments div)
|
135
144
|
:attachment_actions => [:remove], # or :insert, :delete, :remove
|
136
145
|
:table_filter_bar => false,
|
137
146
|
:dialog => false,
|
@@ -20,10 +20,11 @@
|
|
20
20
|
|
21
21
|
- if attachment_actions.include?('remove')
|
22
22
|
%a.attachment-remove{:href => '#', :title => 'Remove'}
|
23
|
-
%
|
23
|
+
%i.glyphicon.glyphicon-remove
|
24
24
|
|
25
25
|
- if attachment_actions.include?('delete')
|
26
|
-
= link_to
|
26
|
+
= link_to effective_assets.effective_asset_path(attachment.asset), :class => 'btn btn-danger attachment-delete', :data => {:method => :delete, :confirm => "Are you sure you want to delete this file? This cannot be undone!"} do
|
27
|
+
%i.glyphicon.glyphicon-trash
|
27
28
|
|
28
29
|
- if attachment.persisted?
|
29
30
|
= hidden_field_tag(attachable_object_name + "[attachments_attributes][#{uid}][id]", attachment.id)
|
@@ -1,11 +1,17 @@
|
|
1
1
|
.uploads
|
2
|
-
.asset-box-uploader{:id => "s3_#{uid}"}
|
2
|
+
.asset-box-uploader{:id => "s3_#{uid}", :class => ('drop-files' if drop_files) }
|
3
3
|
= s3_uploader_fields(:aws_acl => aws_acl)
|
4
4
|
|
5
|
-
- if
|
6
|
-
%
|
7
|
-
|
8
|
-
|
5
|
+
- if drop_files
|
6
|
+
%p Drop files here
|
7
|
+
|
8
|
+
%span.btn.btn-success.fileinput-button
|
9
|
+
%i.glyphicon.glyphicon-upload
|
10
|
+
%span Upload files...
|
11
|
+
- if limit > 1
|
12
|
+
%input{:type => 'file', :name => 'file', :multiple => 'multiple', :disabled => disabled}
|
13
|
+
- else
|
14
|
+
%input{:type => 'file', :name => 'file', :disabled => disabled}
|
9
15
|
|
10
16
|
= render :partial => progress_bar_partial
|
11
17
|
|
@@ -14,4 +14,4 @@
|
|
14
14
|
|
15
15
|
%body
|
16
16
|
= simple_form_for @user_uploads, :url => '/' do |f|
|
17
|
-
= f.input :uploads, :as => :asset_box, :label => false, :uploader => true, :attachment_style => :table, :table_filter_bar => true, :attachment_actions => [:insert, :delete], :file_types => (@file_types || :any), :aws_acl => (@aws_acl || 'public-read')
|
17
|
+
= f.input :uploads, :as => :asset_box, :label => false, :uploader => :top, :uploader_drop_files => true, :attachment_style => :table, :table_filter_bar => true, :attachment_actions => [:insert, :delete], :attachment_add_to => :top, :file_types => (@file_types || :any), :aws_acl => (@aws_acl || 'public-read')
|
@@ -26,7 +26,7 @@ module EffectiveAssets
|
|
26
26
|
end
|
27
27
|
|
28
28
|
initializer "effective_assets.append_precompiled_assets" do |app|
|
29
|
-
Rails.application.config.assets.precompile += ['effective_assets.js', 'effective_assets_iframe.js', 'effective_assets_iframe.css']
|
29
|
+
Rails.application.config.assets.precompile += ['effective_assets.js', 'effective_assets_iframe.js', 'effective_assets_iframe.css', 'spinner.gif']
|
30
30
|
end
|
31
31
|
|
32
32
|
# ActiveAdmin (optional)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|