Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: wulffeld/easy_admin_ui
base: ba47017334
...
head fork: wulffeld/easy_admin_ui
compare: fc16421371
  • 3 commits
  • 12 files changed
  • 0 commit comments
  • 1 contributor
View
2  VERSION
@@ -1 +1 @@
-0.5.6
+0.5.7
View
6 easy_admin_ui.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = "easy_admin_ui"
- s.version = "0.5.6"
+ s.version = "0.5.7"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Martin Moen Wulffeld"]
- s.date = "2011-11-21"
+ s.date = "2011-12-30"
s.description = "Very simple DRY admin UI."
s.email = "martin@wulffeld.org"
s.extra_rdoc_files = [
@@ -98,7 +98,7 @@ Gem::Specification.new do |s|
]
s.homepage = "http://github.com/wulffeld/easy_admin_ui"
s.require_paths = ["lib"]
- s.rubygems_version = "1.8.10"
+ s.rubygems_version = "1.8.11"
s.summary = "Easy Admin UI."
if s.respond_to? :specification_version then
View
2  vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml
@@ -2,7 +2,7 @@
= error_messages_for :<%= singular_name %>
-- form_for(:<%= singular_name %>, :url => object_url, :html => { :method => :put }) do |f|
+= form_for(:<%= singular_name %>, :url => object_url, :html => { :method => :put }) do |f|
= render :partial => "form", :locals => {:f => f}
%p= submit_tag "Update"
View
2  vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_new.haml
@@ -2,7 +2,7 @@
= error_messages_for :<%= singular_name %>
-- form_for(:<%= singular_name %>, :url => objects_url) do |f|
+= form_for(:<%= singular_name %>, :url => objects_url) do |f|
= render :partial => "form", :locals => {:f => f}
%p= submit_tag "Create"
View
11 vendor/plugins/make_resourceful/lib/resourceful/builder.rb
@@ -20,7 +20,7 @@ class Builder
# additions to the controller.
def initialize(kontroller)
@controller = kontroller
- @inherited = !kontroller.read_inheritable_attribute(:resourceful_responses).blank?
+ @inherited = !kontroller.resourceful_responses.blank?
@action_module = Resourceful::Default::Actions.dup
@ok_actions = []
@callbacks = {:before => {}, :after => {}}
@@ -40,6 +40,7 @@ def apply
apply_publish
kontroller = @controller
+
Resourceful::ACTIONS.each do |action_named|
# See if this is a method listed by #actions
unless @ok_actions.include? action_named
@@ -52,11 +53,11 @@ def apply
kontroller.hidden_actions.reject! &@ok_actions.method(:include?)
kontroller.send :include, @action_module
- kontroller.read_inheritable_attribute(:resourceful_callbacks).merge! @callbacks
- kontroller.read_inheritable_attribute(:resourceful_responses).merge! @responses
- kontroller.write_inheritable_attribute(:made_resourceful, true)
+ kontroller.resourceful_callbacks.merge! @callbacks
+ kontroller.resourceful_responses.merge! @responses
+ kontroller.made_resourceful = true
- kontroller.write_inheritable_attribute(:parents, @parents)
+ kontroller.parents = @parents
kontroller.before_filter :load_object, :only => (@ok_actions & SINGULAR_PRELOADED_ACTIONS) + @custom_member_actions
kontroller.before_filter :load_objects, :only => (@ok_actions & PLURAL_ACTIONS) + @custom_collection_actions
kontroller.before_filter :load_parent_object, :only => @ok_actions + @custom_member_actions + @custom_collection_actions
View
32 vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb
@@ -17,7 +17,7 @@ module Default
# and are called by the default make_resourceful actions[link:classes/Resourceful/Default/Actions.html].
# This means that overriding one method
# can affect everything else.
- #
+ #
# This can be dangerous, but it can also be very powerful.
# make_resourceful is designed to take advantage of overriding,
# so as long as the new methods accomplish the same purpose as the old ones,
@@ -60,7 +60,7 @@ def current_objects
#
# This is called automatically by the default make_resourceful actions.
# You shouldn't need to use it directly unless you're creating a new action.
- #
+ #
# For example, in UsersController,
# calling +load_objects+ sets <tt>@users = current_objects</tt>.
def load_objects
@@ -99,7 +99,7 @@ def current_object
#
# This is called automatically by the default make_resourceful actions.
# You shouldn't need to use it directly unless you're creating a new action.
- #
+ #
# For example, in UsersController,
# calling +load_object+ sets <tt>@user = current_object</tt>.
def load_object
@@ -120,12 +120,12 @@ def load_object
#
# build_object
# current_object.person.id #=> 4
- #
+ #
def build_object
@current_object = if current_model.respond_to? :build
current_model.build(object_parameters)
else
- (current_model.new(object_parameters)).tap do |obj|
+ current_model.new(object_parameters).tap do |obj|
if singular? && parent?
obj.send("#{parent_name}_id=", parent_object.id)
obj.send("#{parent_name}_type=", parent_object.class.to_s) if polymorphic_parent?
@@ -144,7 +144,7 @@ def current_model_name
# For example, in Admin::Content::PagesController:
#
# namespaces #=> [:admin, :content]
- #
+ #
def namespaces
@namespaces ||= self.class.name.split('::').slice(0...-1).map(&:underscore).map(&:to_sym)
end
@@ -190,7 +190,7 @@ def object_parameters
#
# Note that the parents must be declared via Builder#belongs_to.
def parent_names
- self.class.read_inheritable_attribute :parents
+ self.class.parents
end
# Returns true if an appropriate parent id parameter has been supplied.
@@ -241,7 +241,7 @@ def polymorphic_parent?
# _or_ that the method hasn't been run yet,
# it uses <tt>defined?(@parent_name)</tt> to do the caching
# rather than <tt>@parent_name ||=</tt>. See the source code.
- #
+ #
# Finally, note that parents must be declared via Builder#belongs_to.
#
# FIXME - Perhaps this logic should be moved to parent?() or another init method
@@ -272,7 +272,7 @@ def parent_name
end
@parent_name
end
-
+
def polymorphic_parent_name
@polymorphic_parent_name
end
@@ -330,7 +330,7 @@ def load_parent_object
# For example:
#
# before_filter :ensure_parent_exists, :only => [:create, :update]
- #
+ #
def ensure_parent_exists
return true if parent?
render :text => 'No parent id given', :status => 422
@@ -345,7 +345,7 @@ def save_succeeded?
# Declares that the current databse update was completed successfully.
# Causes subsequent calls to <tt>save_succeeded?</tt> to return +true+.
- #
+ #
# This is mostly meant to be used by the default actions,
# but it can be used by user-defined actions as well.
def save_succeeded!
@@ -354,7 +354,7 @@ def save_succeeded!
# Declares that the current databse update was not completed successfully.
# Causes subsequent calls to <tt>save_succeeded?</tt> to return +false+.
- #
+ #
# This is mostly meant to be used by the default actions,
# but it can be used by user-defined actions as well.
def save_failed!
@@ -378,8 +378,8 @@ def singular_action?
#
# Note that the way this is determined is based on the singularity of the controller name,
# so it may yield false positives for oddly-named controllers and need to be overridden.
- #
- # TODO: maybe we can define plural? and singular? as class_methods,
+ #
+ # TODO: maybe we can define plural? and singular? as class_methods,
# so they are not visible to the world
def singular?
instance_variable_name.singularize == instance_variable_name
@@ -391,8 +391,8 @@ def singular?
# Note that the way this is determined is based on the singularity of the controller name,
# so it may yield false negatives for oddly-named controllers.
# If this is the case, the singular? method should be overridden.
- #
- # TODO: maybe we can define plural? and singular? as class_methods,
+ #
+ # TODO: maybe we can define plural? and singular? as class_methods,
# so they are not visible to the world
def plural?
!singular?
View
8 vendor/plugins/make_resourceful/lib/resourceful/default/callbacks.rb
@@ -21,7 +21,7 @@ def after(event)
# Note that these aren't called directly,
# but instead passed along to Rails' respond_to method.
def response_for(event)
- if responses = self.class.read_inheritable_attribute(:resourceful_responses)[event.to_sym]
+ if responses = self.class.resourceful_responses[event.to_sym]
respond_to do |format|
responses.each do |key, value|
format.send(key, &scope(value))
@@ -35,15 +35,15 @@ def response_for(event)
# The returned block accepts no arguments,
# even if the given block accepted them.
def scope(block)
- lambda do
- instance_eval(&(block || lambda {}))
+ proc do
+ instance_eval(&(block || proc {}))
end
end
private
def resourceful_fire(type, name)
- callbacks = self.class.read_inheritable_attribute(:resourceful_callbacks)[type][name] || []
+ callbacks = self.class.resourceful_callbacks[type][name] || []
callbacks.each { |callback| scope(callback).call }
end
end
View
15 vendor/plugins/make_resourceful/lib/resourceful/maker.rb
@@ -9,10 +9,15 @@ module Maker
# Called automatically on ActionController::Base.
# Initializes various inheritable attributes.
def self.extended(base)
- base.write_inheritable_attribute :resourceful_callbacks, {}
- base.write_inheritable_attribute :resourceful_responses, {}
- base.write_inheritable_attribute :parents, []
- base.write_inheritable_attribute :made_resourceful, false
+ base.class_attribute :resourceful_callbacks
+ base.class_attribute :resourceful_responses
+ base.class_attribute :parents
+ base.class_attribute :made_resourceful
+
+ base.resourceful_callbacks = {}
+ base.resourceful_responses = {}
+ base.parents = []
+ base.made_resourceful = false
end
# :call-seq:
@@ -66,7 +71,7 @@ def make_resourceful(options = {}, &block)
# Returns whether or not make_resourceful has been called
# on this controller or any controllers it inherits from.
def made_resourceful?
- read_inheritable_attribute(:made_resourceful)
+ self.class.made_resourceful
end
private
View
4 vendor/plugins/make_resourceful/spec/accessors_spec.rb
@@ -250,7 +250,7 @@
mock_controller Resourceful::Default::Accessors
@parents = %w{post comment}
@models = @parents.map(&:camelize).map(&method(:stub_const))
- @kontroller.write_inheritable_attribute(:parents, @parents)
+ @kontroller.parents = @parents
@controller.stubs(:singular?).returns(false)
@controller.stubs(:instance_variable_name).returns('lines')
@@ -312,7 +312,7 @@
mock_controller Resourceful::Default::Accessors
@parents = %w{post comment}
@models = @parents.map(&:camelize).map(&method(:stub_const))
- @kontroller.write_inheritable_attribute(:parents, @parents)
+ @kontroller.parents = @parents
@controller.stubs(:params).returns({})
@controller.stubs(:controller_name).returns('line')
stub_const('Line')
View
2  vendor/plugins/make_resourceful/spec/builder_spec.rb
@@ -36,7 +36,7 @@
it "should set the controller as made_resourceful" do
@builder.apply
- @kontroller.read_inheritable_attribute(:made_resourceful).should be_true
+ @kontroller.made_resourceful.should be_true
end
it "should set load_parent_object as a before_filter for no actions" do
View
10 vendor/plugins/make_resourceful/spec/maker_spec.rb
@@ -5,24 +5,24 @@
before(:each) { mock_kontroller }
it "should create an empty, inheritable callbacks hash" do
- @kontroller.read_inheritable_attribute(:resourceful_callbacks).should == {}
+ @kontroller.resourceful_callbacks.should == {}
end
it "should create an empty, inheritable responses hash" do
- @kontroller.read_inheritable_attribute(:resourceful_responses).should == {}
+ @kontroller.resourceful_responses.should == {}
end
it "should create an empty, inheritable parents array" do
- @kontroller.read_inheritable_attribute(:parents).should == []
+ @kontroller.parents.should == []
end
it "should create a made_resourceful variable set to false" do
- @kontroller.read_inheritable_attribute(:made_resourceful).should be_false
+ @kontroller.made_resourceful.should be_false
end
it "should create a made_resourceful? method on the controller that returns the variable" do
@kontroller.should_not be_made_resourceful
- @kontroller.write_inheritable_attribute(:made_resourceful, true)
+ @kontroller.made_resourceful = true
@kontroller.should be_made_resourceful
end
end
View
6 vendor/plugins/make_resourceful/spec/spec_helper.rb
@@ -105,15 +105,15 @@ class << @builder
end
def responses
- @kontroller.read_inheritable_attribute(:resourceful_responses)
+ @kontroller.resourceful_responses
end
def callbacks
- @kontroller.read_inheritable_attribute(:resourceful_callbacks)
+ @kontroller.resourceful_callbacks
end
def parents
- @kontroller.read_inheritable_attribute(:parents)
+ @kontroller.parents
end
# Evaluates the made_resourceful block of mod (a module)

No commit comments for this range

Something went wrong with that request. Please try again.