Permalink
Browse files

Merge branch 'develop' into helpers

  • Loading branch information...
2 parents dd4878b + 1d5ce0d commit ea1b1fee21c606f5c4a77aafb01344b117bb50dd Haikal Hussein committed Feb 28, 2011
@@ -29,6 +29,10 @@ def button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -54,6 +58,10 @@ def delete_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -79,6 +87,10 @@ def left_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -104,6 +116,10 @@ def right_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -129,6 +145,10 @@ def up_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -154,6 +174,10 @@ def down_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -179,6 +203,10 @@ def plus_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -204,6 +232,10 @@ def minus_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -229,6 +261,10 @@ def check_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -254,6 +290,10 @@ def gear_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -279,6 +319,10 @@ def refresh_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -304,6 +348,10 @@ def forward_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -329,6 +377,10 @@ def back_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -354,6 +406,10 @@ def grid_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -379,6 +435,10 @@ def star_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -404,6 +464,10 @@ def alert_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -429,6 +493,10 @@ def info_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -454,6 +522,10 @@ def home_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -479,6 +551,10 @@ def search_button_link(name, link, options = {})
default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
end
+ if html_options.has_key?('data-inline')
+ default_options = default_options.merge({'data-inline' => html_options['data-inline']})
+ end
+
content_tag(:a, name, {:href => link}.merge(default_options))
end
@@ -506,6 +582,38 @@ def back_split_button(name, link, options ={} )
content_tag(:a, name, {:href => link}.merge(default_options))
end
+ # Grouped Button
+ #
+ # ==== Examples
+ # group_button("
+ # #{home_button_link('home', buttons_path, 'data-iconpos' => 'right')}
+ # #{refresh_button_link 'refresh', buttons_path}
+ # ")
+ # # => <div data-role="controlgroup">
+ # <a data-icon="home" data-iconpos="right" data-role="button" href="/buttons">home</a>
+ # <a data-icon="refresh" data-role="button" href="/buttons">refresh</a>
+ # </div>
+ #
+ # group_button("
+ # #{home_button_link('home', buttons_path, 'data-iconpos' => 'right')}
+ # #{refresh_button_link 'refresh', buttons_path}, {'data-type' => 'horizontal'}
+ # ")
+ # # => <div data-role="controlgroup" data-type="horizontal" >
+ # <a data-icon="home" data-iconpos="right" data-role="button" href="/buttons">home</a>
+ # <a data-icon="refresh" data-role="button" href="/buttons">refresh</a>
+ # </div>
+ def group_button(content, options = {})
+
+ html_options = options.stringify_keys!
+ default_options = {'data-role'=> "controlgroup"}
+
+ if html_options.has_key?('data-type')
+ default_options = default_options.merge({'data-type' => html_options['data-type']})
+ end
+
+ content_tag(:div, content, default_options, false)
+ end
+
end
end
@@ -2,14 +2,15 @@ module JqmobileHelpers
# = JqmobileHelpers List View Helpers
# Provides a set of methods for making toolbars views
# for jquery-mobile markup
- module ToolbarsHelper #:nodoc:
+ module ToolbarsHelper
# Header Bar Title
#
# === Examples
#
- # <h1>Page Title</h1>
+ # => <%= header_toolbar_title('Put Title Here') %>
+ # => <h1>Page Title</h1>
#
def header_toolbar_title(title)
@@ -20,14 +21,14 @@ def header_toolbar_title(title)
#
# ---Options ---
# => '- data-direction = "reverse" ## reverse transition without actually going back in history
- # => - data-icon [delete,check,home,gear]
- # => - data-iconpos [text,notext] ## if use notext, link only show icon
- # => - class
- # => - data-theme ## default 'a'
+ # => - data-icon [delete,check,home,gear]
+ # => - data-iconpos [text,notext] ## if use notext, link only show icon
+ # => - class
+ # => - data-theme ## default 'a'
#
# === Examples
#
- # <a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
+ # => <a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
def header_toolbar_link(link_name,path,options = {})
html_options = options.stringify_keys!
@@ -48,5 +49,67 @@ def header_toolbar_link(link_name,path,options = {})
content_tag(:a, "#{link_name}",default_options)
end
+ # navigation bar container
+ #
+ # A navbar is coded as an unordered list of links wrapped in a container element that has the data-role="navbar" attribute
+ # To set one of links to the active (selected) state, add class="ui-btn-active" to the anchor
+ # The navbar maxes out with 5 items, each 1/5 the width of the browser window
+ # Navbar can be in the header/footer.just add the navbar container inside header/footer container
+ #
+ # *** Options ***
+ # => data-role = 'navbar' (to specify the contanier as navbar)
+ #
+ # Example :
+ # <div data-role="navbar">
+ # <ul>
+ # <li><a href="a.html" class="ui-btn-active">One</a></li>
+ # <li><a href="b.html">Two</a></li>
+ # </ul>
+ # </div><!-- /navbar -->
+ # Usage :
+ # navbar_link(collection) ** this method is to create the link inside the navbar container
+ # <%= navbar_bar([navbar_link('saya',root_path,{'data-icon' => 'gear'}),navbar_link('saya',root_path,{'data-icon' => 'gear'}),navbar_link('dia',toolbars_path,{'data-icon' => 'home'}), navbar_link('kami',toolbars_path,{'data-icon' => 'plus'})]) %>
+
+
+ def navbar_bar(collection)
+ listing = collection.map {|item| content_tag("li",item)}
+ content_tag("div",content_tag(:ul, listing.join.html_safe), {'data-role' => 'navbar'})
+ end
+
+ # link inside the navbar
+ # *** Options ***
+ # => data-icon (to add icon to navbar items)
+ # => data-iconpos="top" (to stack icon above the navbar items label)
+ # => data-theme (set theming for navbar)
+ # Example
+ # # => <a href="a.html" class="ui-btn-active" 'data-icon'="gear">One</a>
+ # Usage :
+ # => navbar_link('saya',root_path,{'data-icon' => 'gear'})
+
+
+ def navbar_link(name,link, options ={})
+ html_options = options.stringify_keys!
+ default_options = {}
+
+ if html_options.has_key?('data-icon')
+ default_options = default_options.merge({'data-icon' => html_options['data-icon']})
+ end
+
+ if html_options.has_key?('data-iconpos')
+ default_options = default_options.merge({'data-iconpos' => html_options['data-iconpos']})
+ end
+
+ if html_options.has_key?('data-theme')
+ default_options = default_options.merge({'data-theme' => html_options['data-theme']})
+ end
+
+ if html_options.has_key?('class')
+ default_options = default_options.merge({'class' => html_options['class']})
+ end
+
+ content_tag('a',name, {'href' => "#{link}"}.merge(default_options))
+ end
+
+
end
end
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+ <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
View
@@ -38,18 +38,18 @@ <h3 class="section-header">In Files</h3>
<div class="section-body">
<ul>
- <li><a href="./lib/jqmobile_helpers/buttons_helper_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
- class="thickbox" title="lib/jqmobile_helpers/buttons_helper.rb">lib/jqmobile_helpers/buttons_helper.rb</a></li>
-
- <li><a href="./lib/jqmobile_helpers/list_views_helper_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
- class="thickbox" title="lib/jqmobile_helpers/list_views_helper.rb">lib/jqmobile_helpers/list_views_helper.rb</a></li>
-
<li><a href="./lib/jqmobile_helpers/railtie_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
class="thickbox" title="lib/jqmobile_helpers/railtie.rb">lib/jqmobile_helpers/railtie.rb</a></li>
<li><a href="./lib/jqmobile_helpers/toolbars_helper_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
class="thickbox" title="lib/jqmobile_helpers/toolbars_helper.rb">lib/jqmobile_helpers/toolbars_helper.rb</a></li>
+ <li><a href="./lib/jqmobile_helpers/list_views_helper_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+ class="thickbox" title="lib/jqmobile_helpers/list_views_helper.rb">lib/jqmobile_helpers/list_views_helper.rb</a></li>
+
+ <li><a href="./lib/jqmobile_helpers/buttons_helper_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+ class="thickbox" title="lib/jqmobile_helpers/buttons_helper.rb">lib/jqmobile_helpers/buttons_helper.rb</a></li>
+
<li><a href="./lib/jqmobile_helpers_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
class="thickbox" title="lib/jqmobile_helpers.rb">lib/jqmobile_helpers.rb</a></li>
@@ -120,10 +120,14 @@ <h3 class="section-header">Class Index
<li><a href="./JqmobileHelpers.html">JqmobileHelpers</a></li>
+ <li><a href="./JqmobileHelpers/ButtonsHelper.html">JqmobileHelpers::ButtonsHelper</a></li>
+
<li><a href="./JqmobileHelpers/ListViewsHelper.html">JqmobileHelpers::ListViewsHelper</a></li>
<li><a href="./JqmobileHelpers/Railtie.html">JqmobileHelpers::Railtie</a></li>
+ <li><a href="./JqmobileHelpers/ToolbarsHelper.html">JqmobileHelpers::ToolbarsHelper</a></li>
+
</ul>
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
</div>
Oops, something went wrong.

0 comments on commit ea1b1fe

Please sign in to comment.