jqmobile_helpers 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +13 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +6 -0
- data/Rakefile +29 -0
- data/lib/jqmobile_helpers.rb +1 -0
- data/lib/jqmobile_helpers/action_view_extensions/form_helper.rb +54 -0
- data/lib/jqmobile_helpers/buttons_helper.rb +639 -0
- data/lib/jqmobile_helpers/form_builder.rb +301 -0
- data/lib/jqmobile_helpers/list_views_helper.rb +326 -0
- data/lib/jqmobile_helpers/railtie.rb +23 -0
- data/lib/jqmobile_helpers/toolbars_helper.rb +115 -0
- data/rdoc/JqmobileHelpers.html +185 -0
- data/rdoc/JqmobileHelpers/ActionViewExtensions.html +160 -0
- data/rdoc/JqmobileHelpers/ActionViewExtensions/FormHelper.html +231 -0
- data/rdoc/JqmobileHelpers/ButtonsHelper.html +1502 -0
- data/rdoc/JqmobileHelpers/FormBuilder.html +816 -0
- data/rdoc/JqmobileHelpers/ListViewsHelper.html +952 -0
- data/rdoc/JqmobileHelpers/Railtie.html +177 -0
- data/rdoc/JqmobileHelpers/ToolbarsHelper.html +416 -0
- data/rdoc/README_rdoc.html +109 -0
- data/rdoc/created.rid +9 -0
- data/rdoc/index.html +180 -0
- data/rdoc/js/darkfish.js +116 -0
- data/rdoc/js/jquery.js +32 -0
- data/rdoc/js/quicksearch.js +114 -0
- data/rdoc/js/thickbox-compressed.js +10 -0
- data/rdoc/lib/jqmobile_helpers/action_view_extensions/form_helper_rb.html +52 -0
- data/rdoc/lib/jqmobile_helpers/buttons_helper_rb.html +52 -0
- data/rdoc/lib/jqmobile_helpers/form_builder_rb.html +52 -0
- data/rdoc/lib/jqmobile_helpers/list_views_helper_rb.html +52 -0
- data/rdoc/lib/jqmobile_helpers/railtie_rb.html +62 -0
- data/rdoc/lib/jqmobile_helpers/toolbars_helper_rb.html +52 -0
- data/rdoc/lib/jqmobile_helpers_rb.html +54 -0
- data/rdoc/rdoc.css +706 -0
- data/test/buttons_helper_test.rb +112 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/buttons_controller.rb +9 -0
- data/test/dummy/app/controllers/forms_controller.rb +71 -0
- data/test/dummy/app/controllers/posts_controller.rb +83 -0
- data/test/dummy/app/controllers/toolbars_controller.rb +16 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/posts_helper.rb +2 -0
- data/test/dummy/app/helpers/toolbars_helper.rb +2 -0
- data/test/dummy/app/models/post.rb +2 -0
- data/test/dummy/app/models/toolbar.rb +2 -0
- data/test/dummy/app/views/buttons/index.html.erb +168 -0
- data/test/dummy/app/views/forms/_form.html.erb +20 -0
- data/test/dummy/app/views/forms/edit.html.erb +6 -0
- data/test/dummy/app/views/forms/index.html.erb +7 -0
- data/test/dummy/app/views/forms/new.html.erb +5 -0
- data/test/dummy/app/views/forms/show.html.erb +24 -0
- data/test/dummy/app/views/layouts/application.html.erb +49 -0
- data/test/dummy/app/views/posts/_form.html.erb +29 -0
- data/test/dummy/app/views/posts/edit.html.erb +6 -0
- data/test/dummy/app/views/posts/index.html.erb +128 -0
- data/test/dummy/app/views/posts/new.html.erb +5 -0
- data/test/dummy/app/views/posts/show.html.erb +24 -0
- data/test/dummy/app/views/toolbars/index.html.erb +25 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +45 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +22 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/production.rb +49 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +69 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20110218095442_create_posts.rb +15 -0
- data/test/dummy/db/migrate/20110223031713_create_toolbars.rb +12 -0
- data/test/dummy/db/schema.rb +29 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +7446 -0
- data/test/dummy/log/production.log +0 -0
- data/test/dummy/log/server.log +0 -0
- data/test/dummy/log/test.log +2278 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/images/ajax-loader.png +0 -0
- data/test/dummy/public/images/form-check-off.png +0 -0
- data/test/dummy/public/images/form-check-on.png +0 -0
- data/test/dummy/public/images/form-radio-off.png +0 -0
- data/test/dummy/public/images/form-radio-on.png +0 -0
- data/test/dummy/public/images/icon-search-black.png +0 -0
- data/test/dummy/public/images/icons-18-black.png +0 -0
- data/test/dummy/public/images/icons-18-white.png +0 -0
- data/test/dummy/public/images/icons-36-black.png +0 -0
- data/test/dummy/public/images/icons-36-white.png +0 -0
- data/test/dummy/public/javascripts/application.js +2 -0
- data/test/dummy/public/javascripts/jquery-1.5.min.js +8176 -0
- data/test/dummy/public/javascripts/jquery-ui-1.8.9.custom.min.js +781 -0
- data/test/dummy/public/javascripts/jquery.mobile-1.0a3.min.js +121 -0
- data/test/dummy/public/javascripts/rails.js +175 -0
- data/test/dummy/public/stylesheets/images/ajax-loader.png +0 -0
- data/test/dummy/public/stylesheets/images/form-check-off.png +0 -0
- data/test/dummy/public/stylesheets/images/form-check-on.png +0 -0
- data/test/dummy/public/stylesheets/images/form-radio-off.png +0 -0
- data/test/dummy/public/stylesheets/images/form-radio-on.png +0 -0
- data/test/dummy/public/stylesheets/images/icon-search-black.png +0 -0
- data/test/dummy/public/stylesheets/images/icons-18-black.png +0 -0
- data/test/dummy/public/stylesheets/images/icons-18-white.png +0 -0
- data/test/dummy/public/stylesheets/images/icons-36-black.png +0 -0
- data/test/dummy/public/stylesheets/images/icons-36-white.png +0 -0
- data/test/dummy/public/stylesheets/jquery-ui-1.8.9.custom.css +573 -0
- data/test/dummy/public/stylesheets/jquery.mobile-1.0a3.min.css +16 -0
- data/test/dummy/public/stylesheets/scaffold.css +56 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- data/test/form_helper_test.rb +13 -0
- data/test/integration/navigation_test.rb +7 -0
- data/test/list_views_helper_test.rb +65 -0
- data/test/support/integration_case.rb +5 -0
- data/test/support/misc_helpers.rb +18 -0
- data/test/support/mock_controller.rb +15 -0
- data/test/support/mock_response.rb +14 -0
- data/test/support/models.rb +135 -0
- data/test/test_helper.rb +92 -0
- data/test/toolbars_helper_test.rb +21 -0
- metadata +182 -0
@@ -0,0 +1,952 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Module: JqmobileHelpers::ListViewsHelper</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="module">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="../index.html">Home</a>
|
29
|
+
<a href="../index.html#classes">Classes</a>
|
30
|
+
<a href="../index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="file-metadata">
|
36
|
+
<div id="file-list-section" class="section">
|
37
|
+
<h3 class="section-header">In Files</h3>
|
38
|
+
<div class="section-body">
|
39
|
+
<ul>
|
40
|
+
|
41
|
+
<li><a href="../lib/jqmobile_helpers/list_views_helper_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/jqmobile_helpers/list_views_helper.rb">lib/jqmobile_helpers/list_views_helper.rb</a></li>
|
43
|
+
|
44
|
+
</ul>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div id="class-metadata">
|
52
|
+
|
53
|
+
<!-- Parent Class -->
|
54
|
+
|
55
|
+
|
56
|
+
<!-- Namespace Contents -->
|
57
|
+
|
58
|
+
|
59
|
+
<!-- Method Quickref -->
|
60
|
+
|
61
|
+
<div id="method-list-section" class="section">
|
62
|
+
<h3 class="section-header">Methods</h3>
|
63
|
+
<ul class="link-list">
|
64
|
+
|
65
|
+
<li><a href="#method-i-basic_list">#basic_list</a></li>
|
66
|
+
|
67
|
+
<li><a href="#method-i-count_bubble">#count_bubble</a></li>
|
68
|
+
|
69
|
+
<li><a href="#method-i-html_attributes_options">#html_attributes_options</a></li>
|
70
|
+
|
71
|
+
<li><a href="#method-i-html_li_attributes_options">#html_li_attributes_options</a></li>
|
72
|
+
|
73
|
+
<li><a href="#method-i-icon_list">#icon_list</a></li>
|
74
|
+
|
75
|
+
<li><a href="#method-i-inset_list">#inset_list</a></li>
|
76
|
+
|
77
|
+
<li><a href="#method-i-list_divider">#list_divider</a></li>
|
78
|
+
|
79
|
+
<li><a href="#method-i-list_formatting">#list_formatting</a></li>
|
80
|
+
|
81
|
+
<li><a href="#method-i-nested_list">#nested_list</a></li>
|
82
|
+
|
83
|
+
<li><a href="#method-i-numbered_list">#numbered_list</a></li>
|
84
|
+
|
85
|
+
<li><a href="#method-i-ol_inset_list">#ol_inset_list</a></li>
|
86
|
+
|
87
|
+
<li><a href="#method-i-search_filter_list">#search_filter_list</a></li>
|
88
|
+
|
89
|
+
<li><a href="#method-i-split_button_list">#split_button_list</a></li>
|
90
|
+
|
91
|
+
<li><a href="#method-i-thumbnail_list">#thumbnail_list</a></li>
|
92
|
+
|
93
|
+
</ul>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
<!-- Included Modules -->
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<div id="project-metadata">
|
102
|
+
|
103
|
+
|
104
|
+
<div id="fileindex-section" class="section project-section">
|
105
|
+
<h3 class="section-header">Files</h3>
|
106
|
+
<ul>
|
107
|
+
|
108
|
+
<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
|
109
|
+
|
110
|
+
</ul>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
|
114
|
+
<div id="classindex-section" class="section project-section">
|
115
|
+
<h3 class="section-header">Class Index
|
116
|
+
<span class="search-toggle"><img src="../images/find.png"
|
117
|
+
height="16" width="16" alt="[+]"
|
118
|
+
title="show/hide quicksearch" /></span></h3>
|
119
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
120
|
+
<fieldset>
|
121
|
+
<legend>Quicksearch</legend>
|
122
|
+
<input type="text" name="quicksearch" value=""
|
123
|
+
class="quicksearch-field" />
|
124
|
+
</fieldset>
|
125
|
+
</form>
|
126
|
+
|
127
|
+
<ul class="link-list">
|
128
|
+
|
129
|
+
<li><a href="../JqmobileHelpers.html">JqmobileHelpers</a></li>
|
130
|
+
|
131
|
+
<li><a href="../JqmobileHelpers/ActionViewExtensions.html">JqmobileHelpers::ActionViewExtensions</a></li>
|
132
|
+
|
133
|
+
<li><a href="../JqmobileHelpers/ActionViewExtensions/FormHelper.html">JqmobileHelpers::ActionViewExtensions::FormHelper</a></li>
|
134
|
+
|
135
|
+
<li><a href="../JqmobileHelpers/ButtonsHelper.html">JqmobileHelpers::ButtonsHelper</a></li>
|
136
|
+
|
137
|
+
<li><a href="../JqmobileHelpers/FormBuilder.html">JqmobileHelpers::FormBuilder</a></li>
|
138
|
+
|
139
|
+
<li><a href="../JqmobileHelpers/ListViewsHelper.html">JqmobileHelpers::ListViewsHelper</a></li>
|
140
|
+
|
141
|
+
<li><a href="../JqmobileHelpers/Railtie.html">JqmobileHelpers::Railtie</a></li>
|
142
|
+
|
143
|
+
<li><a href="../JqmobileHelpers/ToolbarsHelper.html">JqmobileHelpers::ToolbarsHelper</a></li>
|
144
|
+
|
145
|
+
</ul>
|
146
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
|
150
|
+
</div>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div id="documentation">
|
154
|
+
<h1 class="module">JqmobileHelpers::ListViewsHelper</h1>
|
155
|
+
|
156
|
+
<div id="description">
|
157
|
+
<h1><a href="../JqmobileHelpers.html">JqmobileHelpers</a> List View Helpers</h1>
|
158
|
+
<p>
|
159
|
+
Provides a set of methods for making list views for jquery-mobile markup
|
160
|
+
</p>
|
161
|
+
|
162
|
+
</div>
|
163
|
+
|
164
|
+
<!-- Constants -->
|
165
|
+
|
166
|
+
|
167
|
+
<!-- Attributes -->
|
168
|
+
|
169
|
+
|
170
|
+
<!-- Methods -->
|
171
|
+
|
172
|
+
<div id="public-instance-method-details" class="method-section section">
|
173
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
174
|
+
|
175
|
+
|
176
|
+
<div id="basic-list-method" class="method-detail ">
|
177
|
+
<a name="method-i-basic_list"></a>
|
178
|
+
|
179
|
+
<div class="method-heading">
|
180
|
+
|
181
|
+
<span class="method-name">basic_list</span><span
|
182
|
+
class="method-args">(collection, options = {})</span>
|
183
|
+
<span class="method-click-advice">click to toggle source</span>
|
184
|
+
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div class="method-description">
|
188
|
+
|
189
|
+
<h6>BASIC LIST ===========================================================</h6>
|
190
|
+
<p>
|
191
|
+
Creates a simple unordered list containing linked list items with a
|
192
|
+
data-role=“listview” attribute
|
193
|
+
</p>
|
194
|
+
<h4>Options</h4>
|
195
|
+
<pre>
|
196
|
+
# => 'data-inset' => 'true' (Default data-inset is set to true)
|
197
|
+
# => 'data-theme' => 'c' (Default data-theme is set to c)
|
198
|
+
</pre>
|
199
|
+
<h4>Examples</h4>
|
200
|
+
<pre>
|
201
|
+
basic_list(@posts.map{|x| x.title})
|
202
|
+
# => <ul data-role="listview" data-inset="true"><li>Title 1</li><li>test2</li></ul>
|
203
|
+
|
204
|
+
basic_list(@posts.map{|x| link_to(x.title, post_path(x))}, {'data-inset'=>'false', 'data-theme'=>'b'})
|
205
|
+
# => <ul data-role="listview" data-inset="false" data-theme="b"> \\
|
206
|
+
<li><a href='/posts/1'>Title 1</a></li><li><a href="/posts/2">test2</a></li></ul></pre>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
<div class="method-source-code"
|
211
|
+
id="basic-list-source">
|
212
|
+
<pre>
|
213
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 26</span>
|
214
|
+
26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">basic_list</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
215
|
+
27: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
216
|
+
28: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>)}
|
217
|
+
29: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ul</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-identifier">default_options</span>)
|
218
|
+
30: <span class="ruby-keyword kw">end</span></pre>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
</div>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
</div>
|
227
|
+
|
228
|
+
|
229
|
+
<div id="count-bubble-method" class="method-detail ">
|
230
|
+
<a name="method-i-count_bubble"></a>
|
231
|
+
|
232
|
+
<div class="method-heading">
|
233
|
+
|
234
|
+
<span class="method-name">count_bubble</span><span
|
235
|
+
class="method-args">(collection, options = {})</span>
|
236
|
+
<span class="method-click-advice">click to toggle source</span>
|
237
|
+
|
238
|
+
</div>
|
239
|
+
|
240
|
+
<div class="method-description">
|
241
|
+
|
242
|
+
<h6>SPLIT-BUTTON LIST ===========================================================</h6>
|
243
|
+
<p>
|
244
|
+
In cases where there is more than one possible action per list item, a
|
245
|
+
split button can be used to offer two independently clickable items —
|
246
|
+
the list item and a small arrow icon in the far right The framework will
|
247
|
+
add a vertical divider line and sets the title attribute of the link to the
|
248
|
+
text the link for accessibility.
|
249
|
+
</p>
|
250
|
+
<h4>Options</h4>
|
251
|
+
<pre>
|
252
|
+
# => 'data-inset' => 'true' (Default data-inset is set to true)
|
253
|
+
# => 'data-theme' => 'c' (Default data-theme is set to c)
|
254
|
+
</pre>
|
255
|
+
<h4>Examples</h4>
|
256
|
+
<pre>
|
257
|
+
<%= split_button_list "Split Button List", post_path(@posts) %>
|
258
|
+
# => <ul data-role="listview" data-split-icon="gear" data-split-theme="d"><li><a data-rel="dialog" data-transition="slideup" href="/posts/1">Split Button List</a></li></ul>
|
259
|
+
</pre>
|
260
|
+
<h6>for collections of data that have more than one.</h6>
|
261
|
+
<pre>
|
262
|
+
<% @posts.each do |post|
|
263
|
+
<%= split_button_list(post.name, post_path(post)) %>
|
264
|
+
<% end %></pre>
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
<div class="method-source-code"
|
269
|
+
id="count-bubble-source">
|
270
|
+
<pre>
|
271
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 125</span>
|
272
|
+
125: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">count_bubble</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
273
|
+
126: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
274
|
+
127: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
275
|
+
128: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
276
|
+
129: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">item</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">blank?</span>
|
277
|
+
130: <span class="ruby-identifier">item</span>[<span class="ruby-value">1</span>] = <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:a</span>, <span class="ruby-value str">"No item description"</span>, <span class="ruby-value">:href</span> =<span class="ruby-operator">></span> <span class="ruby-value str">""</span>)
|
278
|
+
131: <span class="ruby-keyword kw">end</span>
|
279
|
+
132: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-node">"#{item[1]}<span class=ui-li-count>#{item.size}</span>"</span>.<span class="ruby-identifier">html_safe</span>)
|
280
|
+
133: <span class="ruby-keyword kw">else</span>
|
281
|
+
134: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>)
|
282
|
+
135: <span class="ruby-keyword kw">end</span>
|
283
|
+
136: <span class="ruby-keyword kw">end</span>
|
284
|
+
137: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ul</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>)
|
285
|
+
138: <span class="ruby-keyword kw">end</span></pre>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
</div>
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
</div>
|
294
|
+
|
295
|
+
|
296
|
+
<div id="icon-list-method" class="method-detail ">
|
297
|
+
<a name="method-i-icon_list"></a>
|
298
|
+
|
299
|
+
<div class="method-heading">
|
300
|
+
|
301
|
+
<span class="method-name">icon_list</span><span
|
302
|
+
class="method-args">(collection, options = {})</span>
|
303
|
+
<span class="method-click-advice">click to toggle source</span>
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
<div class="method-description">
|
308
|
+
|
309
|
+
<h6>ICON LIST ===========================================================</h6>
|
310
|
+
<p>
|
311
|
+
To add thumbnails to the left of a list item, the first element in your
|
312
|
+
collection must have a image_tag. The framework will scale the image to 80
|
313
|
+
pixels square.
|
314
|
+
</p>
|
315
|
+
<p>
|
316
|
+
Items in your collection must also be constructed inside an array with 3
|
317
|
+
elements inside
|
318
|
+
</p>
|
319
|
+
<h4>Examples</h4>
|
320
|
+
<pre>
|
321
|
+
<%= icon_list(@posts.collect do |x|
|
322
|
+
[image_tag('/images/sample-pic.jpg'), link_to(x.title, post_path(x))]
|
323
|
+
end) %>
|
324
|
+
# => <ul data-inset="false" data-role="listview">
|
325
|
+
<li><img alt="Gb" class="ui-li-icon" src="https://github.com/jquery/jquery-mobile/blob/master/docs/lists/images/gb.png" />
|
326
|
+
<a href="/posts/1">First Title </a>
|
327
|
+
<span class=ui-li-count>2</span>
|
328
|
+
</li>
|
329
|
+
</ul></pre>
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
<div class="method-source-code"
|
334
|
+
id="icon-list-source">
|
335
|
+
<pre>
|
336
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 188</span>
|
337
|
+
188: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">icon_list</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
338
|
+
189: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
339
|
+
190: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
340
|
+
191: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
341
|
+
192: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">item</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">blank?</span>
|
342
|
+
193: <span class="ruby-identifier">item</span>[<span class="ruby-value">1</span>] = <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:a</span>, <span class="ruby-value str">"No item description"</span>, <span class="ruby-value">:href</span> =<span class="ruby-operator">></span> <span class="ruby-value str">""</span>)
|
343
|
+
194: <span class="ruby-keyword kw">end</span>
|
344
|
+
195: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">+</span> <span class="ruby-node">"#{item[1]}<span class=ui-li-count>#{item.size}</span>"</span>.<span class="ruby-identifier">html_safe</span>)
|
345
|
+
196: <span class="ruby-keyword kw">else</span>
|
346
|
+
197: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>)
|
347
|
+
198: <span class="ruby-keyword kw">end</span>
|
348
|
+
199: <span class="ruby-keyword kw">end</span>
|
349
|
+
200: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ul</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-identifier">default_options</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value str">'data-inset'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'false'</span>))
|
350
|
+
201: <span class="ruby-keyword kw">end</span></pre>
|
351
|
+
</div>
|
352
|
+
|
353
|
+
</div>
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
</div>
|
359
|
+
|
360
|
+
|
361
|
+
<div id="inset-list-method" class="method-detail ">
|
362
|
+
<a name="method-i-inset_list"></a>
|
363
|
+
|
364
|
+
<div class="method-heading">
|
365
|
+
|
366
|
+
<span class="method-name">inset_list</span><span
|
367
|
+
class="method-args">(collection, options = {})</span>
|
368
|
+
<span class="method-click-advice">click to toggle source</span>
|
369
|
+
|
370
|
+
</div>
|
371
|
+
|
372
|
+
<div class="method-description">
|
373
|
+
|
374
|
+
<h6>INSET LIST ===========================================================</h6>
|
375
|
+
<h4>Options</h4>
|
376
|
+
<pre>
|
377
|
+
# => 'data-inset' => 'true' (Default data-inset is set to true)
|
378
|
+
# => 'data-theme' => 'c' (Default data-theme is set to c)
|
379
|
+
</pre>
|
380
|
+
<h4>Examples</h4>
|
381
|
+
<pre>
|
382
|
+
inset_list(@posts.map{|x| x.title})
|
383
|
+
# => <ul data-role="listview" data-inset="true"><li>Title 1</li><li>test2</li></ul>
|
384
|
+
</pre>
|
385
|
+
<h4>Examples</h4>
|
386
|
+
<pre>
|
387
|
+
ol_inset_list(@posts.map{|x| x.title}, {'data-theme' => "a"} )
|
388
|
+
# => <ol data-role="listview" data-inset="true" data-theme="a"><li>Title 1</li><li>test2</li></ul></pre>
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
<div class="method-source-code"
|
393
|
+
id="inset-list-source">
|
394
|
+
<pre>
|
395
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 280</span>
|
396
|
+
280: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inset_list</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
397
|
+
281: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
398
|
+
282: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>)}
|
399
|
+
283: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ul</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-identifier">default_options</span>)
|
400
|
+
284: <span class="ruby-keyword kw">end</span></pre>
|
401
|
+
</div>
|
402
|
+
|
403
|
+
</div>
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
</div>
|
409
|
+
|
410
|
+
|
411
|
+
<div id="list-divider-method" class="method-detail ">
|
412
|
+
<a name="method-i-list_divider"></a>
|
413
|
+
|
414
|
+
<div class="method-heading">
|
415
|
+
|
416
|
+
<span class="method-name">list_divider</span><span
|
417
|
+
class="method-args">(collection, options = {})</span>
|
418
|
+
<span class="method-click-advice">click to toggle source</span>
|
419
|
+
|
420
|
+
</div>
|
421
|
+
|
422
|
+
<div class="method-description">
|
423
|
+
|
424
|
+
<h6>LIST DIVIDER ===========================================================</h6>
|
425
|
+
<p>
|
426
|
+
jQuery Mobile provides a very easy way to filter a list with a simple
|
427
|
+
client-side search feature. To make a list filterable, simply add the
|
428
|
+
data-filter=“true” attribute to the list. The framework will
|
429
|
+
then append a search box above the list and add the behavior to filter out
|
430
|
+
list items that don’t contain the current search string as the user
|
431
|
+
types.
|
432
|
+
</p>
|
433
|
+
<h4>Examples</h4>
|
434
|
+
<pre>
|
435
|
+
<%= search_filter_list(@posts.map{|x| link_to(x.title, post_path(x))}) %>
|
436
|
+
# => <ul data-inset="false" data-role="listview" data-filter="true">
|
437
|
+
<li>
|
438
|
+
<a href="/posts/1">Title 1</a></h3><p>Title 1</p>
|
439
|
+
</li>
|
440
|
+
</ul> </pre>
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
<div class="method-source-code"
|
445
|
+
id="list-divider-source">
|
446
|
+
<pre>
|
447
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 259</span>
|
448
|
+
259: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list_divider</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
449
|
+
260: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
450
|
+
261: <span class="ruby-comment cmt">#html_li_attributes_options(options)</span>
|
451
|
+
262: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:li</span>, <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>), {<span class="ruby-value str">'data-role'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'list-divider'</span>})}
|
452
|
+
263: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ul</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>)
|
453
|
+
264: <span class="ruby-keyword kw">end</span></pre>
|
454
|
+
</div>
|
455
|
+
|
456
|
+
</div>
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
</div>
|
462
|
+
|
463
|
+
|
464
|
+
<div id="list-formatting-method" class="method-detail ">
|
465
|
+
<a name="method-i-list_formatting"></a>
|
466
|
+
|
467
|
+
<div class="method-heading">
|
468
|
+
|
469
|
+
<span class="method-name">list_formatting</span><span
|
470
|
+
class="method-args">(collection, options = {})</span>
|
471
|
+
<span class="method-click-advice">click to toggle source</span>
|
472
|
+
|
473
|
+
</div>
|
474
|
+
|
475
|
+
<div class="method-description">
|
476
|
+
|
477
|
+
<h6>LIST FORMATTING LIST ===========================================================</h6>
|
478
|
+
<p>
|
479
|
+
jQuery Mobile provides a very easy way to filter a list with a simple
|
480
|
+
client-side search feature. To make a list filterable, simply add the
|
481
|
+
data-filter=“true” attribute to the list. The framework will
|
482
|
+
then append a search box above the list and add the behavior to filter out
|
483
|
+
list items that don’t contain the current search string as the user
|
484
|
+
types.
|
485
|
+
</p>
|
486
|
+
<h4>Examples</h4>
|
487
|
+
<pre>
|
488
|
+
<%= search_filter_list(@posts.map{|x| link_to(x.title, post_path(x))}) %>
|
489
|
+
# => <ul data-inset="false" data-role="listview" data-filter="true">
|
490
|
+
<li>
|
491
|
+
<a href="/posts/1">Title 1</a></h3><p>Title 1</p>
|
492
|
+
</li>
|
493
|
+
</ul> </pre>
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
<div class="method-source-code"
|
498
|
+
id="list-formatting-source">
|
499
|
+
<pre>
|
500
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 238</span>
|
501
|
+
238: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list_formatting</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
502
|
+
239: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
503
|
+
240: <span class="ruby-comment cmt">#html_li_attributes_options(options)</span>
|
504
|
+
241: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:li</span>, <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>), {<span class="ruby-value str">'data-role'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'list-divider'</span>})}
|
505
|
+
242: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ul</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>)
|
506
|
+
243: <span class="ruby-keyword kw">end</span></pre>
|
507
|
+
</div>
|
508
|
+
|
509
|
+
</div>
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
</div>
|
515
|
+
|
516
|
+
|
517
|
+
<div id="nested-list-method" class="method-detail ">
|
518
|
+
<a name="method-i-nested_list"></a>
|
519
|
+
|
520
|
+
<div class="method-heading">
|
521
|
+
|
522
|
+
<span class="method-name">nested_list</span><span
|
523
|
+
class="method-args">(collection, options = {})</span>
|
524
|
+
<span class="method-click-advice">click to toggle source</span>
|
525
|
+
|
526
|
+
</div>
|
527
|
+
|
528
|
+
<div class="method-description">
|
529
|
+
|
530
|
+
<h6>NESTED LIST ===========================================================</h6>
|
531
|
+
<p>
|
532
|
+
By nesting child ul of ol inside list items, you can create nested lists.
|
533
|
+
When a list item with a child list is clicked, the framework will generate
|
534
|
+
a new ui-page populated with the title of the parent in the header and the
|
535
|
+
list of child elements.
|
536
|
+
</p>
|
537
|
+
<h4>Options</h4>
|
538
|
+
<pre>
|
539
|
+
# => 'data-inset' => 'true' (Default data-inset is set to true)
|
540
|
+
# => 'data-theme' => 'c' (Default data-theme is set to c)
|
541
|
+
</pre>
|
542
|
+
<h4>Examples</h4>
|
543
|
+
<pre>
|
544
|
+
<%= nested_list @posts.map{|x| link_to(x.title, post_path(x))} %>
|
545
|
+
# => <ul data-inset="true" data-role="listview"><li><ul><li><a href="/birds/1">Bird</a></li></ul></li></ul></pre>
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
<div class="method-source-code"
|
550
|
+
id="nested-list-source">
|
551
|
+
<pre>
|
552
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 71</span>
|
553
|
+
71: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nested_list</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
554
|
+
72: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
555
|
+
73: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"ul"</span>, <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>)))}
|
556
|
+
74: <span class="ruby-identifier">content_tag</span> <span class="ruby-value">:ul</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>
|
557
|
+
75: <span class="ruby-keyword kw">end</span></pre>
|
558
|
+
</div>
|
559
|
+
|
560
|
+
</div>
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
</div>
|
566
|
+
|
567
|
+
|
568
|
+
<div id="numbered-list-method" class="method-detail ">
|
569
|
+
<a name="method-i-numbered_list"></a>
|
570
|
+
|
571
|
+
<div class="method-heading">
|
572
|
+
|
573
|
+
<span class="method-name">numbered_list</span><span
|
574
|
+
class="method-args">(collection, options = {})</span>
|
575
|
+
<span class="method-click-advice">click to toggle source</span>
|
576
|
+
|
577
|
+
</div>
|
578
|
+
|
579
|
+
<div class="method-description">
|
580
|
+
|
581
|
+
<h6>NUMBERED LIST ===========================================================</h6>
|
582
|
+
<p>
|
583
|
+
Creates ordered lists (ol) which is useful when presented items that are in
|
584
|
+
a sequence. When the enhanced markup is applied to the list view, jQuery
|
585
|
+
Mobile will try to first use CSS to add numbers to the list and, if not
|
586
|
+
supported, will fall back to injecting numbers with JavaScript
|
587
|
+
</p>
|
588
|
+
<h4>Options</h4>
|
589
|
+
<pre>
|
590
|
+
# => 'data-inset' => 'true' (Default data-inset is set to true)
|
591
|
+
# => 'data-theme' => 'c' (Default data-theme is set to c)
|
592
|
+
</pre>
|
593
|
+
<h4>Examples</h4>
|
594
|
+
<pre>
|
595
|
+
basic_list(@posts.map{|x| x.title})
|
596
|
+
# => <ol data-role="listview" data-inset="true"><li>Title 1</li><li>test2</li></ol>
|
597
|
+
|
598
|
+
basic_list(@posts.map{|x| link_to(x.title, post_path(x))}, {'data-inset'=>'false', 'data-theme'=>'b'})
|
599
|
+
# => <ol data-role="listview" data-inset="false" data-theme="b"> \\
|
600
|
+
<li><a href='/posts/1'>Title 1</a></li><li><a href="/posts/2">test2</a></li></ol></pre>
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
<div class="method-source-code"
|
605
|
+
id="numbered-list-source">
|
606
|
+
<pre>
|
607
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 49</span>
|
608
|
+
49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">numbered_list</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
609
|
+
50: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
610
|
+
51: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>)}
|
611
|
+
52: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ol</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>)
|
612
|
+
53: <span class="ruby-keyword kw">end</span></pre>
|
613
|
+
</div>
|
614
|
+
|
615
|
+
</div>
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
|
620
|
+
</div>
|
621
|
+
|
622
|
+
|
623
|
+
<div id="ol-inset-list-method" class="method-detail ">
|
624
|
+
<a name="method-i-ol_inset_list"></a>
|
625
|
+
|
626
|
+
<div class="method-heading">
|
627
|
+
|
628
|
+
<span class="method-name">ol_inset_list</span><span
|
629
|
+
class="method-args">(collection, options = {})</span>
|
630
|
+
<span class="method-click-advice">click to toggle source</span>
|
631
|
+
|
632
|
+
</div>
|
633
|
+
|
634
|
+
<div class="method-description">
|
635
|
+
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
|
640
|
+
<div class="method-source-code"
|
641
|
+
id="ol-inset-list-source">
|
642
|
+
<pre>
|
643
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 286</span>
|
644
|
+
286: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ol_inset_list</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
645
|
+
287: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
646
|
+
288: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>)}
|
647
|
+
289: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ol</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-identifier">default_options</span>)
|
648
|
+
290: <span class="ruby-keyword kw">end</span></pre>
|
649
|
+
</div>
|
650
|
+
|
651
|
+
</div>
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
</div>
|
657
|
+
|
658
|
+
|
659
|
+
<div id="search-filter-list-method" class="method-detail ">
|
660
|
+
<a name="method-i-search_filter_list"></a>
|
661
|
+
|
662
|
+
<div class="method-heading">
|
663
|
+
|
664
|
+
<span class="method-name">search_filter_list</span><span
|
665
|
+
class="method-args">(collection, options = {})</span>
|
666
|
+
<span class="method-click-advice">click to toggle source</span>
|
667
|
+
|
668
|
+
</div>
|
669
|
+
|
670
|
+
<div class="method-description">
|
671
|
+
|
672
|
+
<h6>SEARCH FILTER LIST ===========================================================</h6>
|
673
|
+
<p>
|
674
|
+
jQuery Mobile provides a very easy way to filter a list with a simple
|
675
|
+
client-side search feature. To make a list filterable, simply add the
|
676
|
+
data-filter=“true” attribute to the list. The framework will
|
677
|
+
then append a search box above the list and add the behavior to filter out
|
678
|
+
list items that don’t contain the current search string as the user
|
679
|
+
types.
|
680
|
+
</p>
|
681
|
+
<h4>Examples</h4>
|
682
|
+
<pre>
|
683
|
+
<%= search_filter_list(@posts.map{|x| link_to(x.title, post_path(x))}) %>
|
684
|
+
# => <ul data-inset="false" data-role="listview" data-filter="true">
|
685
|
+
<li>
|
686
|
+
<a href="/posts/1">Title 1</a></h3><p>Title 1</p>
|
687
|
+
</li>
|
688
|
+
</ul></pre>
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
<div class="method-source-code"
|
693
|
+
id="search-filter-list-source">
|
694
|
+
<pre>
|
695
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 217</span>
|
696
|
+
217: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">search_filter_list</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
697
|
+
218: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
698
|
+
219: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>)}
|
699
|
+
220: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ul</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-identifier">default_options</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value str">'data-filter'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'true'</span>, <span class="ruby-value str">'data-inset'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'false'</span>))
|
700
|
+
221: <span class="ruby-keyword kw">end</span></pre>
|
701
|
+
</div>
|
702
|
+
|
703
|
+
</div>
|
704
|
+
|
705
|
+
|
706
|
+
|
707
|
+
|
708
|
+
</div>
|
709
|
+
|
710
|
+
|
711
|
+
<div id="split-button-list-method" class="method-detail ">
|
712
|
+
<a name="method-i-split_button_list"></a>
|
713
|
+
|
714
|
+
<div class="method-heading">
|
715
|
+
|
716
|
+
<span class="method-name">split_button_list</span><span
|
717
|
+
class="method-args">(name,link, options={})</span>
|
718
|
+
<span class="method-click-advice">click to toggle source</span>
|
719
|
+
|
720
|
+
</div>
|
721
|
+
|
722
|
+
<div class="method-description">
|
723
|
+
|
724
|
+
<h6>SPLIT-BUTTON LIST ===========================================================</h6>
|
725
|
+
<p>
|
726
|
+
In cases where there is more than one possible action per list item, a
|
727
|
+
split button can be used to offer two independently clickable items —
|
728
|
+
the list item and a small arrow icon in the far right The framework will
|
729
|
+
add a vertical divider line and sets the title attribute of the link to the
|
730
|
+
text the link for accessibility.
|
731
|
+
</p>
|
732
|
+
<h4>Options</h4>
|
733
|
+
<pre>
|
734
|
+
# => 'data-inset' => 'true' (Default data-inset is set to true)
|
735
|
+
# => 'data-theme' => 'c' (Default data-theme is set to c)
|
736
|
+
</pre>
|
737
|
+
<h4>Examples</h4>
|
738
|
+
<pre>
|
739
|
+
<%= split_button_list "Split Button List", post_path(@posts) %>
|
740
|
+
# => <ul data-role="listview" data-split-icon="gear" data-split-theme="d"><li><a data-rel="dialog" data-transition="slideup" href="/posts/1">Split Button List</a></li></ul>
|
741
|
+
</pre>
|
742
|
+
<h6>for collections of data that have more than one.</h6>
|
743
|
+
<pre>
|
744
|
+
<% @posts.each do |post|
|
745
|
+
<%= split_button_list(post.name, post_path(post)) %>
|
746
|
+
<% end %></pre>
|
747
|
+
|
748
|
+
|
749
|
+
|
750
|
+
<div class="method-source-code"
|
751
|
+
id="split-button-list-source">
|
752
|
+
<pre>
|
753
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 96</span>
|
754
|
+
96: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">split_button_list</span>(<span class="ruby-identifier">name</span>,<span class="ruby-identifier">link</span>, <span class="ruby-identifier">options</span>={})
|
755
|
+
97: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
756
|
+
98: <span class="ruby-identifier">default_split_options</span> = {<span class="ruby-value str">'data-icon'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"gear"</span>}
|
757
|
+
99: <span class="ruby-identifier">split_options</span> = {<span class="ruby-value str">'data-rel'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"dialog"</span>, <span class="ruby-value str">'data-transition'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"slideup"</span>}
|
758
|
+
100: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:a</span>, <span class="ruby-identifier">name</span>, {<span class="ruby-value">:href</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">link</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">split_options</span>)))
|
759
|
+
101: <span class="ruby-comment cmt">#list = content_tag("li", content_tag(:a, data, {:href => link}.merge(split_options)))</span>
|
760
|
+
102: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ul</span>, <span class="ruby-identifier">list</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">default_split_options</span>))
|
761
|
+
103: <span class="ruby-keyword kw">end</span></pre>
|
762
|
+
</div>
|
763
|
+
|
764
|
+
</div>
|
765
|
+
|
766
|
+
|
767
|
+
|
768
|
+
|
769
|
+
</div>
|
770
|
+
|
771
|
+
|
772
|
+
<div id="thumbnail-list-method" class="method-detail ">
|
773
|
+
<a name="method-i-thumbnail_list"></a>
|
774
|
+
|
775
|
+
<div class="method-heading">
|
776
|
+
|
777
|
+
<span class="method-name">thumbnail_list</span><span
|
778
|
+
class="method-args">(collection, options={})</span>
|
779
|
+
<span class="method-click-advice">click to toggle source</span>
|
780
|
+
|
781
|
+
</div>
|
782
|
+
|
783
|
+
<div class="method-description">
|
784
|
+
|
785
|
+
<p>
|
786
|
+
To add thumbnails to the left of a list item, the first element in your
|
787
|
+
collection must have a image_tag. The framework will scale the image to 80
|
788
|
+
pixels square.
|
789
|
+
</p>
|
790
|
+
<p>
|
791
|
+
Items in your collection must also be constructed inside an array with 3
|
792
|
+
elements inside
|
793
|
+
</p>
|
794
|
+
<h4>Examples</h4>
|
795
|
+
<pre>
|
796
|
+
<%= thumbnail_list(@posts.collect do |x|
|
797
|
+
[image_tag('/images/sample-pic.jpg'), link_to(x.title, post_path(x)), x.title]
|
798
|
+
end) %>
|
799
|
+
# => <ul data-inset="false" data-role="listview">
|
800
|
+
<li>
|
801
|
+
<img alt="Album-bb" src="/images/album-bb.jpg" />
|
802
|
+
<h3><a href="/posts/1">Title 1</a></h3><p>Title 1</p>
|
803
|
+
</li>
|
804
|
+
</ul></pre>
|
805
|
+
|
806
|
+
|
807
|
+
|
808
|
+
<div class="method-source-code"
|
809
|
+
id="thumbnail-list-source">
|
810
|
+
<pre>
|
811
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 156</span>
|
812
|
+
156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">thumbnail_list</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span>={})
|
813
|
+
157: <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
814
|
+
158: <span class="ruby-identifier">list</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
815
|
+
159: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
816
|
+
160: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">item</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">blank?</span>
|
817
|
+
161: <span class="ruby-identifier">item</span>[<span class="ruby-value">1</span>] = <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:a</span>, <span class="ruby-value str">"No item description"</span>, <span class="ruby-value">:href</span> =<span class="ruby-operator">></span> <span class="ruby-value str">""</span>)
|
818
|
+
162: <span class="ruby-keyword kw">end</span>
|
819
|
+
163: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">+</span> <span class="ruby-node">"<h3>#{item[1]}</h3><p>#{item[2]}</p>"</span>.<span class="ruby-identifier">html_safe</span>)
|
820
|
+
164: <span class="ruby-keyword kw">else</span>
|
821
|
+
165: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">"li"</span>, <span class="ruby-identifier">item</span>)
|
822
|
+
166: <span class="ruby-keyword kw">end</span>
|
823
|
+
167: <span class="ruby-keyword kw">end</span>
|
824
|
+
168: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:ul</span>, <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">html_safe</span>, <span class="ruby-identifier">default_options</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value str">'data-inset'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'false'</span>))
|
825
|
+
169: <span class="ruby-keyword kw">end</span></pre>
|
826
|
+
</div>
|
827
|
+
|
828
|
+
</div>
|
829
|
+
|
830
|
+
|
831
|
+
|
832
|
+
|
833
|
+
</div>
|
834
|
+
|
835
|
+
|
836
|
+
</div>
|
837
|
+
|
838
|
+
<div id="private-instance-method-details" class="method-section section">
|
839
|
+
<h3 class="section-header">Private Instance Methods</h3>
|
840
|
+
|
841
|
+
|
842
|
+
<div id="html-attributes-options-method" class="method-detail ">
|
843
|
+
<a name="method-i-html_attributes_options"></a>
|
844
|
+
|
845
|
+
<div class="method-heading">
|
846
|
+
|
847
|
+
<span class="method-name">html_attributes_options</span><span
|
848
|
+
class="method-args">(options)</span>
|
849
|
+
<span class="method-click-advice">click to toggle source</span>
|
850
|
+
|
851
|
+
</div>
|
852
|
+
|
853
|
+
<div class="method-description">
|
854
|
+
|
855
|
+
<p>
|
856
|
+
Default html5 data attributes for list view in jquery-mobile
|
857
|
+
</p>
|
858
|
+
|
859
|
+
|
860
|
+
|
861
|
+
<div class="method-source-code"
|
862
|
+
id="html-attributes-options-source">
|
863
|
+
<pre>
|
864
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 295</span>
|
865
|
+
295: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">html_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
866
|
+
296: <span class="ruby-identifier">html_options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">stringify_keys!</span>
|
867
|
+
297: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span> = {<span class="ruby-value str">'data-role'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"listview"</span>, <span class="ruby-value str">'data-inset'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"true"</span>}
|
868
|
+
298:
|
869
|
+
299: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">html_options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">'data-inset'</span>)
|
870
|
+
300: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span> = <span class="ruby-identifier">default_options</span>.<span class="ruby-identifier">merge</span>({<span class="ruby-value str">'data-inset'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">html_options</span>[<span class="ruby-value str">'data-inset'</span>]})
|
871
|
+
301: <span class="ruby-keyword kw">end</span>
|
872
|
+
302:
|
873
|
+
303: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">html_options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">'data-theme'</span>)
|
874
|
+
304: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span> = <span class="ruby-identifier">default_options</span>.<span class="ruby-identifier">merge</span>({<span class="ruby-value str">'data-theme'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">html_options</span>[<span class="ruby-value str">'data-theme'</span>]})
|
875
|
+
305: <span class="ruby-keyword kw">end</span>
|
876
|
+
306:
|
877
|
+
307: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">html_options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">'data-rel'</span>)
|
878
|
+
308: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span> = <span class="ruby-identifier">default_options</span>.<span class="ruby-identifier">merge</span>({<span class="ruby-value str">'data-rel'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">html_options</span>[<span class="ruby-value str">'data-rel'</span>]})
|
879
|
+
309: <span class="ruby-keyword kw">end</span>
|
880
|
+
310:
|
881
|
+
311: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">html_options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">'data-transition'</span>)
|
882
|
+
312: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span> = <span class="ruby-identifier">default_options</span>.<span class="ruby-identifier">merge</span>({<span class="ruby-value str">'data-transition'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">html_options</span>[<span class="ruby-value str">'data-transition'</span>]})
|
883
|
+
313: <span class="ruby-keyword kw">end</span>
|
884
|
+
314:
|
885
|
+
315: <span class="ruby-keyword kw">end</span></pre>
|
886
|
+
</div>
|
887
|
+
|
888
|
+
</div>
|
889
|
+
|
890
|
+
|
891
|
+
|
892
|
+
|
893
|
+
</div>
|
894
|
+
|
895
|
+
|
896
|
+
<div id="html-li-attributes-options-method" class="method-detail ">
|
897
|
+
<a name="method-i-html_li_attributes_options"></a>
|
898
|
+
|
899
|
+
<div class="method-heading">
|
900
|
+
|
901
|
+
<span class="method-name">html_li_attributes_options</span><span
|
902
|
+
class="method-args">(options)</span>
|
903
|
+
<span class="method-click-advice">click to toggle source</span>
|
904
|
+
|
905
|
+
</div>
|
906
|
+
|
907
|
+
<div class="method-description">
|
908
|
+
|
909
|
+
|
910
|
+
|
911
|
+
|
912
|
+
|
913
|
+
<div class="method-source-code"
|
914
|
+
id="html-li-attributes-options-source">
|
915
|
+
<pre>
|
916
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/list_views_helper.rb, line 317</span>
|
917
|
+
317: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">html_li_attributes_options</span>(<span class="ruby-identifier">options</span>)
|
918
|
+
318: <span class="ruby-identifier">html_options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">stringify_keys!</span>
|
919
|
+
319: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">li_options</span> = {<span class="ruby-value str">'data-role'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"list-divider"</span>}
|
920
|
+
320:
|
921
|
+
321: <span class="ruby-keyword kw">end</span></pre>
|
922
|
+
</div>
|
923
|
+
|
924
|
+
</div>
|
925
|
+
|
926
|
+
|
927
|
+
|
928
|
+
|
929
|
+
</div>
|
930
|
+
|
931
|
+
|
932
|
+
</div>
|
933
|
+
|
934
|
+
|
935
|
+
</div>
|
936
|
+
|
937
|
+
|
938
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
939
|
+
|
940
|
+
<p>Disabled; run with --debug to generate this.</p>
|
941
|
+
|
942
|
+
</div>
|
943
|
+
|
944
|
+
<div id="validator-badges">
|
945
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
946
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
947
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
948
|
+
</div>
|
949
|
+
|
950
|
+
</body>
|
951
|
+
</html>
|
952
|
+
|