Browse Source

Refactoring of modal api.

Martin Edenhofer 10 years ago
parent
commit
62987c82e8

+ 7 - 9
app/assets/javascripts/app/controllers/ticket_customer.js.coffee

@@ -1,26 +1,24 @@
 class App.TicketCustomer extends App.ControllerModal
   constructor: ->
     super
-    @render()
-
-  render: ->
     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 },
     ]
 
-    @html App.view('agent_ticket_customer')()
-
-    new App.ControllerForm(
-      el: @el.find('#form-customer'),
+    controller = new App.ControllerForm(
       model: {
         configure_attributes: configure_attributes,
         className:            'update',
       },
       autofocus: true,
     )
-    @hide()
+    @head   = 'Change Customer'
+    @close  = true
+    @cancel = true
+    @button = true
+    @show( controller.form )
 
-  submit: (e) =>
+  onSubmit: (e) =>
     e.preventDefault()
 
     params = @formParam(e.target)

+ 0 - 17
app/assets/javascripts/app/views/agent_ticket_customer.jst.eco

@@ -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>