Where exactly does that line of code go for a Rails application? Which file, and is there any additional surrounding syntax? Does anyone have a complete example of how to disable jQuery loading messages? I’ve read the documentation but I think there’s just something really basic I’m missing that’s not explicitly covered in the documentation.
Thanks
application.js
//= require jquery
//= require jquery_ujs
//= require jquery.mobile
application.mobile.js
//= require jquery.mobile
application.css
*= require_self
*= require jquery.mobile
*= require scaffolds.css
application.mobile.css
*= require_self
*= require jquery.mobile
Gemfile
source 'http://rubygems.org'
gem 'rails', '3.2.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'thin'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier'
end
gem 'jquery-rails'
gem 'mobylette'
gem 'jquery_mobile_rails'
group :test, :development do
gem 'rspec'
gem 'rspec-rails'
gem 'sqlite3'
end
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Mobile Version!</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<%= javascript_include_tag "application" %>
<script type='text/javascript'>
$.mobile.hidePageLoadingMsg();
</script>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application.mobile.js" %>
<%= stylesheet_link_tag "application.mobile.css" %>
<%= csrf_meta_tags %>
</head>
<body>
<div data-role="page">
<%= yield %>
<div data-role="footer" data-position="fixed">
<div data-role="navbar">
<ul>
<li>
<%= link_to notes_path, :class => ("ui-btn-active" if action_name == 'index'), :"data-icon" => "home", :"data-iconpos" => "top" do %>
Home
<% end %>
</li>
<li>
<%= link_to new_note_path, :class => ("ui-btn-active" if action_name == 'new'), :"data-icon" => "plus", :"data-iconpos" => "top" do %>
New Note
<% end %>
</li>
</ul>
</div>
</div>
</div>
</body>
</html>
Ok so basically, the moral of the story here is DONT user Gems for jQuery Mobile. Saying they don’t work would be an understatement…they get 95% of the job done but then they puke so spectacularly that it’s almost comical to think you tried to use them in the first place. These gems seem to (1) have an innate ability to explode when literally ANYTHING is updated that is remotely related to Rails and/or jQuery Mobile, (2) get abruptly and inexplicably delisted by their github owner, (3) throw awesomely rare and automagical errors, and (4) all for the awesome benefit of including MORE lines (that are by the way really sensitive to breaking) of code than if you were to just use jQuery Mobile hotlinks in the first place.
Save yourself a ton of headaches and just use hotlinks. If not, you’ll win an all-expense paid vacation to suckville, sponsored by jQuery Mobile Gems, Inc (the latest versions of which, by the way, are almost guaranteed to be out of date and completely useless).
application.html.erb