resourcelogic 0.0.12 → 0.9.0
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/{LICENSE → MIT-LICENSE} +0 -0
- data/Manifest.txt +21 -0
- data/README.rdoc +41 -73
- data/Rakefile +18 -47
- data/lib/resourcelogic.rb +1 -3
- data/lib/resourcelogic/accessors.rb +1 -1
- data/lib/resourcelogic/actions.rb +52 -19
- data/lib/resourcelogic/base.rb +3 -33
- data/lib/resourcelogic/child.rb +73 -33
- data/lib/resourcelogic/context.rb +61 -24
- data/lib/resourcelogic/parent.rb +100 -68
- data/lib/resourcelogic/response_collector.rb +2 -7
- data/lib/resourcelogic/self.rb +123 -87
- data/lib/resourcelogic/sibling.rb +46 -4
- data/lib/resourcelogic/singleton.rb +55 -37
- data/lib/resourcelogic/urligence.rb +59 -77
- data/lib/resourcelogic/version.rb +51 -0
- metadata +23 -18
- data/.gitignore +0 -7
- data/VERSION.yml +0 -4
- data/lib/resourcelogic/aliases.rb +0 -134
- data/lib/resourcelogic/context_options.rb +0 -5
- data/lib/resourcelogic/scope.rb +0 -36
- data/lib/resourcelogic/sub_views.rb +0 -98
- data/resourcelogic.gemspec +0 -62
data/lib/resourcelogic/scope.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
module Resourcelogic
|
2
|
-
module Scope
|
3
|
-
def self.included(klass)
|
4
|
-
klass.class_eval do
|
5
|
-
add_acts_as_resource_module(Methods)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
module Methods
|
10
|
-
def self.included(klass)
|
11
|
-
klass.class_eval do
|
12
|
-
attr_accessor :scoping, :scoping_parent
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
def scope
|
18
|
-
return @scope if defined?(@scope)
|
19
|
-
|
20
|
-
if parent?
|
21
|
-
@scope = parent_object.send(parent_scope_name)
|
22
|
-
else
|
23
|
-
@scope = model
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def parent_scope
|
28
|
-
parent_model
|
29
|
-
end
|
30
|
-
|
31
|
-
def parent_scope_name
|
32
|
-
@parent_scope_name ||= model_name.to_s.pluralize
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
# Nested and Polymorphic Resource Helpers
|
2
|
-
#
|
3
|
-
module Resourcelogic
|
4
|
-
module SubViews
|
5
|
-
def self.included(klass)
|
6
|
-
klass.class_eval do
|
7
|
-
extend Config
|
8
|
-
add_acts_as_resource_module(Methods)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
module Config
|
13
|
-
def namespace_views_by_context(value = nil)
|
14
|
-
rw_config(:namespace_views_by_context, value)
|
15
|
-
end
|
16
|
-
|
17
|
-
def namespace_views_by_context?
|
18
|
-
!namespace_views_by_context.blank?
|
19
|
-
end
|
20
|
-
|
21
|
-
def namespace_views_by_route_alias(value = nil)
|
22
|
-
rw_config(:namespace_views_by_route_alias, value)
|
23
|
-
end
|
24
|
-
|
25
|
-
def namespace_views_by_route_alias?
|
26
|
-
!namespace_views_by_route_alias.blank?
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
module Methods
|
31
|
-
def self.included(klass)
|
32
|
-
klass.helper_method :namespace_views_by_route_alias, :namespace_views_by_route_alias?,
|
33
|
-
:namespace_views_by_context, :namespace_views_by_context?, :sub_template_name
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
def namespace_views_by_context?
|
38
|
-
self.class.namespace_views_by_context?
|
39
|
-
end
|
40
|
-
|
41
|
-
def namespace_views_by_context
|
42
|
-
self.class.namespace_views_by_context
|
43
|
-
end
|
44
|
-
|
45
|
-
def namespace_views_by_route_alias?
|
46
|
-
self.class.namespace_views_by_route_alias? && route_name != model_name
|
47
|
-
end
|
48
|
-
|
49
|
-
def namespace_views_by_route_alias
|
50
|
-
self.class.namespace_views_by_route_alias
|
51
|
-
end
|
52
|
-
|
53
|
-
def sub_template_name(name)
|
54
|
-
path_parts = [controller_name]
|
55
|
-
|
56
|
-
if namespace_views_by_context?
|
57
|
-
context_folder_name = namespace_views_by_context.is_a?(Hash) && namespace_views_by_context.key?(context) ?
|
58
|
-
namespace_views_by_context[context] : context
|
59
|
-
path_parts << (context_folder_name || "root")
|
60
|
-
end
|
61
|
-
|
62
|
-
if namespace_views_by_route_alias?
|
63
|
-
route_alias_folder_name = namespace_views_by_route_alias.is_a?(Hash) && namespace_views_by_route_alias.key?(route_name) ?
|
64
|
-
namespace_views_by_route_alias[route_name] : route_name
|
65
|
-
path_parts << (route_alias_folder_name).to_s.pluralize
|
66
|
-
end
|
67
|
-
|
68
|
-
path_parts << name
|
69
|
-
path_parts.join("/")
|
70
|
-
end
|
71
|
-
|
72
|
-
def default_template_name(action_name = self.action_name)
|
73
|
-
if namespace_views_by_context? || namespace_views_by_route_alias?
|
74
|
-
sub_template_name(action_name)
|
75
|
-
else
|
76
|
-
super
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
module Partials
|
82
|
-
def _pick_partial_template(partial_path)
|
83
|
-
if respond_to?(:namespace_views_by_context?) && respond_to?(:namespace_views_by_route_alias?) &&
|
84
|
-
(namespace_views_by_context? || namespace_views_by_route_alias?) && !partial_path.include?("/")
|
85
|
-
partial_path = sub_template_name(partial_path)
|
86
|
-
end
|
87
|
-
super
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
module ActionView
|
95
|
-
class Base
|
96
|
-
include Resourcelogic::SubViews::Partials
|
97
|
-
end
|
98
|
-
end
|
data/resourcelogic.gemspec
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{resourcelogic}
|
5
|
-
s.version = "0.0.12"
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Ben Johnson of Binary Logic"]
|
9
|
-
s.date = %q{2009-06-28}
|
10
|
-
s.email = %q{bjohnson@binarylogic.com}
|
11
|
-
s.extra_rdoc_files = [
|
12
|
-
"LICENSE",
|
13
|
-
"README.rdoc"
|
14
|
-
]
|
15
|
-
s.files = [
|
16
|
-
".gitignore",
|
17
|
-
"CHANGELOG.rdoc",
|
18
|
-
"LICENSE",
|
19
|
-
"README.rdoc",
|
20
|
-
"Rakefile",
|
21
|
-
"VERSION.yml",
|
22
|
-
"init.rb",
|
23
|
-
"lib/resourcelogic.rb",
|
24
|
-
"lib/resourcelogic/accessors.rb",
|
25
|
-
"lib/resourcelogic/action_options.rb",
|
26
|
-
"lib/resourcelogic/actions.rb",
|
27
|
-
"lib/resourcelogic/aliases.rb",
|
28
|
-
"lib/resourcelogic/base.rb",
|
29
|
-
"lib/resourcelogic/child.rb",
|
30
|
-
"lib/resourcelogic/context.rb",
|
31
|
-
"lib/resourcelogic/context_options.rb",
|
32
|
-
"lib/resourcelogic/failable_action_options.rb",
|
33
|
-
"lib/resourcelogic/parent.rb",
|
34
|
-
"lib/resourcelogic/response_collector.rb",
|
35
|
-
"lib/resourcelogic/scope.rb",
|
36
|
-
"lib/resourcelogic/self.rb",
|
37
|
-
"lib/resourcelogic/sibling.rb",
|
38
|
-
"lib/resourcelogic/singleton.rb",
|
39
|
-
"lib/resourcelogic/sub_views.rb",
|
40
|
-
"lib/resourcelogic/urligence.rb",
|
41
|
-
"resourcelogic.gemspec"
|
42
|
-
]
|
43
|
-
s.homepage = %q{http://github.com/binarylogic/resourcelogic}
|
44
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
45
|
-
s.require_paths = ["lib"]
|
46
|
-
s.rubyforge_project = %q{resourcelogic}
|
47
|
-
s.rubygems_version = %q{1.3.4}
|
48
|
-
s.summary = %q{Removes the need to namespace controllers by adding context and relative url functions among other things.}
|
49
|
-
|
50
|
-
if s.respond_to? :specification_version then
|
51
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
52
|
-
s.specification_version = 3
|
53
|
-
|
54
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
55
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
56
|
-
else
|
57
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
58
|
-
end
|
59
|
-
else
|
60
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
61
|
-
end
|
62
|
-
end
|