padrino-helpers 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.
- data/VERSION +1 -1
- data/lib/padrino-helpers/asset_tag_helpers.rb +4 -2
- data/padrino-helpers.gemspec +2 -2
- data/test/test_asset_tag_helpers.rb +11 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -82,8 +82,9 @@ module Padrino
|
|
82
82
|
# Returns the javascript_path appending the default javascripts path if necessary
|
83
83
|
def javascript_path(source)
|
84
84
|
return source if source =~ /^http/
|
85
|
+
source.gsub!(/\.js$/, '')
|
85
86
|
result_path = "#{source}.js" if source =~ %r{^/} # absolute path
|
86
|
-
result_path ||= uri_root_path("javascripts", "#{
|
87
|
+
result_path ||= uri_root_path("javascripts", "#{source}.js")
|
87
88
|
stamp = File.exist?(result_path) ? File.mtime(result_path) : Time.now.to_i
|
88
89
|
"#{result_path}?#{stamp}"
|
89
90
|
end
|
@@ -91,8 +92,9 @@ module Padrino
|
|
91
92
|
# Returns the stylesheet_path appending the default stylesheets path if necessary
|
92
93
|
def stylesheet_path(source)
|
93
94
|
return source if source =~ /^http/
|
95
|
+
source.gsub!(/\.css$/, '')
|
94
96
|
result_path = "#{source}.css" if source =~ %r{^/} # absolute path
|
95
|
-
result_path ||= uri_root_path("stylesheets", "#{
|
97
|
+
result_path ||= uri_root_path("stylesheets", "#{source}.css")
|
96
98
|
stamp = File.exist?(result_path) ? File.mtime(result_path) : Time.now.to_i
|
97
99
|
"#{result_path}?#{stamp}"
|
98
100
|
end
|
data/padrino-helpers.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{padrino-helpers}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-20}
|
13
13
|
s.description = %q{Tag helpers, asset helpers, form helpers, form builders and many more helpers for padrino}
|
14
14
|
s.email = %q{nesquena@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -103,6 +103,12 @@ class TestAssetTagHelpers < Test::Unit::TestCase
|
|
103
103
|
expected_options = { :media => "screen", :rel => "stylesheet", :type => "text/css" }
|
104
104
|
assert_has_tag('link', expected_options.merge(:href => "/stylesheets/style.css?#{time.to_i}")) { stylesheet_link_tag('style') }
|
105
105
|
end
|
106
|
+
should "display stylesheet link item for long relative path" do
|
107
|
+
time = stop_time_for_test
|
108
|
+
expected_options = { :media => "screen", :rel => "stylesheet", :type => "text/css" }
|
109
|
+
actual_html = stylesheet_link_tag('example/demo/style')
|
110
|
+
assert_has_tag('link', expected_options.merge(:href => "/stylesheets/example/demo/style.css?#{time.to_i}")) { actual_html }
|
111
|
+
end
|
106
112
|
should "display stylesheet link item with absolute path" do
|
107
113
|
time = stop_time_for_test
|
108
114
|
expected_options = { :media => "screen", :rel => "stylesheet", :type => "text/css" }
|
@@ -132,6 +138,11 @@ class TestAssetTagHelpers < Test::Unit::TestCase
|
|
132
138
|
actual_html = javascript_include_tag('application')
|
133
139
|
assert_has_tag('script', :src => "/javascripts/application.js?#{time.to_i}", :type => "text/javascript") { actual_html }
|
134
140
|
end
|
141
|
+
should "display javascript item for long relative path" do
|
142
|
+
time = stop_time_for_test
|
143
|
+
actual_html = javascript_include_tag('example/demo/application')
|
144
|
+
assert_has_tag('script', :src => "/javascripts/example/demo/application.js?#{time.to_i}", :type => "text/javascript") { actual_html }
|
145
|
+
end
|
135
146
|
should "display javascript item with absolute path" do
|
136
147
|
time = stop_time_for_test
|
137
148
|
actual_html = javascript_include_tag('/js/application')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-helpers
|
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
|
- Padrino Team
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-11-
|
15
|
+
date: 2009-11-20 00:00:00 -08:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|