Skip to content

Rails helpers for building autodiscovery and links for alternative page formats.

License

Notifications You must be signed in to change notification settings

Data-Liberation-Front/alternate-rails

Repository files navigation

Build Status Dependency Status Coverage Status Code Climate Gem Version License Badges

AlternateRails

Helpers for Rails 6 for building autodiscovery and links for alternative page formats. Also sends correct Content-Location headers if no extension has been specified.

License

This code is open source under the MIT license. See the LICENSE.md file for full details.

Requirements

  • Rails >= 6.0

Usage

In your controller, if you have alternative representations, call alternate_formats from a before_filter:

before_filter(:only => [:index, :show]) { alternate_formats [:json, :ics] }

In the header in your layout, call alternate_auto_discovery_link_tags to generate autodiscover link tags.

In your view, call alternate_link_buttons to build some buttons for links. Currently these assume bootstrap and font-awesome, but it would be good to make styling more flexible.

If you want to change elements of the link buttons, you can specify a class and / or icon as follows:

alternate_link_buttons(:class => 'myclass', :icon => 'icon-myicon')

About

Rails helpers for building autodiscovery and links for alternative page formats.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages