coffee_asset_paths 1.0.0 → 1.0.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe488b31d73f19c1b29ec54139e0afb269dc1274
|
|
4
|
+
data.tar.gz: 018ad01c840534eb38852ce9b91c3913c9936594
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f1afeafedd821255e1daee9ca644c10937d2b693dc5ed507b7fdb8f31473465d288c7a75caf56167204455490ef97494acdd91f1773d2d0dc195ab7890cadb9d
|
|
7
|
+
data.tar.gz: 4b1f7ba0b54574b94376ef0b60864825d9d334552bfa9470b96f1b1fcffa6e64a7566114335e6aa5808c3fcf3b3ae0e2eb187b97cd0eec5818260d2b77c2ba08
|
data/lib/coffee_asset_paths.rb
CHANGED
|
@@ -8,29 +8,4 @@ module CoffeeAssetPaths
|
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
class << self
|
|
12
|
-
include ActionView::Helpers::AssetUrlHelper
|
|
13
|
-
|
|
14
|
-
def asset_types
|
|
15
|
-
ASSET_PUBLIC_DIRECTORIES.keys.to_json
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def assets
|
|
19
|
-
@assets ||= begin
|
|
20
|
-
assets = {}
|
|
21
|
-
|
|
22
|
-
ASSET_PUBLIC_DIRECTORIES.each do |type, path|
|
|
23
|
-
asset_dir = File.join(::Rails.root, 'app', 'assets', path)
|
|
24
|
-
next unless File.directory?(asset_dir)
|
|
25
|
-
|
|
26
|
-
Dir.chdir(asset_dir) do
|
|
27
|
-
assets[type] = Dir["**"].inject({}) {|h,f| h.merge! f => asset_path(f)}
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
assets.to_json
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
11
|
end
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
window.CoffeeAssetPaths =
|
|
2
2
|
|
|
3
|
-
assets: <%=
|
|
3
|
+
assets: <%=
|
|
4
|
+
assets = {}
|
|
5
|
+
ActionView::Helpers::AssetUrlHelper::ASSET_PUBLIC_DIRECTORIES.each do |type, path|
|
|
6
|
+
asset_dir = File.join(::Rails.root, 'app', 'assets', path)
|
|
7
|
+
next unless File.directory?(asset_dir)
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
Dir.chdir(asset_dir) do
|
|
10
|
+
assets[type] = Dir["**"].inject({}) {|h,f| h.merge! f => asset_path(f, :type => type)}
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
assets.to_json %>
|
|
14
|
+
|
|
15
|
+
assetTypes: <%= ActionView::Helpers::AssetUrlHelper::ASSET_PUBLIC_DIRECTORIES.keys.to_json %>
|
|
6
16
|
|
|
7
17
|
assetPath: (type, name)->
|
|
8
18
|
if @assets[type]?
|