test/dummy/tmp/cache/assets/test/sprockets/eb2867da33f352331b0a86f8f9b9ccdf in i18n_admin_utils-1.0.0 vs test/dummy/tmp/cache/assets/test/sprockets/eb2867da33f352331b0a86f8f9b9ccdf in i18n_admin_utils-1.1.0

- old
+ new

@@ -1,8 +1,8 @@ {I" class:EFI"BundledAsset;FI"logical_path;FI"$i18n_admin_utils/application.js;TI" pathname;FI"_C:/dev/ws/ruby/i18n_admin_utils/app/assets/javascripts/i18n_admin_utils/application.coffee;FI"content_type;FI"application/javascript;FI" -mtime;Fl+‚HSI" length;FiÑI" digest;F"%2671099791fbc6f93af04d2d2f26361eI" source;FI"Ñ/*! +mtime;Fl+ TSI" length;FiyäI" digest;F"%55a06973958b9d982b0973d2da5084b4I" source;FI"yä/*! * jQuery JavaScript Library v1.11.0 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ @@ -11350,12 +11350,21 @@ url: form.attr('action'), type: form.attr('method'), dataType: 'json', data: form.serialize() }).success(function(data) { + var button, old_html; if (data.success) { - form.find('button:not(.nosubmit)').html("<span class='glyphicon glyphicon-ok'></span>"); + button = form.find('button:not(.nosubmit)'); + old_html = button.html(); + button.width(button.width()); + button.html("<span class='glyphicon glyphicon-ok'></span>"); + button.trigger('translation-saved'); + setTimeout(function() { + button.html(old_html); + return button.prop('disabled', false); + }, 1500); return form.find('div.alert').hide(); } else { return handle_error(form, data); } }).error(function(data) { @@ -11449,22 +11458,20 @@ var position = this.$element.offset() var offset = this.options.offset var offsetTop = offset.top var offsetBottom = offset.bottom - if (this.affixed == 'top') position.top += scrollTop - if (typeof offset != 'object') offsetBottom = offsetTop = offset if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false if (this.affixed === affix) return - if (this.unpin) this.$element.css('top', '') + if (this.unpin != null) this.$element.css('top', '') var affixType = 'affix' + (affix ? '-' + affix : '') var e = $.Event(affixType + '.bs.affix') this.$element.trigger(e) @@ -11478,11 +11485,11 @@ .removeClass(Affix.RESET) .addClass(affixType) .trigger($.Event(affixType.replace('affix', 'affixed'))) if (affix == 'bottom') { - this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() }) + this.$element.offset({ top: position.top }) } } // AFFIX PLUGIN DEFINITION @@ -11777,22 +11784,22 @@ return this } Carousel.prototype.getActiveIndex = function () { this.$active = this.$element.find('.item.active') - this.$items = this.$active.parent().children() + this.$items = this.$active.parent().children('.item') return this.$items.index(this.$active) } Carousel.prototype.to = function (pos) { var that = this var activeIndex = this.getActiveIndex() if (pos > (this.$items.length - 1) || pos < 0) return - if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) + if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid". not a typo. past tense of "to slide". if (activeIndex == pos) return this.pause().cycle() return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) } @@ -11842,11 +11849,11 @@ isCycling && this.pause() if (this.$indicators.length) { this.$indicators.find('.active').removeClass('active') - this.$element.one('slid.bs.carousel', function () { + this.$element.one('slid.bs.carousel', function () { // yes, "slid". not a typo. past tense of "to slide". var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) $nextIndicator && $nextIndicator.addClass('active') }) } @@ -11858,18 +11865,18 @@ $active .one($.support.transition.end, function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false - setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) + setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) // yes, "slid". not a typo. past tense of "to slide". }) .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000) } else { $active.removeClass('active') $next.addClass('active') this.sliding = false - this.$element.trigger('slid.bs.carousel') + this.$element.trigger('slid.bs.carousel') // yes, "slid". not a typo. past tense of "to slide". } isCycling && this.cycle() return this @@ -11986,32 +11993,34 @@ var dimension = this.dimension() this.$element .removeClass('collapse') - .addClass('collapsing') - [dimension](0) + .addClass('collapsing')[dimension](0) this.transitioning = 1 - var complete = function () { + var complete = function (e) { + if (e && e.target != this.$element[0]) { + this.$element + .one($.support.transition.end, $.proxy(complete, this)) + return + } this.$element .removeClass('collapsing') - .addClass('collapse in') - [dimension]('auto') + .addClass('collapse in')[dimension]('auto') this.transitioning = 0 this.$element.trigger('shown.bs.collapse') } if (!$.support.transition) return complete.call(this) var scrollSize = $.camelCase(['scroll', dimension].join('-')) this.$element .one($.support.transition.end, $.proxy(complete, this)) - .emulateTransitionEnd(350) - [dimension](this.$element[0][scrollSize]) + .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize]) } Collapse.prototype.hide = function () { if (this.transitioning || !this.$element.hasClass('in')) return @@ -12019,22 +12028,25 @@ this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return var dimension = this.dimension() - this.$element - [dimension](this.$element[dimension]()) - [0].offsetHeight + this.$element[dimension](this.$element[dimension]())[0].offsetHeight this.$element .addClass('collapsing') .removeClass('collapse') .removeClass('in') this.transitioning = 1 - var complete = function () { + var complete = function (e) { + if (e && e.target != this.$element[0]) { + this.$element + .one($.support.transition.end, $.proxy(complete, this)) + return + } this.transitioning = 0 this.$element .trigger('hidden.bs.collapse') .removeClass('collapsing') .addClass('collapse') @@ -12083,11 +12095,11 @@ // COLLAPSE DATA-API // ================= - $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) { + $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { var $this = $(this), href var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 var $target = $(target) @@ -12095,11 +12107,11 @@ var option = data ? 'toggle' : $this.data() var parent = $this.attr('data-parent') var $parent = parent && $(parent) if (!data || !data.transitioning) { - if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed') + if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') } $target.collapse(option) }) @@ -12120,11 +12132,11 @@ // DROPDOWN CLASS DEFINITION // ========================= var backdrop = '.dropdown-backdrop' - var toggle = '[data-toggle=dropdown]' + var toggle = '[data-toggle="dropdown"]' var Dropdown = function (element) { $(element).on('click.bs.dropdown', this.toggle) } Dropdown.prototype.toggle = function (e) { @@ -12146,15 +12158,15 @@ var relatedTarget = { relatedTarget: this } $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) if (e.isDefaultPrevented()) return + $this.trigger('focus') + $parent .toggleClass('open') .trigger('shown.bs.dropdown', relatedTarget) - - $this.focus() } return false } @@ -12170,26 +12182,26 @@ var $parent = getParent($this) var isActive = $parent.hasClass('open') if (!isActive || (isActive && e.keyCode == 27)) { - if (e.which == 27) $parent.find(toggle).focus() - return $this.click() + if (e.which == 27) $parent.find(toggle).trigger('focus') + return $this.trigger('click') } var desc = ' li:not(.divider):visible a' - var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc) + var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc) if (!$items.length) return var 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() + $items.eq(index).trigger('focus') } function clearMenus(e) { $(backdrop).remove() $(toggle).each(function () { @@ -12248,11 +12260,11 @@ $(document) .on('click.bs.dropdown.data-api', clearMenus) .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) - .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown) + .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown) }(jQuery); /* ======================================================================== * Bootstrap: tab.js v3.1.1 * http://getbootstrap.com/javascript/#tabs @@ -12397,14 +12409,14 @@ function transitionEnd() { var el = document.createElement('bootstrap') var transEndEventNames = { - 'WebkitTransition' : 'webkitTransitionEnd', - 'MozTransition' : 'transitionend', - 'OTransition' : 'oTransitionEnd otransitionend', - 'transition' : 'transitionend' + WebkitTransition : 'webkitTransitionEnd', + MozTransition : 'transitionend', + OTransition : 'oTransitionEnd otransitionend', + transition : 'transitionend' } for (var name in transEndEventNames) { if (el.style[name] !== undefined) { return { end: transEndEventNames[name] } @@ -12448,11 +12460,11 @@ var href var process = $.proxy(this.process, this) this.$element = $(element).is('body') ? $(window) : $(element) this.$body = $('body') - this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process) + this.$scrollElement = this.$element.on('scroll.bs.scrollspy', process) this.options = $.extend({}, ScrollSpy.DEFAULTS, options) this.selector = (this.options.target || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 || '') + ' .nav li > a' this.offsets = $([]) @@ -12472,11 +12484,12 @@ this.offsets = $([]) this.targets = $([]) var self = this - var $targets = this.$body + + this.$body .find(this.selector) .map(function () { var $el = $(this) var href = $el.data('target') || $el.attr('href') var $href = /^#./.test(href) && $(href) @@ -12493,11 +12506,11 @@ }) } ScrollSpy.prototype.process = function () { var scrollTop = this.$scrollElement.scrollTop() + this.options.offset - var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight + var scrollHeight = this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) var maxScroll = scrollHeight - this.$scrollElement.height() var offsets = this.offsets var targets = this.targets var activeTarget = this.activeTarget var i @@ -12572,11 +12585,11 @@ // SCROLLSPY DATA-API // ================== - $(window).on('load', function () { + $(window).on('load.bs.scrollspy.data-api', function () { $('[data-spy="scroll"]').each(function () { var $spy = $(this) $spy.scrollspy($spy.data()) }) }) @@ -12597,14 +12610,16 @@ // MODAL CLASS DEFINITION // ====================== var Modal = function (element, options) { - this.options = options - this.$element = $(element) - this.$backdrop = - this.isShown = null + this.options = options + this.$body = $(document.body) + this.$element = $(element) + this.$backdrop = + this.isShown = null + this.scrollbarWidth = 0 if (this.options.remote) { this.$element .find('.modal-content') .load(this.options.remote, $.proxy(function () { @@ -12618,11 +12633,11 @@ keyboard: true, show: true } Modal.prototype.toggle = function (_relatedTarget) { - return this[!this.isShown ? 'show' : 'hide'](_relatedTarget) + return this.isShown ? this.hide() : this.show(_relatedTarget) } Modal.prototype.show = function (_relatedTarget) { var that = this var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) @@ -12631,19 +12646,23 @@ if (this.isShown || e.isDefaultPrevented()) return this.isShown = true + this.checkScrollbar() + this.$body.addClass('modal-open') + + this.setScrollbar() this.escape() this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { - that.$element.appendTo(document.body) // don't move modals dom position + that.$element.appendTo(that.$body) // don't move modals dom position } that.$element .show() .scrollTop(0) @@ -12661,14 +12680,14 @@ var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) transition ? that.$element.find('.modal-dialog') // wait for modal to slide in .one($.support.transition.end, function () { - that.$element.focus().trigger(e) + that.$element.trigger('focus').trigger(e) }) .emulateTransitionEnd(300) : - that.$element.focus().trigger(e) + that.$element.trigger('focus').trigger(e) }) } Modal.prototype.hide = function (e) { if (e) e.preventDefault() @@ -12679,10 +12698,13 @@ if (!this.isShown || e.isDefaultPrevented()) return this.isShown = false + this.$body.removeClass('modal-open') + + this.resetScrollbar() this.escape() $(document).off('focusin.bs.modal') this.$element @@ -12700,11 +12722,11 @@ Modal.prototype.enforceFocus = function () { $(document) .off('focusin.bs.modal') // guard against infinite focus loop .on('focusin.bs.modal', $.proxy(function (e) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { - this.$element.focus() + this.$element.trigger('focus') } }, this)) } Modal.prototype.escape = function () { @@ -12736,11 +12758,11 @@ if (this.isShown && this.options.backdrop) { var doAnimate = $.support.transition && animate this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') - .appendTo(document.body) + .appendTo(this.$body) this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { if (e.target !== e.currentTarget) return this.options.backdrop == 'static' ? this.$element[0].focus.call(this.$element[0]) @@ -12771,11 +12793,34 @@ } else if (callback) { callback() } } + Modal.prototype.checkScrollbar = function () { + if (document.body.clientWidth >= window.innerWidth) return + this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar() + } + Modal.prototype.setScrollbar = function () { + var bodyPad = parseInt(this.$body.css('padding-right') || 0) + if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) + } + + Modal.prototype.resetScrollbar = function () { + this.$body.css('padding-right', '') + } + + Modal.prototype.measureScrollbar = function () { // thx walsh + var scrollDiv = document.createElement('div') + scrollDiv.className = 'modal-scrollbar-measure' + this.$body.append(scrollDiv) + var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth + this.$body[0].removeChild(scrollDiv) + return scrollbarWidth + } + + // MODAL PLUGIN DEFINITION // ======================= var old = $.fn.modal @@ -12815,18 +12860,14 @@ if ($this.is('a')) e.preventDefault() $target .modal(option, this) .one('hide', function () { - $this.is(':visible') && $this.focus() + $this.is(':visible') && $this.trigger('focus') }) }) - $(document) - .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') }) - .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') }) - }(jQuery); /* ======================================================================== * Bootstrap: tooltip.js v3.1.1 * http://getbootstrap.com/javascript/#tooltip * Inspired by the original jQuery.tipsy by Jason Frame @@ -12856,23 +12897,28 @@ Tooltip.DEFAULTS = { animation: true, placement: 'top', selector: false, - template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', + template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', trigger: 'hover focus', title: '', delay: 0, html: false, - container: false + container: false, + viewport: { + selector: 'body', + padding: 0 + } } Tooltip.prototype.init = function (type, element, options) { - this.enabled = true - this.type = type - this.$element = $(element) - this.options = this.getOptions(options) + this.enabled = true + this.type = type + this.$element = $(element) + this.options = this.getOptions(options) + this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport) var triggers = this.options.trigger.split(' ') for (var i = triggers.length; i--;) { var trigger = triggers[i] @@ -12984,22 +13030,18 @@ var pos = this.getPosition() var actualWidth = $tip[0].offsetWidth var actualHeight = $tip[0].offsetHeight if (autoPlace) { - var $parent = this.$element.parent() - var orgPlacement = placement - var docScroll = document.documentElement.scrollTop || document.body.scrollTop - var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth() - var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight() - var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left + var $parent = this.$element.parent() + var parentDim = this.getPosition($parent) - placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' : - placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' : - placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' : - placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' : + placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' : + placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' : + placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' : + placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' : placement $tip .removeClass(orgPlacement) .addClass(placement) @@ -13021,11 +13063,10 @@ complete() } } Tooltip.prototype.applyPlacement = function (offset, placement) { - var replace var $tip = this.tip() var width = $tip[0].offsetWidth var height = $tip[0].offsetHeight // manually read margins because getBoundingClientRect includes difference @@ -13055,33 +13096,24 @@ // check to see if placing tip in new offset caused the tip to resize itself var actualWidth = $tip[0].offsetWidth var actualHeight = $tip[0].offsetHeight if (placement == 'top' && actualHeight != height) { - replace = true offset.top = offset.top + height - actualHeight } - if (/bottom|top/.test(placement)) { - var delta = 0 + var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) - if (offset.left < 0) { - delta = offset.left * -2 - offset.left = 0 + if (delta.left) offset.left += delta.left + else offset.top += delta.top - $tip.offset(offset) + var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight + var arrowPosition = delta.left ? 'left' : 'top' + var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight' - actualWidth = $tip[0].offsetWidth - actualHeight = $tip[0].offsetHeight - } - - this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') - } else { - this.replaceArrow(actualHeight - height, actualHeight, 'top') - } - - if (replace) $tip.offset(offset) + $tip.offset(offset) + this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition) } Tooltip.prototype.replaceArrow = function (delta, dimension, position) { this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '') } @@ -13130,25 +13162,57 @@ Tooltip.prototype.hasContent = function () { return this.getTitle() } - Tooltip.prototype.getPosition = function () { - var el = this.$element[0] - return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { - width: el.offsetWidth, - height: el.offsetHeight - }, this.$element.offset()) + Tooltip.prototype.getPosition = function ($element) { + $element = $element || this.$element + var el = $element[0] + var isBody = el.tagName == 'BODY' + return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, { + scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(), + width: isBody ? $(window).width() : $element.outerWidth(), + height: isBody ? $(window).height() : $element.outerHeight() + }, isBody ? {top: 0, left: 0} : $element.offset()) } Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } + } + Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { + var delta = { top: 0, left: 0 } + if (!this.$viewport) return delta + + var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 + var viewportDimensions = this.getPosition(this.$viewport) + + if (/right|left/.test(placement)) { + var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll + var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight + if (topEdgeOffset < viewportDimensions.top) { // top overflow + delta.top = viewportDimensions.top - topEdgeOffset + } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow + delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset + } + } else { + var leftEdgeOffset = pos.left - viewportPadding + var rightEdgeOffset = pos.left + viewportPadding + actualWidth + if (leftEdgeOffset < viewportDimensions.left) { // left overflow + delta.left = viewportDimensions.left - leftEdgeOffset + } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow + delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset + } + } + + return delta + } + Tooltip.prototype.getTitle = function () { var title var $e = this.$element var o = this.options @@ -13271,11 +13335,11 @@ var $tip = this.tip() var title = this.getTitle() var content = this.getContent() $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) - $tip.find('.popover-content')[ // we use append for html objects to maintain js events + $tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' ](content) $tip.removeClass('fade top bottom left right in') @@ -13380,20 +13444,51 @@ return container.hide(); } else { return container.show(); } }); + $(document).on('click', '.translation_edit_container .locale-tab', function() { + var active_tab, form, locale_input, tab, text_input, translation_edit_container; + tab = $(this); + active_tab = tab.parent().find('.locale-tab.active'); + translation_edit_container = tab.closest('.translation_edit_container'); + form = translation_edit_container.find('form.translation_form'); + locale_input = form.find('input[name="locale"]'); + text_input = form.find('textarea[name="value"]'); + active_tab.data('translation', text_input.val()); + text_input.val(tab.data('translation')); + locale_input.val(tab.data('locale')); + active_tab.removeClass('active'); + return tab.addClass('active'); + }); + $(document).on('translation-saved', '.translation_edit_container form.translation_form button', function() { + var active_tab, button, container, element, form, key, list, locale; + button = $(this); + form = button.closest('form.translation_form'); + locale = form.find('input[name="locale"]'); + container = button.closest('.translation_edit_container'); + active_tab = container.find('.locale-tab[data-locale="' + locale.val() + '"]'); + active_tab.removeClass('btn-danger').addClass('btn-success'); + list = button.closest('.translation_container').find('.translation_list'); + key = form.find('input[name="key"]'); + element = list.find('.translation_item[data-key="' + key.val() + '"]'); + return $.get(element.data('reload-url'), { + translation: element.data('translation') + }).success(function(data) { + return element.html($(data).html()); + }); + }); $(document).on('keyup', 'input.translation_search', function() { var container, elements, input, query, val; input = $(this); val = input.val(); container = input.closest('.translation_container'); elements = container.find('.translation_list .translation_item'); if (val.length === 0) { return show_translation_element(elements); } else { - query = '[data-locale*="' + val + '"],[data-key*="' + val + '"], [data-filename*="' + val + '"]'; + query = '[data-key*="' + val + '"]'; show_translation_element(elements.filter(query)); return hide_translation_element(elements.not(query)); } }); return $(document).on('click', '.translation_list .translation_item', function() { @@ -13451,6 +13546,6 @@ } }); }; }).call(this); -;TI"required_assets_digest;F"%b410a84a4c6b4ecedf030e1762ee28d6I" _version;F"%2b66aa67c90052d553e0328c249bc9b0 +;TI"required_assets_digest;F"%88347abeade4f6da14f3656f700ff01fI" _version;F"%2b66aa67c90052d553e0328c249bc9b0 \ No newline at end of file