diff --git a/classes/lnApp/Controller/TemplateDefault.php b/classes/lnApp/Controller/TemplateDefault.php index 72b8093..cb9eefe 100644 --- a/classes/lnApp/Controller/TemplateDefault.php +++ b/classes/lnApp/Controller/TemplateDefault.php @@ -175,6 +175,11 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template { $this->response->bodyadd(sprintf('
%s
',$this->template->content)); } + // Used by our javascript to know what the SITE URL is. + Script::factory() + ->type('stdin') + ->data('var site_url="'.URL::site('',TRUE).'";'); + parent::after(); // Generate and check the ETag for this file diff --git a/classes/lnApp/Meta.php b/classes/lnApp/Meta.php index 36df856..5f90bd6 100644 --- a/classes/lnApp/Meta.php +++ b/classes/lnApp/Meta.php @@ -29,5 +29,14 @@ abstract class lnApp_Meta { $this->_data[$key] = $value; } + + public function secure() { + static $secure = NULL; + + if (! $secure) + $secure = Request::current()->secure() ? 'https://' : 'http://'; + + return $secure; + } } ?> diff --git a/media/js/lodash/lodash-1.2.1.min.js b/media/js/lodash/lodash-1.2.1.min.js new file mode 100644 index 0000000..3c4f072 --- /dev/null +++ b/media/js/lodash/lodash-1.2.1.min.js @@ -0,0 +1,44 @@ +/** + * @license + * Lo-Dash 1.2.1 (Custom Build) lodash.com/license + * Build: `lodash modern -o ./dist/lodash.js` + * Underscore.js 1.4.4 underscorejs.org/LICENSE + */ +;(function(n){function t(o){function f(n){if(!n||ue.call(n)!=A)return a;var t=n.valueOf,e=typeof t=="function"&&(e=Zt(t))&&Zt(e);return e?n==e||Zt(n)==e:Y(n)}function D(n,t,e){if(!n||!R[typeof n])return n;t=t&&typeof e=="undefined"?t:U.createCallback(t,e);for(var r=-1,u=R[typeof n]?be(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(ne?0:e);++re?le(0,u+e):e)||0,typeof u=="number"?o=-1<(ft(n)?n.indexOf(t,e):xt(n,t,e)):D(n,function(n){return++ru&&(u=o) +}}else t=!t&&ft(n)?G:U.createCallback(t,e),yt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function bt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Rt(r);++earguments.length;t=U.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; +if(typeof u!="number")var i=be(n),u=i.length;return t=U.createCallback(t,r,4),yt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function kt(n,t,e){var r;t=U.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?le(0,u+e):e||0)-1;else if(e)return r=Et(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=s;if(l)var v={};for(e!=u&&(c=[],e=U.createCallback(e,r));++oxt(c,g))&&((e||l)&&c.push(g),f.push(r))}return f}function Nt(n,t){for(var e=-1,r=n?n.length:0,u={};++e/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:U}},W.prototype=U.prototype;var me=oe,be=ce?function(n){return ot(n)?ce(n):[]}:M,de={"&":"&","<":"<",">":">",'"':""","'":"'"},_e=rt(de);return zt&&i&&typeof ee=="function"&&(At=St(ee,o)),Tt=8==se(_+"08")?se:function(n,t){return se(ft(n)?n.replace(k,""):n,t||0)},U.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},U.assign=K,U.at=function(n){for(var t=-1,e=Xt.apply(Gt,ge.call(arguments,1)),r=e.length,u=Rt(r);++t=s,i=[],f=i;n:for(;++uxt(f,c)){o&&f.push(c); +for(var v=e;--v;)if(!(r[v]||(r[v]=V(t[v])))(c))continue n;i.push(c)}}return i},U.invert=rt,U.invoke=function(n,t){var e=ge.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Rt(typeof a=="number"?a:0);return yt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},U.keys=be,U.map=ht,U.max=mt,U.memoize=function(n,t){var e={};return function(){var r=p+(t?t.apply(this,arguments):arguments[0]);return ne.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},U.merge=ct,U.min=function(n,t,e){var r=1/0,u=r; +if(!t&&me(n)){e=-1;for(var a=n.length;++ext(a,e))&&(u[e]=n)}),u},U.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},U.pairs=function(n){for(var t=-1,e=be(n),r=e.length,u=Rt(r);++te?le(0,r+e):pe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},U.mixin=Bt,U.noConflict=function(){return o._=Jt,this},U.parseInt=Tt,U.random=function(n,t){return n==u&&t==u&&(t=1),n=+n||0,t==u&&(t=n,n=0),n+Yt(ve()*((+t||0)-n+1))},U.reduce=dt,U.reduceRight=_t,U.result=function(n,t){var r=n?n[t]:e;return at(r)?n[t]():r},U.runInContext=t,U.size=function(n){var t=n?n.length:0; +return typeof t=="number"?t:be(n).length},U.some=kt,U.sortedIndex=Et,U.template=function(n,t,u){var a=U.templateSettings;n||(n=""),u=P({},u,a);var o,i=P({},u.imports,a.imports),a=be(i),i=lt(i),f=0,c=u.interpolate||w,l="__p+='",c=Mt((u.escape||w).source+"|"+c.source+"|"+(c===d?m:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,L),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t +}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Dt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},U.unescape=function(n){return n==u?"":Ut(n).replace(h,nt)},U.uniqueId=function(n){var t=++c;return Ut(n==u?"":n)+t +},U.all=st,U.any=kt,U.detect=gt,U.foldl=dt,U.foldr=_t,U.include=pt,U.inject=dt,D(U,function(n,t){U.prototype[t]||(U.prototype[t]=function(){var t=[this.__wrapped__];return te.apply(t,arguments),n.apply(U,t)})}),U.first=jt,U.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=U.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return Z(n,le(0,a-r))}},U.take=jt,U.head=jt,D(U,function(n,t){U.prototype[t]||(U.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); +return t==u||e&&typeof t!="function"?r:new W(r)})}),U.VERSION="1.2.1",U.prototype.toString=function(){return Ut(this.__wrapped__)},U.prototype.value=Ft,U.prototype.valueOf=Ft,yt(["join","pop","shift"],function(n){var t=Gt[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),yt(["push","reverse","sort","unshift"],function(n){var t=Gt[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),yt(["concat","slice","splice"],function(n){var t=Gt[n];U.prototype[n]=function(){return new W(t.apply(this.__wrapped__,arguments)) +}}),U}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,m=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,b=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=RegExp("^["+_+"]*0+(?=.$)"),w=/($^)/,j=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Number]",A="[object Object]",$="[object RegExp]",B="[object String]",F={"[object Function]":a}; +F[O]=F[E]=F[I]=F[N]=F[S]=F[A]=F[$]=F[B]=r;var R={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},T={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},q=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=q,define(function(){return q})):o&&!o.nodeType?i?(i.exports=q)._=q:o._=q:n._=q})(this); \ No newline at end of file diff --git a/media/theme/baseadmin/css/custom.css b/media/theme/baseadmin/css/custom.css index 1aa05d2..0624d63 100644 --- a/media/theme/baseadmin/css/custom.css +++ b/media/theme/baseadmin/css/custom.css @@ -7,3 +7,7 @@ padding-top: 56px; } } + +.pull-right > .dropdown-menu { + right: auto; +} diff --git a/media/theme/baseadmin/js/backtotop.js b/media/theme/baseadmin/js/backtotop.js new file mode 100644 index 0000000..2f1821a --- /dev/null +++ b/media/theme/baseadmin/js/backtotop.js @@ -0,0 +1,25 @@ +$(document).ready(function() { + var backToTop = $('', { id: 'back-to-top', href: '#top' }); + var icon = $('', { class: 'icon-chevron-up' }); + + backToTop.appendTo ('body'); + icon.appendTo (backToTop); + + backToTop.hide(); + + $(window).scroll(function () { + if ($(this).scrollTop() > 100) { + backToTop.fadeIn (); + } else { + backToTop.fadeOut (); + } + }); + + backToTop.click (function (e) { + e.preventDefault (); + + $('body, html').animate({ + scrollTop: 0 + }, 600); + }); +}); diff --git a/media/theme/baseadmin/js/custom.js b/media/theme/baseadmin/js/custom.js deleted file mode 100644 index d8bbbfb..0000000 --- a/media/theme/baseadmin/js/custom.js +++ /dev/null @@ -1,37 +0,0 @@ -$(function () { - Application.init (); -}); - -var Application = function () { - return { init: init }; - - function init () { - enableBackToTop (); - } - - function enableBackToTop () { - var backToTop = $('', { id: 'back-to-top', href: '#top' }); - var icon = $('', { class: 'icon-chevron-up' }); - - backToTop.appendTo ('body'); - icon.appendTo (backToTop); - - backToTop.hide(); - - $(window).scroll(function () { - if ($(this).scrollTop() > 100) { - backToTop.fadeIn (); - } else { - backToTop.fadeOut (); - } - }); - - backToTop.click (function (e) { - e.preventDefault (); - - $('body, html').animate({ - scrollTop: 0 - }, 600); - }); - } -}(); diff --git a/views/theme/baseadmin/page.php b/views/theme/baseadmin/page.php index c45a9f7..045a4a2 100644 --- a/views/theme/baseadmin/page.php +++ b/views/theme/baseadmin/page.php @@ -21,15 +21,14 @@ // @todo Work out how to delay this loading until required echo HTML::style('media/theme/bootstrap/vendor/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.css'); } else { - // @todo - This protocol should be ommitted so that http/https is used as appropriate - echo HTML::style('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css'); - echo HTML::style('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css'); - echo HTML::style('http://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css'); + echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css'); + echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css'); + echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css'); // @todo Work out how to delay this loading until required - echo HTML::style('http://cdn.jsdelivr.net/bootstrap.wysihtml5/0.0.2/bootstrap-wysihtml5-0.0.2.css'); + echo HTML::style($meta->secure().'cdn.jsdelivr.net/bootstrap.wysihtml5/0.0.2/bootstrap-wysihtml5-0.0.2.css'); } - echo HTML::style('http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800'); + echo HTML::style($meta->secure().'fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800'); echo HTML::style('media/css/ui-lightness/jquery-ui-1.10.0.custom.min.css'); echo HTML::style('media/theme/baseadmin/css/base-admin-2.css'); echo HTML::style('media/theme/baseadmin/css/base-admin-2-responsive.css'); @@ -52,7 +51,7 @@ @@ -104,15 +103,19 @@ // @todo Work out how to delay this loading until required echo HTML::script('media/theme/bootstrap/vendor/bootstrap-wysihtml5-0.0.2/libs/js/wysihtml5-0.3.0_rc2.min.js'); echo HTML::script('media/theme/bootstrap/vendor/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.min.js'); + echo HTML::script('media/js/lodash/lodash-1.2.1.min.js'); } else { - echo HTML::script('http://code.jquery.com/jquery-1.9.1.min.js'); - echo HTML::script('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js'); + echo HTML::script($meta->secure().'code.jquery.com/jquery-1.9.1.min.js'); + echo HTML::script($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js'); // @todo Work out how to delay this loading until required - echo HTML::script('http://cdn.jsdelivr.net/wysihtml5/0.3.0/wysihtml5-0.3.0.min.js'); - echo HTML::script('http://cdn.jsdelivr.net/bootstrap.wysihtml5/0.0.2/bootstrap-wysihtml5-0.0.2.min.js'); + echo HTML::script($meta->secure().'cdn.jsdelivr.net/wysihtml5/0.3.0/wysihtml5-0.3.0.min.js'); + echo HTML::script($meta->secure().'cdn.jsdelivr.net/bootstrap.wysihtml5/0.0.2/bootstrap-wysihtml5-0.0.2.min.js'); + echo HTML::script($meta->secure().'cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js'); } - echo HTML::script('media/theme/baseadmin/js/custom.js'); + echo HTML::script('media/theme/baseadmin/js/backtotop.js'); + echo HTML::script('media/js/search.js'); + echo HTML::script('media/js/custom.js'); echo Script::factory()->render_all(); ?> diff --git a/views/theme/focusbusiness/page.php b/views/theme/focusbusiness/page.php index 1a166d1..3f0fa41 100644 --- a/views/theme/focusbusiness/page.php +++ b/views/theme/focusbusiness/page.php @@ -19,13 +19,12 @@ echo HTML::style('media/theme/bootstrap/css/bootstrap-responsive.min.css'); echo HTML::style('media/vendor/font-awesome/css/font-awesome.min.css'); } else { - // @todo - This protocol should be ommitted so that http/https is used as appropriate - echo HTML::style('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css'); - echo HTML::style('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css'); - echo HTML::style('http://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css'); + echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css'); + echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css'); + echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css'); } - echo HTML::style('http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800'); + echo HTML::style($meta->secure().'fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800'); echo HTML::style('media/theme/focusbusiness/css/focus-1.1.css'); echo HTML::style('media/theme/focusbusiness/css/focus-1.1-responsive.css'); echo HTML::style('media/theme/focusbusiness/css/custom.css'); @@ -94,8 +93,8 @@ echo HTML::script('media/js/jquery/jquery-1.9.1.min.js'); echo HTML::script('media/theme/bootstrap/js/bootstrap.min.js'); } else { - echo HTML::script('http://code.jquery.com/jquery-1.9.1.min.js'); - echo HTML::script('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js'); + echo HTML::script($meta->secure().'code.jquery.com/jquery-1.9.1.min.js'); + echo HTML::script($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js'); } echo HTML::script('media/theme/focusbusiness/js/focus.js');