Created
April 9, 2014 14:48
-
-
Save caseyli/10279040 to your computer and use it in GitHub Desktop.
Rest In Place Helper that takes Authorization into account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
# This helper will basically create a rest-in-place spans around your content, but will prevent it from being active if editable is false | |
def rest_in_place(text, attribute, editable) | |
css_class = "rest-in-place" if editable | |
content_tag(:span, data: { attribute: attribute }, class: css_class) do | |
text | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-object="product"> | |
<%= rest_in_place product.name, "name", is_admin? %> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment