casey_jones 0.0.116 → 0.0.117

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,36 +1,59 @@
1
1
  module AjaxLoading
2
- module ActionControllerExtensions
2
+ module ControllerClassMethods
3
3
  def ajax_loading
4
4
  class_eval do
5
- def container
6
- @container ||= (params[:container] || "main_container")
7
- end
8
- def ajax_function
9
- @ajax_function ||= (params[:ajax_function] || choose_ajax_function)
10
- end
11
- def choose_ajax_function
12
- case params[:action]
13
- when :destroy
14
- "remove"
15
- when :create
16
- "append"
17
- when :new
18
- "append"
19
- when :edit
20
- "html"
21
- when :show
22
- "html"
23
- when :index
24
- "html"
25
- when :update
26
- "html"
27
- end
28
- end
29
- helper_method :container
5
+ include AjaxLoading::ActionControllerExtensions
6
+ helper_method :container, :ajax_function
7
+ end
8
+ end
9
+ end
10
+ module ActionControllerExtensions
11
+ def container
12
+ @container ||= (params[:container] || choose_container)
13
+ end
14
+ def ajax_function
15
+ @ajax_function ||= (params[:ajax_function] || choose_ajax_function)
16
+ end
17
+
18
+ def choose_container
19
+ case params[:action].to_sym
20
+ when :destroy
21
+ resource.element_id
22
+ when :create
23
+ "main_container"
24
+ when :new
25
+ "main_container"
26
+ when :edit
27
+ resource.element_id
28
+ when :index
29
+ "main_container"
30
+ when :show
31
+ "main_container"
32
+ when :update
33
+ resource.element_id
34
+ end
35
+ end
36
+
37
+ def choose_ajax_function
38
+ case params[:action].to_sym
39
+ when :destroy
40
+ "remove"
41
+ when :create
42
+ "append"
43
+ when :new
44
+ "append"
45
+ when :edit
46
+ "html"
47
+ when :show
48
+ "html"
49
+ when :index
50
+ "html"
51
+ when :update
52
+ "html"
30
53
  end
31
54
  end
32
55
  end
33
56
  end
34
57
 
35
- ActionController::Base.extend AjaxLoading::ActionControllerExtensions
58
+ ActionController::Base.extend AjaxLoading::ControllerClassMethods
36
59
 
@@ -0,0 +1,6 @@
1
+ module CaseyJonesEngine
2
+ class Engine < Rails::Engine
3
+ engine_name :casey_jones_engine
4
+ end
5
+ end
6
+
data/lib/casey_jones.rb CHANGED
@@ -3,6 +3,7 @@ require 'casey_jones/application_helper_methods'
3
3
  require 'casey_jones/string_reader'
4
4
  require 'ajax_loading/ajax_loading'
5
5
  require 'acts_as_linkable/acts_as_linkable'
6
+ require 'casey_jones/casey_jones_engine'
6
7
  ActiveRecord::Base.extend(CaseyJones::ActiveRecord)
7
8
  ActionView::Base.send :include, CaseyJones::ApplicationHelperMethods
8
9
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casey_jones
3
3
  version: !ruby/object:Gem::Version
4
- hash: 247
4
+ hash: 245
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 116
10
- version: 0.0.116
9
+ - 117
10
+ version: 0.0.117
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Gannon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-16 00:00:00 -07:00
18
+ date: 2010-08-17 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -42,6 +42,7 @@ files:
42
42
  - lib/casey_jones.rb
43
43
  - lib/casey_jones/active_record_extensions.rb
44
44
  - lib/casey_jones/application_helper_methods.rb
45
+ - lib/casey_jones/casey_jones_engine.rb
45
46
  - lib/casey_jones/string_reader.rb
46
47
  - lib/generators/anaf_habtm/anaf_habtm_generator.rb
47
48
  - lib/generators/anaf_habtm/assets/nested_attributes.css