From: Guillaume Pellerin Date: Thu, 11 Dec 2014 01:07:00 +0000 (+0100) Subject: auto size admin iframe X-Git-Tag: 1.5.0rc3~3^2~4 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=620bc309d7635ed229620b5f92c531c280248cab;p=telemeta.git auto size admin iframe --- diff --git a/example/sandbox/settings.py b/example/sandbox/settings.py index 5817fcfd..6a9d79e0 100644 --- a/example/sandbox/settings.py +++ b/example/sandbox/settings.py @@ -190,3 +190,7 @@ PAGINATION_SETTINGS = { 'PAGE_RANGE_DISPLAYED': 10, 'MARGIN_PAGES_DISPLAYED': 2, } + +SUIT_CONFIG = { + 'ADMIN_NAME': 'Telemeta Admin' +} diff --git a/telemeta/static/telemeta/js/jquery.browser.js b/telemeta/static/telemeta/js/jquery.browser.js new file mode 100644 index 00000000..c1acb863 --- /dev/null +++ b/telemeta/static/telemeta/js/jquery.browser.js @@ -0,0 +1,39 @@ +(function( jQuery ) { + var matched, + userAgent = navigator.userAgent || ""; + + // Use of jQuery.browser is frowned upon. + // More details: http://api.jquery.com/jQuery.browser + // jQuery.uaMatch maintained for back-compat + jQuery.uaMatch = function( ua ) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+)/.exec( ua ) || + /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || + /(msie) ([\w.]+)/.exec( ua ) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + + matched = jQuery.uaMatch( userAgent ); + + jQuery.browser = {}; + + if ( matched.browser ) { + jQuery.browser[ matched.browser ] = true; + jQuery.browser.version = matched.version; + } + + // Deprecated, use jQuery.browser.webkit instead + // Maintained for back-compat only + if ( jQuery.browser.webkit ) { + jQuery.browser.safari = true; + } + +}( jQuery )); \ No newline at end of file diff --git a/telemeta/static/telemeta/js/jquery.iframe-auto-height.plugin.1.9.5.min.js b/telemeta/static/telemeta/js/jquery.iframe-auto-height.plugin.1.9.5.min.js new file mode 100644 index 00000000..871fc874 --- /dev/null +++ b/telemeta/static/telemeta/js/jquery.iframe-auto-height.plugin.1.9.5.min.js @@ -0,0 +1,7 @@ +/* + Plugin: iframe autoheight jQuery Plugin + Version: 1.9.5 + Description: when the page loads set the height of an iframe based on the height of its contents + see README: http://github.com/house9/jquery-iframe-auto-height +*/ +!function(e){e.fn.iframeAutoHeight=function(t){function i(e){h.debug&&h.debug===!0&&window.console&&console.log(e)}function n(t,n){i("Diagnostics from '"+n+"'");try{i(" "+e(t,window.top.document).contents().find("body")[0].scrollHeight+" for ...find('body')[0].scrollHeight"),i(" "+e(t.contentWindow.document).height()+" for ...contentWindow.document).height()"),i(" "+e(t.contentWindow.document.body).height()+" for ...contentWindow.document.body).height()")}catch(r){i(" unable to check in this state")}i("End diagnostics -> results vary by browser and when diagnostics are requested")}var r;if(e.browser===r){var o=[];return o.push("WARNING: you appear to be using a newer version of jquery which does not support the $.browser variable."),o.push("The jQuery iframe auto height plugin relies heavly on the $.browser features."),o.push("Install jquery-browser: https://raw.github.com/house9/jquery-iframe-auto-height/master/release/jquery.browser.js"),alert(o.join("\n")),e}var h=e.extend({heightOffset:0,minHeight:0,maxHeight:0,callback:function(){},animate:!1,debug:!1,diagnostics:!1,resetToMinHeight:!1,triggerFunctions:[],heightCalculationOverrides:[]},t);return i(h),this.each(function(){function t(e){var t=null;return jQuery.each(o,function(i,n){return e[n]?(t=s[n],!1):void 0}),null===t&&(t=s["default"]),t}function r(r){h.diagnostics&&n(r,"resizeHeight"),h.resetToMinHeight&&h.resetToMinHeight===!0&&(r.style.height=h.minHeight+"px");var o=e(r,window.top.document).contents().find("body"),s=t(e.browser),a=s(r,o,h,e.browser);i(a),a0&&a>h.maxHeight&&(i("new height is greater than maxHeight"),a=h.maxHeight),a+=h.heightOffset,i("New Height: "+a),h.animate?e(r).animate({height:a+"px"},{duration:500}):r.style.height=a+"px",h.callback.apply(e(r),[{newFrameHeight:a}])}var o=["webkit","mozilla","msie","opera"],s={};s["default"]=function(e,t,i){return t[0].scrollHeight+i.heightOffset},jQuery.each(o,function(e,t){s[t]=s["default"]}),jQuery.each(h.heightCalculationOverrides,function(e,t){s[t.browser]=t.calculation});var a=0,c=this.contentDocument||this.contentWindow.document;if(i(this),h.diagnostics&&n(this,"each iframe"),h.triggerFunctions.length>0){i(h.triggerFunctions.length+" trigger Functions");for(var u=0;u{% trans "General" %} - + {% block content %}
diff --git a/telemeta/templates/telemeta/admin_general.html b/telemeta/templates/telemeta/admin_general.html index c83baffe..f225bb40 100644 --- a/telemeta/templates/telemeta/admin_general.html +++ b/telemeta/templates/telemeta/admin_general.html @@ -1,10 +1,24 @@ {% extends "telemeta/admin.html" %} {% load i18n %} +{% block extra_javascript %} +{{ block.super }} + + +{% endblock %} + {% block title %}

{% trans "Administration" %} > {% trans "General" %}

{% endblock %} {% block tabcontents %} - + + + {% endblock %} + +