diff --git a/app/assets/javascripts/app/controllers/agent_ticket_view.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_view.js.coffee index c51fdd6f3..7dd743702 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_view.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_view.js.coffee @@ -18,7 +18,7 @@ class Index extends App.Controller # set title @title '' - @navupdate '#ticket/view/' + @view + @navupdate '#ticket_view/' + @view @meta = {} @bulk = {} @@ -462,5 +462,5 @@ class Router extends App.Controller else @navigate 'ticket/zoom/' + @ticket_list[ @position - 1 ] + '/nav/true' -Config.Routes['ticket/view/:view/:position/:direction'] = Router -Config.Routes['ticket/view/:view'] = Index +Config.Routes['ticket_view/:view/:position/:direction'] = Router +Config.Routes['ticket_view/:view'] = Index diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index dcf281cf1..ceeb52461 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -136,17 +136,17 @@ class App.Navigation extends App.Controller # remove old views for key of Config.NavBar - if Config.NavBar[key].parent is '#ticket/view' + if Config.NavBar[key].parent is '#ticket_view' delete Config.NavBar[key] # add new views for item in data Config.NavBar['TicketOverview' + item.url] = { prio: item.prio, - parent: '#ticket/view', + parent: '#ticket_view', name: item.name, count: item.count, - target: '#ticket/view/' + item.url, + target: '#ticket_view/' + item.url, role: ['Agent'], } diff --git a/app/assets/javascripts/app/controllers/organizations.js.coffee b/app/assets/javascripts/app/controllers/organizations.js.coffee index c4cd9ee08..c8a9d74cf 100644 --- a/app/assets/javascripts/app/controllers/organizations.js.coffee +++ b/app/assets/javascripts/app/controllers/organizations.js.coffee @@ -49,11 +49,9 @@ Config.NavBar['SettingObject'] = { prio: 1700, parent: '#settings', name: 'Obj Config.NavBar['Packages'] = { prio: 1800, parent: '#settings', name: 'Packages', target: '#packages', role: ['Admin'] } -Config.NavBar['TicketOverview'] = { prio: 1000, parent: '', name: 'Overviews', target: '#ticket/view', role: ['Agent'] } -#Config.NavBar[''] = { prio: 1000, parent: '#ticket/view', name: 'My assigned Tickets (51)', target: '#ticket/view/my_assigned', role: ['Agent'] } -#Config.NavBar[''] = { prio: 1000, parent: '#ticket/view', name: 'Unassigned Tickets (133)', target: '#ticket/view/all_unassigned', role: ['Agent'] } -#Config.NavBar[''] = { prio: 1000, parent: '#ticket/view', name: 'Escalated Tickets (0)', target: '#ticket/view/all_escalated', role: ['Agent'] } -#Config.NavBar[''] = { prio: 1000, parent: '#ticket/view', name: 'My Pending reached Tickets (2)', target: '#ticket/view/my_pending_reached', role: ['Agent'] } +Config.NavBar['TicketOverview'] = { prio: 1000, parent: '', name: 'Overviews', target: '#ticket_view', role: ['Agent'] } +#Config.NavBar[''] = { prio: 1000, parent: '#ticket_view', name: 'My assigned Tickets (51)', target: '#ticket_view/my_assigned', role: ['Agent'] } +#Config.NavBar[''] = { prio: 1000, parent: '#ticket_view', name: 'Unassigned Tickets (133)', target: '#ticket_view/all_unassigned', role: ['Agent'] } #Config.NavBar['Network'] = { prio: 1500, parent: '', name: 'Networking', target: '#network', role: ['Anybody', 'Customer', 'Agent'] } diff --git a/app/assets/javascripts/app/index.js.coffee b/app/assets/javascripts/app/index.js.coffee index bd2e8f347..9c825cbe8 100644 --- a/app/assets/javascripts/app/index.js.coffee +++ b/app/assets/javascripts/app/index.js.coffee @@ -1,6 +1,6 @@ #s#= require json2 -#= require ./lib/jquery-1.7.2.min.js -#= require ./lib/ui/jquery-ui-1.8.18.custom.min.js +#= require ./lib/jquery-1.8.0.min.js +#= require ./lib/ui/jquery-ui-1.8.23.custom.min.js #= require ./lib/spine/spine.js #= require ./lib/spine/ajax.js diff --git a/app/assets/javascripts/app/lib/bootstrap-dropdown.js b/app/assets/javascripts/app/lib/bootstrap-dropdown.js index 48d3ce0f8..7b9356952 100644 --- a/app/assets/javascripts/app/lib/bootstrap-dropdown.js +++ b/app/assets/javascripts/app/lib/bootstrap-dropdown.js @@ -1,5 +1,5 @@ /* ============================================================ - * bootstrap-dropdown.js v2.0.0 + * bootstrap-dropdown.js v2.1.0 * http://twitter.github.com/bootstrap/javascript.html#dropdowns * ============================================================ * Copyright 2012 Twitter, Inc. @@ -18,15 +18,16 @@ * ============================================================ */ -!function( $ ){ +!function ($) { + + "use strict"; // jshint ;_; - "use strict" /* DROPDOWN CLASS DEFINITION * ========================= */ - var toggle = '[data-toggle="dropdown"]' - , Dropdown = function ( element ) { + var toggle = '[data-toggle=dropdown]' + , Dropdown = function (element) { var $el = $(element).on('click.dropdown.data-api', this.toggle) $('html').on('click.dropdown.data-api', function () { $el.parent().removeClass('open') @@ -37,39 +38,92 @@ constructor: Dropdown - , toggle: function ( e ) { + , toggle: function (e) { var $this = $(this) - , selector = $this.attr('data-target') , $parent , isActive - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } + if ($this.is('.disabled, :disabled')) return - $parent = $(selector) - $parent.length || ($parent = $this.parent()) + $parent = getParent($this) isActive = $parent.hasClass('open') clearMenus() - !isActive && $parent.toggleClass('open') + + if (!isActive) { + $parent.toggleClass('open') + $this.focus() + } return false } + , keydown: function (e) { + var $this + , $items + , $active + , $parent + , isActive + , index + + if (!/(38|40|27)/.test(e.keyCode)) return + + $this = $(this) + + e.preventDefault() + e.stopPropagation() + + if ($this.is('.disabled, :disabled')) return + + $parent = getParent($this) + + isActive = $parent.hasClass('open') + + if (!isActive || (isActive && e.keyCode == 27)) return $this.click() + + $items = $('[role=menu] li:not(.divider) a', $parent) + + if (!$items.length) return + + index = $items.index($items.filter(':focus')) + + if (e.keyCode == 38 && index > 0) index-- // up + if (e.keyCode == 40 && index < $items.length - 1) index++ // down + if (!~index) index = 0 + + $items + .eq(index) + .focus() + } + } function clearMenus() { - $(toggle).parent().removeClass('open') + getParent($(toggle)) + } + + function getParent($this) { + var selector = $this.attr('data-target') + , $parent + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + } + selector.replace(/\//, '\/\/') + + $parent = $(selector) + $parent.length || ($parent = $this.parent()) + + return $parent } /* DROPDOWN PLUGIN DEFINITION * ========================== */ - $.fn.dropdown = function ( option ) { + $.fn.dropdown = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('dropdown') @@ -85,8 +139,12 @@ * =================================== */ $(function () { - $('html').on('click.dropdown.data-api', clearMenus) - $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) + $('html') + .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) + $('body') + .on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() }) + .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle) + .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) }) -}( window.jQuery ) +}(window.jQuery); \ No newline at end of file diff --git a/app/assets/javascripts/app/lib/bootstrap-modal.js b/app/assets/javascripts/app/lib/bootstrap-modal.js index ba64368b2..62fbc951b 100644 --- a/app/assets/javascripts/app/lib/bootstrap-modal.js +++ b/app/assets/javascripts/app/lib/bootstrap-modal.js @@ -1,5 +1,5 @@ /* ========================================================= - * bootstrap-modal.js v2.0.0 + * bootstrap-modal.js v2.1.0 * http://twitter.github.com/bootstrap/javascript.html#modals * ========================================================= * Copyright 2012 Twitter, Inc. @@ -18,17 +18,19 @@ * ========================================================= */ -!function( $ ){ +!function ($) { + + "use strict"; // jshint ;_; - "use strict" /* MODAL CLASS DEFINITION * ====================== */ - var Modal = function ( content, options ) { - this.options = $.extend({}, $.fn.modal.defaults, options) - this.$element = $(content) + var Modal = function (element, options) { + this.options = options + this.$element = $(element) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) + this.options.remote && this.$element.find('.modal-body').load(this.options.remote) } Modal.prototype = { @@ -41,19 +43,24 @@ , show: function () { var that = this + , e = $.Event('show') - if (this.isShown) return + this.$element.trigger(e) + + if (this.isShown || e.isDefaultPrevented()) return $('body').addClass('modal-open') this.isShown = true - this.$element.trigger('show') - escape.call(this) - backdrop.call(this, function () { + this.escape() + + this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') - !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position + if (!that.$element.parent().length) { + that.$element.appendTo(document.body) //don't move modals dom position + } that.$element .show() @@ -62,7 +69,12 @@ that.$element[0].offsetWidth // force reflow } - that.$element.addClass('in') + that.$element + .addClass('in') + .attr('aria-hidden', false) + .focus() + + that.enforceFocus() transition ? that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) : @@ -71,122 +83,134 @@ }) } - , hide: function ( e ) { + , hide: function (e) { e && e.preventDefault() - if (!this.isShown) return - var that = this + + e = $.Event('hide') + + this.$element.trigger(e) + + if (!this.isShown || e.isDefaultPrevented()) return + this.isShown = false $('body').removeClass('modal-open') - escape.call(this) + this.escape() + + $(document).off('focusin.modal') this.$element - .trigger('hide') .removeClass('in') + .attr('aria-hidden', true) $.support.transition && this.$element.hasClass('fade') ? - hideWithTransition.call(this) : - hideModal.call(this) + this.hideWithTransition() : + this.hideModal() } - } - - - /* MODAL PRIVATE METHODS - * ===================== */ - - function hideWithTransition() { - var that = this - , timeout = setTimeout(function () { - that.$element.off($.support.transition.end) - hideModal.call(that) - }, 500) - - this.$element.one($.support.transition.end, function () { - clearTimeout(timeout) - hideModal.call(that) - }) - } - - function hideModal( that ) { - this.$element - .hide() - .trigger('hidden') - - backdrop.call(this) - } - - function backdrop( callback ) { - var that = this - , animate = this.$element.hasClass('fade') ? 'fade' : '' - - if (this.isShown && this.options.backdrop) { - var doAnimate = $.support.transition && animate - - this.$backdrop = $('