Merge branch 'master' into i18n

Conflicts:
	app/assets/javascripts/application.js
This commit is contained in:
wvengen 2013-10-18 12:30:34 +02:00
commit 98e7189d31
24 changed files with 223 additions and 248 deletions

View file

@ -1,5 +1,4 @@
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require select2
//= require twitter/bootstrap
@ -7,12 +6,14 @@
//= require bootstrap-datepicker/core
//= require bootstrap-datepicker/locales/bootstrap-datepicker.de
//= require bootstrap-datepicker/locales/bootstrap-datepicker.nl
//= require bootstrap-datepicker/locales/bootstrap-datepicker.fr
//= require jquery.observe_field
//= require list
//= require list.unlist
//= require list.delay
//= require list.reset
//= require rails.validations
//= require rails.validations.simple_form
//= require i18n
//= require i18n/translations
//= require_self
@ -36,19 +37,19 @@ $.fn.extend({
$(function() {
// Show/Hide a specific DOM element
$('a[data-toggle-this]').live('click', function() {
$(document).on('click', 'a[data-toggle-this]', function() {
$($(this).data('toggle-this')).toggle();
return false;
});
// Remove this item from DOM
$('a[data-remove-this]').live('click', function() {
$(document).on('click', 'a[data-remove-this]', function() {
$($(this).data('remove-this')).remove();
return false;
});
// Check/Uncheck a single checkbox
$('[data-check-this]').live('click', function() {
$(document).on('click', '[data-check-this]', function() {
var checkbox = $($(this).data('check-this'));
checkbox.attr('checked', !checkbox.is(':checked'));
highlightRow(checkbox);
@ -56,7 +57,7 @@ $(function() {
});
// Check/Uncheck all checkboxes for a specific form
$('input[data-check-all]').live('click', function() {
$(document).on('click', 'input[data-check-all]', function() {
var status = $(this).is(':checked');
var context = $(this).data('check-all');
var elms = $('input[type="checkbox"]', context);
@ -68,7 +69,7 @@ $(function() {
});
// Submit form when changing a select menu.
$('form[data-submit-onchange] select').live('change', function() {
$(document).on('change', 'form[data-submit-onchange] select', function() {
var confirmMessage = $(this).children(':selected').data('confirm');
if (confirmMessage) {
if (confirm(confirmMessage)) {
@ -101,7 +102,7 @@ $(function() {
});
// Remote paginations
$('div.pagination[data-remote] a').live('click', function() {
$(document).on('click', 'div.pagination[data-remote] a', function() {
$.getScript($(this).attr('href'));
return false;
});
@ -122,6 +123,20 @@ $(function() {
// Use bootstrap datepicker for dateinput
$('.datepicker').datepicker({format: 'yyyy-mm-dd', language: I18n.locale});
// bootstrap tooltips (for price)
// Extra options don't work when using selector, so override defaults
// https://github.com/twbs/bootstrap/issues/3875 . These can still be
// overridden per tooltip using data-placement attributes and the like.
$.extend($.fn.tooltip.defaults, {
html: true,
animation: false,
placement: 'left',
container: 'body'
});
$(document).tooltip({
selector: '[data-toggle~="tooltip"]',
});
// See stupidtable.js for initialization of local table sorting
});
@ -148,3 +163,5 @@ function highlightRow(checkbox) {
function setHiddenId(text, li) {
$('hidden_id').value = li.id;
}

View file

@ -1,4 +1,3 @@
jQuery ->
$("a[rel=popover]").popover()
$(".tooltip").tooltip()
$("a[rel=tooltip]").tooltip()
$("a[rel~=popover], .has-popover").popover()
$("a[rel~=tooltip], .has-tooltip").tooltip()