diff --git a/app/assets/javascripts/app/controllers/_application_controller.coffee b/app/assets/javascripts/app/controllers/_application_controller.coffee
index 9f4df144b..a5d83313b 100644
--- a/app/assets/javascripts/app/controllers/_application_controller.coffee
+++ b/app/assets/javascripts/app/controllers/_application_controller.coffee
@@ -637,6 +637,7 @@ class App.ControllerModal extends App.Controller
buttonSubmit: true
headPrefix: ''
shown: true
+ closeOnAnyClick: false
events:
'submit form': 'submit'
@@ -724,6 +725,11 @@ class App.ControllerModal extends App.Controller
@onClosed()
$('.modal').remove()
+ if @closeOnAnyClick
+ @el.on('click', =>
+ @close()
+ )
+
close: (e) =>
if e
e.preventDefault()
diff --git a/app/assets/javascripts/app/controllers/_dashboard/first_steps.coffee b/app/assets/javascripts/app/controllers/_dashboard/first_steps.coffee
index 13378ec1f..93bb301cf 100644
--- a/app/assets/javascripts/app/controllers/_dashboard/first_steps.coffee
+++ b/app/assets/javascripts/app/controllers/_dashboard/first_steps.coffee
@@ -1,19 +1,23 @@
class App.DashboardFirstSteps extends App.Controller
events:
'click a': 'scrollIntoView'
+ 'click .js-testTicket': 'testTicket'
'click .js-inviteAgent': 'inviteAgent'
'click .js-inviteCustomer': 'inviteCustomer'
constructor: ->
super
- @load()
+ @interval(@load, 35000)
load: =>
+ return if @lastData && !@el.is(':visible')
@ajax(
id: 'first_steps'
type: 'GET'
url: @apiPath + '/first_steps'
success: (data) =>
+ return if _.isEqual(@lastData, data)
+ @lastData = data
@render(data)
)
@@ -31,20 +35,63 @@ class App.DashboardFirstSteps extends App.Controller
@scrollToIfNeeded(element)
@delay(delay, 40)
- inviteAgent: (e) =>
+ inviteAgent: (e) ->
e.preventDefault()
new App.InviteUser(
- container: @el.closest('.content')
+ #container: @el.closest('.content')
head: 'Invite Colleagues'
screen: 'invite_agent'
role: 'Agent'
)
- inviteCustomer: (e) =>
+ inviteCustomer: (e) ->
e.preventDefault()
new App.InviteUser(
- container: @el.closest('.content')
+ #container: @el.closest('.content')
head: 'Invite Customer'
screen: 'invite_customer'
role: 'Customer'
)
+
+ testTicketLoading: =>
+ template = App.view('dashboard/first_steps_test_ticket_loading')()
+ create = =>
+ @ajax(
+ id: 'test_ticket'
+ type: 'POST'
+ url: @apiPath + '/first_steps/test_ticket'
+ processData: true
+ success: (data) =>
+ App.Collection.loadAssets(data.assets)
+ ticket = App.Ticket.fullLocal(data.ticket_id)
+ overview = App.Overview.fullLocal(data.overview_id)
+
+ finish = @testTicketFinish(
+ overviewName: App.i18n.translatePlain(overview.name)
+ overviewUrl: overview.uiUrl()
+ ticketUrl: ticket.uiUrl()
+ ticketNumber: ticket.number
+ )
+ $('.modal .modal-body').html(finish)
+ )
+ @delay(create, 1800)
+ template
+
+ testTicketFinish: (data) ->
+ App.view('dashboard/first_steps_test_ticket_finish')(data)
+
+ testTicket: (e) =>
+ e.preventDefault()
+
+ modal = new App.ControllerModal(
+ head: 'Test Ticket'
+ #container: @el.parents('.content')
+ content: @testTicketLoading
+ shown: true
+ buttonSubmit: false
+ buttonCancel: false
+ small: true
+ closeOnAnyClick: true
+ onSubmit: ->
+ modal.close()
+ )
diff --git a/app/assets/javascripts/app/lib/app_post/i18n.coffee b/app/assets/javascripts/app/lib/app_post/i18n.coffee
index 776bae199..9dd04d535 100644
--- a/app/assets/javascripts/app/lib/app_post/i18n.coffee
+++ b/app/assets/javascripts/app/lib/app_post/i18n.coffee
@@ -227,15 +227,19 @@ class _i18nSingleton extends Spine.Module
.replace(/\/\/(.+?)\/\//gm, '$1')
.replace(/§(.+?)§/gm, '$1')
- # search %s
+ # search %s|%l
if args
for arg in args
- if quote
- argNew = App.Utils.htmlEscape(arg)
- else
- argNew = arg
-
- translated = translated.replace(/%s/, argNew)
+ translated = translated.replace(/%(s|l)/, (match) ->
+ if match is '%s'
+ if quote
+ argNew = App.Utils.htmlEscape(arg)
+ else
+ argNew = arg
+ argNew
+ else
+ "🔗"
+ )
@log 'debug', 'translate', string, args, translated
diff --git a/app/assets/javascripts/app/models/overview.coffee b/app/assets/javascripts/app/models/overview.coffee
index 759a99741..9f78efae3 100644
--- a/app/assets/javascripts/app/models/overview.coffee
+++ b/app/assets/javascripts/app/models/overview.coffee
@@ -149,3 +149,6 @@ class App.Overview extends App.Model
Sie können auch individuelle Übersichten für einzelne Agenten oder agenten Gruppen erstellen.
'''
+
+ uiUrl: ->
+ '#ticket/view/' + @link
diff --git a/app/assets/javascripts/app/views/dashboard/first_steps_test_ticket_finish.jst.eco b/app/assets/javascripts/app/views/dashboard/first_steps_test_ticket_finish.jst.eco
new file mode 100644
index 000000000..3c10a91a3
--- /dev/null
+++ b/app/assets/javascripts/app/views/dashboard/first_steps_test_ticket_finish.jst.eco
@@ -0,0 +1,2 @@
+
<%- @T('A Test Ticket has been created, you can find it in your overview |"%s"|', @overviewName) %>
+<%- @T('To open and work on it, click on the Ticket |#%s| directly %l or in the overview |"%s"| %l and click on the Ticket.', @ticketNumber, @ticketUrl, @overviewName, @overviewUrl) %>
\ No newline at end of file diff --git a/app/assets/javascripts/app/views/dashboard/first_steps_test_ticket_loading.jst.eco b/app/assets/javascripts/app/views/dashboard/first_steps_test_ticket_loading.jst.eco new file mode 100644 index 000000000..703303a53 --- /dev/null +++ b/app/assets/javascripts/app/views/dashboard/first_steps_test_ticket_loading.jst.eco @@ -0,0 +1,5 @@ ++ +
+Hallo <%= d 'agent.firstname' %>,
+dies ist ein Test Ticket. Ich bin ein Kunde und benötige Hilfe! :)
+<%= d 'customer.fullname' %>
+Das Zammad Projekt
diff --git a/app/views/mailer/test_ticket/en.html.erb b/app/views/mailer/test_ticket/en.html.erb new file mode 100644 index 000000000..b3443445d --- /dev/null +++ b/app/views/mailer/test_ticket/en.html.erb @@ -0,0 +1,9 @@ +Test Ticket! + +Dear <%= d 'agent.firstname' %>,
+this is a Test Ticket. I'm a customer and I need some help! :)
+<%= d 'customer.fullname' %>
+The Zammad Project
diff --git a/config/routes/first_steps.rb b/config/routes/first_steps.rb index 77015674c..ec40d165e 100644 --- a/config/routes/first_steps.rb +++ b/config/routes/first_steps.rb @@ -1,6 +1,7 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path - match api_path + '/first_steps', to: 'first_steps#index', via: :get + match api_path + '/first_steps', to: 'first_steps#index', via: :get + match api_path + '/first_steps/test_ticket', to: 'first_steps#test_ticket', via: :post end diff --git a/db/seeds.rb b/db/seeds.rb index d0cd392ce..a2093afbe 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1589,7 +1589,7 @@ user = User.create_if_not_exists( ) UserInfo.current_user_id = 1 -roles = Role.where( name: 'Customer' ) +roles = Role.find_by(name: 'Customer') organizations = Organization.all groups = Group.all org_community = Organization.create_if_not_exists( @@ -1608,48 +1608,48 @@ user_community = User.create_or_update( organization_id: org_community.id, ) -Link::Type.create_if_not_exists( id: 1, name: 'normal' ) -Link::Object.create_if_not_exists( id: 1, name: 'Ticket' ) -Link::Object.create_if_not_exists( id: 2, name: 'Announcement' ) -Link::Object.create_if_not_exists( id: 3, name: 'Question/Answer' ) -Link::Object.create_if_not_exists( id: 4, name: 'Idea' ) -Link::Object.create_if_not_exists( id: 5, name: 'Bug' ) +Link::Type.create_if_not_exists(id: 1, name: 'normal') +Link::Object.create_if_not_exists(id: 1, name: 'Ticket') +Link::Object.create_if_not_exists(id: 2, name: 'Announcement') +Link::Object.create_if_not_exists(id: 3, name: 'Question/Answer') +Link::Object.create_if_not_exists(id: 4, name: 'Idea') +Link::Object.create_if_not_exists(id: 5, name: 'Bug') -Ticket::StateType.create_if_not_exists( id: 1, name: 'new' ) -Ticket::StateType.create_if_not_exists( id: 2, name: 'open' ) -Ticket::StateType.create_if_not_exists( id: 3, name: 'pending reminder' ) -Ticket::StateType.create_if_not_exists( id: 4, name: 'pending action' ) -Ticket::StateType.create_if_not_exists( id: 5, name: 'closed' ) -Ticket::StateType.create_if_not_exists( id: 6, name: 'merged' ) -Ticket::StateType.create_if_not_exists( id: 7, name: 'removed' ) +Ticket::StateType.create_if_not_exists(id: 1, name: 'new' ) +Ticket::StateType.create_if_not_exists(id: 2, name: 'open' ) +Ticket::StateType.create_if_not_exists(id: 3, name: 'pending reminder') +Ticket::StateType.create_if_not_exists(id: 4, name: 'pending action') +Ticket::StateType.create_if_not_exists(id: 5, name: 'closed') +Ticket::StateType.create_if_not_exists(id: 6, name: 'merged') +Ticket::StateType.create_if_not_exists(id: 7, name: 'removed') -Ticket::State.create_if_not_exists( id: 1, name: 'new', state_type_id: Ticket::StateType.find_by(name: 'new').id, ) -Ticket::State.create_if_not_exists( id: 2, name: 'open', state_type_id: Ticket::StateType.find_by(name: 'open').id ) -Ticket::State.create_if_not_exists( id: 3, name: 'pending reminder', state_type_id: Ticket::StateType.find_by(name: 'pending reminder').id, ignore_escalation: true ) -Ticket::State.create_if_not_exists( id: 4, name: 'closed', state_type_id: Ticket::StateType.find_by(name: 'closed').id, ignore_escalation: true ) -Ticket::State.create_if_not_exists( id: 5, name: 'merged', state_type_id: Ticket::StateType.find_by(name: 'merged').id, ignore_escalation: true ) -Ticket::State.create_if_not_exists( id: 6, name: 'removed', state_type_id: Ticket::StateType.find_by(name: 'removed').id, active: false, ignore_escalation: true ) -Ticket::State.create_if_not_exists( id: 7, name: 'pending close', state_type_id: Ticket::StateType.find_by(name: 'pending action').id, next_state_id: 4, ignore_escalation: true ) +Ticket::State.create_if_not_exists(id: 1, name: 'new', state_type_id: Ticket::StateType.find_by(name: 'new').id, ) +Ticket::State.create_if_not_exists(id: 2, name: 'open', state_type_id: Ticket::StateType.find_by(name: 'open').id) +Ticket::State.create_if_not_exists(id: 3, name: 'pending reminder', state_type_id: Ticket::StateType.find_by(name: 'pending reminder').id, ignore_escalation: true) +Ticket::State.create_if_not_exists(id: 4, name: 'closed', state_type_id: Ticket::StateType.find_by(name: 'closed').id, ignore_escalation: true) +Ticket::State.create_if_not_exists(id: 5, name: 'merged', state_type_id: Ticket::StateType.find_by(name: 'merged').id, ignore_escalation: true) +Ticket::State.create_if_not_exists(id: 6, name: 'removed', state_type_id: Ticket::StateType.find_by(name: 'removed').id, active: false, ignore_escalation: true) +Ticket::State.create_if_not_exists(id: 7, name: 'pending close', state_type_id: Ticket::StateType.find_by(name: 'pending action').id, next_state_id: 4, ignore_escalation: true) -Ticket::Priority.create_if_not_exists( id: 1, name: '1 low' ) -Ticket::Priority.create_if_not_exists( id: 2, name: '2 normal' ) -Ticket::Priority.create_if_not_exists( id: 3, name: '3 high' ) +Ticket::Priority.create_if_not_exists(id: 1, name: '1 low') +Ticket::Priority.create_if_not_exists(id: 2, name: '2 normal') +Ticket::Priority.create_if_not_exists(id: 3, name: '3 high') -Ticket::Article::Type.create_if_not_exists( id: 1, name: 'email', communication: true ) -Ticket::Article::Type.create_if_not_exists( id: 2, name: 'sms', communication: true ) -Ticket::Article::Type.create_if_not_exists( id: 3, name: 'chat', communication: true ) -Ticket::Article::Type.create_if_not_exists( id: 4, name: 'fax', communication: true ) -Ticket::Article::Type.create_if_not_exists( id: 5, name: 'phone', communication: true ) -Ticket::Article::Type.create_if_not_exists( id: 6, name: 'twitter status', communication: true ) -Ticket::Article::Type.create_if_not_exists( id: 7, name: 'twitter direct-message', communication: true ) -Ticket::Article::Type.create_if_not_exists( id: 8, name: 'facebook feed post', communication: true ) -Ticket::Article::Type.create_if_not_exists( id: 9, name: 'facebook feed comment', communication: true ) -Ticket::Article::Type.create_if_not_exists( id: 10, name: 'note', communication: false ) -Ticket::Article::Type.create_if_not_exists( id: 11, name: 'web', communication: true ) +Ticket::Article::Type.create_if_not_exists(id: 1, name: 'email', communication: true) +Ticket::Article::Type.create_if_not_exists(id: 2, name: 'sms', communication: true) +Ticket::Article::Type.create_if_not_exists(id: 3, name: 'chat', communication: true) +Ticket::Article::Type.create_if_not_exists(id: 4, name: 'fax', communication: true) +Ticket::Article::Type.create_if_not_exists(id: 5, name: 'phone', communication: true) +Ticket::Article::Type.create_if_not_exists(id: 6, name: 'twitter status', communication: true) +Ticket::Article::Type.create_if_not_exists(id: 7, name: 'twitter direct-message', communication: true) +Ticket::Article::Type.create_if_not_exists(id: 8, name: 'facebook feed post', communication: true) +Ticket::Article::Type.create_if_not_exists(id: 9, name: 'facebook feed comment', communication: true) +Ticket::Article::Type.create_if_not_exists(id: 10, name: 'note', communication: false) +Ticket::Article::Type.create_if_not_exists(id: 11, name: 'web', communication: true) -Ticket::Article::Sender.create_if_not_exists( id: 1, name: 'Agent' ) -Ticket::Article::Sender.create_if_not_exists( id: 2, name: 'Customer' ) -Ticket::Article::Sender.create_if_not_exists( id: 3, name: 'System' ) +Ticket::Article::Sender.create_if_not_exists(id: 1, name: 'Agent') +Ticket::Article::Sender.create_if_not_exists(id: 2, name: 'Customer') +Ticket::Article::Sender.create_if_not_exists(id: 3, name: 'System') Macro.create_if_not_exists( name: 'Close & Tag as Spam', @@ -1668,21 +1668,21 @@ Macro.create_if_not_exists( UserInfo.current_user_id = user_community.id ticket = Ticket.create( - group_id: Group.where( name: 'Users' ).first.id, - customer_id: User.where( login: 'nicole.braun@zammad.org' ).first.id, - owner_id: User.where( login: '-' ).first.id, + group_id: Group.find_by(name: 'Users').id, + customer_id: User.find_by(login: 'nicole.braun@zammad.org').id, + owner_id: User.find_by(login: '-').id, title: 'Welcome to Zammad!', - state_id: Ticket::State.where( name: 'new' ).first.id, - priority_id: Ticket::Priority.where( name: '2 normal' ).first.id, + state_id: Ticket::State.find_by(name: 'new').id, + priority_id: Ticket::Priority.find_by(name: '2 normal').id, ) Ticket::Article.create( ticket_id: ticket.id, - type_id: Ticket::Article::Type.where(name: 'phone' ).first.id, - sender_id: Ticket::Article::Sender.where(name: 'Customer' ).first.id, + type_id: Ticket::Article::Type.find_by(name: 'phone').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, from: 'Zammad Feedback