rails-jquerymobile 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
+ require "rails-jquerymobile/version"
3
+
4
+ task :build do
5
+ system "gem build rails-jquerymobile.gemspec"
6
+ end
7
+
8
+ task :release => :build do
9
+ system "gem push rails-jquerymobile-#{RailsJquerymobile::VERSION}.gem"
10
+ end
@@ -12,7 +12,6 @@ ActionController::Base.send :include, HasMobileFormat
12
12
  class RailsJquerymobile::LayoutGenerator < Rails::Generators::Base
13
13
  source_root File.expand_path("../templates", __FILE__)
14
14
  def create_mobile_layout
15
- #create_file "app/views/layouts/application.mobile.erb", "<!-- This may be a layout... -->"
16
15
  copy_file "application.mobile.erb", "app/views/layouts/application.mobile.erb"
17
16
  end
18
17
  end
@@ -1,4 +1,5 @@
1
1
  module HasMobileFormat
2
+
2
3
  def self.included(base)
3
4
  base.send :extend, ClassMethods
4
5
  end
@@ -6,26 +7,37 @@ module HasMobileFormat
6
7
  module ClassMethods
7
8
  def has_mobile_format(options = {})
8
9
  send :include, InstanceMethods
10
+ class_attribute :jquerymobile_options
11
+ self.jquerymobile_options = options
9
12
  before_filter :prepare_for_mobile_formats
10
13
  end
11
14
  end
12
15
 
13
16
  module InstanceMethods
14
17
  def mobile?
18
+ raise "not implemented yet"
15
19
  end
16
20
  # TODO: following should be private?
17
21
  def prepare_for_mobile_formats
18
22
  remember_format(params[:mobile].to_s)
19
- puts "before assigning: request.format=#{request.format}, session[:remembered_format]=#{session[:remembered_format]}"
23
+ puts "before assigning: request.format=#{request.format}, " +
24
+ "session[:remembered_format]=#{session[:remembered_format]}" if debug?
20
25
  format = session[:remembered_format]
21
- puts "format=#{format}"
26
+ puts "determined format=#{format}" if debug?
22
27
  request.format = format unless format.blank?
23
- puts "request.format=#{request.format}"
28
+ puts "request.format=#{request.format}" if debug?
24
29
  end
30
+
31
+ private
32
+
25
33
  def remember_format(format)
26
34
  session[:remembered_format] = :mobile if format == '1'
27
35
  session[:remembered_format] = nil if format == '0'
28
- puts "session[:remembered_format]=#{session[:remembered_format]}"
36
+ puts "session[:remembered_format]=#{session[:remembered_format]}" if debug?
37
+ end
38
+
39
+ def debug?
40
+ self.class.jquerymobile_options[:debug]
29
41
  end
30
42
  end
31
43
 
@@ -1,3 +1,3 @@
1
1
  module RailsJquerymobile
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-jquerymobile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-20 00:00:00.000000000Z
12
+ date: 2011-12-21 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2153380820 !ruby/object:Gem::Requirement
16
+ requirement: &2153463760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153380820
24
+ version_requirements: *2153463760
25
25
  description: Use jQuery Mobile in a Rails application by adding a :mobile format,
26
26
  and by adding a mobile layout that references jQuery Mobile
27
27
  email:
@@ -33,6 +33,7 @@ files:
33
33
  - .gitignore
34
34
  - Gemfile
35
35
  - README.md
36
+ - Rakefile
36
37
  - init.rb
37
38
  - lib/rails-jquerymobile.rb
38
39
  - lib/rails-jquerymobile/has_mobile_format.rb