easy_admin_ui 0.5.6 → 0.5.7
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/VERSION +1 -1
- data/easy_admin_ui.gemspec +3 -3
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml +1 -1
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_new.haml +1 -1
- data/vendor/plugins/make_resourceful/lib/resourceful/builder.rb +6 -5
- data/vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb +16 -16
- data/vendor/plugins/make_resourceful/lib/resourceful/default/callbacks.rb +4 -4
- data/vendor/plugins/make_resourceful/lib/resourceful/maker.rb +10 -5
- data/vendor/plugins/make_resourceful/spec/accessors_spec.rb +2 -2
- data/vendor/plugins/make_resourceful/spec/builder_spec.rb +1 -1
- data/vendor/plugins/make_resourceful/spec/maker_spec.rb +5 -5
- data/vendor/plugins/make_resourceful/spec/spec_helper.rb +3 -3
- metadata +34 -62
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.7
|
data/easy_admin_ui.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "easy_admin_ui"
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Martin Moen Wulffeld"]
|
12
|
-
s.date = "2011-
|
12
|
+
s.date = "2011-12-30"
|
13
13
|
s.description = "Very simple DRY admin UI."
|
14
14
|
s.email = "martin@wulffeld.org"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -98,7 +98,7 @@ Gem::Specification.new do |s|
|
|
98
98
|
]
|
99
99
|
s.homepage = "http://github.com/wulffeld/easy_admin_ui"
|
100
100
|
s.require_paths = ["lib"]
|
101
|
-
s.rubygems_version = "1.8.
|
101
|
+
s.rubygems_version = "1.8.11"
|
102
102
|
s.summary = "Easy Admin UI."
|
103
103
|
|
104
104
|
if s.respond_to? :specification_version then
|
data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
= error_messages_for :<%= singular_name %>
|
4
4
|
|
5
|
-
|
5
|
+
= form_for(:<%= singular_name %>, :url => object_url, :html => { :method => :put }) do |f|
|
6
6
|
= render :partial => "form", :locals => {:f => f}
|
7
7
|
%p= submit_tag "Update"
|
8
8
|
|
@@ -20,7 +20,7 @@ module Resourceful
|
|
20
20
|
# additions to the controller.
|
21
21
|
def initialize(kontroller)
|
22
22
|
@controller = kontroller
|
23
|
-
@inherited = !kontroller.
|
23
|
+
@inherited = !kontroller.resourceful_responses.blank?
|
24
24
|
@action_module = Resourceful::Default::Actions.dup
|
25
25
|
@ok_actions = []
|
26
26
|
@callbacks = {:before => {}, :after => {}}
|
@@ -40,6 +40,7 @@ module Resourceful
|
|
40
40
|
apply_publish
|
41
41
|
|
42
42
|
kontroller = @controller
|
43
|
+
|
43
44
|
Resourceful::ACTIONS.each do |action_named|
|
44
45
|
# See if this is a method listed by #actions
|
45
46
|
unless @ok_actions.include? action_named
|
@@ -52,11 +53,11 @@ module Resourceful
|
|
52
53
|
kontroller.hidden_actions.reject! &@ok_actions.method(:include?)
|
53
54
|
kontroller.send :include, @action_module
|
54
55
|
|
55
|
-
kontroller.
|
56
|
-
kontroller.
|
57
|
-
kontroller.
|
56
|
+
kontroller.resourceful_callbacks.merge! @callbacks
|
57
|
+
kontroller.resourceful_responses.merge! @responses
|
58
|
+
kontroller.made_resourceful = true
|
58
59
|
|
59
|
-
kontroller.
|
60
|
+
kontroller.parents = @parents
|
60
61
|
kontroller.before_filter :load_object, :only => (@ok_actions & SINGULAR_PRELOADED_ACTIONS) + @custom_member_actions
|
61
62
|
kontroller.before_filter :load_objects, :only => (@ok_actions & PLURAL_ACTIONS) + @custom_collection_actions
|
62
63
|
kontroller.before_filter :load_parent_object, :only => @ok_actions + @custom_member_actions + @custom_collection_actions
|
@@ -17,7 +17,7 @@ module Resourceful
|
|
17
17
|
# and are called by the default make_resourceful actions[link:classes/Resourceful/Default/Actions.html].
|
18
18
|
# This means that overriding one method
|
19
19
|
# can affect everything else.
|
20
|
-
#
|
20
|
+
#
|
21
21
|
# This can be dangerous, but it can also be very powerful.
|
22
22
|
# make_resourceful is designed to take advantage of overriding,
|
23
23
|
# so as long as the new methods accomplish the same purpose as the old ones,
|
@@ -60,7 +60,7 @@ module Resourceful
|
|
60
60
|
#
|
61
61
|
# This is called automatically by the default make_resourceful actions.
|
62
62
|
# You shouldn't need to use it directly unless you're creating a new action.
|
63
|
-
#
|
63
|
+
#
|
64
64
|
# For example, in UsersController,
|
65
65
|
# calling +load_objects+ sets <tt>@users = current_objects</tt>.
|
66
66
|
def load_objects
|
@@ -99,7 +99,7 @@ module Resourceful
|
|
99
99
|
#
|
100
100
|
# This is called automatically by the default make_resourceful actions.
|
101
101
|
# You shouldn't need to use it directly unless you're creating a new action.
|
102
|
-
#
|
102
|
+
#
|
103
103
|
# For example, in UsersController,
|
104
104
|
# calling +load_object+ sets <tt>@user = current_object</tt>.
|
105
105
|
def load_object
|
@@ -120,12 +120,12 @@ module Resourceful
|
|
120
120
|
#
|
121
121
|
# build_object
|
122
122
|
# current_object.person.id #=> 4
|
123
|
-
#
|
123
|
+
#
|
124
124
|
def build_object
|
125
125
|
@current_object = if current_model.respond_to? :build
|
126
126
|
current_model.build(object_parameters)
|
127
127
|
else
|
128
|
-
|
128
|
+
current_model.new(object_parameters).tap do |obj|
|
129
129
|
if singular? && parent?
|
130
130
|
obj.send("#{parent_name}_id=", parent_object.id)
|
131
131
|
obj.send("#{parent_name}_type=", parent_object.class.to_s) if polymorphic_parent?
|
@@ -144,7 +144,7 @@ module Resourceful
|
|
144
144
|
# For example, in Admin::Content::PagesController:
|
145
145
|
#
|
146
146
|
# namespaces #=> [:admin, :content]
|
147
|
-
#
|
147
|
+
#
|
148
148
|
def namespaces
|
149
149
|
@namespaces ||= self.class.name.split('::').slice(0...-1).map(&:underscore).map(&:to_sym)
|
150
150
|
end
|
@@ -190,7 +190,7 @@ module Resourceful
|
|
190
190
|
#
|
191
191
|
# Note that the parents must be declared via Builder#belongs_to.
|
192
192
|
def parent_names
|
193
|
-
self.class.
|
193
|
+
self.class.parents
|
194
194
|
end
|
195
195
|
|
196
196
|
# Returns true if an appropriate parent id parameter has been supplied.
|
@@ -241,7 +241,7 @@ module Resourceful
|
|
241
241
|
# _or_ that the method hasn't been run yet,
|
242
242
|
# it uses <tt>defined?(@parent_name)</tt> to do the caching
|
243
243
|
# rather than <tt>@parent_name ||=</tt>. See the source code.
|
244
|
-
#
|
244
|
+
#
|
245
245
|
# Finally, note that parents must be declared via Builder#belongs_to.
|
246
246
|
#
|
247
247
|
# FIXME - Perhaps this logic should be moved to parent?() or another init method
|
@@ -272,7 +272,7 @@ module Resourceful
|
|
272
272
|
end
|
273
273
|
@parent_name
|
274
274
|
end
|
275
|
-
|
275
|
+
|
276
276
|
def polymorphic_parent_name
|
277
277
|
@polymorphic_parent_name
|
278
278
|
end
|
@@ -330,7 +330,7 @@ module Resourceful
|
|
330
330
|
# For example:
|
331
331
|
#
|
332
332
|
# before_filter :ensure_parent_exists, :only => [:create, :update]
|
333
|
-
#
|
333
|
+
#
|
334
334
|
def ensure_parent_exists
|
335
335
|
return true if parent?
|
336
336
|
render :text => 'No parent id given', :status => 422
|
@@ -345,7 +345,7 @@ module Resourceful
|
|
345
345
|
|
346
346
|
# Declares that the current databse update was completed successfully.
|
347
347
|
# Causes subsequent calls to <tt>save_succeeded?</tt> to return +true+.
|
348
|
-
#
|
348
|
+
#
|
349
349
|
# This is mostly meant to be used by the default actions,
|
350
350
|
# but it can be used by user-defined actions as well.
|
351
351
|
def save_succeeded!
|
@@ -354,7 +354,7 @@ module Resourceful
|
|
354
354
|
|
355
355
|
# Declares that the current databse update was not completed successfully.
|
356
356
|
# Causes subsequent calls to <tt>save_succeeded?</tt> to return +false+.
|
357
|
-
#
|
357
|
+
#
|
358
358
|
# This is mostly meant to be used by the default actions,
|
359
359
|
# but it can be used by user-defined actions as well.
|
360
360
|
def save_failed!
|
@@ -378,8 +378,8 @@ module Resourceful
|
|
378
378
|
#
|
379
379
|
# Note that the way this is determined is based on the singularity of the controller name,
|
380
380
|
# so it may yield false positives for oddly-named controllers and need to be overridden.
|
381
|
-
#
|
382
|
-
# TODO: maybe we can define plural? and singular? as class_methods,
|
381
|
+
#
|
382
|
+
# TODO: maybe we can define plural? and singular? as class_methods,
|
383
383
|
# so they are not visible to the world
|
384
384
|
def singular?
|
385
385
|
instance_variable_name.singularize == instance_variable_name
|
@@ -391,8 +391,8 @@ module Resourceful
|
|
391
391
|
# Note that the way this is determined is based on the singularity of the controller name,
|
392
392
|
# so it may yield false negatives for oddly-named controllers.
|
393
393
|
# If this is the case, the singular? method should be overridden.
|
394
|
-
#
|
395
|
-
# TODO: maybe we can define plural? and singular? as class_methods,
|
394
|
+
#
|
395
|
+
# TODO: maybe we can define plural? and singular? as class_methods,
|
396
396
|
# so they are not visible to the world
|
397
397
|
def plural?
|
398
398
|
!singular?
|
@@ -21,7 +21,7 @@ module Resourceful
|
|
21
21
|
# Note that these aren't called directly,
|
22
22
|
# but instead passed along to Rails' respond_to method.
|
23
23
|
def response_for(event)
|
24
|
-
if responses = self.class.
|
24
|
+
if responses = self.class.resourceful_responses[event.to_sym]
|
25
25
|
respond_to do |format|
|
26
26
|
responses.each do |key, value|
|
27
27
|
format.send(key, &scope(value))
|
@@ -35,15 +35,15 @@ module Resourceful
|
|
35
35
|
# The returned block accepts no arguments,
|
36
36
|
# even if the given block accepted them.
|
37
37
|
def scope(block)
|
38
|
-
|
39
|
-
instance_eval(&(block ||
|
38
|
+
proc do
|
39
|
+
instance_eval(&(block || proc {}))
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
45
|
def resourceful_fire(type, name)
|
46
|
-
callbacks = self.class.
|
46
|
+
callbacks = self.class.resourceful_callbacks[type][name] || []
|
47
47
|
callbacks.each { |callback| scope(callback).call }
|
48
48
|
end
|
49
49
|
end
|
@@ -9,10 +9,15 @@ module Resourceful
|
|
9
9
|
# Called automatically on ActionController::Base.
|
10
10
|
# Initializes various inheritable attributes.
|
11
11
|
def self.extended(base)
|
12
|
-
base.
|
13
|
-
base.
|
14
|
-
base.
|
15
|
-
base.
|
12
|
+
base.class_attribute :resourceful_callbacks
|
13
|
+
base.class_attribute :resourceful_responses
|
14
|
+
base.class_attribute :parents
|
15
|
+
base.class_attribute :made_resourceful
|
16
|
+
|
17
|
+
base.resourceful_callbacks = {}
|
18
|
+
base.resourceful_responses = {}
|
19
|
+
base.parents = []
|
20
|
+
base.made_resourceful = false
|
16
21
|
end
|
17
22
|
|
18
23
|
# :call-seq:
|
@@ -66,7 +71,7 @@ module Resourceful
|
|
66
71
|
# Returns whether or not make_resourceful has been called
|
67
72
|
# on this controller or any controllers it inherits from.
|
68
73
|
def made_resourceful?
|
69
|
-
|
74
|
+
self.class.made_resourceful
|
70
75
|
end
|
71
76
|
|
72
77
|
private
|
@@ -250,7 +250,7 @@ describe Resourceful::Default::Accessors, " with two parent classes set on the c
|
|
250
250
|
mock_controller Resourceful::Default::Accessors
|
251
251
|
@parents = %w{post comment}
|
252
252
|
@models = @parents.map(&:camelize).map(&method(:stub_const))
|
253
|
-
@kontroller.
|
253
|
+
@kontroller.parents = @parents
|
254
254
|
@controller.stubs(:singular?).returns(false)
|
255
255
|
@controller.stubs(:instance_variable_name).returns('lines')
|
256
256
|
|
@@ -312,7 +312,7 @@ describe Resourceful::Default::Accessors, " with two parent classes set on the c
|
|
312
312
|
mock_controller Resourceful::Default::Accessors
|
313
313
|
@parents = %w{post comment}
|
314
314
|
@models = @parents.map(&:camelize).map(&method(:stub_const))
|
315
|
-
@kontroller.
|
315
|
+
@kontroller.parents = @parents
|
316
316
|
@controller.stubs(:params).returns({})
|
317
317
|
@controller.stubs(:controller_name).returns('line')
|
318
318
|
stub_const('Line')
|
@@ -36,7 +36,7 @@ describe Resourceful::Builder, " applied without any modification" do
|
|
36
36
|
|
37
37
|
it "should set the controller as made_resourceful" do
|
38
38
|
@builder.apply
|
39
|
-
@kontroller.
|
39
|
+
@kontroller.made_resourceful.should be_true
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should set load_parent_object as a before_filter for no actions" do
|
@@ -5,24 +5,24 @@ describe Resourceful::Maker, "when extended" do
|
|
5
5
|
before(:each) { mock_kontroller }
|
6
6
|
|
7
7
|
it "should create an empty, inheritable callbacks hash" do
|
8
|
-
@kontroller.
|
8
|
+
@kontroller.resourceful_callbacks.should == {}
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should create an empty, inheritable responses hash" do
|
12
|
-
@kontroller.
|
12
|
+
@kontroller.resourceful_responses.should == {}
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should create an empty, inheritable parents array" do
|
16
|
-
@kontroller.
|
16
|
+
@kontroller.parents.should == []
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should create a made_resourceful variable set to false" do
|
20
|
-
@kontroller.
|
20
|
+
@kontroller.made_resourceful.should be_false
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should create a made_resourceful? method on the controller that returns the variable" do
|
24
24
|
@kontroller.should_not be_made_resourceful
|
25
|
-
@kontroller.
|
25
|
+
@kontroller.made_resourceful = true
|
26
26
|
@kontroller.should be_made_resourceful
|
27
27
|
end
|
28
28
|
end
|
@@ -105,15 +105,15 @@ module ControllerMocks
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def responses
|
108
|
-
@kontroller.
|
108
|
+
@kontroller.resourceful_responses
|
109
109
|
end
|
110
110
|
|
111
111
|
def callbacks
|
112
|
-
@kontroller.
|
112
|
+
@kontroller.resourceful_callbacks
|
113
113
|
end
|
114
114
|
|
115
115
|
def parents
|
116
|
-
@kontroller.
|
116
|
+
@kontroller.parents
|
117
117
|
end
|
118
118
|
|
119
119
|
# Evaluates the made_resourceful block of mod (a module)
|
metadata
CHANGED
@@ -1,63 +1,45 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_admin_ui
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.7
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
- 6
|
10
|
-
version: 0.5.6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Martin Moen Wulffeld
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-12-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: kaminari
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2152643900 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 39
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 12
|
32
|
-
- 4
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 0.12.4
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: formtastic
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *2152643900
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: formtastic
|
27
|
+
requirement: &2152643420 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 25
|
45
|
-
segments:
|
46
|
-
- 1
|
47
|
-
- 2
|
48
|
-
- 3
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
49
32
|
version: 1.2.3
|
50
33
|
type: :runtime
|
51
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2152643420
|
52
36
|
description: Very simple DRY admin UI.
|
53
37
|
email: martin@wulffeld.org
|
54
38
|
executables: []
|
55
|
-
|
56
39
|
extensions: []
|
57
|
-
|
58
|
-
extra_rdoc_files:
|
40
|
+
extra_rdoc_files:
|
59
41
|
- README
|
60
|
-
files:
|
42
|
+
files:
|
61
43
|
- README
|
62
44
|
- Rakefile
|
63
45
|
- VERSION
|
@@ -139,36 +121,26 @@ files:
|
|
139
121
|
- vendor/plugins/make_resourceful/spec/views/things/update.rjs
|
140
122
|
homepage: http://github.com/wulffeld/easy_admin_ui
|
141
123
|
licenses: []
|
142
|
-
|
143
124
|
post_install_message:
|
144
125
|
rdoc_options: []
|
145
|
-
|
146
|
-
require_paths:
|
126
|
+
require_paths:
|
147
127
|
- lib
|
148
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
129
|
none: false
|
150
|
-
requirements:
|
151
|
-
- -
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
|
154
|
-
|
155
|
-
- 0
|
156
|
-
version: "0"
|
157
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
135
|
none: false
|
159
|
-
requirements:
|
160
|
-
- -
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
|
163
|
-
segments:
|
164
|
-
- 0
|
165
|
-
version: "0"
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
166
140
|
requirements: []
|
167
|
-
|
168
141
|
rubyforge_project:
|
169
|
-
rubygems_version: 1.8.
|
142
|
+
rubygems_version: 1.8.11
|
170
143
|
signing_key:
|
171
144
|
specification_version: 3
|
172
145
|
summary: Easy Admin UI.
|
173
146
|
test_files: []
|
174
|
-
|