From a97736b9586f2420d67339964171a9d3aa9ea576 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 9 Dec 2012 14:55:04 +0100 Subject: [PATCH] Upgrade to bootstrap 2.2.1 (moved to new bootstrap classes). --- .../_application_controller_form.js.coffee | 8 +- .../controllers/_dashboard/ticket.js.coffee | 8 +- .../controllers/agent_ticket_view.js.coffee | 16 ++-- .../controllers/agent_ticket_zoom.js.coffee | 12 +-- .../javascripts/app/lib/base/fileuploader.js | 4 +- .../app/lib/bootstrap/bootstrap-button.js | 94 +++++++++++++++++++ .../app/views/agent_ticket_create.jst.eco | 12 ++- .../app/views/agent_ticket_view.jst.eco | 4 +- .../app/views/agent_ticket_view/bulk.jst.eco | 2 +- .../views/agent_ticket_view/detail.jst.eco | 2 +- .../app/views/agent_ticket_zoom.jst.eco | 4 +- app/assets/javascripts/application.js | 1 + app/assets/stylesheets/zzz.css | 8 -- 13 files changed, 136 insertions(+), 39 deletions(-) create mode 100644 app/assets/javascripts/app/lib/bootstrap/bootstrap-button.js diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee index 3e4078eb2..a58bfef21 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -297,7 +297,7 @@ class App.ControllerForm extends App.Controller params: form_id: @form_id ) - @delay( u, 200 ) + @delay( u, 100 ) # tag else if attribute.tag is 'tag' @@ -326,7 +326,7 @@ class App.ControllerForm extends App.Controller ) siteUpdate(true) - @delay( a, 600 ) + @delay( a, 100 ) # autocompletion @@ -369,7 +369,7 @@ class App.ControllerForm extends App.Controller # @log 'selected', event, ui b(event, ui.item.id) ) - @delay( a, 600 ) + @delay( a, 100 ) # input else @@ -403,7 +403,7 @@ class App.ControllerForm extends App.Controller item = $( ui.formGenItem(attribute, classname, attributes_clean) ) ui.log item, classname ) - @delay(b, 800) + @delay(b, 100) # if attribute.onchange[] ui = @ diff --git a/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee b/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee index 9bb961166..cf53f00e0 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee @@ -153,8 +153,8 @@ class Settings extends App.ControllerModal @configure_attributes_article = [ # { name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', }, # { name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' }, -# { name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'keepleft' }, -# { name: 'internal', display: 'Visability', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'keepleft' }, +# { name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'pull-left' }, +# { name: 'internal', display: 'Visability', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' }, { name: 'per_page', display: 'Items per page', @@ -169,7 +169,7 @@ class Settings extends App.ControllerModal 20: 20, }, class: 'medium', -# item_class: 'keepleft', +# item_class: 'pull-left', }, { name: 'attributes', @@ -193,7 +193,7 @@ class Settings extends App.ControllerModal close_time: 'Close Time', }, class: 'medium', -# item_class: 'keepleft', +# item_class: 'pull-left', }, { name: 'order_by', 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 cc8f28b63..258e9d149 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_view.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_view.js.coffee @@ -244,10 +244,10 @@ class Index extends App.Controller bulk_form: => @configure_attributes_ticket = [ - { name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @bulk, translate: true, nulloption: true, default: '', class: 'span2', item_class: 'keepleft' }, - { name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @bulk, translate: true, nulloption: true, default: '', class: 'span2', item_class: 'keepleft' }, - { name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: true, relation: 'Group', filter: @bulk, nulloption: true, class: 'span2', item_class: 'keepleft' }, - { name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, relation: 'User', filter: @bulk, nulloption: true, class: 'span2', item_class: 'keepleft' }, + { name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @bulk, translate: true, nulloption: true, default: '', class: 'span2', item_class: 'pull-left' }, + { name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @bulk, translate: true, nulloption: true, default: '', class: 'span2', item_class: 'pull-left' }, + { name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: true, relation: 'Group', filter: @bulk, nulloption: true, class: 'span2', item_class: 'pull-left' }, + { name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, relation: 'User', filter: @bulk, nulloption: true, class: 'span2', item_class: 'pull-left' }, ] # render init page @@ -348,8 +348,8 @@ class Settings extends App.ControllerModal @configure_attributes_article = [ # { name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', }, # { name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' }, -# { name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'keepleft' }, -# { name: 'internal', display: 'Visability', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'keepleft' }, +# { name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'pull-left' }, +# { name: 'internal', display: 'Visability', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' }, { name: 'per_page' display: 'Items per page' @@ -364,7 +364,7 @@ class Settings extends App.ControllerModal 30: 30 35: 35 class: 'medium' -# item_class: 'keepleft' +# item_class: 'pull-left' }, { name: 'attributes' @@ -447,7 +447,7 @@ class Settings extends App.ControllerModal # relation: 'TicketArticleType', # default: '9', # class: 'medium', -# item_class: 'keepleft', +# item_class: 'pull-left', # }, ] diff --git a/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee index ce8d20886..c1b73ee99 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee @@ -89,15 +89,15 @@ class Index extends App.Controller # set title @title 'Ticket Zoom ' + @ticket.number @configure_attributes_ticket = [ - { name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @edit_form, translate: true, class: 'span2', item_class: 'keepleft' }, - { name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @edit_form, translate: true, class: 'span2', item_class: 'keepleft' }, - { name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: true, relation: 'Group', filter: @edit_form, class: 'span2', item_class: 'keepleft' }, - { name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, relation: 'User', filter: @edit_form, nulloption: true, class: 'span2', item_class: 'keepleft' }, + { name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' }, + { name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' }, + { name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: true, relation: 'Group', filter: @edit_form, class: 'span2', item_class: 'pull-left' }, + { name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, relation: 'User', filter: @edit_form, nulloption: true, class: 'span2', item_class: 'pull-left' }, ] if @isRole('Customer') @configure_attributes_ticket = [ - { name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @edit_form, translate: true, class: 'span2', item_class: 'keepleft' }, - { name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @edit_form, translate: true, class: 'span2', item_class: 'keepleft' }, + { name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' }, + { name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' }, ] @configure_attributes_article = [ diff --git a/app/assets/javascripts/app/lib/base/fileuploader.js b/app/assets/javascripts/app/lib/base/fileuploader.js index 42786f462..48fc4d0a0 100644 --- a/app/assets/javascripts/app/lib/base/fileuploader.js +++ b/app/assets/javascripts/app/lib/base/fileuploader.js @@ -485,8 +485,8 @@ qq.FileUploader = function(o){ listElement: null, template: '
' + - '
Drop to attach files
' + - '
' + + '
Drop to attach files
' + + '
' + '' + '
', diff --git a/app/assets/javascripts/app/lib/bootstrap/bootstrap-button.js b/app/assets/javascripts/app/lib/bootstrap/bootstrap-button.js new file mode 100644 index 000000000..002d983a6 --- /dev/null +++ b/app/assets/javascripts/app/lib/bootstrap/bootstrap-button.js @@ -0,0 +1,94 @@ +/* ============================================================ + * bootstrap-button.js v2.2.1 + * http://twitter.github.com/bootstrap/javascript.html#buttons + * ============================================================ + * Copyright 2012 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================ */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* BUTTON PUBLIC CLASS DEFINITION + * ============================== */ + + var Button = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, $.fn.button.defaults, options) + } + + Button.prototype.setState = function (state) { + var d = 'disabled' + , $el = this.$element + , data = $el.data() + , val = $el.is('input') ? 'val' : 'html' + + state = state + 'Text' + data.resetText || $el.data('resetText', $el[val]()) + + $el[val](data[state] || this.options[state]) + + // push to event loop to allow forms to submit + setTimeout(function () { + state == 'loadingText' ? + $el.addClass(d).attr(d, d) : + $el.removeClass(d).removeAttr(d) + }, 0) + } + + Button.prototype.toggle = function () { + var $parent = this.$element.closest('[data-toggle="buttons-radio"]') + + $parent && $parent + .find('.active') + .removeClass('active') + + this.$element.toggleClass('active') + } + + + /* BUTTON PLUGIN DEFINITION + * ======================== */ + + $.fn.button = function (option) { + return this.each(function () { + var $this = $(this) + , data = $this.data('button') + , options = typeof option == 'object' && option + if (!data) $this.data('button', (data = new Button(this, options))) + if (option == 'toggle') data.toggle() + else if (option) data.setState(option) + }) + } + + $.fn.button.defaults = { + loadingText: 'loading...' + } + + $.fn.button.Constructor = Button + + + /* BUTTON DATA-API + * =============== */ + + $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { + var $btn = $(e.target) + if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') + $btn.button('toggle') + }) + +}(window.jQuery); \ No newline at end of file diff --git a/app/assets/javascripts/app/views/agent_ticket_create.jst.eco b/app/assets/javascripts/app/views/agent_ticket_create.jst.eco index b4c1b366a..8d8c2977b 100644 --- a/app/assets/javascripts/app/views/agent_ticket_create.jst.eco +++ b/app/assets/javascripts/app/views/agent_ticket_create.jst.eco @@ -1,5 +1,15 @@
diff --git a/app/assets/javascripts/app/views/agent_ticket_view.jst.eco b/app/assets/javascripts/app/views/agent_ticket_view.jst.eco index 27d873adf..f153f66ee 100644 --- a/app/assets/javascripts/app/views/agent_ticket_view.jst.eco +++ b/app/assets/javascripts/app/views/agent_ticket_view.jst.eco @@ -4,7 +4,7 @@

<%- @T( @overview.meta.name ) %> <% if @edit: %><% end %>

-