gestioCOF/gestioncof/static/grappelli/js/grappelli.min.js

1 line
28 KiB
JavaScript
Raw Normal View History

var grp={jQuery:jQuery.noConflict(true)};var django={jQuery:grp.jQuery.noConflict(true)};(function(a){grappelli.getFormat=function(b){if(b=="date"){var c=DATE_FORMAT.toLowerCase().replace(/%\w/g,function(d){d=d.replace(/%/,"");return d+d});return c}};grappelli.initDateAndTimePicker=function(){a("p.datetime").each(function(){var d=a(this).html();d=d.replace(/^\w*: /,"");d=d.replace(/<br>[^<]*: /g,"<br>");a(this).html(d)});var c={constrainInput:false,showOn:"button",buttonImageOnly:false,buttonText:"",dateFormat:grappelli.getFormat("date"),showButtonPanel:true,showAnim:"",beforeShow:function(d,f,e){grappelli.datepicker_instance=this}};var b=a("input[class*='vDateField']:not([id*='__prefix__'])");b.datepicker(c);if(typeof IS_POPUP!="undefined"&&IS_POPUP){b.datepicker("disable")}a(".ui-datepicker-current").on("click",function(){a.datepicker._selectDate(grappelli.datepicker_instance);grappelli.datepicker_instance=null});a("input[class*='vTimeField']:not([id*='__prefix__'])").grp_timepicker()};grappelli.initFilter=function(){a("a.grp-pulldown-handler").click(function(){var b=a(this).closest(".grp-pulldown-container");a(b).toggleClass("grp-pulldown-state-open").children(".grp-pulldown-content").toggle()});a("a.grp-pulldown-handler").bind("mouseout",function(){a(this).blur()});a(".grp-filter-choice").change(function(){location.href=a(this).val()})};grappelli.initSearchbar=function(){var b=a("input.grp-search-field");b.focus()};grappelli.updateSelectFilter=function(b){if(typeof SelectFilter!="undefined"){b.find(".selectfilter").each(function(c,e){var d=e.name.split("-");SelectFilter.init(e.id,d[d.length-1],false,"{% admin_media_prefix %}")});b.find(".selectfilterstacked").each(function(c,e){var d=e.name.split("-");SelectFilter.init(e.id,d[d.length-1],true,"{% admin_media_prefix %}")})}};grappelli.reinitDateTimeFields=function(b){b.find(".vDateField").datepicker({constrainInput:false,showOn:"button",buttonImageOnly:false,buttonText:"",dateFormat:grappelli.getFormat("date")});b.find(".vTimeField").grp_timepicker()};grappelli.get_app_label=function(d){var c=d.next("a");if(c.length>0){var b=c.attr("href").split("/");return b[b.length-3]}return false};grappelli.get_model_name=function(d){var c=d.next("a");if(c.length>0){var b=c.attr("href").split("/");return b[b.length-2]}return false};grappelli.get_query_string=function(d){var c=d.next("a");if(c.length>0){var b=c.attr("href").split("/");pairs=b[b.length-1].replace("?","").split("&");return pairs.join(":")}return false}})(grp.jQuery);(function(c){c.fn.grp_collapsible=function(e){var g={toggle_handler_slctr:".grp-collapse-handler:first",closed_css:"grp-closed",open_css:"grp-open",on_init:function(){},on_toggle:function(){}};var f=c.extend(g,e);return this.each(function(){b(c(this),f)})};var b=function(f,e){e.on_init(f,e);a(f,e)};var a=function(f,e){d(f,e)};var d=function(f,e){f.children(e.toggle_handler_slctr).click(function(){f.toggleClass(e.closed_css).toggleClass(e.open_css);e.on_toggle(f,e)})}})(grp.jQuery);(function(d){d.fn.grp_collapsible_group=function(f){var g={open_handler_slctr:".grp-open-handler",close_handler_slctr:".grp-close-handler",collapsible_container_slctr:".grp-collapse",closed_css:"grp-closed",open_css:"grp-open",on_init:function(){},on_open:function(){},on_close:function(){}};f=d.extend(g,f);return this.each(function(){c(d(this),f)})};var c=function(g,f){f.on_init(g,f);b(g,f)};var b=function(g,f){a(g,f);e(g,f)};var a=function(g,f){g.find(f.open_handler_slctr).each(function(){d(this).click(function(){f.on_open(g,f);g.find(f.collapsible_container_slctr).removeClass(f.closed_css).addClass(f.open_css);g.removeClass(f.closed_css).addClass(f.open_css)})})};var e=function(g,f){g.find(f.close_handler_slctr).each(function(){d(this).click(function(){f.on_close(g,f);g.find(f.collapsible_container_slctr).removeClass(f.open_css).addClass(f.closed_css)})})}})(grp.jQuery);(function(a){a.widget("ui.grp_timepicker",{options:{template:'<div id="ui-timepicker" class="module" style="position: absolute; display: none;"></div>',timepicker_selector:"#ui-timepicker",offset:{top:0},defau