Merge branch 'develop' of github.com:martini/zammad into develop
This commit is contained in:
commit
0972180e57
4 changed files with 133 additions and 70 deletions
|
@ -42,29 +42,32 @@ class App.TicketCreate extends App.Controller
|
||||||
@buildScreen(params)
|
@buildScreen(params)
|
||||||
@bindId = App.TicketCreateCollection.one(load)
|
@bindId = App.TicketCreateCollection.one(load)
|
||||||
|
|
||||||
changeFormType: (e) =>
|
currentChannel: =>
|
||||||
type = $(e.target).data('type')
|
|
||||||
if !type
|
if !type
|
||||||
type = $(e.target).parent().data('type')
|
type = @$('.type-tabs .tab.active').data('type')
|
||||||
|
if !type
|
||||||
|
type = @default_type
|
||||||
|
type
|
||||||
|
|
||||||
|
changeFormType: (e) =>
|
||||||
|
type = $(e.currentTarget).data('type')
|
||||||
@setFormTypeInUi(type)
|
@setFormTypeInUi(type)
|
||||||
|
|
||||||
setFormTypeInUi: (type) =>
|
setFormTypeInUi: (type) =>
|
||||||
|
|
||||||
# detect current form type
|
# detect current form type
|
||||||
if !type
|
if !type
|
||||||
type = @el.find('.type-tabs .tab.active').data('type')
|
type = @currentChannel()
|
||||||
if !type
|
|
||||||
type = @default_type
|
|
||||||
|
|
||||||
# reset all tabs
|
# reset all tabs
|
||||||
tabs = @el.find('.type-tabs .tab')
|
tabs = @$('.type-tabs .tab')
|
||||||
tabs.removeClass('active')
|
tabs.removeClass('active')
|
||||||
tabIcons = @el.find('.type-tabs .tab .icon')
|
tabIcons = @$('.type-tabs .tab .icon')
|
||||||
tabIcons.addClass('gray')
|
tabIcons.addClass('gray')
|
||||||
tabIcons.removeClass('white')
|
tabIcons.removeClass('white')
|
||||||
|
|
||||||
# set active tab
|
# set active tab
|
||||||
selectedTab = @el.find(".type-tabs .tab[data-type='#{type}']")
|
selectedTab = @$(".type-tabs .tab[data-type='#{type}']")
|
||||||
selectedTab.addClass('active')
|
selectedTab.addClass('active')
|
||||||
|
|
||||||
# set form type attributes
|
# set form type attributes
|
||||||
|
@ -87,16 +90,22 @@ class App.TicketCreate extends App.Controller
|
||||||
@articleAttributes = articleSenderTypeMap[type]
|
@articleAttributes = articleSenderTypeMap[type]
|
||||||
|
|
||||||
# update form
|
# update form
|
||||||
@el.find('[name="formSenderType"]').val(type)
|
@$('[name="formSenderType"]').val(type)
|
||||||
|
|
||||||
# force changing signature
|
# force changing signature
|
||||||
@el.find('[name="group_id"]').trigger('change')
|
@$('[name="group_id"]').trigger('change')
|
||||||
|
|
||||||
|
# show cc
|
||||||
|
if type is 'email-out'
|
||||||
|
@$('[name="cc"]').closest('.form-group').removeClass('hide')
|
||||||
|
else
|
||||||
|
@$('[name="cc"]').closest('.form-group').addClass('hide')
|
||||||
|
|
||||||
meta: =>
|
meta: =>
|
||||||
text = ''
|
text = ''
|
||||||
if @articleAttributes
|
if @articleAttributes
|
||||||
text = App.i18n.translateInline(@articleAttributes['title'])
|
text = App.i18n.translateInline(@articleAttributes['title'])
|
||||||
title = @el.find('[name=title]').val()
|
title = @$('[name=title]').val()
|
||||||
if title
|
if title
|
||||||
text = "#{text}: #{title}"
|
text = "#{text}: #{title}"
|
||||||
meta =
|
meta =
|
||||||
|
@ -107,20 +116,20 @@ class App.TicketCreate extends App.Controller
|
||||||
iconClass: 'pen'
|
iconClass: 'pen'
|
||||||
|
|
||||||
url: =>
|
url: =>
|
||||||
'#ticket/create/id/' + @id
|
"#ticket/create/id/#{@id}"
|
||||||
|
|
||||||
show: =>
|
show: =>
|
||||||
@navupdate '#'
|
@navupdate '#'
|
||||||
|
|
||||||
changed: =>
|
changed: =>
|
||||||
formCurrent = @formParam( @el.find('.ticket-create') )
|
formCurrent = @formParam( @$('.ticket-create') )
|
||||||
diff = difference(@formDefault, formCurrent)
|
diff = difference(@formDefault, formCurrent)
|
||||||
return false if !diff || _.isEmpty(diff)
|
return false if !diff || _.isEmpty(diff)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
autosave: =>
|
autosave: =>
|
||||||
update = =>
|
update = =>
|
||||||
data = @formParam( @el.find('.ticket-create') )
|
data = @formParam(@$('.ticket-create'))
|
||||||
diff = difference(@autosaveLast, data)
|
diff = difference(@autosaveLast, data)
|
||||||
if !@autosaveLast || (diff && !_.isEmpty(diff))
|
if !@autosaveLast || (diff && !_.isEmpty(diff))
|
||||||
@autosaveLast = data
|
@autosaveLast = data
|
||||||
|
@ -226,7 +235,7 @@ class App.TicketCreate extends App.Controller
|
||||||
@$('[data-name="body"]').find('[data-signature=true]').remove()
|
@$('[data-name="body"]').find('[data-signature=true]').remove()
|
||||||
|
|
||||||
new App.ControllerForm(
|
new App.ControllerForm(
|
||||||
el: @el.find('.ticket-form-top')
|
el: @$('.ticket-form-top')
|
||||||
form_id: @form_id
|
form_id: @form_id
|
||||||
model: App.Ticket
|
model: App.Ticket
|
||||||
screen: 'create_top'
|
screen: 'create_top'
|
||||||
|
@ -242,14 +251,14 @@ class App.TicketCreate extends App.Controller
|
||||||
)
|
)
|
||||||
|
|
||||||
new App.ControllerForm(
|
new App.ControllerForm(
|
||||||
el: @el.find('.article-form-top')
|
el: @$('.article-form-top')
|
||||||
form_id: @form_id
|
form_id: @form_id
|
||||||
model: App.TicketArticle
|
model: App.TicketArticle
|
||||||
screen: 'create_top'
|
screen: 'create_top'
|
||||||
params: params
|
params: params
|
||||||
)
|
)
|
||||||
new App.ControllerForm(
|
new App.ControllerForm(
|
||||||
el: @el.find('.ticket-form-middle')
|
el: @$('.ticket-form-middle')
|
||||||
form_id: @form_id
|
form_id: @form_id
|
||||||
model: App.Ticket
|
model: App.Ticket
|
||||||
screen: 'create_middle'
|
screen: 'create_middle'
|
||||||
|
@ -264,7 +273,7 @@ class App.TicketCreate extends App.Controller
|
||||||
noFieldset: true
|
noFieldset: true
|
||||||
)
|
)
|
||||||
new App.ControllerForm(
|
new App.ControllerForm(
|
||||||
el: @el.find('.ticket-form-bottom')
|
el: @$('.ticket-form-bottom')
|
||||||
form_id: @form_id
|
form_id: @form_id
|
||||||
model: App.Ticket
|
model: App.Ticket
|
||||||
screen: 'create_bottom'
|
screen: 'create_bottom'
|
||||||
|
@ -282,11 +291,11 @@ class App.TicketCreate extends App.Controller
|
||||||
@setFormTypeInUi( params['formSenderType'] )
|
@setFormTypeInUi( params['formSenderType'] )
|
||||||
|
|
||||||
# remember form params of init load
|
# remember form params of init load
|
||||||
@formDefault = @formParam( @el.find('.ticket-create') )
|
@formDefault = @formParam( @$('.ticket-create') )
|
||||||
|
|
||||||
# show text module UI
|
# show text module UI
|
||||||
@textModule = new App.WidgetTextModule(
|
@textModule = new App.WidgetTextModule(
|
||||||
el: @el.find('[data-name="body"]').parent()
|
el: @$('[data-name="body"]').parent()
|
||||||
)
|
)
|
||||||
|
|
||||||
new Sidebar(
|
new Sidebar(
|
||||||
|
@ -337,6 +346,10 @@ class App.TicketCreate extends App.Controller
|
||||||
if params.group_id
|
if params.group_id
|
||||||
group = App.Group.find(params.group_id)
|
group = App.Group.find(params.group_id)
|
||||||
|
|
||||||
|
# allow cc only on email tickets
|
||||||
|
if @currentChannel() isnt 'email-out'
|
||||||
|
delete params.cc
|
||||||
|
|
||||||
# create article
|
# create article
|
||||||
if sender.name is 'Customer'
|
if sender.name is 'Customer'
|
||||||
params['article'] = {
|
params['article'] = {
|
||||||
|
@ -569,7 +582,7 @@ class Router extends App.ControllerPermanent
|
||||||
id: params.id
|
id: params.id
|
||||||
|
|
||||||
App.TaskManager.execute(
|
App.TaskManager.execute(
|
||||||
key: 'TicketCreateScreen-' + params['id']
|
key: "TicketCreateScreen-#{params['id']}"
|
||||||
controller: 'TicketCreate'
|
controller: 'TicketCreate'
|
||||||
params: clean_params
|
params: clean_params
|
||||||
show: true
|
show: true
|
||||||
|
|
32
db/migrate/20160303000001_email_ticket_cc.rb
Normal file
32
db/migrate/20160303000001_email_ticket_cc.rb
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
class EmailTicketCc < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
ObjectManager::Attribute.add(
|
||||||
|
object: 'Ticket',
|
||||||
|
name: 'cc',
|
||||||
|
display: 'Cc',
|
||||||
|
data_type: 'input',
|
||||||
|
data_option: {
|
||||||
|
type: 'text',
|
||||||
|
maxlength: 1000,
|
||||||
|
null: true,
|
||||||
|
},
|
||||||
|
editable: false,
|
||||||
|
active: true,
|
||||||
|
screens: {
|
||||||
|
create_top: {
|
||||||
|
Agent: {
|
||||||
|
null: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
create_middle: {},
|
||||||
|
edit: {}
|
||||||
|
},
|
||||||
|
pending_migration: false,
|
||||||
|
position: 11,
|
||||||
|
created_by_id: 1,
|
||||||
|
updated_by_id: 1,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
33
db/seeds.rb
33
db/seeds.rb
|
@ -2113,7 +2113,30 @@ ObjectManager::Attribute.add(
|
||||||
pending_migration: false,
|
pending_migration: false,
|
||||||
position: 10,
|
position: 10,
|
||||||
)
|
)
|
||||||
|
ObjectManager::Attribute.add(
|
||||||
|
object: 'Ticket',
|
||||||
|
name: 'cc',
|
||||||
|
display: 'Cc',
|
||||||
|
data_type: 'input',
|
||||||
|
data_option: {
|
||||||
|
type: 'text',
|
||||||
|
maxlength: 1000,
|
||||||
|
null: true,
|
||||||
|
},
|
||||||
|
editable: false,
|
||||||
|
active: true,
|
||||||
|
screens: {
|
||||||
|
create_top: {
|
||||||
|
Agent: {
|
||||||
|
null: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
create_middle: {},
|
||||||
|
edit: {}
|
||||||
|
},
|
||||||
|
pending_migration: false,
|
||||||
|
position: 11,
|
||||||
|
)
|
||||||
ObjectManager::Attribute.add(
|
ObjectManager::Attribute.add(
|
||||||
object: 'Ticket',
|
object: 'Ticket',
|
||||||
name: 'type',
|
name: 'type',
|
||||||
|
@ -2440,13 +2463,7 @@ ObjectManager::Attribute.add(
|
||||||
editable: false,
|
editable: false,
|
||||||
active: true,
|
active: true,
|
||||||
screens: {
|
screens: {
|
||||||
create_phone_in: {},
|
create_top: {},
|
||||||
create_phone_out: {},
|
|
||||||
create_email_out: {
|
|
||||||
'-all-' => {
|
|
||||||
null: true,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
create_middle: {},
|
create_middle: {},
|
||||||
edit: {
|
edit: {
|
||||||
Agent: {
|
Agent: {
|
||||||
|
|
|
@ -1256,6 +1256,7 @@ wait untill text in selector disabppears
|
||||||
data = params[:data]
|
data = params[:data]
|
||||||
|
|
||||||
instance.find_elements(css: 'a[href="#manage"]')[0].click
|
instance.find_elements(css: 'a[href="#manage"]')[0].click
|
||||||
|
sleep 0.2
|
||||||
instance.find_elements(css: 'a[href="#manage/overviews"]')[0].click
|
instance.find_elements(css: 'a[href="#manage/overviews"]')[0].click
|
||||||
sleep 0.2
|
sleep 0.2
|
||||||
instance.find_elements(css: '#content a[data-type="new"]')[0].click
|
instance.find_elements(css: '#content a[data-type="new"]')[0].click
|
||||||
|
|
Loading…
Reference in a new issue