assetable 0.1.2 → 0.1.3
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 +8 -8
- data/app/assets/stylesheets/assetable/components/_forms.css.sass +2 -1
- data/app/controllers/assetable/external_services_controller.rb +4 -1
- data/app/models/asset.rb +16 -0
- data/app/models/external_service.rb +9 -1
- data/app/views/assetable/assets/_asset.html.haml +4 -1
- data/app/views/assetable/external_services/new.html.haml +4 -1
- data/config/initializers/uploader_input.rb +5 -1
- data/lib/assetable/config.rb +2 -1
- data/lib/assetable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjZiYTU5Zjc1OTk0NTE2MzFhZWRlMjdlYzVmZmMyOTMzYWNmMzM1Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDIxMWU0MjMyYTdhZDQ5NTM2NzJmOTViY2ViYTdmMTNhM2E5NjExOQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmIwNWJjOGE2ZTNmMzhlMjdhNGU5ZmE0MTIyMjM1NzIwOTI2OGQ4YzIwZDhj
|
10
|
+
ZmE3OTRmY2FjYmY2YjFhY2FhNjMyOGM2MzRhNzc1MWYzNzUyZGM4ZWY4YWRh
|
11
|
+
NmJmMTU2NTliNDMyMWViMDE3YTgwMTYxMTU1MThjZGUxNmU4ODk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTAxYjQ3ZWUwMDA2MWE4ZmM2ZmRhZjUyOWYxNzY4NDcyZWQ5OTcyYmE3NzY2
|
14
|
+
YjhjNTgwMTQ2NWM4MTA2YTJkNjc0NTEwZGVkZmRkOWM0YjU3NTYwNzkxMWNk
|
15
|
+
MTAyNzMwZWFmNDU2MWY3MmIyZDZkOGUyNGVhN2JhYmZiNGZjYzA=
|
data/app/models/asset.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# Base Asset Class
|
2
|
+
# ---------------------------------------
|
3
|
+
# Available Attributes:
|
4
|
+
# :type
|
5
|
+
# :name
|
6
|
+
# :body
|
7
|
+
# :filename
|
8
|
+
# :checksum
|
9
|
+
# :path
|
10
|
+
# :content_type
|
11
|
+
# :file_size
|
12
|
+
# :width
|
13
|
+
# :height
|
14
|
+
# :duration
|
15
|
+
# :bit_rate
|
16
|
+
|
1
17
|
class Asset < ActiveRecord::Base
|
2
18
|
|
3
19
|
has_many :asset_attachments, :as => :assetable, :dependent => :destroy
|
@@ -2,7 +2,6 @@ class ExternalService < Asset
|
|
2
2
|
|
3
3
|
validates_presence_of :name, :body
|
4
4
|
|
5
|
-
# G
|
6
5
|
def self.possible_content_types
|
7
6
|
if user_defined_document_types = Assetable.external_document_types
|
8
7
|
return user_defined_document_types
|
@@ -11,4 +10,13 @@ class ExternalService < Asset
|
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
13
|
+
def has_icon?
|
14
|
+
available_icons = Assetable.external_document_icons.collect{|k, v| k}
|
15
|
+
available_icons.include? self.content_type.to_sym if self.content_type.present?
|
16
|
+
end
|
17
|
+
|
18
|
+
def icon
|
19
|
+
Assetable.external_document_icons[self.content_type.to_sym].to_s if self.has_icon?
|
20
|
+
end
|
21
|
+
|
14
22
|
end
|
@@ -8,7 +8,10 @@
|
|
8
8
|
- elsif asset.video?
|
9
9
|
= image_tag "assetable/icons/icon-mp4.png", class: "uploader-preview"
|
10
10
|
- elsif asset.external_service?
|
11
|
-
|
11
|
+
- if asset.has_icon?
|
12
|
+
= image_tag "assetable/icons/#{asset.icon}", class: "uploader-preview"
|
13
|
+
- else
|
14
|
+
= image_tag "assetable/icons/icon-document.png", class: "uploader-preview"
|
12
15
|
|
13
16
|
%span.uploader-name= asset.name
|
14
17
|
.uploader-size-and-actions
|
@@ -11,10 +11,13 @@
|
|
11
11
|
|
12
12
|
.form-group
|
13
13
|
= f.label :name
|
14
|
-
= f.text_field :name, class: "form-control
|
14
|
+
= f.text_field :name, class: "form-control input-fluid", required: true
|
15
15
|
.form-group
|
16
16
|
= f.label :content_type
|
17
17
|
= f.select :content_type, ExternalService.possible_content_types
|
18
|
+
.form-group
|
19
|
+
= f.label :filename
|
20
|
+
= f.text_field :filename, class: "form-control input-fluid"
|
18
21
|
.form-group
|
19
22
|
= f.label :body
|
20
23
|
= f.text_area :body, class: "form-control input-fluid", required: true
|
@@ -52,7 +52,11 @@ class ActionView::Helpers::FormBuilder
|
|
52
52
|
elsif asset.video?
|
53
53
|
preview_image_tag = image_tag(ActionController::Base.helpers.asset_path("assetable/icons/icon-mp4.png"), class: "uploader-preview")
|
54
54
|
elsif asset.external_service?
|
55
|
-
|
55
|
+
if asset.has_icon?
|
56
|
+
preview_image_tag = image_tag(ActionController::Base.helpers.asset_path("assetable/icons/#{asset.icon}"), class: "uploader-preview")
|
57
|
+
else
|
58
|
+
preview_image_tag = image_tag(ActionController::Base.helpers.asset_path("assetable/icons/icon-document.png"), class: "uploader-preview")
|
59
|
+
end
|
56
60
|
end
|
57
61
|
|
58
62
|
return link_to preview_image_tag, asset.filename.to_s, target: "_blank"
|
data/lib/assetable/config.rb
CHANGED
data/lib/assetable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assetable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Koht
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|