view_models 1.5.7 → 2.0.0.ruby19
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/init.rb +1 -0
- data/lib/padrino/README.textile +3 -0
- data/lib/padrino/init.rb +10 -0
- data/lib/padrino/lib/helpers/collection.rb +27 -0
- data/lib/padrino/lib/padrino/view_models.rb +19 -0
- data/lib/padrino/lib/view_models/base.rb +65 -0
- data/lib/rails2/README.textile +3 -0
- data/{TODO.textile → lib/rails2/TODO.textile} +0 -0
- data/{generators → lib/rails2/generators}/view_models/USAGE +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/README +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/spec/view_model_spec.rb +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/view_models/view_model.rb +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/views/_empty.html.haml +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_collection.html.erb +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_collection.html.haml +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_collection.text.erb +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_list.html.erb +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_list.text.erb +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_pagination.html.haml +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_pagination.text.erb +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_table.html.haml +0 -0
- data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_table.text.erb +0 -0
- data/{generators → lib/rails2/generators}/view_models/view_models_generator.rb +0 -0
- data/lib/rails2/init.rb +18 -0
- data/lib/{experimental → rails2/lib/experimental}/modules_in_render_hierarchy.rb +0 -0
- data/lib/{extensions → rails2/lib/extensions}/view.rb +0 -0
- data/lib/rails2/lib/helpers/collection.rb +27 -0
- data/lib/{helpers → rails2/lib/helpers}/view.rb +0 -0
- data/lib/rails2/lib/view_models.rb +1 -0
- data/lib/rails2/lib/view_models/base.rb +99 -0
- data/lib/{view_models → rails2/lib/view_models}/view.rb +5 -1
- data/lib/shared/README.textile +3 -0
- data/lib/shared/init.rb +11 -0
- data/lib/shared/lib/view_models.rb +4 -0
- data/lib/{view_models → shared/lib/view_models}/base.rb +46 -91
- data/lib/{view_models/controller_extractor.rb → shared/lib/view_models/context_extractor.rb} +4 -2
- data/lib/{extensions → shared/lib/view_models/extensions}/active_record.rb +2 -0
- data/lib/{extensions → shared/lib/view_models/extensions}/model_reader.rb +1 -1
- data/lib/{helpers → shared/lib/view_models/helpers}/collection.rb +1 -13
- data/lib/{helpers/rails.rb → shared/lib/view_models/helpers/mapping.rb} +5 -1
- data/lib/{view_models → shared/lib/view_models}/path_store.rb +0 -0
- data/lib/{view_models → shared/lib/view_models}/render_options.rb +4 -0
- data/lib/view_models.rb +5 -3
- metadata +60 -109
- data/CHANGELOG +0 -26
- data/MIT-LICENSE +0 -20
- data/README.textile +0 -40
- data/Rakefile +0 -49
- data/VERSION.yml +0 -4
- data/generators/view_models/templates/views/view_models/collection/_list.html.haml +0 -7
- data/lib/experimental/README.textile +0 -32
- data/rails/init.rb +0 -18
- data/spec/integration/integration_spec.rb +0 -281
- data/spec/integration/models/sub_subclass.rb +0 -14
- data/spec/integration/models/subclass.rb +0 -3
- data/spec/integration/view_models/module_for_rendering.rb +0 -7
- data/spec/integration/view_models/project.rb +0 -14
- data/spec/integration/view_models/sub_subclass.rb +0 -42
- data/spec/integration/view_models/subclass.rb +0 -1
- data/spec/integration/views/view_models/collection/_collection.html.erb +0 -1
- data/spec/integration/views/view_models/collection/_collection.text.erb +0 -6
- data/spec/integration/views/view_models/collection/_list.html.erb +0 -1
- data/spec/integration/views/view_models/collection/_list.text.erb +0 -6
- data/spec/integration/views/view_models/module_for_rendering/_not_found_in_sub_subclass_but_in_module.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_capture_in_template.erb +0 -2
- data/spec/integration/views/view_models/sub_subclass/_capture_in_view_model.erb +0 -3
- data/spec/integration/views/view_models/sub_subclass/_collection_example.html.erb +0 -3
- data/spec/integration/views/view_models/sub_subclass/_collection_example.text.erb +0 -3
- data/spec/integration/views/view_models/sub_subclass/_collection_item.html.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_collection_item.text.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_exists.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_exists.html.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_exists.text.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_exists_in_both.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_inner.also_explicit.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_inner.nesting.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_list_example.html.erb +0 -3
- data/spec/integration/views/view_models/sub_subclass/_list_example.text.erb +0 -3
- data/spec/integration/views/view_models/sub_subclass/_list_item.html.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_list_item.text.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_outer.explicit.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_outer.nesting.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/_part_that_is_dependent_on_the_view_model.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/show.html.erb +0 -1
- data/spec/integration/views/view_models/sub_subclass/show.text.erb +0 -1
- data/spec/integration/views/view_models/subclass/_exists_in_both.erb +0 -1
- data/spec/integration/views/view_models/subclass/_no_sub_subclass.erb +0 -1
- data/spec/integration/views/view_models/subclass/_not_found_in_sub_subclass.erb +0 -1
- data/spec/lib/extensions/active_record_spec.rb +0 -31
- data/spec/lib/extensions/model_reader_spec.rb +0 -93
- data/spec/lib/helpers/collection_spec.rb +0 -196
- data/spec/lib/helpers/rails_spec.rb +0 -84
- data/spec/lib/helpers/view_spec.rb +0 -20
- data/spec/lib/view_models/base_spec.rb +0 -102
- data/spec/lib/view_models/view_spec.rb +0 -9
- data/spec/spec_helper.rb +0 -14
- data/spec/spec_helper_extensions.rb +0 -13
data/lib/{view_models/controller_extractor.rb → shared/lib/view_models/context_extractor.rb}
RENAMED
@@ -4,7 +4,9 @@ module ViewModels
|
|
4
4
|
|
5
5
|
# Extracts controllers for a living from unsuspecting views.
|
6
6
|
#
|
7
|
-
|
7
|
+
# Note: This is actually only needed in Rails. In Padrino, the context is always the app.
|
8
|
+
#
|
9
|
+
class ContextExtractor
|
8
10
|
|
9
11
|
attr_reader :context
|
10
12
|
|
@@ -16,7 +18,7 @@ module ViewModels
|
|
16
18
|
#
|
17
19
|
def extract
|
18
20
|
context = self.context
|
19
|
-
context.respond_to?(:controller) ? context.controller : context
|
21
|
+
context.respond_to?(:controller) ? context.send(:controller) : context
|
20
22
|
end
|
21
23
|
|
22
24
|
end
|
@@ -88,7 +88,7 @@ module ViewModels
|
|
88
88
|
# Combines left parentheses and filters.
|
89
89
|
#
|
90
90
|
def filtered_left_parentheses
|
91
|
-
filters.zip(left_parentheses).
|
91
|
+
filters.zip(left_parentheses).join
|
92
92
|
end
|
93
93
|
|
94
94
|
# Generates the needed amount of parentheses to match the left parentheses.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module ViewModels
|
2
2
|
module Helpers
|
3
|
-
module
|
3
|
+
module Mapping
|
4
4
|
|
5
5
|
# Construct a view_model for a collection.
|
6
6
|
#
|
@@ -103,18 +103,6 @@ module ViewModels
|
|
103
103
|
|
104
104
|
render_partial :pagination, default_options.merge(options)
|
105
105
|
end
|
106
|
-
|
107
|
-
private
|
108
|
-
|
109
|
-
# Helper method that renders a partial in the context of the context instance.
|
110
|
-
#
|
111
|
-
# Example:
|
112
|
-
# If the collection view_model helper has been instantiated in the context
|
113
|
-
# of a controller, render will be called in the controller.
|
114
|
-
#
|
115
|
-
def render_partial name, locals
|
116
|
-
@context.instance_eval { render :partial => "view_models/collection/#{name}", :locals => locals }
|
117
|
-
end
|
118
106
|
end
|
119
107
|
|
120
108
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module ViewModels
|
2
2
|
module Helpers
|
3
|
-
module
|
3
|
+
module Mapping
|
4
4
|
|
5
5
|
mattr_accessor :specific_view_model_mapping
|
6
6
|
self.specific_view_model_mapping = {}
|
@@ -10,7 +10,11 @@ module ViewModels
|
|
10
10
|
#
|
11
11
|
# Note: Will emit an ArgumentError if the view model class doesn't support 2 arguments.
|
12
12
|
#
|
13
|
+
# Padrino: context is an app instance.
|
14
|
+
# Rails 2: context is either a view instance or a controller instance.
|
15
|
+
#
|
13
16
|
def view_model_for model, context = self
|
17
|
+
# p [:view_model_for, view_model_class_for(model)]
|
14
18
|
view_model_class_for(model).new model, context
|
15
19
|
end
|
16
20
|
|
File without changes
|
@@ -2,6 +2,8 @@ module ViewModels
|
|
2
2
|
|
3
3
|
# Container object for render options.
|
4
4
|
#
|
5
|
+
# TODO Make a rails exclusive.
|
6
|
+
#
|
5
7
|
module RenderOptions
|
6
8
|
|
7
9
|
# Base class for Partial and Template.
|
@@ -39,6 +41,8 @@ module ViewModels
|
|
39
41
|
@options.reverse_merge :file => file
|
40
42
|
end
|
41
43
|
|
44
|
+
# TODO Rails specific.
|
45
|
+
#
|
42
46
|
def format! view
|
43
47
|
view.template_format = @format if @format
|
44
48
|
end
|
data/lib/view_models.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: true
|
5
5
|
segments:
|
6
|
-
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
|
6
|
+
- 2
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- ruby19
|
10
|
+
version: 2.0.0.ruby19
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Florian Hanke
|
@@ -17,13 +18,14 @@ autorequire:
|
|
17
18
|
bindir: bin
|
18
19
|
cert_chain: []
|
19
20
|
|
20
|
-
date: 2010-
|
21
|
+
date: 2010-07-19 00:00:00 +02:00
|
21
22
|
default_executable:
|
22
23
|
dependencies:
|
23
24
|
- !ruby/object:Gem::Dependency
|
24
|
-
name:
|
25
|
+
name: activesupport
|
25
26
|
prerelease: false
|
26
27
|
requirement: &id001 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
27
29
|
requirements:
|
28
30
|
- - ">="
|
29
31
|
- !ruby/object:Gem::Version
|
@@ -38,6 +40,7 @@ dependencies:
|
|
38
40
|
name: rspec
|
39
41
|
prerelease: false
|
40
42
|
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
41
44
|
requirements:
|
42
45
|
- - ">="
|
43
46
|
- !ruby/object:Gem::Version
|
@@ -48,97 +51,58 @@ dependencies:
|
|
48
51
|
version: 1.2.9
|
49
52
|
type: :development
|
50
53
|
version_requirements: *id002
|
51
|
-
description: "
|
54
|
+
description: "For Padrino and Rails 2 views. Adds the missing R (Representation) to Rails' MVC. Provides simple proxy functionality for your models, thus helps you keep the model and view representation separate. Define focused helper methods on the (view) model, more quickly understood and more easily testable. Also: Hierarchical rendering for your hierarchical models. So, in a nutshell: Polymorphism not just in the model, but also in the view. Have fun!"
|
52
55
|
email: florian.hanke@gmail.com
|
53
56
|
executables: []
|
54
57
|
|
55
58
|
extensions: []
|
56
59
|
|
57
|
-
extra_rdoc_files:
|
58
|
-
|
60
|
+
extra_rdoc_files: []
|
61
|
+
|
59
62
|
files:
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
- generators/view_models/templates/
|
69
|
-
- generators/view_models/templates/
|
70
|
-
- generators/view_models/templates/
|
71
|
-
- generators/view_models/templates/views/
|
72
|
-
- generators/view_models/templates/views/view_models/collection/_collection.html.
|
73
|
-
- generators/view_models/templates/views/view_models/collection/_collection.
|
74
|
-
- generators/view_models/templates/views/view_models/collection/
|
75
|
-
- generators/view_models/templates/views/view_models/collection/_list.html.
|
76
|
-
- generators/view_models/templates/views/view_models/collection/_list.text.erb
|
77
|
-
- generators/view_models/templates/views/view_models/collection/_pagination.html.haml
|
78
|
-
- generators/view_models/templates/views/view_models/collection/_pagination.text.erb
|
79
|
-
- generators/view_models/templates/views/view_models/collection/_table.html.haml
|
80
|
-
- generators/view_models/templates/views/view_models/collection/_table.text.erb
|
81
|
-
- generators/view_models/
|
82
|
-
- lib/
|
83
|
-
- lib/
|
84
|
-
- lib/
|
85
|
-
- lib/extensions/
|
86
|
-
- lib/
|
87
|
-
- lib/helpers/
|
88
|
-
- lib/
|
89
|
-
- lib/
|
63
|
+
- lib/init.rb
|
64
|
+
- lib/padrino/README.textile
|
65
|
+
- lib/padrino/init.rb
|
66
|
+
- lib/padrino/lib/helpers/collection.rb
|
67
|
+
- lib/padrino/lib/padrino/view_models.rb
|
68
|
+
- lib/padrino/lib/view_models/base.rb
|
69
|
+
- lib/rails2/README.textile
|
70
|
+
- lib/rails2/TODO.textile
|
71
|
+
- lib/rails2/generators/view_models/templates/README
|
72
|
+
- lib/rails2/generators/view_models/templates/spec/view_model_spec.rb
|
73
|
+
- lib/rails2/generators/view_models/templates/view_models/view_model.rb
|
74
|
+
- lib/rails2/generators/view_models/templates/views/_empty.html.haml
|
75
|
+
- lib/rails2/generators/view_models/templates/views/view_models/collection/_collection.html.erb
|
76
|
+
- lib/rails2/generators/view_models/templates/views/view_models/collection/_collection.html.haml
|
77
|
+
- lib/rails2/generators/view_models/templates/views/view_models/collection/_collection.text.erb
|
78
|
+
- lib/rails2/generators/view_models/templates/views/view_models/collection/_list.html.erb
|
79
|
+
- lib/rails2/generators/view_models/templates/views/view_models/collection/_list.text.erb
|
80
|
+
- lib/rails2/generators/view_models/templates/views/view_models/collection/_pagination.html.haml
|
81
|
+
- lib/rails2/generators/view_models/templates/views/view_models/collection/_pagination.text.erb
|
82
|
+
- lib/rails2/generators/view_models/templates/views/view_models/collection/_table.html.haml
|
83
|
+
- lib/rails2/generators/view_models/templates/views/view_models/collection/_table.text.erb
|
84
|
+
- lib/rails2/generators/view_models/USAGE
|
85
|
+
- lib/rails2/generators/view_models/view_models_generator.rb
|
86
|
+
- lib/rails2/init.rb
|
87
|
+
- lib/rails2/lib/experimental/modules_in_render_hierarchy.rb
|
88
|
+
- lib/rails2/lib/extensions/view.rb
|
89
|
+
- lib/rails2/lib/helpers/collection.rb
|
90
|
+
- lib/rails2/lib/helpers/view.rb
|
91
|
+
- lib/rails2/lib/view_models/base.rb
|
92
|
+
- lib/rails2/lib/view_models/view.rb
|
93
|
+
- lib/rails2/lib/view_models.rb
|
94
|
+
- lib/shared/README.textile
|
95
|
+
- lib/shared/init.rb
|
96
|
+
- lib/shared/lib/view_models/base.rb
|
97
|
+
- lib/shared/lib/view_models/context_extractor.rb
|
98
|
+
- lib/shared/lib/view_models/extensions/active_record.rb
|
99
|
+
- lib/shared/lib/view_models/extensions/model_reader.rb
|
100
|
+
- lib/shared/lib/view_models/helpers/collection.rb
|
101
|
+
- lib/shared/lib/view_models/helpers/mapping.rb
|
102
|
+
- lib/shared/lib/view_models/path_store.rb
|
103
|
+
- lib/shared/lib/view_models/render_options.rb
|
104
|
+
- lib/shared/lib/view_models.rb
|
90
105
|
- lib/view_models.rb
|
91
|
-
- lib/view_models/base.rb
|
92
|
-
- lib/view_models/controller_extractor.rb
|
93
|
-
- lib/view_models/path_store.rb
|
94
|
-
- lib/view_models/render_options.rb
|
95
|
-
- lib/view_models/view.rb
|
96
|
-
- rails/init.rb
|
97
|
-
- spec/integration/integration_spec.rb
|
98
|
-
- spec/integration/models/sub_subclass.rb
|
99
|
-
- spec/integration/models/subclass.rb
|
100
|
-
- spec/integration/view_models/module_for_rendering.rb
|
101
|
-
- spec/integration/view_models/project.rb
|
102
|
-
- spec/integration/view_models/sub_subclass.rb
|
103
|
-
- spec/integration/view_models/subclass.rb
|
104
|
-
- spec/integration/views/view_models/collection/_collection.html.erb
|
105
|
-
- spec/integration/views/view_models/collection/_collection.text.erb
|
106
|
-
- spec/integration/views/view_models/collection/_list.html.erb
|
107
|
-
- spec/integration/views/view_models/collection/_list.text.erb
|
108
|
-
- spec/integration/views/view_models/module_for_rendering/_not_found_in_sub_subclass_but_in_module.erb
|
109
|
-
- spec/integration/views/view_models/sub_subclass/_capture_in_template.erb
|
110
|
-
- spec/integration/views/view_models/sub_subclass/_capture_in_view_model.erb
|
111
|
-
- spec/integration/views/view_models/sub_subclass/_collection_example.html.erb
|
112
|
-
- spec/integration/views/view_models/sub_subclass/_collection_example.text.erb
|
113
|
-
- spec/integration/views/view_models/sub_subclass/_collection_item.html.erb
|
114
|
-
- spec/integration/views/view_models/sub_subclass/_collection_item.text.erb
|
115
|
-
- spec/integration/views/view_models/sub_subclass/_exists.erb
|
116
|
-
- spec/integration/views/view_models/sub_subclass/_exists.html.erb
|
117
|
-
- spec/integration/views/view_models/sub_subclass/_exists.text.erb
|
118
|
-
- spec/integration/views/view_models/sub_subclass/_exists_in_both.erb
|
119
|
-
- spec/integration/views/view_models/sub_subclass/_inner.also_explicit.erb
|
120
|
-
- spec/integration/views/view_models/sub_subclass/_inner.nesting.erb
|
121
|
-
- spec/integration/views/view_models/sub_subclass/_list_example.html.erb
|
122
|
-
- spec/integration/views/view_models/sub_subclass/_list_example.text.erb
|
123
|
-
- spec/integration/views/view_models/sub_subclass/_list_item.html.erb
|
124
|
-
- spec/integration/views/view_models/sub_subclass/_list_item.text.erb
|
125
|
-
- spec/integration/views/view_models/sub_subclass/_outer.explicit.erb
|
126
|
-
- spec/integration/views/view_models/sub_subclass/_outer.nesting.erb
|
127
|
-
- spec/integration/views/view_models/sub_subclass/_part_that_is_dependent_on_the_view_model.erb
|
128
|
-
- spec/integration/views/view_models/sub_subclass/show.html.erb
|
129
|
-
- spec/integration/views/view_models/sub_subclass/show.text.erb
|
130
|
-
- spec/integration/views/view_models/subclass/_exists_in_both.erb
|
131
|
-
- spec/integration/views/view_models/subclass/_no_sub_subclass.erb
|
132
|
-
- spec/integration/views/view_models/subclass/_not_found_in_sub_subclass.erb
|
133
|
-
- spec/lib/extensions/active_record_spec.rb
|
134
|
-
- spec/lib/extensions/model_reader_spec.rb
|
135
|
-
- spec/lib/helpers/collection_spec.rb
|
136
|
-
- spec/lib/helpers/rails_spec.rb
|
137
|
-
- spec/lib/helpers/view_spec.rb
|
138
|
-
- spec/lib/view_models/base_spec.rb
|
139
|
-
- spec/lib/view_models/view_spec.rb
|
140
|
-
- spec/spec_helper.rb
|
141
|
-
- spec/spec_helper_extensions.rb
|
142
106
|
has_rdoc: true
|
143
107
|
homepage: http://floere.github.com/view_models
|
144
108
|
licenses: []
|
@@ -150,6 +114,7 @@ rdoc_options:
|
|
150
114
|
require_paths:
|
151
115
|
- lib
|
152
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
153
118
|
requirements:
|
154
119
|
- - ">="
|
155
120
|
- !ruby/object:Gem::Version
|
@@ -157,6 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
122
|
- 0
|
158
123
|
version: "0"
|
159
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
160
126
|
requirements:
|
161
127
|
- - ">="
|
162
128
|
- !ruby/object:Gem::Version
|
@@ -166,24 +132,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
132
|
requirements: []
|
167
133
|
|
168
134
|
rubyforge_project:
|
169
|
-
rubygems_version: 1.3.
|
135
|
+
rubygems_version: 1.3.7
|
170
136
|
signing_key:
|
171
137
|
specification_version: 3
|
172
138
|
summary: A model proxy for Rails views. Helps you keep the representation of a model and the model itself separate.
|
173
|
-
test_files:
|
174
|
-
|
175
|
-
- spec/integration/models/sub_subclass.rb
|
176
|
-
- spec/integration/models/subclass.rb
|
177
|
-
- spec/integration/view_models/module_for_rendering.rb
|
178
|
-
- spec/integration/view_models/project.rb
|
179
|
-
- spec/integration/view_models/sub_subclass.rb
|
180
|
-
- spec/integration/view_models/subclass.rb
|
181
|
-
- spec/lib/extensions/active_record_spec.rb
|
182
|
-
- spec/lib/extensions/model_reader_spec.rb
|
183
|
-
- spec/lib/helpers/collection_spec.rb
|
184
|
-
- spec/lib/helpers/rails_spec.rb
|
185
|
-
- spec/lib/helpers/view_spec.rb
|
186
|
-
- spec/lib/view_models/base_spec.rb
|
187
|
-
- spec/lib/view_models/view_spec.rb
|
188
|
-
- spec/spec_helper.rb
|
189
|
-
- spec/spec_helper_extensions.rb
|
139
|
+
test_files: []
|
140
|
+
|
data/CHANGELOG
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
1.5.2 - 25.02.10 - floere: The capture method - if included per Capturehelper - works now in view models.
|
2
|
-
1.5.1 - 22.02.10 - floere: Renamed ViewModels::Helper to ViewModels::Helpers.
|
3
|
-
1.5.0 - 20.02.10 - floere: format propagates through collection rendering
|
4
|
-
render_as, new sig: :partial => to explicitly define the partial. (Syntactic Discouragement)
|
5
|
-
Added: render_with, an alias of render_as.
|
6
|
-
Added: render_template, to render non-partials.
|
7
|
-
1.4.2 - 10.02.10 - floere: render_as does not check the deprecated API anymore. Use the new options
|
8
|
-
form to pass a format.
|
9
|
-
- floere: MissingViewModelError is not thrown anymore.
|
10
|
-
- floere: include ViewModels::Extensions::ActiveRecord in your Project view model to
|
11
|
-
give id, dom_id, to_param capabilities to your view_models. Or include in a
|
12
|
-
subclass.
|
13
|
-
1.4.0 - 08.02.10 - floere: Changed Api of ViewModels::Base#render_as to go up through the view model
|
14
|
-
class hierarchy to find a partial.
|
15
|
-
1.3.0 - 29.01.10 - andi: Changed Api of ViewModels::Base#render_as to take an options hash. Now supports
|
16
|
-
passing locals to the render call.
|
17
|
-
1.2.0 - 13.01.10 - floere: Simple generator written.
|
18
|
-
1.1.0 - 30.06.09 - floere: Rewrite: Representer => ViewModel.
|
19
|
-
1.0.2 - 08.08.08 - floere: Renamed Representers::Helper::Rails to Representers::Helper::Rails.
|
20
|
-
- floere: Added Representers::Helpers::View for conveniently integrating common view-helpers.
|
21
|
-
- floere: Added controller_methods for RequestForgeryProtection in ViewModels::Base.
|
22
|
-
- floere: Added methods for id and dom_id in Representers::ActiveRecord.
|
23
|
-
- floere: Included ActionController::Helpers in Representers::Base and removed own helper-method.
|
24
|
-
- floere: Changed visibility of method view_instance in Representers::Base from private to protected.
|
25
|
-
1.0.1 - 24.07.08 - floere: Rewrite: Presenter => Representer.
|
26
|
-
1.0.0 - May 2008 - floere: Initial commit.
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2007 Florian Hanke & Kaspar Schiess
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
h1. ViewModels
|
2
|
-
|
3
|
-
A view model/representer solution for Rails.
|
4
|
-
|
5
|
-
h2. Features
|
6
|
-
|
7
|
-
* Polymorph view model objects that correspond to model objects.
|
8
|
-
* View model specific templates.
|
9
|
-
* Hierarchical Template Rendering: Allows generalized templates for a class tree of view models.
|
10
|
-
* Helper methods directly on the view models.
|
11
|
-
* No view related code in the models.
|
12
|
-
* A clean API for use in Rails.
|
13
|
-
* 100% rcov coverage, nice metrics, gallons of blood and sweat by excellent contributors.
|
14
|
-
|
15
|
-
h2. Installation
|
16
|
-
|
17
|
-
h3. Rails Plugin
|
18
|
-
|
19
|
-
@script/plugin install git://github.com/floere/view_models.git@
|
20
|
-
|
21
|
-
h3. Gem (for use in Rails)
|
22
|
-
|
23
|
-
@gem install view_models@
|
24
|
-
|
25
|
-
and then adding the line
|
26
|
-
|
27
|
-
@config.gem 'view_models'@
|
28
|
-
|
29
|
-
in your environment.rb.
|
30
|
-
|
31
|
-
h2. Links Galore!
|
32
|
-
|
33
|
-
"Usage, Examples, In-depth Infos [Wiki]":http://wiki.github.com/floere/view_models/
|
34
|
-
"Reference [RDoc]":http://rdoc.info/projects/floere/view_models
|
35
|
-
"Gem [RubyGems.org]":http://rubygems.org/gems/view_models
|
36
|
-
"Mailing List":http://groups.google.com/group/view_models/topics
|
37
|
-
"Bug Tracker":http://github.com/floere/view_models/issues
|
38
|
-
"Metrics":http://getcaliper.com/caliper/project?repo=git://github.com/floere/view_models.git
|
39
|
-
"Source [Github]":http://github.com/floere/view_models
|
40
|
-
"Homepage":http://floere.github.com/view_models/
|
data/Rakefile
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
def require_if task, name
|
2
|
-
require name if ARGV[0] =~ %r{^#{task}}
|
3
|
-
end
|
4
|
-
|
5
|
-
require 'rake'
|
6
|
-
require 'rake/testtask'
|
7
|
-
require 'rake/rdoctask'
|
8
|
-
|
9
|
-
require 'spec/rake/spectask'
|
10
|
-
require 'spec/rake/verify_rcov'
|
11
|
-
|
12
|
-
require_if :metrics, 'metric_fu'
|
13
|
-
|
14
|
-
task :default => :spec
|
15
|
-
|
16
|
-
# run with rake spec
|
17
|
-
Spec::Rake::SpecTask.new(:spec) do |t|
|
18
|
-
t.spec_opts = %w{--colour --format progress --loadby mtime --reverse}
|
19
|
-
t.spec_files = Dir.glob('spec/**/*_spec.rb')
|
20
|
-
t.warning = false
|
21
|
-
end
|
22
|
-
|
23
|
-
# run with rake rcov
|
24
|
-
Spec::Rake::SpecTask.new(:rcov) do |t|
|
25
|
-
t.spec_opts = %w{--colour --format progress --loadby mtime --reverse}
|
26
|
-
t.spec_files = Dir.glob('spec/**/*_spec.rb')
|
27
|
-
t.warning = false
|
28
|
-
t.rcov = true
|
29
|
-
puts "Open coverage/index.html for the rcov results."
|
30
|
-
end
|
31
|
-
|
32
|
-
begin
|
33
|
-
require 'jeweler'
|
34
|
-
Jeweler::Tasks.new do |gemspec|
|
35
|
-
gemspec.name = "view_models"
|
36
|
-
gemspec.summary = "A model proxy for Rails views. Helps you keep the representation of a model and the model itself separate."
|
37
|
-
gemspec.email = "florian.hanke@gmail.com"
|
38
|
-
gemspec.homepage = "http://floere.github.com/view_models"
|
39
|
-
gemspec.description = "The view models gem adds the missing R (Representation) to Rails' MVC. It provides simple proxy functionality for your models and thus helps you keep the model and view representations of a model separate, as it should be. Also, you can define helper methods on the (view) model instead of globally to keep them focused, more quickly understood and more easily testable. View Models also introduce hierarchical rendering for your hierarchical models. If the account view is not defined for the subclass FemaleUser, it checks if it is defined for User, for example, to see when there is no specific view, if there is a general view. So, in other words: Polymorphism not just in the model, but also in the view. Have fun!"
|
40
|
-
gemspec.authors = ["Florian Hanke", "Kaspar Schiess", "Niko Dittmann", "Andreas Schacke"]
|
41
|
-
gemspec.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
42
|
-
gemspec.files = FileList["[A-Z]*", "{generators,lib,rails,spec}/**/*"]
|
43
|
-
gemspec.add_dependency 'rails', '>= 2.2.0'
|
44
|
-
gemspec.add_development_dependency 'rspec', '>=1.2.9'
|
45
|
-
end
|
46
|
-
Jeweler::GemcutterTasks.new
|
47
|
-
rescue LoadError => e
|
48
|
-
puts "Jeweler not available (#{e}). Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
49
|
-
end
|