Sha256: 3f714799e12d6ce797794e89469978d62195395341a914b8b2cd5d6fff084cf0

Contents?: true

Size: 1.03 KB

Versions: 14

Compression:

Stored size: 1.03 KB

Contents

module Tawork
  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 title(page_title)
      content_for(:title) { page_title }
      page_title
    end

    def icon_for(thing)
      case thing
      when Space
        icon = "bullseye"
      when Page
        icon = "file"
      when Attachment
        icon = "paperclip"
      end

      tag(:i, class: "fa fa-#{icon}")
    end

    def body_layout
      if params[:controller] == "wiki/pages" && params[:action] == "compare"
        return "layouts/compare_layout"
      end

      "layouts/default_layout"
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
tawork-0.0.50 app/helpers/tawork/application_helper.rb
tawork-0.0.49 app/helpers/tawork/application_helper.rb
tawork-0.0.48 app/helpers/tawork/application_helper.rb
tawork-0.0.47 app/helpers/tawork/application_helper.rb
tawork-0.0.46 app/helpers/tawork/application_helper.rb
tawork-0.0.45 app/helpers/tawork/application_helper.rb
tawork-0.0.44 app/helpers/tawork/application_helper.rb
tawork-0.0.43 app/helpers/tawork/application_helper.rb
tawork-0.0.42 app/helpers/tawork/application_helper.rb
tawork-0.0.41 app/helpers/tawork/application_helper.rb
tawork-0.0.40 app/helpers/tawork/application_helper.rb
tawork-0.0.39 app/helpers/tawork/application_helper.rb
tawork-0.0.38 app/helpers/tawork/application_helper.rb
tawork-0.0.37 app/helpers/tawork/application_helper.rb