rbmobile 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mobile_helpers.rb +89 -89
- metadata +3 -3
data/lib/mobile_helpers.rb
CHANGED
@@ -27,10 +27,10 @@ module RBMobile
|
|
27
27
|
# You can disable or enable configuration properties
|
28
28
|
# using:
|
29
29
|
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
30
|
+
# RBMobile::config do
|
31
|
+
# enable :property
|
32
|
+
# disable :property
|
33
|
+
# end
|
34
34
|
#
|
35
35
|
def self.config(&block)
|
36
36
|
RBMobile::class_eval(&block) if block_given?
|
@@ -50,14 +50,14 @@ module RBMobile
|
|
50
50
|
# This module should be included as a view helper
|
51
51
|
# In Sinatra you need to do following:
|
52
52
|
#
|
53
|
-
#
|
54
|
-
#
|
53
|
+
# require 'mobile_helpers'
|
54
|
+
# helpers RBMobile::Helpers
|
55
55
|
#
|
56
56
|
# In Rails you should be able to include this module
|
57
57
|
# inside your ApplicationHelper as:
|
58
58
|
#
|
59
|
-
#
|
60
|
-
#
|
59
|
+
# require 'mobile_helpers'
|
60
|
+
# include RBMobile::Helpers
|
61
61
|
#
|
62
62
|
module Helpers
|
63
63
|
|
@@ -65,7 +65,7 @@ module RBMobile
|
|
65
65
|
# You can exclude jQuery itself (in case your project is already including
|
66
66
|
# this library somewhere else by:
|
67
67
|
#
|
68
|
-
#
|
68
|
+
# = mobile_include(:no_jquery => true)
|
69
69
|
#
|
70
70
|
# This method should be placed right after %head tag.
|
71
71
|
#
|
@@ -90,8 +90,8 @@ module RBMobile
|
|
90
90
|
#
|
91
91
|
# This helper will generate:
|
92
92
|
#
|
93
|
-
#
|
94
|
-
#
|
93
|
+
# <div data-role="page">
|
94
|
+
# </div>
|
95
95
|
#
|
96
96
|
# Additional properties that could be set:
|
97
97
|
#
|
@@ -100,9 +100,9 @@ module RBMobile
|
|
100
100
|
#
|
101
101
|
# Example usage:
|
102
102
|
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
103
|
+
# - page :theme => 'c' do
|
104
|
+
# - header do
|
105
|
+
# %h1 Header
|
106
106
|
#
|
107
107
|
def page(opts={}, &block)
|
108
108
|
opts.merge!(:'data-title' => opts.delete(:title)) if opts[:title]
|
@@ -120,8 +120,8 @@ module RBMobile
|
|
120
120
|
#
|
121
121
|
# This helper will generate:
|
122
122
|
#
|
123
|
-
#
|
124
|
-
#
|
123
|
+
# <div data-role="header">
|
124
|
+
# </div>
|
125
125
|
#
|
126
126
|
# Additional properties that could be set:
|
127
127
|
#
|
@@ -136,8 +136,8 @@ module RBMobile
|
|
136
136
|
#
|
137
137
|
# This helper will generate:
|
138
138
|
#
|
139
|
-
#
|
140
|
-
#
|
139
|
+
# <div data-role="content">
|
140
|
+
# </div>
|
141
141
|
#
|
142
142
|
# Additional properties that could be set:
|
143
143
|
#
|
@@ -153,12 +153,12 @@ module RBMobile
|
|
153
153
|
# margins around the page and a dark background to make the "dialog" appear
|
154
154
|
# to be suspended above the page.
|
155
155
|
#
|
156
|
-
#
|
156
|
+
# <a href="foo.html" data-rel="dialog">Open dialog</a>
|
157
157
|
#
|
158
158
|
# This helper will generate a block that may contain a dialog:
|
159
159
|
#
|
160
|
-
#
|
161
|
-
#
|
160
|
+
# <div data-role="dialog">
|
161
|
+
# </div>
|
162
162
|
#
|
163
163
|
# Additional properties that could be set:
|
164
164
|
#
|
@@ -180,10 +180,10 @@ module RBMobile
|
|
180
180
|
#
|
181
181
|
# This helper will generate:
|
182
182
|
#
|
183
|
-
#
|
184
|
-
#
|
185
|
-
#
|
186
|
-
#
|
183
|
+
# <div data-role="navbar">
|
184
|
+
# <ul>
|
185
|
+
# </ul>
|
186
|
+
# </div>
|
187
187
|
#
|
188
188
|
# Additional properties that could be set:
|
189
189
|
#
|
@@ -199,18 +199,18 @@ module RBMobile
|
|
199
199
|
|
200
200
|
# This helper will generate a link inside 'navbar' block:
|
201
201
|
#
|
202
|
-
#
|
203
|
-
#
|
204
|
-
#
|
202
|
+
# - navbar do
|
203
|
+
# = navigate_to 'a.html', 'One'
|
204
|
+
# = navigate_to 'b.html', 'Two'
|
205
205
|
#
|
206
206
|
# Will produce:
|
207
207
|
#
|
208
|
-
#
|
209
|
-
#
|
210
|
-
#
|
211
|
-
#
|
212
|
-
#
|
213
|
-
#
|
208
|
+
# <div data-role="navbar">
|
209
|
+
# <ul>
|
210
|
+
# <li><a href="a.html" class="ui-btn-active">One</a></li>
|
211
|
+
# <li><a href="b.html">Two</a></li>
|
212
|
+
# </ul>
|
213
|
+
# </div>
|
214
214
|
#
|
215
215
|
# Additional properties that could be set:
|
216
216
|
#
|
@@ -235,14 +235,14 @@ module RBMobile
|
|
235
235
|
|
236
236
|
# The footer bar has the same basic structure as the header except it uses the data-role attribute value of footer.
|
237
237
|
#
|
238
|
-
#
|
239
|
-
#
|
238
|
+
# - footer do
|
239
|
+
# %h4 Footer content
|
240
240
|
#
|
241
241
|
# Will generate:
|
242
242
|
#
|
243
|
-
#
|
244
|
-
#
|
245
|
-
#
|
243
|
+
# <div data-role="footer">
|
244
|
+
# <h4>Footer content</h4>
|
245
|
+
# </div>
|
246
246
|
#
|
247
247
|
# Additional properties that could be set:
|
248
248
|
#
|
@@ -266,16 +266,16 @@ module RBMobile
|
|
266
266
|
#
|
267
267
|
# This helper will generate:
|
268
268
|
#
|
269
|
-
#
|
270
|
-
#
|
271
|
-
#
|
269
|
+
# - buttongroup :horizontal do
|
270
|
+
# = button :load, 'load.html', 'Load'
|
271
|
+
# = button :save, 'save.html', 'Save'
|
272
272
|
#
|
273
273
|
# Will produce:
|
274
274
|
#
|
275
|
-
#
|
276
|
-
#
|
277
|
-
#
|
278
|
-
#
|
275
|
+
# <div data-role="controlgroup">
|
276
|
+
# <a href="load.html" data-role="button">Load</a>
|
277
|
+
# <a href="save.html" data-role="button">Save</a>
|
278
|
+
# </div>
|
279
279
|
#
|
280
280
|
# Additional properties that could be set:
|
281
281
|
#
|
@@ -293,8 +293,8 @@ module RBMobile
|
|
293
293
|
#
|
294
294
|
# Example usage:
|
295
295
|
#
|
296
|
-
#
|
297
|
-
#
|
296
|
+
# = button :save, 'save.html', 'Save', :theme => 'b'
|
297
|
+
# = button :save, 'save.html', 'Save', :ajax => true
|
298
298
|
#
|
299
299
|
# [kind] Define icon used for button
|
300
300
|
# [url] Where to move after click
|
@@ -324,8 +324,8 @@ module RBMobile
|
|
324
324
|
#
|
325
325
|
# Example usage:
|
326
326
|
#
|
327
|
-
#
|
328
|
-
#
|
327
|
+
# %p
|
328
|
+
# Click %{inline_button(:save, '/save', 'Save')} to submit changes
|
329
329
|
#
|
330
330
|
def inline_button(kind, url, label, opts={})
|
331
331
|
opts.merge!(:'data-inline' => 'true')
|
@@ -346,11 +346,11 @@ module RBMobile
|
|
346
346
|
#
|
347
347
|
# Usage:
|
348
348
|
#
|
349
|
-
#
|
350
|
-
#
|
351
|
-
#
|
352
|
-
#
|
353
|
-
#
|
349
|
+
# - grid do
|
350
|
+
# - column do
|
351
|
+
# Left content
|
352
|
+
# - column do
|
353
|
+
# Right content
|
354
354
|
#
|
355
355
|
# [columns] How many columns will be used (Default: 2)
|
356
356
|
#
|
@@ -376,13 +376,13 @@ module RBMobile
|
|
376
376
|
#
|
377
377
|
# Usage:
|
378
378
|
#
|
379
|
-
#
|
380
|
-
#
|
379
|
+
# - collapse "This content is collapsible" do
|
380
|
+
# %p Some content here!
|
381
381
|
#
|
382
|
-
#
|
383
|
-
#
|
384
|
-
#
|
385
|
-
#
|
382
|
+
# <div data-role="collapsible">
|
383
|
+
# <h3>I'm a header</h3>
|
384
|
+
# <p>I'm the collapsible content. By default I'm open and displayed on the page, but you can click the header to hide me.</p>
|
385
|
+
# </div>
|
386
386
|
#
|
387
387
|
# [collapsed] Determine whenever this block is collapsed or not
|
388
388
|
#
|
@@ -405,11 +405,11 @@ module RBMobile
|
|
405
405
|
#
|
406
406
|
# Example:
|
407
407
|
#
|
408
|
-
#
|
409
|
-
#
|
410
|
-
#
|
411
|
-
#
|
412
|
-
#
|
408
|
+
# - collapse_set do
|
409
|
+
# - collapse 'This is collapsible' do
|
410
|
+
# Hello world!
|
411
|
+
# - collapse 'This is collapsible' do
|
412
|
+
# Hello world!
|
413
413
|
#
|
414
414
|
def collapse_set(opts={}, &block)
|
415
415
|
@collapsed = true
|
@@ -428,11 +428,11 @@ module RBMobile
|
|
428
428
|
# transition.
|
429
429
|
#
|
430
430
|
# Example:
|
431
|
-
#
|
432
|
-
#
|
433
|
-
#
|
434
|
-
#
|
435
|
-
#
|
431
|
+
# - list :theme => 'a', :filter => true do
|
432
|
+
# = divider "This is divider"
|
433
|
+
# - item do
|
434
|
+
# Hello World!
|
435
|
+
# = counter('3')
|
436
436
|
#
|
437
437
|
# [filter] Determine if search filter will show up or not
|
438
438
|
#
|
@@ -476,9 +476,9 @@ module RBMobile
|
|
476
476
|
#
|
477
477
|
# Example:
|
478
478
|
#
|
479
|
-
#
|
480
|
-
#
|
481
|
-
#
|
479
|
+
# - list do
|
480
|
+
# - link 'a.html', :icon => 'alert' do
|
481
|
+
# This item will send you to a.html
|
482
482
|
#
|
483
483
|
def link(url, opts={}, &block)
|
484
484
|
original_block = block
|
@@ -496,9 +496,9 @@ module RBMobile
|
|
496
496
|
#
|
497
497
|
# Example:
|
498
498
|
#
|
499
|
-
#
|
500
|
-
#
|
501
|
-
#
|
499
|
+
# - list do
|
500
|
+
# - nested_item 'This is item header', :theme => 'b' do
|
501
|
+
# This is item content
|
502
502
|
#
|
503
503
|
def nested_item(title, opts={}, &block)
|
504
504
|
original_block = block
|
@@ -515,10 +515,10 @@ module RBMobile
|
|
515
515
|
#
|
516
516
|
# Example:
|
517
517
|
#
|
518
|
-
#
|
519
|
-
#
|
520
|
-
#
|
521
|
-
#
|
518
|
+
# - list do
|
519
|
+
# - item do
|
520
|
+
# Active connections
|
521
|
+
# = counter '3'
|
522
522
|
#
|
523
523
|
def counter(value)
|
524
524
|
capture_haml do
|
@@ -532,10 +532,10 @@ module RBMobile
|
|
532
532
|
#
|
533
533
|
# Example:
|
534
534
|
#
|
535
|
-
#
|
536
|
-
#
|
537
|
-
#
|
538
|
-
#
|
535
|
+
# - list do
|
536
|
+
# - item do
|
537
|
+
# = thumb '/images/computer.png'
|
538
|
+
# Computer
|
539
539
|
#
|
540
540
|
def thumb(image_url)
|
541
541
|
capture_haml do
|
@@ -546,10 +546,10 @@ module RBMobile
|
|
546
546
|
# This will create a list divider. It could be also used to create a contact
|
547
547
|
# list alphabetically sorted.
|
548
548
|
#
|
549
|
-
#
|
550
|
-
#
|
551
|
-
#
|
552
|
-
#
|
549
|
+
# - list do
|
550
|
+
# = divider "A"
|
551
|
+
# - item do
|
552
|
+
# Andreas Muller
|
553
553
|
#
|
554
554
|
def divider(title, opts={})
|
555
555
|
opts[:element] = :li
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbmobile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michal Fojtik
|