Browse Source

Merge branch 'private-issue576' into develop

Martin Edenhofer 8 years ago
parent
commit
b9768edb54

+ 1 - 2
app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee

@@ -11,7 +11,6 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi
 
     updateDataMap = (localParams, localAttribute, localAttributes, localClassname, localForm, localA) =>
       localItem = localForm.closest('.js-data')
-      console.log('updateDataMap', attribute, params)
       element = $(App.view("object_manager/attribute/#{localParams.data_type}")(
         attribute: attribute
         params: params
@@ -49,7 +48,7 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi
     objects =
       Ticket:
         Customer:
-          create:
+          create_bottom:
             shown: true
             required: false
           edit:

+ 12 - 11
app/assets/javascripts/app/controllers/customer_ticket_create.coffee

@@ -68,17 +68,18 @@ class Index extends App.ControllerContent
       params:     defaults
       noFieldset: true
     )
-    #new App.ControllerForm(
-    #  el:       @el.find('.ticket-form-bottom')
-    #  form_id:  @form_id
-    #  model:    App.Ticket
-    #  screen:   'create_bottom'#@article_attributes['screen']
-    #  handlers: [
-    #    formChanges
-    #  ]
-    #  filter:    @formMeta.filter
-    #  params:    defaults
-    #)
+    if !_.isEmpty(App.Ticket.attributesGet('create_bottom', false, true))
+      new App.ControllerForm(
+        el:       @el.find('.ticket-form-bottom')
+        form_id:  @form_id
+        model:    App.Ticket
+        screen:   'create_bottom'
+        handlers: [
+          @ticketFormChanges
+        ]
+        filter:    @formMeta.filter
+        params:    defaults
+      )
 
     new App.ControllerDrox(
       el:   @el.find('.sidebar')

+ 2 - 2
app/assets/javascripts/app/models/_application_model.coffee

@@ -184,7 +184,7 @@ class App.Model extends Spine.Model
 
   ###
 
-  @attributesGet: (screen = undefined, attributes = false) ->
+  @attributesGet: (screen = undefined, attributes = false, noDefaultAttributes = false) ->
     if !attributes
       attributes = clone(App[ @.className ].configure_attributes, true)
     else
@@ -203,7 +203,7 @@ class App.Model extends Spine.Model
           attributesNew[ attribute.name ] = attribute
 
     # if no screen is given or no attribute has this screen - use default attributes
-    if !screen || _.isEmpty(attributesNew)
+    if (!screen || _.isEmpty(attributesNew)) && !noDefaultAttributes
       for attribute in attributes
         attributesNew[ attribute.name ] = attribute
 

+ 1 - 2
app/assets/javascripts/app/views/customer_ticket_create.jst.eco

@@ -3,7 +3,7 @@
     <div class="newTicket">
       <div class="box box--newTicket">
         <div class="page-header">
-          <h1><%- @T( 'New Ticket' ) %></h1>
+          <h1><%- @T('New Ticket') %></h1>
         </div>
 
         <div class="page-content">
@@ -18,7 +18,6 @@
               <div class="ticket-form-bottom"></div>
             </div>
 
-
             <div class="form-controls">
               <a class="btn btn--text btn--subtle js-cancel" href="#/"><%- @T( 'Cancel & Go Back' ) %></a>
               <button type="submit" class="btn btn--success js-submit align-right"><%- @T( 'Create' ) %></button>

+ 10 - 3
test/browser/customer_ticket_create_test.rb

@@ -28,6 +28,13 @@ class CustomerTicketCreateTest < TestCase
       css: '.newTicket [data-name="body"]',
       value: 'some body 123äöü',
     )
+    exists_not(
+      css: '.newTicket input[name="customer_id"]',
+    )
+    exists_not(
+      css: '.newTicket input[name="priority_id"]',
+    )
+
     click(css: '.newTicket button.js-submit')
     sleep 5
 
@@ -42,7 +49,7 @@ class CustomerTicketCreateTest < TestCase
 
     # update ticket
     set(
-      css: '.active [data-name="body"]',
+      css: '.content.active [data-name="body"]',
       value: 'some body 1234 äöüß',
       no_click: true,
     )
@@ -51,10 +58,10 @@ class CustomerTicketCreateTest < TestCase
       type: 'stayOnTab',
     )
 
-    click(css: '.active .js-submit')
+    click(css: '.content.active .js-submit')
 
     watch_for(
-      css: '.active div.ticket-article',
+      css: '.content.active div.ticket-article',
       value: 'some body 1234 äöüß',
     )
   end