Interage::Helper
Installation
Add this line to your application's Gemfile:
gem 'interage-helpers', '~> 0.1.1'
And then execute:
bundle install
Or install it yourself as:
gem install interage-helpers
Usage
You can use a Rails generator to create ApplicationHelper
and add locales file:
rails g interage:helpers:install
If you want to overwrite some variables:
### APPLICATION HELPER
## Interage::ApplicationHelpers
#
APP_NAME='Nome da Aplicação'
ENV_NAME='development'
PREFIX_ADMIN_PAGE_TITLE='Administração :: '
PREFIX_DEVISE_PAGE_TITLE='Autenticação :: '
## Interage::ApplicationIconHelper
#
# Use 'fa' or 'md'
DEFAULT_FONT_ICON='fa'
## Interage::CocoonHelper
#
DEFAULT_BTN_TYPE_CLASS='btn btn-sm btn-outline-'
## Interage::ControllerActiveHelper
#
CONTROLLER_SHOW_CLASS='show'
CONTROLLER_ACTIVE_CLASS='active'
## Interage::FaviconHelper
#
FAVICON_EXTENTION='png'
FAVICON_FILE_NAME='icons/apple-touch-icon'
Finally ... Some examples:
Interage::LinkToHelper
<%= link_to_edit edit_user_path(user) %>
<%= link_to_back :back %>
<%= link_to_show user_path(user) %>
<%= link_to_destroy user_path(user) %>
<%= link_to_new User, users_path %>
Interage::ApplicationIconHelper
<%= app_icon('user', class: 'text-muted') %>
<%= app_icon_text('users', 'Usuários', class: 'text-muted') %>
Interage::FontAwesomeHelper
<%= fa_icon('user', class: 'text-muted') %>
<%= fa_icon_text('users', 'Usuários', class: 'text-muted') %>
Interage::MaterialDesignIconsHelper
<%= md_icon('user', class: 'text-muted') %>
<%= md_icon_text('users', 'Usuários', class: 'text-muted') %>
Interage::VersionHelper
<%= app_version %>
<%= app_text_version %>
Interage::TranslationHelper
<%= tm(User) %>
<%= tmp(User) %>
<%= ta(User, :name) %>
<%= tb(false) %>
<%= tb(true) %>
<%= tbi(false) %>
<%= tbi(true) %>
<%= tbci(false) %>
<%= tbci(true) %>
Interage::TextHelper
<%= nl2br("Hello\nWorld") %>
Interage::PhoneHelper
<%= format_phone('+5581987654321') %>
<%= format_phone('5581987654321') %>
<%= format_phone('081987654321') %>
<%= format_phone('81987654321') %>
<%= format_phone('8187654321') %>
<%= format_phone('987654321') %>
<%= format_phone('98765432') %>
Interage::PaginationHelper
<%= pagination_links(@users) %>
Interage::NumberHelper
<%= default_currency_format(10.57) %>
<%= default_currency_format(100.17) %>
<%= default_currency_format(1_000) %>
<%= default_currency_format(10_000) %>
<%= default_currency_format(1_000_000) %>
Interage::GravatarHelper
<%= gravatar_image_tag(user.email) %>
Interage::ControllerActiveHelper
<%= current_controller?('home') %>
<%= current_controller?('docs') %>
<%= menu_class_show('docs') %>
<%= menu_active('docs') %>
<%= current_controller?('home', 'docs') %>
<%= menu_class_show('home', 'docs') %>
<%= menu_active('home', 'docs') %>
Interage::CEPHelper
<%= format_cep('54754-195') %>
<%= format_cep('54754195') %>
Interage::CNPJHelper
<%= format_cnpj('08.475.876/0001-04') %>
<%= format_cnpj('08475876000104') %>
Interage::CPFHelper
<%= format_cpf('320.871.430-05') %>
<%= format_cpf('32087143005') %>
Interage::ApplicationHelper
<%= format_seconds(20) %>
<%= admin_page_title %>
<%= devise_page_title %>
<%= page_title %>
<%= app_name %>
<%= env_name_upcase %>
Interage::BootstrapHelper
<%= bs_alert_info('Info message') %>
<%= bs_alert_warning('Warning message') %>
<%= bs_alert_success('Success message') %>
<%= bs_alert_danger('Danger message') %>
<%= bs_alert_not_found_male(User) %>
<%= bs_alert_not_found_female(User) %>
<%= text_not_found_male(User) %>
<%= text_not_found_female(User) %>
Contributing
Bug reports and merge requests are welcome on GitLab at https://gitlab.com/[USERNAME]/interage-helper.