Class: YDIM::Html::View::InvoiceComposite
- Inherits:
-
HtmlGrid::DivComposite
- Object
- HtmlGrid::DivComposite
- YDIM::Html::View::InvoiceComposite
- Includes:
- HtmlGrid::FormMethods
- Defined in:
- lib/ydim/html/view/invoice.rb
Direct Known Subclasses
Constant Summary collapse
- FORM_ID =
'invoice'
- COMPONENTS =
{ [0,0] => InvoiceInnerComposite, [0,1] => :items, [0,2] => InvoiceTotalComposite, [0,3] => :submit, [1,3] => :pdf, [2,3] => :send_invoice, }
- CSS_MAP =
{ 3 => 'padded' }
- EVENT =
:update
Instance Method Summary collapse
- #button(key, model) ⇒ Object
- #hidden_fields(context) ⇒ Object
- #init ⇒ Object
- #items(model) ⇒ Object
- #pdf(model) ⇒ Object
- #send_invoice(model) ⇒ Object
Instance Method Details
#button(key, model) ⇒ Object
200 201 202 203 204 205 206 |
# File 'lib/ydim/html/view/invoice.rb', line 200 def (key, model) = HtmlGrid::Button.new(key, model, @session, self) url = @lookandfeel._event_url(key, {:unique_id => model.unique_id}) .set_attribute('onClick', "this.form.event.value='#{key}'; this.form.submit()") end |
#hidden_fields(context) ⇒ Object
185 186 187 |
# File 'lib/ydim/html/view/invoice.rb', line 185 def hidden_fields(context) super << context.hidden('unique_id', @model.unique_id) end |
#init ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/ydim/html/view/invoice.rb', line 168 def init if(@model.unique_id.nil?) @components = { [0,0] => components[[0,0]], [0,1] => :submit, } @css_map = { 1 => 'padded' } elsif(@model.items.empty?) @components = { [0,0] => components[[0,0]], [0,1] => :items, [0,2] => :submit, } @css_map = { 2 => 'padded' } end super end |
#items(model) ⇒ Object
188 189 190 |
# File 'lib/ydim/html/view/invoice.rb', line 188 def items(model) ItemList.new(model.items, @session, self) end |
#pdf(model) ⇒ Object
191 192 193 194 195 196 |
# File 'lib/ydim/html/view/invoice.rb', line 191 def pdf(model) = HtmlGrid::Button.new(:pdf, model, @session, self) url = @lookandfeel._event_url(:pdf, {:unique_id => model.unique_id}) .set_attribute('onClick', "document.location.href='#{url}'") end |
#send_invoice(model) ⇒ Object
197 198 199 |
# File 'lib/ydim/html/view/invoice.rb', line 197 def send_invoice(model) (:send_invoice, model) end |