Skip to content

Commit

Permalink
fix bug when generating url (urls were namespaced by 'super_finder')
Browse files Browse the repository at this point in the history
  • Loading branch information
did committed Jan 13, 2010
1 parent 39cd08e commit 52634c4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Expand Up @@ -19,7 +19,7 @@ function SuperFinder(options) {
return false;
});

this.options.button.click(function(event) {
jQuery(this.options.button).click(function(event) {
self.open();
event.preventDefault();
return false;
Expand Down Expand Up @@ -190,4 +190,4 @@ SuperFinder.prototype = {
}
return new RegExp(exp);
}
};
};
Expand Up @@ -16,7 +16,7 @@ div#superfinder p input {
background: white;
}

div#superfinder ul { list-style: none; margin: 10px 0 0 0px; }
div#superfinder ul { list-style: none; margin: 10px 0 0 0px; padding: 0px; }

div#superfinder li {
background: #dff5f8;
Expand Down
6 changes: 3 additions & 3 deletions lib/super_finder/generator_controller.rb
Expand Up @@ -72,10 +72,10 @@ def entry_url(entry, options)
case url
when Hash, nil
url = (SuperFinder::Config.instance.url || {}).merge(url || {})
controller_name = entry.class.name.pluralize.underscore
resource_name = entry.class.name.pluralize.underscore

url_for({
:controller => File.join([url[:name_prefix], controller_name].compact),
:controller => File.join(['/', url[:name_prefix], resource_name].compact),
:action => url[:action].to_sym ,
:id => entry.id
})
Expand All @@ -91,4 +91,4 @@ def generate
map
end

end
end
6 changes: 3 additions & 3 deletions spec/unit/controller_spec.rb
Expand Up @@ -55,12 +55,12 @@ class HelloWorld; end
end

it 'should generate an url' do
@controller.expects(:url_for).with({ :controller => 'admin/projects', :action => :edit, :id => 42 })
@controller.expects(:url_for).with({ :controller => '/admin/projects', :action => :edit, :id => 42 })
@controller.send(:entry_url, @entry, { :klass => Project })
end

it 'should generate an url from an Hash option' do
@controller.expects(:url_for).with({ :controller => 'projects', :action => :show, :id => 42 })
@controller.expects(:url_for).with({ :controller => '/projects', :action => :show, :id => 42 })
@controller.send(:entry_url, @entry, { :klass => Project, :url => { :name_prefix => nil, :action => 'show' } })
end

Expand All @@ -73,4 +73,4 @@ class HelloWorld; end
@controller.class.send(:filter_chain).collect(&:method).should == [:hello_world, :foo]
end

end
end

0 comments on commit 52634c4

Please sign in to comment.