Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brentgreeff/special_fried_links
Links but with extra tasty bits
https://github.com/brentgreeff/special_fried_links
html rails
Last synced: about 7 hours ago
JSON representation
Links but with extra tasty bits
- Host: GitHub
- URL: https://github.com/brentgreeff/special_fried_links
- Owner: brentgreeff
- License: mit
- Created: 2009-09-12T14:15:55.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2011-01-13T08:55:03.000Z (almost 14 years ago)
- Last Synced: 2024-11-15T04:55:22.788Z (5 days ago)
- Topics: html, rails
- Language: Ruby
- Homepage: http://www.brentgreeff.com/rails-plugins/special-fried-links
- Size: 97.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: MIT-LICENSE
Awesome Lists containing this project
README
= Special Fried Links
== Install
gem install special_fried_links
(or use bundler)
== Links but with extra tasty bits
* Ever seen code like this?
<%= link_to('Edit', edit_something_path(something), :class => 'edit round', :title => "Edit record for #{record.owner}") %>
* Before you know it your templates start looking like php, and God knows we don't need that.
* Obviously the best is to move it into a helpermodule SomethingHelper
def link_to_edit_something(something)
title = "Edit record for #{record.owner}"
path = edit_something_path(something)
return link_to('Edit', path, :class => 'edit round', :title => title)
end
end* Nice neat and reusable.
== So whats your point?
* This plugin allows you to change the calling code from this:
<%= link_to_edit_something(something) %>
* to this:
<%= link_to :edit => something %>
* Tasty hash syntax
The downside is that the implementation still needs to be:
module SomethingHelper
def link_to_edit_something(something)
title = "Edit record for #{record.owner}"
path = edit_something_path(something)
return link_to('Edit', path, :class => 'edit round', :title => title)
end
endOr does it?
== Beyond 2000
It would be nicer if the implementation code was sexier.
== Fat model auth
This gem is designed to be used with the Fat model auth gem, giving you the following pattern:
link_to :edit => @cabbage if allowed_to? :edit => @cabbage
Got ideas? fork it or send me a message.
Copyright (c) 2009 [Brent Greeff], released under the MIT license