aboutsummaryrefslogtreecommitdiffstats
path: root/lib/link.rb
AgeCommit message (Collapse)Author
2017-12-21Refs #5361 @1H; Make company optional in Lines formZog
And handle the case when it is nil in the views
2017-12-21Refs #5430 @2h; Deactivate lines instead of destroying themZog
- Add `activate` and `deactivate` actions in `LinesController`, as well as corresponding routes - Add `activate!` and `deactivate!` methods in `Chouette::Line`, as well as `activated?` - Add `activate?` and `deactivate?` permissions in `LinePolicy` - Add corresponding `action_links`in the Decorator - Create helper for these actions - Add an optional `'extra_class` to the Links - Update styles for ".delete-action" to handle the case where there are several - Add I18n keys accordingly
2017-06-15Link: Change :name & :content into a single property :contentTeddy Wing
The only difference between :name and :content was that :name contained a string and :content contained HTML. But they're really the same thing. Thus it makes much more sense to combine those into a single property that means both, and handles content regardless of type. Refs #3479
2017-06-15TableBuilder: Make destroy link in gear menu render correctlyTeddy Wing
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
2017-06-15TableBuilder;Link: Remove default `:get` for HTTP methodTeddy Wing
Don't set links as `method: :get` by default. This shows up as: link_to _, _, method: :get If we set the method to `nil` instead, we don't get a `data-method="get"` attribute in our HTML output. Instead, we get no `data-method` attribute, which is a lot better and cleaner. I had originally used `:get` as a default because I wanted to generalise links and certain ones we create need `:delete` or `:put` methods. I figured, since we're always going to be passing `method:` to `link_to`, we should have a sane default for that option. However, using `nil` is even better as a default because then we don't get an extra attribute in our HTML at all. Refs #3479
2017-06-12referentials/show.html.slim: Extract header buttons to a decoratorTeddy Wing
Add a new `ReferentialDecorator` that we can use to define the links that appear as buttons in the header of the `/referentials/:id` page. The idea is that these links will take the place of the existing view code and in the view, we'll instead loop over the links provided by the decorator and render them as buttons. I decided to do it this way because there's a requirement that the links in the gear menu in tables show the same links that appear in the header of the page. So the Workbenches#show page would show a table of referentials, and their gear menu links should ostensibly be the same as the header links in the Referentials#show page. My goal was to abstract links, and try to separate them from the presentation layer. Still having trouble with this though. I created a new `Link` class to represent a link. We can then use this in the template to create a `link_to`. It becomes messy, though, when we want to put other elements inside a certain link, as evidenced by the `:delete` link. Don't like how that's done, but still working out the best approach to make it cleaner. Refs #3479