Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 4 files changed
  • 0 comments
  • 1 contributor
11 app/views/jqm/_page.html.erb
@@ -3,7 +3,7 @@
3 3 <%= prev_page if defined?(prev_page) %>
4 4 <%= content_tag header_tag, title, :class => 'page-title' if defined? title %>
5 5 <%= next_page if defined?(next_page) %>
6   - <%= content_tag :div, :'data-role' => :navbar do %>
  6 + <%= content_tag :div, :data => { :role => :navbar } do %>
7 7 <ul>
8 8 <% navbar_items.each do |item| %>
9 9 <%= content_tag :li, link_to(item[:body], item[:url], item[:options]) %>
@@ -17,11 +17,12 @@
17 17 <% end %>
18 18
19 19 <%= content_tag :footer, :data => footer_data do %>
20   - <div data-role="navbar">
  20 + <%= content_tag :div, :data => { :role => :navbar } do %>
21 21 <ul>
22   - <li><%= link_to 'Home', root_path %></li>
23   - <li><%= link_to 'Hilfe', '#' %></li>
  22 + <% footer_items.each do |item| %>
  23 + <%= content_tag :li, link_to(item[:body], item[:url], item[:options]) %>
  24 + <% end %>
24 25 </ul>
25   - </div>
  26 + <% end if defined?(footer_items) %>
26 27 <% end unless defined?(footer) and !footer %>
27 28 <% end %>
9 lib/jqm-rails.rb
... ... @@ -1,10 +1,17 @@
1 1 require "jqm-rails/version"
2 2 require "jqm-rails/helpers"
  3 +require "jqm-rails/mobile_detection"
3 4
4 5 class Engine < ::Rails::Engine
5 6 # Must extend Rails::Engine to be able to supply vendor/assets stuff
6 7 end
7 8
  9 +class ActionController::Base
  10 + extend ::Jqm::MobileDetection::ClassMethods
  11 + include ::Jqm::MobileDetection::ClassMethods
  12 +end
  13 +
8 14 class ActionView::Base
9   - send :include, ::Jqm::Helpers
  15 + send :include, ::Jqm::Helpers
  16 + send :include, ::Jqm::MobileDetection::ClassMethods
10 17 end
26 lib/jqm-rails/mobile_detection.rb
... ... @@ -0,0 +1,26 @@
  1 +# Adaptation of Mobile_Fu logic, https://github.com/brendanlim/mobile-fu
  2 +# Taken from https://github.com/fakingfantastic/jquery-mobile-rails -- @amiuhle
  3 +
  4 +module Jqm
  5 + module MobileDetection
  6 + MOBILE_USER_AGENTS = 'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' +
  7 + 'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' +
  8 + 'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' +
  9 + 'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' +
  10 + 'webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|' +
  11 + 'mobile'
  12 +
  13 + module InstanceMethods
  14 + def mobile_device?
  15 + request.user_agent.to_s.downcase =~ Regexp.new(Jqm::MobileDetection::MOBILE_USER_AGENTS)
  16 + end
  17 + end
  18 +
  19 + module ClassMethods
  20 + def mobile_device?
  21 + request.user_agent.to_s.downcase =~ Regexp.new(Jqm::MobileDetection::MOBILE_USER_AGENTS)
  22 + end
  23 + end
  24 +
  25 + end
  26 +end
2  vendor/assets/javascripts/jquery.mobile.analytics.js.coffee
@@ -22,7 +22,7 @@ jQuery ->
22 22 u ||= url.pathname
23 23 if u then gaq.push(['_trackPageview', u]) else gaq.push(['_trackPageview'])
24 24
25   - $(":jqmData(jqm-analytics-event)").live 'click', (event) ->
  25 + $(":jqmData(jqm-analytics-event)").live 'tap', (event) ->
26 26 event_data = $(this).jqmData('jqm-analytics-event')
27 27 event_data = ['_trackEvent'].concat(event_data) unless event_data?[0] is '_trackEvent'
28 28 gaq.push event_data

No commit comments for this range

Something went wrong with that request. Please try again.