Module: EacRailsUtils::LinksHelper
- Defined in:
- app/helpers/eac_rails_utils/links_helper.rb,
app/helpers/eac_rails_utils/links_helper/object_link.rb,
app/helpers/eac_rails_utils/links_helper/object_path.rb
Defined Under Namespace
Classes: ObjectLink, ObjectPath
Constant Summary
collapse
- LINK_OPTIONS =
{ target: '_blank' }.freeze
- SHORT_LINK_OPTIONS =
LINK_OPTIONS.merge(name: '').freeze
- DETAIL_LINK_OPTIONS =
LINK_OPTIONS.merge(action: 'detail')
- SHORT_DELETE_LINK_OPTIONS =
SHORT_LINK_OPTIONS.merge(
action: '', class: 'delete_link', method: :delete,
title_translation: 'eac_rails_utils.links.delete_object',
confirm_translation: 'eac_rails_utils.links.delete_confirm'
).freeze
- SHORT_EDIT_LINK_OPTIONS =
SHORT_LINK_OPTIONS.merge(
action: 'edit', class: 'edit_link', title_translation: 'eac_rails_utils.links.edit_object'
).freeze
- SHORT_DETAIL_SHOW_LINK_OPTIONS =
SHORT_LINK_OPTIONS.merge(
class: 'show_link', title_translation: 'eac_rails_utils.links.show_object'
).freeze
- SHORT_DETAIL_LINK_OPTIONS =
SHORT_DETAIL_SHOW_LINK_OPTIONS.merge(action: 'detail')
- SHORT_SHOW_LINK_OPTIONS =
SHORT_DETAIL_SHOW_LINK_OPTIONS.merge(action: '')
- SHOW_LINK_OPTIONS =
LINK_OPTIONS.merge(action: '')
Instance Method Summary
collapse
Instance Method Details
#detail_link(object, **options) ⇒ ActiveSupport::SafeBuffer
26
27
28
|
# File 'app/helpers/eac_rails_utils/links_helper.rb', line 26
def detail_link(object, **options)
object_link object, DETAIL_LINK_OPTIONS.merge(options)
end
|
#short_delete_link(object) ⇒ Object
30
31
32
|
# File 'app/helpers/eac_rails_utils/links_helper.rb', line 30
def short_delete_link(object)
object_link object, SHORT_DELETE_LINK_OPTIONS
end
|
#short_detail_link(object) ⇒ Object
50
51
52
|
# File 'app/helpers/eac_rails_utils/links_helper.rb', line 50
def short_detail_link(object)
object_link object, SHORT_DETAIL_LINK_OPTIONS
end
|
#short_edit_link(object) ⇒ Object
34
35
36
|
# File 'app/helpers/eac_rails_utils/links_helper.rb', line 34
def short_edit_link(object)
object_link object, SHORT_EDIT_LINK_OPTIONS
end
|
#short_goto_link(url) ⇒ Object
38
39
40
41
42
43
44
|
# File 'app/helpers/eac_rails_utils/links_helper.rb', line 38
def short_goto_link(url)
value_or_sign(url, '') do |value|
link_to '', value, class: 'goto_link', target: '_blank',
title: ::I18n.t('eac_rails_utils.links.goto_url', url: value.to_s),
rel: 'noopener'
end
end
|
#short_show_link(object) ⇒ Object
46
47
48
|
# File 'app/helpers/eac_rails_utils/links_helper.rb', line 46
def short_show_link(object)
object_link object, SHORT_SHOW_LINK_OPTIONS
end
|
#show_link(object, **options) ⇒ ActiveSupport::SafeBuffer
57
58
59
|
# File 'app/helpers/eac_rails_utils/links_helper.rb', line 57
def show_link(object, **options)
object_link object, SHOW_LINK_OPTIONS.merge(options)
end
|