ujsos 0.0.1 → 0.0.2

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.
data/Rakefile CHANGED
@@ -1,2 +1,4 @@
1
+ # rake install
2
+ # rake release
1
3
  require 'bundler'
2
4
  Bundler::GemHelper.install_tasks
@@ -7,18 +7,19 @@ module Ujsos
7
7
 
8
8
  Mime::Type.register_alias "text/html", :htmlf
9
9
 
10
+
10
11
  # patch view lookups to use html files in case of htmlf as well
11
- module ::ActionView
12
- class LookupContext
13
- module Details
14
- alias_method :orig_formats=, :formats=
15
-
16
- def formats=(values)
17
- values << :html if !values.nil? && values == [:htmlf]
18
- self.orig_formats=(values)
19
- end
20
- end
12
+ patch = "
13
+ alias_method(:orig_formats=, :formats=)
14
+ def formats=(values)
15
+ values << :html if !values.nil? && values == [:htmlf]
16
+ self.orig_formats=(values)
21
17
  end
18
+ "
19
+ if RUBY_VERSION.to_s =~ /^1.9/
20
+ ::ActionView::LookupContext::Details.class_eval { eval patch }
21
+ else
22
+ ::ActionView::LookupContext.class_eval { eval patch }
22
23
  end
23
24
  end
24
25
  end
@@ -27,12 +28,16 @@ module Ujsos
27
28
  extend ActiveSupport::Concern
28
29
 
29
30
  included do
30
- self.responder = Ujsos::HtmlfResponder
31
31
  helper_method :ujsos_attrs
32
+ layout lambda { |c| htmlf_request? ? false : 'application' }
32
33
  end
33
34
 
34
35
  protected
35
36
 
37
+ def htmlf_request?
38
+ request.format && request.format.htmlf?
39
+ end
40
+
36
41
  def ujsos_attrs(attrs)
37
42
  Ujsos::DomUpdater.attributes_for_dom_update(attrs)
38
43
  end
data/lib/ujsos/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ujsos
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/ujsos.rb CHANGED
@@ -1,3 +1,2 @@
1
- require 'ujsos/htmlf_responder.rb'
2
1
  require 'ujsos/dom_updater.rb'
3
2
  require 'ujsos/rails_engine.rb'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ujsos
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christian Seiler
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-30 00:00:00 +02:00
19
- default_executable:
18
+ date: 2011-09-11 00:00:00 Z
20
19
  dependencies: []
21
20
 
22
21
  description: I need to comeup with a description
@@ -35,11 +34,9 @@ files:
35
34
  - lib/assets/javascripts/jquery_ujsos.js
36
35
  - lib/ujsos.rb
37
36
  - lib/ujsos/dom_updater.rb
38
- - lib/ujsos/htmlf_responder.rb
39
37
  - lib/ujsos/rails_engine.rb
40
38
  - lib/ujsos/version.rb
41
39
  - ujsos.gemspec
42
- has_rdoc: true
43
40
  homepage: http://rubygems.org/gems/ujsos
44
41
  licenses: []
45
42
 
@@ -69,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
66
  requirements: []
70
67
 
71
68
  rubyforge_project: ujsos
72
- rubygems_version: 1.3.7
69
+ rubygems_version: 1.8.6
73
70
  signing_key:
74
71
  specification_version: 3
75
72
  summary: Unobtrusive Javascript on Steroids
@@ -1,23 +0,0 @@
1
- module Ujsos
2
- class HtmlfResponder < ::ActionController::Responder
3
- def to_htmlf
4
- render :partial => controller.action_name
5
- rescue ActionView::MissingTemplate => e
6
- htmlf_navigation_behavior(e)
7
- end
8
-
9
- protected
10
-
11
- # This is the common behavior for "navigation" requests, like :html, :iphone and so forth.
12
- def htmlf_navigation_behavior(error)
13
- if get?
14
- raise error
15
- elsif has_errors? && default_action
16
- render :partial => default_action.to_s, :status => :unprocessable_entity
17
- else
18
- render :partial => 'show'
19
- end
20
- end
21
- end
22
-
23
- end