Sha256: 5fbd7d825b4666f2e9a856fdef03679cc74bf928588b8308e850964037e652c6

Contents?: true

Size: 892 Bytes

Versions: 43

Compression:

Stored size: 892 Bytes

Contents

# frozen_string_literal: true

module EacRailsBase0
  module Patches
    module EacRailsUtilsLinksHelper
      class << self
        def included(base)
          base.prepend(InstanceMethods)
          base.prepend(::CanCanDryHelper)
        end
      end

      module InstanceMethods
        def short_object_link(object, action = nil, options = {})
          value_or_sign(object, '') do |value|
            path = object_path(value, action)
            link_to '', url_for(path), options if can_by_path?(path, options[:method])
          end
        end

        def object_path_by_class(*args)
          super(*args).gsub(/_url\z/, '_path')
        end
      end
    end
  end
end

require 'eac_rails_utils/links_helper'
patch = ::EacRailsBase0::Patches::EacRailsUtilsLinksHelper
target = ::EacRailsUtils::LinksHelper
target.prepend(patch) unless target.included_modules.include?(patch)

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
eac_rails_base0-0.55.2 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.55.1 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.55.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.54.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.53.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.52.3 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.52.2 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.52.1 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.52.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.51.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.50.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.49.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.48.1 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.48.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.47.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.46.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.45.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.44.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.43.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.42.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb