class YDIM::Html::View::InvoiceList

Constants

COMPONENTS
CSS_ID
CSS_MAP
SORT_DEFAULT

Public Class Methods

toggle(name, on, off) click to toggle source
# File lib/ydim/html/view/invoices.rb, line 47
def toggle(name, on, off)
        define_method("toggle_#{name}") { |model|
                current = model.send(name)
                key = current ? off : on
                link = HtmlGrid::Link.new(key, model, @session, self)
                args = {
                        :unique_id                         =>   model.unique_id,
                        name                                                       =>      !current,
                }
                url = @lookandfeel._event_url("ajax_#{css_id}", args)
                link.href = "javascript: reload_list('#{css_id}', '#{url}')"
                link
        }
end

Public Instance Methods

column_position(key, offset) click to toggle source
# File lib/ydim/html/view/invoices.rb, line 101
def column_position(key, offset)
        pos = components.key(key)
        [pos.at(0) + offset.at(0), pos.at(1) + offset.at(1)]
end
formatted_date(model) click to toggle source
# File lib/ydim/html/view/invoices.rb, line 105
def formatted_date(model)
        if(date = model.date)
                link = date(model)
                link.value = @lookandfeel.format_date(date)
                link
        end
end
pdf(model) click to toggle source
# File lib/ydim/html/view/invoices.rb, line 112
def pdf(model)
        link = HtmlGrid::Link.new(:pdf, model, @session, self)
        link.href = @lookandfeel._event_url(:pdf, {:unique_id => model.unique_id})
        link
end
row_css(model, bg_flag) click to toggle source
Calls superclass method
# File lib/ydim/html/view/invoices.rb, line 67
    def row_css(model, bg_flag)
[super, model.status].compact.join(' ')
    end
send_invoice(model) click to toggle source
# File lib/ydim/html/view/invoices.rb, line 117
def send_invoice(model)
        if(model.status == 'is_due')
                link = HtmlGrid::Link.new(:send_invoice, model, @session, self)
                link.href = @lookandfeel._event_url(:send_invoice, 
                                                                                                                                                                {:unique_id => model.unique_id})
                link
        end
end
total(key, total, offset) click to toggle source
# File lib/ydim/html/view/invoices.rb, line 96
def total(key, total, offset)
        tpos = column_position(key, offset)
        @grid.add(number_format(format(total)), *tpos)
        @grid.add_attribute('class', 'right total', *tpos)
end