Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration of display text within content_tag #91

Open
SirRawlins opened this issue Aug 8, 2017 · 0 comments
Open

Allow configuration of display text within content_tag #91

SirRawlins opened this issue Aug 8, 2017 · 0 comments

Comments

@SirRawlins
Copy link

At the moment the value option is used to generate the content within the content_tag output, however, I find myself often wanting to display cropped or truncated content i.e.

<span class="editable" value="Once upon a time in the west.">Once upon a time....</span>

I'd like to propose either a new option to the edtiable() helper to allow configuration of this:

<%= editable @book, :title, display: @book.title.truncate(10) %>

Or perhaps allow the passing of a block which is yielded within the content_tag.

<%= editable @book, :title do %>
    <%= @book.title.truncate(10) %>
<% end %>

Anyone have thoughts on this? I'd be happy to look at putting a PR together unless there are objections to this kind of behaviour in the helper?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant