app/assets/javascripts/spina.coffee.erb in spina-template-0.3.3 vs app/assets/javascripts/spina.coffee.erb in spina-template-0.4.0

- old
+ new

@@ -2,10 +2,11 @@ #= require spina/jquery.ui #= require spina/jquery.ui.datepicker-nl #= require spina/jquery.nestable #= require spina/jquery.customfileinput #= require spina/jquery.farbtastic +#= require spina/sortable #= require jquery-fileupload/basic #= require spina/raphael #= require spina/morris #= require spina/nprogress #= require spina/wysihtml5 @@ -16,21 +17,34 @@ #= require spina/tabs #= require spina/forms #= require spina/dropdown #= require spina/galleryselect #= require spina/uploads +#= require spina/navigation +#= require spina/notifications # Nprogress $(document).on 'page:fetch', -> NProgress.start() $(document).on 'page:change', -> NProgress.done() $(document).on 'page:restore', -> NProgress.remove() # Clickable TR's -$(document).on 'click', '.table-clickable tbody tr', -> - checkbox = $(this).find('input[type="checkbox"]:first, input[type="radio"]:first') - checkbox.prop("checked", !checkbox.prop("checked")) +$(document).on 'click', '.table-clickable tbody tr', (e) -> + $row = $(this).closest('tr') + checkbox = $row.find('input[type="checkbox"]:first, input[type="radio"]:first') + if checkbox.length > 0 + checkbox.prop("checked", !checkbox.prop("checked")) + else + $row.find('a.table-link:first')[0].click() + +$(document).on 'click', '.table-clickable tbody .table-link', (e) -> + e.stopPropagation() + +$(document).on 'click', '.table-clickable tbody tr input', (e) -> + e.stopPropagation() + # Search inputs $(document).on 'keyup', '.search-input input', (e) -> $(this).parent().removeClass('animated small-shake') if $(this).val() == "" $(this).parent().find('.clear-input').fadeOut(200) @@ -59,10 +73,15 @@ # Datatables ready = -> + # Set paddingTop for section#main + if header = document.getElementById('header') + headerHeight = header.getBoundingClientRect().height + $('section#main').css({paddingTop: headerHeight}) + # Custom file $('input[type="file"][data-customfileinput]:visible').each -> $(this).customFileInput() # Image upload @@ -113,13 +132,10 @@ container.find(".choose-text-type").fadeIn(100) editor.on "blur", -> container.find(".choose-text-type").fadeOut(100) - $(".dd").nestable - maxDepth: 3 - $(".structure-form-menu ul").sortable handle: '.sortable-handle' # Switch if $('input[data-switch]').length > 0 @@ -151,7 +167,6 @@ "sNext": "Volgende", "sPrevious": "Vorige" } } -$(document).ready(ready) -$(document).on 'page:load', ready +$(document).on 'turbolinks:load', ready \ No newline at end of file