Class: EacRailsUtils::LinksHelper::ObjectLink

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/eac_rails_utils/links_helper/object_link.rb

Overview

Returns The link or the blank_sign.

Returns:

  • (ActiveSupport::SafeBuffer)

    The link or the blank_sign.

Constant Summary collapse

%i[action blank_value confirm_translation name title_translation].freeze

Instance Method Summary collapse

Instance Method Details

#actionString?

Returns:

  • (String, nil)


27
28
29
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 27

def action
  options[:action]
end

#blank_valueString?

Returns:

  • (String, nil)


32
33
34
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 32

def blank_value
  options[:blank_value]
end

#confirmString?

Returns:

  • (String, nil)


37
38
39
40
41
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 37

def confirm
  options[:confirm_translation].if_present do |v|
    ::I18n.t(v, label: object.to_s)
  end
end

#nameString?

Returns:

  • (String, nil)


44
45
46
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 44

def name
  options[:name] || object.to_s
end

#resultActiveSupport::SafeBuffer

Returns:

  • (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), link_to_options
  end
end

#titleString?

Returns:

  • (String, nil)


49
50
51
52
53
# File 'app/helpers/eac_rails_utils/links_helper/object_link.rb', line 49

def title
  options[:title_translation].if_present do |v|
    ::I18n.t(v, label: object.to_s)
  end
end