diff options
| author | Teddy Wing | 2017-06-15 14:37:14 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-06-15 14:37:14 +0200 |
| commit | 3b621ee93c5097c55bd4ce4c7bdecdaa18c6f9ab (patch) | |
| tree | e4c5fd925687018476e51435511b686b456a03b1 /app/helpers/links_helper.rb | |
| parent | 5897637c559ba3d37e4f02b97149ff7dab927ef2 (diff) | |
| download | chouette-core-3b621ee93c5097c55bd4ce4c7bdecdaa18c6f9ab.tar.bz2 | |
TableBuilder: Make destroy link in gear menu render correctly
Previously we weren't correctly outputting the proper HTML to get the
:delete link rendering correctly with the icon and text. It should show:
[TRASH CAN ICON] Supprimer
but instead was showing the href.
To get this working, I added a `@content` attribute to `Link`. This
allows us to optionally specify non-text content to display in the link.
We then have delete-link-specific handling when rendering the gear
menu's HTML. In that particular case, the `<li>` needs to have a
'delete-action' class in order for the styling to work properly.
Created a new `destroy_link` helper method to allow us to reuse the
destroy link content in the header bar.
TODO: Collect Link#content and Link#name into the same property.
TODO: Rename `#destroy_link` to `#destroy_link_content`
Refs #3479
Diffstat (limited to 'app/helpers/links_helper.rb')
| -rw-r--r-- | app/helpers/links_helper.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/helpers/links_helper.rb b/app/helpers/links_helper.rb new file mode 100644 index 000000000..48cfe9ca4 --- /dev/null +++ b/app/helpers/links_helper.rb @@ -0,0 +1,5 @@ +module LinksHelper + def destroy_link + content_tag(:span, nil, class: 'fa fa-trash') + t('actions.destroy') + end +end |
