Refactoring of modal api.

This commit is contained in:
Martin Edenhofer 2014-09-16 23:50:00 +02:00
parent 6f05bf7c61
commit 62987c82e8
2 changed files with 7 additions and 26 deletions

View file

@ -1,26 +1,24 @@
class App.TicketCustomer extends App.ControllerModal class App.TicketCustomer extends App.ControllerModal
constructor: -> constructor: ->
super super
@render()
render: ->
configure_attributes = [ configure_attributes = [
{ name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 100, null: false, relation: 'User', class: 'span5', autocapitalize: false, help: 'Select the new customer of the Ticket.', source: @apiPath + '/users/search', minLengt: 2 }, { name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 100, null: false, relation: 'User', class: 'span5', autocapitalize: false, help: 'Select the new customer of the Ticket.', source: @apiPath + '/users/search', minLengt: 2 },
] ]
@html App.view('agent_ticket_customer')() controller = new App.ControllerForm(
new App.ControllerForm(
el: @el.find('#form-customer'),
model: { model: {
configure_attributes: configure_attributes, configure_attributes: configure_attributes,
className: 'update', className: 'update',
}, },
autofocus: true, autofocus: true,
) )
@hide() @head = 'Change Customer'
@close = true
@cancel = true
@button = true
@show( controller.form )
submit: (e) => onSubmit: (e) =>
e.preventDefault() e.preventDefault()
params = @formParam(e.target) params = @formParam(e.target)

View file

@ -1,17 +0,0 @@
<form>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div class="modal-close js-close">
<div class="close icon"></div>
</div>
<h1 class="modal-title"><%- @T( 'Change Customer' ) %></h1>
</div>
<div class="modal-body" id="form-customer"></div>
<div class="modal-footer horizontal">
<a class="subtle-link standalone js-cancel" href="#/"><%- @T( 'Cancel & Go Back' ) %></a>
<button type="submit" class="btn btn-create js-submit align-right"><%- @T( 'Submit' ) %></button>
</div>
</div>
</div>
</form>