Sha256: 95728ad5e135b6bd308d71b27b60ea359e1f7d6706ab52011cdf2ce2acefbcac

Contents?: true

Size: 1.32 KB

Versions: 6

Compression:

Stored size: 1.32 KB

Contents

module RedmineCrm
  module Liquid
    class TimeEntriesDrop < ::Liquid::Drop
      def initialize(time_entries)
        @time_entries = time_entries
      end

      def all
        @all ||= @time_entries.map do |time_entry|
          TimeEntryDrop.new time_entry
        end
      end

      def visible
        @visible ||= @all.select(&:visible?)
      end

      def each(&block)
        all.each(&block)
      end

      def size
        @time_entries.size
      end
    end

    class TimeEntryDrop < ::Liquid::Drop
      include ActionView::Helpers::UrlHelper

      delegate :id,
               :hours,
               :comments,
               :spent_on,
               :tyear,
               :tmonth,
               :tweek,
               :visible?,
               :updated_on,
               :created_on,
               :to => :@time_entry, 
               allow_nil: true

      def initialize(time_entry)
        @time_entry = time_entry
      end

      def user
        @user ||= UserDrop.new(@time_entry.user)
      end

      def issue
        @issue ||= IssueDrop.new(@time_entry.issue) unless @time_entry.issue.blank?
      end

      def activity
        @activity ||= @time_entry.activity && @time_entry.activity.name
      end

      def custom_field_values
        @time_entry.custom_field_values
      end      

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
redmine_crm-0.0.63 lib/redmine_crm/liquid/drops/time_entries_drop.rb
redmine_crm-0.0.62 lib/redmine_crm/liquid/drops/time_entries_drop.rb
redmine_crm-0.0.61 lib/redmine_crm/liquid/drops/time_entries_drop.rb
redmine_crm-0.0.60 lib/redmine_crm/liquid/drops/time_entries_drop.rb
redmine_crm-0.0.59 lib/redmine_crm/liquid/drops/time_entries_drop.rb
redmine_crm-0.0.58 lib/redmine_crm/liquid/drops/time_entries_drop.rb