diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e9f2c2e96..439e74a8e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -76,6 +76,7 @@ job_integration_twitter: stage: test tags: - core + - twitter script: - export RAILS_ENV=test - rake db:drop; diff --git a/Gemfile b/Gemfile index 171b39718..584dd0716 100644 --- a/Gemfile +++ b/Gemfile @@ -38,6 +38,7 @@ gem 'twitter' gem 'koala' gem 'mail' gem 'email_verifier' +gem 'htmlentities' gem 'mime-types' diff --git a/Gemfile.lock b/Gemfile.lock index 3044c2e01..a15890d47 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -120,6 +120,7 @@ GEM guard-compat (~> 1.0) multi_json (~> 1.8) hashie (3.4.3) + htmlentities (4.3.4) http (1.0.2) addressable (~> 2.3) http-cookie (~> 1.0) @@ -341,6 +342,7 @@ DEPENDENCIES execjs guard (>= 2.2.2) guard-livereload + htmlentities icalendar json koala diff --git a/app/assets/javascripts/app/controllers/_dashboard/first_steps_clues.coffee b/app/assets/javascripts/app/controllers/_dashboard/first_steps_clues.coffee index db2f3cb78..970be7da8 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/first_steps_clues.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/first_steps_clues.coffee @@ -1,18 +1,22 @@ class App.FirstStepsClues extends App.Controller clues: [ + { + container: '.js-dashboardMenuItem' + headline: 'Dashboard' + text: 'Here you see a quick overview about your and other agents performance.' + actions: [ + 'hover' + ] + } { container: '.search-holder' headline: 'Search' - text: 'Here you can search for ticket, customers and organizations. To find everything use the *-Placeholder' - #headline: 'Suche' - #text: 'Um alles zu finden nutze den *-Platzhalter' + text: 'Here you can search for ticket, customers and organizations. To find everything use the §*§-Placeholder' } { container: '.user-menu' headline: 'Create' text: 'Here you can create new tickets. Also if you have the permissions you can create new customers and organizations.' - #headline: 'Erstellen' - #text: 'Hier kannst du Tickets, Kunden und Organisationen anlegen.' actions: [ 'click .add .js-action', 'hover .add' @@ -22,8 +26,6 @@ class App.FirstStepsClues extends App.Controller container: '.user-menu' headline: 'Personal Settings' text: 'Here you can sign out, change the frontend language or see your latest views items.' - #headline: 'Persönliches Menü' - #text: 'Hier findest du den Logout, den Weg zu deinen Einstellungen und deinen Verlauf.' actions: [ 'click .user .js-action', 'hover .user' @@ -33,18 +35,6 @@ class App.FirstStepsClues extends App.Controller container: '.js-overviewsMenuItem' headline: 'Overviews' text: 'Here you find your ticket overviews for open, my assigned or escalated tickets.' - #headline: 'Übersichten' - #text: 'Hier findest du eine Liste aller Tickets.' - actions: [ - 'hover' - ] - } - { - container: '.js-dashboardMenuItem' - headline: 'Dashboard' - text: 'Here you see a quick overview about your and other agents performance.' - #headline: 'Dashboard' - #text: 'Hier siehst du auf einem Blick ob sich alle Agenten an die Spielregeln halten.' actions: [ 'hover' ] @@ -78,8 +68,6 @@ class App.FirstStepsClues extends App.Controller onComplete: a callback for when the user is done ### - - @options.onComplete = -> null @position = 0 @render() @@ -235,7 +223,7 @@ class App.FirstStepsClues extends App.Controller left = maxWidth - modal.width if top < 0 - moveArrow = modal.height/2 + height + moveArrow = modal.height/2 + top top = 0 else if top + modal.height > maxHeight moveArrow = modal.height/2 + maxHeight - (top + modal.height) diff --git a/app/assets/javascripts/app/controllers/dashboard.coffee b/app/assets/javascripts/app/controllers/dashboard.coffee index 57e0e9e9f..606a9f3dd 100644 --- a/app/assets/javascripts/app/controllers/dashboard.coffee +++ b/app/assets/javascripts/app/controllers/dashboard.coffee @@ -1,4 +1,5 @@ class App.Dashboard extends App.Controller + clueAccess: true events: 'click .tabs .tab': 'toggle' 'click .intro': 'clues' @@ -7,7 +8,7 @@ class App.Dashboard extends App.Controller super if @isRole('Customer') - @navigate '#', true + @clueAccess = false return # render page @@ -18,6 +19,8 @@ class App.Dashboard extends App.Controller return if !@authenticate(true) @render() + @mayBeClues() + render: -> @html App.view('dashboard')( @@ -34,14 +37,34 @@ class App.Dashboard extends App.Controller limit: 25 ) + mayBeClues: => + return if !@clueAccess + return if !@activeState + preferences = @Session.get('preferences') + @clueAccess = false + return if preferences['intro'] + @clues() + clues: (e) => - e.preventDefault() + @clueAccess = false + if e + e.preventDefault() new App.FirstStepsClues( el: @el + onComplete: => + @ajax( + id: 'preferences' + type: 'PUT' + url: @apiPath + '/users/preferences' + data: JSON.stringify({user:{intro:true}}) + processData: true + ) ) active: (state) => @activeState = state + if state + @mayBeClues() isActive: => @activeState @@ -51,6 +74,10 @@ class App.Dashboard extends App.Controller show: (params) => + if @isRole('Customer') + @navigate '#', true + return + # set title @title 'Dashboard' diff --git a/app/assets/javascripts/app/controllers/import_zendesk.coffee b/app/assets/javascripts/app/controllers/import_zendesk.coffee index a94f5631c..e0f1519cc 100644 --- a/app/assets/javascripts/app/controllers/import_zendesk.coffee +++ b/app/assets/javascripts/app/controllers/import_zendesk.coffee @@ -151,7 +151,11 @@ class Index extends App.ControllerContent success: (data, status, xhr) => if data.result is 'import_done' - window.location.reload() + delay = 0 + if @Config.get('developer_mode') is true + delay = 5000 + + @delay(window.location.reload, delay) return if data.result is 'error' diff --git a/app/assets/javascripts/app/lib/app_post/i18n.coffee b/app/assets/javascripts/app/lib/app_post/i18n.coffee index f0b1ba8c7..6183be418 100644 --- a/app/assets/javascripts/app/lib/app_post/i18n.coffee +++ b/app/assets/javascripts/app/lib/app_post/i18n.coffee @@ -184,6 +184,12 @@ class _i18nSingleton extends Spine.Module translated = App.Utils.htmlEscape(@translate(string, args)) + # apply inline markup + translated + .replace(/\*(.+?)\*/gm, '$1') + .replace(/_(.+?)_/gm, '$1') + .replace(/§(.+?)§/gm, '$1') + translatePlain: (string, args) => @translate(string, args) diff --git a/app/assets/javascripts/app/lib/base/jquery.textmodule.js b/app/assets/javascripts/app/lib/base/jquery.textmodule.js index 21ea38609..0165f988a 100644 --- a/app/assets/javascripts/app/lib/base/jquery.textmodule.js +++ b/app/assets/javascripts/app/lib/base/jquery.textmodule.js @@ -367,14 +367,6 @@ this.$widget.find('ul').html('') this.log('result', term, result) - if (!result[0]) { - result = [{id:'', name: '-'}] - } - - if (!this.active) { - this.open() - } - var elements = $() for (var i = 0; i < result.length; i++) { @@ -383,7 +375,7 @@ element.attr('data-id', item.id) element.text(App.Utils.htmlEscape(item.name)) element.addClass('u-clickable u-textTruncate') - if (i == result.length-1 && item.id != '') { + if (i == result.length-1) { element.addClass('is-active') } if (item.keywords) { diff --git a/app/assets/javascripts/app/views/dashboard/first_steps_clues_content.jst.eco b/app/assets/javascripts/app/views/dashboard/first_steps_clues_content.jst.eco index 3dd37d1d4..d05b95e31 100644 --- a/app/assets/javascripts/app/views/dashboard/first_steps_clues_content.jst.eco +++ b/app/assets/javascripts/app/views/dashboard/first_steps_clues_content.jst.eco @@ -4,7 +4,7 @@ <%- @Icon('diagonal-cross') %> - +