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.68.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.67.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.66.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.65.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.64.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.63.1 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.63.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.62.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.61.1 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.61.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.60.4 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.60.3 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.60.2 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.60.1 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.60.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.59.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.58.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.57.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.56.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.55.3 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb