rack-jquery_ui 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CH CH CHANGES #
2
2
 
3
+ ## v0.0.4 ##
4
+
5
+ * Using the rack-jquery-helpers library now, to help cut down on duplicated code.
6
+ * Cleaned up the examples a bit.
7
+
3
8
  ## v0.0.3 ##
4
9
 
5
10
  Wednesday the 5th of March 2013
data/examples/config.rb CHANGED
@@ -10,23 +10,27 @@ class App < Sinatra::Base
10
10
  use Rack::JQueryUI
11
11
 
12
12
  get "/" do
13
- "RUNNING"
13
+ haml :index, :layout => :unspecified
14
14
  end
15
15
 
16
16
  get "/google-cdn" do
17
- haml :index, :layout => :google
17
+ haml :accordion, :layout => :google
18
18
  end
19
19
 
20
20
  get "/media-temple-cdn" do
21
- haml :index, :layout => :mediatemple
21
+ haml :accordion, :layout => :mediatemple
22
22
  end
23
23
 
24
24
  get "/microsoft-cdn" do
25
- haml :index, :layout => :microsoft
25
+ haml :accordion, :layout => :microsoft
26
26
  end
27
27
 
28
28
  get "/unspecified-cdn" do
29
- haml :index, :layout => :unspecified
29
+ haml :accordion, :layout => :unspecified
30
+ end
31
+
32
+ get "/ui/:plugin" do |plugin|
33
+ haml plugin.to_sym, :layout => :ui
30
34
  end
31
35
  end
32
36
 
@@ -37,6 +41,12 @@ __END__
37
41
  %head
38
42
  = Rack::JQuery.cdn( :google )
39
43
  = Rack::JQueryUI.cdn( :google )
44
+ %link{ href: "http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css", rel: "stylesheet"}
45
+ :css
46
+ body {
47
+ font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
48
+ font-size: 62.5%;
49
+ }
40
50
  = yield
41
51
 
42
52
  @@microsoft
@@ -44,6 +54,12 @@ __END__
44
54
  %head
45
55
  = Rack::JQuery.cdn( :microsoft )
46
56
  = Rack::JQueryUI.cdn( :microsoft )
57
+ %link{ href: "http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css", rel: "stylesheet"}
58
+ :css
59
+ body {
60
+ font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
61
+ font-size: 62.5%;
62
+ }
47
63
  = yield
48
64
 
49
65
  @@mediatemple
@@ -51,6 +67,12 @@ __END__
51
67
  %head
52
68
  = Rack::JQuery.cdn( :media_temple )
53
69
  = Rack::JQueryUI.cdn( :media_temple )
70
+ %link{ href: "http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css", rel: "stylesheet"}
71
+ :css
72
+ body {
73
+ font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
74
+ font-size: 62.5%;
75
+ }
54
76
  = yield
55
77
 
56
78
  @@unspecified
@@ -58,21 +80,92 @@ __END__
58
80
  %head
59
81
  = Rack::JQuery.cdn()
60
82
  = Rack::JQueryUI.cdn()
61
- = yield
83
+ %link{ href: "http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css", rel: "stylesheet"}
84
+ :css
85
+ body {
86
+ font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
87
+ font-size: 62.5%;
88
+ }
89
+ %body
90
+ = yield
91
+
92
+ @@ui
93
+ %html
94
+ %head
95
+ = Rack::JQuery.cdn()
96
+ = Rack::JQueryUI.cdn()
97
+ %link{ href: "http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css", rel: "stylesheet"}
98
+ :css
99
+ body {
100
+ font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
101
+ font-size: 62.5%;
102
+ }
103
+ %body
104
+ = yield
62
105
 
63
106
  @@index
107
+ %p
108
+ %a{ href: "/google-cdn" }
109
+ google-cdn
110
+ %p
111
+ %a{ href: "/media-temple-cdn" }
112
+ media-temple
113
+ %p
114
+ %a{ href: "/microsoft-cdn" }
115
+ microsoft-cdn
116
+ %p
117
+ %a{ href: "/unspecified-cdn" }
118
+ unspecified-cdn
119
+ %p
120
+ %a{ href: "/ui/accordion" }
121
+ accordion
64
122
 
65
- %p.aclass
66
- "NOTHING TO SEE HERE… "
67
- %p.aclass
68
- "MOVE ALONG… "
69
- %p.aclass
70
- "MOVE ALONG… "
71
- #placeholder
123
+ @@accordion
72
124
  :javascript
73
- all_text = $('.aclass').text();
74
- $('#placeholder').text(all_text + " (draggable!)").mouseover(function() {
75
- $(this).css({ 'color': 'red', 'font-size': '150%' });
76
- }).mouseout(function() {
77
- $(this).css({ 'color': 'blue', 'font-size': '100%' });
78
- }).draggable();
125
+ $(function() {
126
+ $( "#accordion" ).accordion();
127
+ });
128
+ #accordion
129
+ %h3
130
+ Section 1
131
+ %div
132
+ %p
133
+ Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
134
+ ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
135
+ amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
136
+ odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
137
+ %h3
138
+ Section 2
139
+ %div
140
+ %p
141
+ Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
142
+ purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
143
+ velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
144
+ suscipit faucibus urna.
145
+ %h3
146
+ Section 3
147
+ %div
148
+ %p
149
+ Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
150
+ Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
151
+ ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
152
+ lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
153
+ %ul
154
+ %li
155
+ List item one
156
+ %li
157
+ List item two
158
+ %li
159
+ List item three
160
+ %h3
161
+ Section 4
162
+ %div
163
+ %p
164
+ Cras dictum. Pellentesque habitant morbi tristique senectus et netus
165
+ et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
166
+ faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
167
+ mauris vel est.
168
+ %p
169
+ Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
170
+ Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
171
+ inceptos himenaeos.
@@ -1,9 +1,11 @@
1
1
  require "rack/jquery_ui/version"
2
+ require "rack/jquery/helpers"
2
3
 
3
4
  module Rack
4
5
 
5
6
  # jQuery CDN script tags and fallback in one neat package.
6
7
  class JQueryUI
8
+ include JQuery::Helpers
7
9
 
8
10
  JQUERY_UI_FILE_NAME = "jquery-ui.min.js"
9
11
 
@@ -24,10 +26,6 @@ module Rack
24
26
  STR
25
27
 
26
28
 
27
- # Ten years in seconds.
28
- TEN_YEARS = 60 * 60 * 24 * 365 * 10
29
-
30
-
31
29
  # @param [Symbol] organisation Choose which CDN to use, either :google, :microsoft or :media_temple
32
30
  # @return [String] The HTML script tags to get the CDN.
33
31
  def self.cdn( organisation=:google )
@@ -67,13 +65,7 @@ STR
67
65
  if request.path_info == @http_path_to_jquery
68
66
  response = Rack::Response.new
69
67
  # for caching
70
- response.headers.merge!( {
71
- "Last-Modified" => JQUERY_UI_VERSION_DATE,
72
- "Expires" => Rack::Utils.rfc2109(Time.now + TEN_YEARS),
73
- "Cache-Control" => "max-age=#{TEN_YEARS},public",
74
- "Etag" => "#{JQUERY_UI_FILE_NAME}-#{JQUERY_UI_VERSION}",
75
- 'Content-Type' =>'application/javascript; charset=utf-8'
76
- })
68
+ response.headers.merge! caching_headers( "#{JQUERY_UI_FILE_NAME}-#{JQUERY_UI_VERSION}", JQUERY_UI_VERSION_DATE)
77
69
 
78
70
  # There's no need to test if the IF_MODIFIED_SINCE against the release date because the header will only be passed if the file was previously accessed by the requester, and the file is never updated. If it is updated then it is accessed by a different path.
79
71
  if request.env['HTTP_IF_MODIFIED_SINCE']
@@ -1,6 +1,6 @@
1
1
  module Rack
2
2
  class JQueryUI
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  JQUERY_UI_VERSION = "1.10.1"
5
5
 
6
6
  # This is the release date of the jQuery file, it makes an easy "Last-Modified" date for setting the headers around caching.
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.2"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_dependency("rack")
24
+ spec.add_dependency("rack-jquery-helpers")
24
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-jquery_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-06 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rack-jquery-helpers
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  description: jQuery-UI CDN script tags and fallback in one neat package. Current version
63
79
  is for jQuery-UI v1.10.1
64
80
  email: