Class: EacRailsUtils::LinksHelper::ObjectLink
- Inherits:
-
Object
- Object
- EacRailsUtils::LinksHelper::ObjectLink
- Defined in:
- app/helpers/eac_rails_utils/links_helper/object_link.rb
Overview
Returns The link or the blank_sign.
Constant Summary collapse
- NON_LINK_TO_OPTIONS =
%i[action blank_value confirm_translation name title_translation].freeze
Instance Method Summary collapse
- #action ⇒ String?
- #blank_value ⇒ String?
- #confirm ⇒ String?
- #name ⇒ String?
- #result ⇒ ActiveSupport::SafeBuffer
- #title ⇒ String?
Instance Method Details
#action ⇒ String?
27 28 29 |
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 27 def action [:action] end |
#blank_value ⇒ String?
32 33 34 |
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 32 def blank_value [:blank_value] end |
#confirm ⇒ String?
37 38 39 40 41 |
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 37 def confirm [:confirm_translation].if_present do |v| ::I18n.t(v, label: object.to_s) end end |
#name ⇒ String?
44 45 46 |
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 44 def name [:name] || object.to_s end |
#result ⇒ ActiveSupport::SafeBuffer
20 21 22 23 24 |
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 20 def result view.value_or_sign(object, blank_value) do |value| view.link_to name, view.object_path(value, action), end end |
#title ⇒ String?
49 50 51 52 53 |
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 49 def title [:title_translation].if_present do |v| ::I18n.t(v, label: object.to_s) end end |