Sha256: ae0ca3437772d9959aa289d99a757bb4dd7c4fa9990f73333e868b8accd39317

Contents?: true

Size: 706 Bytes

Versions: 3

Compression:

Stored size: 706 Bytes

Contents

module ApplicationHelper
  [:project, :story, :bug, :task].each do |method|
    define_method("#{method}_path") do |*args|
      ticket_path(*args)
    end

    define_method("#{method.to_s.pluralize}_path") do |*args|
      tickets_path(*args)
    end
  end

  def ticket_types
    Ticket::ALLOWED_TYPES.each_with_object({}) do |type, hash|
      hash[type] = Ticket.filtered_type_class(type).new(
        creator: current_user,
        parent_id: params[:parent_id]
      )
    end
  end

  def link_to_trackable activity, path
    link = send(:"#{path}_path", (activity.trackable || "deleted-#{activity.trackable_id}"))

    link_to((activity.trackable.try(:title) || "[Deleted Page]"), link)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tawork-0.0.27 app/helpers/application_helper.rb
tawork-0.0.26 app/helpers/application_helper.rb
tawork-0.0.25 app/helpers/application_helper.rb