typus 3.0.10 → 3.0.11.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/Gemfile +9 -5
- data/README.md +17 -53
- data/app/assets/vendor/typus/javascripts/application.js +2 -0
- data/app/assets/vendor/typus/javascripts/jquery.application.js +29 -0
- data/app/assets/vendor/typus/javascripts/jquery.rails.autocomplete.js +32 -0
- data/app/assets/vendor/typus/javascripts/jquery.rails.js +158 -0
- data/app/assets/vendor/typus/javascripts/jquery.searchField.js +91 -0
- data/app/assets/vendor/typus/stylesheets/application.css +11 -0
- data/app/assets/vendor/typus/stylesheets/reset.css +48 -0
- data/app/assets/vendor/typus/stylesheets/screen.css +361 -0
- data/app/assets/vendor/typus/vendor/jquery-tokeninput/css/token-input-facebook.css +122 -0
- data/app/assets/vendor/typus/vendor/jquery-tokeninput/css/token-input-mac.css +204 -0
- data/app/assets/vendor/typus/vendor/jquery-tokeninput/css/token-input.css +120 -0
- data/app/assets/vendor/typus/vendor/jquery-tokeninput/js/jquery.tokeninput.js +736 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/jquery-ui-1.8.12.custom.css +578 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/index.html +367 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/js/jquery-1.5.1.min.js +16 -0
- data/app/assets/vendor/typus/vendor/jquery-ui-1.8.12.custom/js/jquery-ui-1.8.12.custom.min.js +783 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/blank.gif +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_close.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_loading.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_nav_left.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_nav_right.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_shadow_e.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_shadow_n.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_shadow_ne.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_shadow_nw.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_shadow_s.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_shadow_se.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_shadow_sw.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_shadow_w.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_title_left.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_title_main.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_title_over.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancy_title_right.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancybox-x.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancybox-y.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/fancybox.png +0 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.easing-1.3.pack.js +72 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.css +359 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.js +1156 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.pack.js +46 -0
- data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.mousewheel-3.0.4.pack.js +14 -0
- data/app/controllers/admin/account_controller.rb +2 -2
- data/app/controllers/admin/base_controller.rb +4 -0
- data/app/controllers/admin/resources_controller.rb +8 -83
- data/app/controllers/admin/session_controller.rb +10 -2
- data/app/helpers/admin/file_preview_helper.rb +15 -1
- data/app/helpers/admin/filters_helper.rb +4 -4
- data/app/helpers/admin/relationships_helper.rb +11 -6
- data/app/helpers/admin/resources_helper.rb +4 -1
- data/app/helpers/admin/table_helper.rb +6 -3
- data/app/views/admin/dashboard/_sidebar.html.erb +1 -3
- data/app/views/admin/helpers/table/_table.html.erb +0 -8
- data/app/views/admin/resources/index.html.erb +3 -1
- data/app/views/admin/shared/_head.html.erb +30 -0
- data/app/views/admin/templates/_belongs_to_with_autocomplete.html.erb +23 -4
- data/app/views/admin/templates/_relate_form.html.erb +1 -1
- data/app/views/admin/templates/_selector.html.erb +5 -1
- data/app/views/layouts/admin/base.html.erb +1 -30
- data/app/views/layouts/admin/headless.html.erb +1 -30
- data/app/views/layouts/admin/session.html.erb +1 -19
- data/doc/mongo_db.md +10 -0
- data/lib/generators/typus/typus_generator.rb +0 -5
- data/lib/support/active_record.rb +8 -0
- data/lib/typus.rb +2 -1
- data/lib/typus/controller/actions.rb +7 -0
- data/lib/typus/controller/acts_as.rb +22 -0
- data/lib/typus/controller/associations.rb +66 -0
- data/lib/typus/controller/autocomplete.rb +1 -1
- data/lib/typus/controller/format.rb +1 -1
- data/lib/typus/engine.rb +7 -2
- data/lib/typus/orm/active_record/class_methods.rb +1 -1
- data/lib/typus/version.rb +1 -1
- data/test/app/controllers/admin/assets_controller_test.rb +8 -5
- data/test/app/controllers/admin/pages_controller_test.rb +2 -2
- data/test/app/controllers/admin/posts_controller_test.rb +27 -2
- data/test/app/controllers/admin/views_controller_test.rb +36 -0
- data/test/app/helpers/admin/file_preview_helper_test.rb +9 -1
- data/test/app/helpers/admin/filters_helper_test.rb +5 -0
- data/test/app/helpers/admin/resources_helper_test.rb +2 -2
- data/test/app/helpers/admin/table_helper_test.rb +26 -0
- data/test/factories.rb +11 -0
- data/test/fixtures/rails_app/app/controllers/admin/hits_controller.rb +0 -3
- data/test/fixtures/rails_app/app/controllers/admin/views_controller.rb +6 -0
- data/test/fixtures/rails_app/app/models/asset.rb +16 -4
- data/test/fixtures/rails_app/app/models/site.rb +16 -0
- data/test/fixtures/rails_app/app/models/view.rb +2 -0
- data/test/fixtures/rails_app/config/typus/crud_extended.yml +2 -2
- data/test/fixtures/rails_app/db/schema.rb +15 -0
- data/test/lib/support/active_record_test.rb +24 -0
- data/test/lib/typus/orm/active_record/class_methods_test.rb +4 -4
- data/test/lib/typus_test.rb +1 -1
- metadata +68 -190
- data/.gemtest +0 -0
- data/doc/hudson_setup.md +0 -19
- data/lib/generators/typus/assets_generator.rb +0 -19
- data/test/fixtures/rails_app/app/views/layouts/admin/headless.html.erb +0 -38
data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.pack.js
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
/*
|
2
|
+
* FancyBox - jQuery Plugin
|
3
|
+
* Simple and fancy lightbox alternative
|
4
|
+
*
|
5
|
+
* Examples and documentation at: http://fancybox.net
|
6
|
+
*
|
7
|
+
* Copyright (c) 2008 - 2010 Janis Skarnelis
|
8
|
+
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
|
9
|
+
*
|
10
|
+
* Version: 1.3.4 (11/11/2010)
|
11
|
+
* Requires: jQuery v1.3+
|
12
|
+
*
|
13
|
+
* Dual licensed under the MIT and GPL licenses:
|
14
|
+
* http://www.opensource.org/licenses/mit-license.php
|
15
|
+
* http://www.gnu.org/licenses/gpl.html
|
16
|
+
*/
|
17
|
+
|
18
|
+
;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
|
19
|
+
F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
|
20
|
+
c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
|
21
|
+
false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
|
22
|
+
function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
|
23
|
+
'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
|
24
|
+
"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
|
25
|
+
";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
|
26
|
+
opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
|
27
|
+
d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
|
28
|
+
y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
|
29
|
+
i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
|
30
|
+
f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
|
31
|
+
37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
|
32
|
+
s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
|
33
|
+
f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
|
34
|
+
j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
|
35
|
+
"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
|
36
|
+
10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
|
37
|
+
b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
|
38
|
+
0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
|
39
|
+
1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
|
40
|
+
true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
|
41
|
+
b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
|
42
|
+
d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
|
43
|
+
D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
|
44
|
+
b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
|
45
|
+
b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
|
46
|
+
easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
|
data/app/assets/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.mousewheel-3.0.4.pack.js
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
|
2
|
+
* Licensed under the MIT License (LICENSE.txt).
|
3
|
+
*
|
4
|
+
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
5
|
+
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
6
|
+
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
7
|
+
*
|
8
|
+
* Version: 3.0.4
|
9
|
+
*
|
10
|
+
* Requires: 1.2.2+
|
11
|
+
*/
|
12
|
+
|
13
|
+
(function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=
|
14
|
+
f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
|
@@ -42,11 +42,11 @@ class Admin::AccountController < Admin::BaseController
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def sign_in?
|
45
|
-
redirect_to new_admin_session_path unless
|
45
|
+
redirect_to new_admin_session_path unless zero_users
|
46
46
|
end
|
47
47
|
|
48
48
|
def new?
|
49
|
-
redirect_to new_admin_account_path if
|
49
|
+
redirect_to new_admin_account_path if zero_users
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class Admin::ResourcesController < Admin::BaseController
|
2
2
|
|
3
3
|
include Typus::Controller::Actions
|
4
|
+
include Typus::Controller::ActsAs
|
4
5
|
include Typus::Controller::Associations
|
5
6
|
include Typus::Controller::Autocomplete
|
6
7
|
include Typus::Controller::Filters
|
@@ -9,7 +10,7 @@ class Admin::ResourcesController < Admin::BaseController
|
|
9
10
|
Whitelist = [:edit, :update, :destroy, :toggle, :position, :relate, :unrelate]
|
10
11
|
|
11
12
|
before_filter :get_model
|
12
|
-
before_filter :
|
13
|
+
before_filter :set_context # MultiSite ...
|
13
14
|
before_filter :get_object, :only => Whitelist + [:show]
|
14
15
|
before_filter :check_resource_ownership, :only => Whitelist
|
15
16
|
before_filter :check_if_user_can_perform_action_on_resources
|
@@ -25,7 +26,6 @@ class Admin::ResourcesController < Admin::BaseController
|
|
25
26
|
|
26
27
|
respond_to do |format|
|
27
28
|
format.html do
|
28
|
-
prepend_predefined_filter("All", "index", "unscoped")
|
29
29
|
add_resource_action(default_action.titleize, {:action => default_action}, {})
|
30
30
|
add_resource_action("Trash", {:action => "destroy"}, {:confirm => "#{Typus::I18n.t("Trash")}?", :method => 'delete'})
|
31
31
|
generate_html
|
@@ -124,84 +124,6 @@ class Admin::ResourcesController < Admin::BaseController
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
-
##
|
128
|
-
# Change item position:
|
129
|
-
#
|
130
|
-
# params[:go] = 'move_to_top'
|
131
|
-
#
|
132
|
-
# Available positions are move_to_top, move_higher, move_lower, move_to_bottom.
|
133
|
-
#
|
134
|
-
# NOTE: Only works if `acts_as_list` is installed.
|
135
|
-
#
|
136
|
-
def position
|
137
|
-
@item.send(params[:go])
|
138
|
-
notice = Typus::I18n.t("%{model} successfully updated.", :model => @resource.model_name.human)
|
139
|
-
redirect_to :back, :notice => notice
|
140
|
-
end
|
141
|
-
|
142
|
-
##
|
143
|
-
# Action to relate models which respond to:
|
144
|
-
#
|
145
|
-
# - has_and_belongs_to_many
|
146
|
-
# - has_many
|
147
|
-
#
|
148
|
-
# For example:
|
149
|
-
#
|
150
|
-
# class Item < ActiveRecord::Base
|
151
|
-
# has_many :line_items
|
152
|
-
# end
|
153
|
-
#
|
154
|
-
# class LineItem < ActiveRecord::Base
|
155
|
-
# belongs_to :item
|
156
|
-
# end
|
157
|
-
#
|
158
|
-
# >> related_item = LineItem.find(params[:related][:id])
|
159
|
-
# => ...
|
160
|
-
# >> item = Item.find(params[:id])
|
161
|
-
# => ...
|
162
|
-
# >> item.line_items << related_item
|
163
|
-
# => ...
|
164
|
-
#
|
165
|
-
def relate
|
166
|
-
resource_class = params[:related][:model].typus_constantize
|
167
|
-
association_name = params[:related][:association_name].tableize
|
168
|
-
|
169
|
-
if @item.send(association_name) << resource_class.find(params[:related][:id])
|
170
|
-
notice = Typus::I18n.t("%{model} successfully updated.", :model => @resource.model_name.human)
|
171
|
-
end
|
172
|
-
|
173
|
-
redirect_to :back, :notice => notice
|
174
|
-
end
|
175
|
-
|
176
|
-
##
|
177
|
-
# Action to unrelate models which respond to:
|
178
|
-
#
|
179
|
-
# - has_and_belongs_to_many
|
180
|
-
# - has_many
|
181
|
-
# - has_one
|
182
|
-
#
|
183
|
-
def unrelate
|
184
|
-
item_class = params[:resource].typus_constantize
|
185
|
-
item = item_class.find(params[:resource_id])
|
186
|
-
|
187
|
-
case item_class.relationship_with(@resource)
|
188
|
-
when :has_one
|
189
|
-
association_name = @resource.model_name.underscore.to_sym
|
190
|
-
worked = item.send(association_name).delete
|
191
|
-
else
|
192
|
-
association_name = params[:association_name] ? params[:association_name].to_sym : @resource.model_name.tableize.to_sym
|
193
|
-
worked = item.send(association_name).delete(@item)
|
194
|
-
end
|
195
|
-
|
196
|
-
if worked
|
197
|
-
notice = Typus::I18n.t("%{model} successfully updated.", :model => item_class.model_name.human)
|
198
|
-
else
|
199
|
-
alert = item.error.full_messages
|
200
|
-
end
|
201
|
-
|
202
|
-
redirect_to :back, :notice => notice, :alert => alert
|
203
|
-
end
|
204
|
-
|
205
127
|
private
|
206
128
|
|
207
129
|
def get_model
|
@@ -209,9 +131,10 @@ class Admin::ResourcesController < Admin::BaseController
|
|
209
131
|
@object_name = ActiveModel::Naming.singular(@resource)
|
210
132
|
end
|
211
133
|
|
212
|
-
def
|
213
|
-
@resource
|
134
|
+
def set_context
|
135
|
+
@resource
|
214
136
|
end
|
137
|
+
helper_method :set_context
|
215
138
|
|
216
139
|
def get_object
|
217
140
|
@item = @resource.find(params[:id])
|
@@ -270,7 +193,9 @@ class Admin::ResourcesController < Admin::BaseController
|
|
270
193
|
#
|
271
194
|
def create_with_back_to
|
272
195
|
item_class = params[:resource].typus_constantize
|
273
|
-
|
196
|
+
# For some reason we are forced to set the /admin prefix to the controller
|
197
|
+
# when working with namespaced stuff.
|
198
|
+
options = { :controller => "/admin/#{item_class.to_resource}" }
|
274
199
|
assoc = item_class.relationship_with(@resource).to_s
|
275
200
|
send("set_#{assoc}_association", item_class, options)
|
276
201
|
end
|
@@ -9,7 +9,7 @@ class Admin::SessionController < Admin::BaseController
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def create
|
12
|
-
user =
|
12
|
+
user = user_scope.authenticate(params[:typus_user][:email], params[:typus_user][:password])
|
13
13
|
|
14
14
|
path = if user
|
15
15
|
session[:typus_user_id] = user.id
|
@@ -28,11 +28,19 @@ class Admin::SessionController < Admin::BaseController
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def create_an_account?
|
31
|
-
redirect_to new_admin_account_path if
|
31
|
+
redirect_to new_admin_account_path if zero_users
|
32
32
|
end
|
33
33
|
|
34
34
|
def set_locale
|
35
35
|
I18n.locale = I18n.default_locale
|
36
36
|
end
|
37
37
|
|
38
|
+
def user_scope
|
39
|
+
if Typus.user_class.scopes.include?(:in_domain)
|
40
|
+
Typus.user_class.in_domain(request.host)
|
41
|
+
else
|
42
|
+
Typus.user_class
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
38
46
|
end
|
@@ -14,12 +14,26 @@ module Admin
|
|
14
14
|
|
15
15
|
attachment = @item.send(attribute)
|
16
16
|
|
17
|
+
# We are here and we already know we are handling attachments, but
|
18
|
+
# `dragonfly` and `paperclip` have different behaviors.
|
19
|
+
|
20
|
+
if defined?(Paperclip)
|
21
|
+
present = case attachment
|
22
|
+
when Paperclip::Attachment
|
23
|
+
attachment.exists?
|
24
|
+
else
|
25
|
+
attachment.present?
|
26
|
+
end
|
27
|
+
else
|
28
|
+
present = attachment.present?
|
29
|
+
end
|
30
|
+
|
17
31
|
field = case get_type_of_attachment(attachment)
|
18
32
|
when :dragonfly then attribute
|
19
33
|
when :paperclip then "#{attribute}_file_name"
|
20
34
|
end
|
21
35
|
|
22
|
-
if !validators.include?(field) && attachment
|
36
|
+
if present && !validators.include?(field) && attachment
|
23
37
|
attribute_i18n = @item.class.human_attribute_name(attribute)
|
24
38
|
message = Typus::I18n.t("Remove")
|
25
39
|
label_text = <<-HTML
|
@@ -10,7 +10,7 @@ module Admin
|
|
10
10
|
items = case value
|
11
11
|
when :boolean then boolean_filter(key)
|
12
12
|
when :string then string_filter(key)
|
13
|
-
when :date, :datetime then date_filter(key)
|
13
|
+
when :date, :datetime, :timestamp then date_filter(key)
|
14
14
|
when :belongs_to then belongs_to_filter(key)
|
15
15
|
when :has_many, :has_and_belongs_to_many then
|
16
16
|
has_many_filter(key)
|
@@ -79,10 +79,10 @@ module Admin
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def string_filter(filter)
|
82
|
-
values = if
|
83
|
-
|
82
|
+
values = if set_context.const_defined?(filter.to_s.upcase)
|
83
|
+
set_context::const_get(filter.to_s.upcase).to_a
|
84
84
|
else
|
85
|
-
|
85
|
+
set_context.send(filter.to_s).to_a
|
86
86
|
end
|
87
87
|
|
88
88
|
items = [[Typus::I18n.t("Show by %{attribute}", :attribute => @resource.human_attribute_name(filter).downcase), ""]]
|
@@ -6,7 +6,7 @@ module Admin
|
|
6
6
|
@model_to_relate = @resource.reflect_on_association(field.to_sym).class_name.typus_constantize
|
7
7
|
@model_to_relate_as_resource = @model_to_relate.to_resource
|
8
8
|
@reflection = @resource.reflect_on_association(field.to_sym)
|
9
|
-
@association_name = @reflection.
|
9
|
+
@association_name = @reflection.name.to_s
|
10
10
|
end
|
11
11
|
|
12
12
|
def typus_form_has_many(field)
|
@@ -17,7 +17,7 @@ module Admin
|
|
17
17
|
count_items_to_relate = @model_to_relate.order(@model_to_relate.typus_order_by).count - @item.send(field).count
|
18
18
|
|
19
19
|
if set_condition && !count_items_to_relate.zero?
|
20
|
-
form = if count_items_to_relate > Typus.autocomplete
|
20
|
+
form = if Typus.autocomplete && (count_items_to_relate > Typus.autocomplete)
|
21
21
|
build_relate_form('admin/templates/relate_form_with_autocomplete')
|
22
22
|
else
|
23
23
|
@items_to_relate = @model_to_relate.order(@model_to_relate.typus_order_by) - @item.send(field)
|
@@ -49,7 +49,7 @@ module Admin
|
|
49
49
|
count_items_to_relate = @model_to_relate.order(@model_to_relate.typus_order_by).count - @item.send(field).count
|
50
50
|
|
51
51
|
if set_condition && !count_items_to_relate.zero?
|
52
|
-
form = if count_items_to_relate > Typus.autocomplete
|
52
|
+
form = if Typus.autocomplete && (count_items_to_relate > Typus.autocomplete)
|
53
53
|
build_relate_form('admin/templates/relate_form_with_autocomplete')
|
54
54
|
else
|
55
55
|
@items_to_relate = @model_to_relate.order(@model_to_relate.typus_order_by) - @item.send(field)
|
@@ -140,7 +140,11 @@ module Admin
|
|
140
140
|
|
141
141
|
def typus_belongs_to_field(attribute, form)
|
142
142
|
association = @resource.reflect_on_association(attribute.to_sym)
|
143
|
-
related =
|
143
|
+
related = if defined?(set_belongs_to_context)
|
144
|
+
set_belongs_to_context.send(attribute.pluralize.to_sym)
|
145
|
+
else
|
146
|
+
association.class_name.typus_constantize
|
147
|
+
end
|
144
148
|
related_fk = association.primary_key_name
|
145
149
|
|
146
150
|
# TODO: Use the build_add_new method.
|
@@ -155,7 +159,7 @@ module Admin
|
|
155
159
|
end
|
156
160
|
|
157
161
|
# Set the template.
|
158
|
-
template = if related.respond_to?(:roots) || !(related.count > Typus.autocomplete)
|
162
|
+
template = if Typus.autocomplete && (related.respond_to?(:roots) || !(related.count > Typus.autocomplete))
|
159
163
|
"admin/templates/belongs_to"
|
160
164
|
else
|
161
165
|
"admin/templates/belongs_to_with_autocomplete"
|
@@ -164,11 +168,12 @@ module Admin
|
|
164
168
|
# Set the values.
|
165
169
|
values = if related.respond_to?(:roots)
|
166
170
|
expand_tree_into_select_field(related.roots, related_fk)
|
167
|
-
elsif !(related.count > Typus.autocomplete)
|
171
|
+
elsif Typus.autocomplete && !(related.count > Typus.autocomplete)
|
168
172
|
related.order(related.typus_order_by).map { |p| [p.to_label, p.id] }
|
169
173
|
end
|
170
174
|
|
171
175
|
render template,
|
176
|
+
:association => association,
|
172
177
|
:resource => @resource,
|
173
178
|
:attribute => attribute,
|
174
179
|
:form => form,
|
@@ -15,7 +15,10 @@ module Admin
|
|
15
15
|
if params[:resource]
|
16
16
|
|
17
17
|
item_class = params[:resource].typus_constantize
|
18
|
-
|
18
|
+
|
19
|
+
# For some reason we are forced to set the /admin prefix to the controller
|
20
|
+
# when working with namespaced stuff.
|
21
|
+
url = { :controller => "/admin/#{item_class.to_resource}" }
|
19
22
|
|
20
23
|
if params[:resource_id]
|
21
24
|
item = item_class.find(params[:resource_id])
|
@@ -51,13 +51,15 @@ module Admin
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def table_actions(model, item, association_name = nil)
|
54
|
-
resource_actions.map do |body, url, options|
|
54
|
+
resource_actions.map do |body, url, options, proc|
|
55
55
|
if admin_user.can?(url[:action], model.name)
|
56
|
+
next if proc && proc.respond_to?(:call) && proc.call(item) == false
|
57
|
+
|
56
58
|
link_to Typus::I18n.t(body),
|
57
|
-
params.dup.cleanup.merge(url).merge(:controller => model.to_resource, :id => item.id),
|
59
|
+
params.dup.cleanup.merge(url).merge(:controller => "/admin/#{model.to_resource}", :id => item.id),
|
58
60
|
options
|
59
61
|
end
|
60
|
-
end.join(" / ").html_safe
|
62
|
+
end.compact.join(" / ").html_safe
|
61
63
|
end
|
62
64
|
|
63
65
|
def table_belongs_to_field(attribute, item)
|
@@ -132,6 +134,7 @@ module Admin
|
|
132
134
|
|
133
135
|
alias :table_date_field :table_datetime_field
|
134
136
|
alias :table_time_field :table_datetime_field
|
137
|
+
alias :table_timestamp_field :table_datetime_field
|
135
138
|
|
136
139
|
def table_boolean_field(attribute, item)
|
137
140
|
status = item.send(attribute)
|
@@ -1,7 +1,5 @@
|
|
1
1
|
<h2>Welcome!</h2>
|
2
2
|
|
3
|
-
<p>If you need help don't hesitate in joining the <%= link_to 'mailing list', 'http://groups.google.com/group/typus' %> or use the <%= link_to "
|
3
|
+
<p>If you need help don't hesitate in joining the <%= link_to 'mailing list', 'http://groups.google.com/group/typus' %> or use the provided <%= link_to "user guide", admin_user_guide_path %>.</p>
|
4
4
|
|
5
5
|
<p>Replace this sidebar dropping a file named <code>_sidebar.html.erb</code> on the <code>app/views/admin/dashboard</code> folder.</p>
|
6
|
-
|
7
|
-
<p>If you need help you can use the provided <%= link_to "user guide", admin_user_guide_path %>.</p>
|
@@ -15,8 +15,10 @@
|
|
15
15
|
<%= render 'index' %>
|
16
16
|
|
17
17
|
<ul class="predefined_filters">
|
18
|
+
<li><%= link_to Typus::I18n.t("All"), :action => 'index' %> (<%= set_context.count %>)</li>
|
18
19
|
<% predefined_filters.each do |filter, action, scope| %>
|
19
|
-
|
20
|
+
<% url = action.is_a?(String) ? params.dup.cleanup.merge(:action => action) : action %>
|
21
|
+
<li><%= link_to Typus::I18n.t(filter), url %> <%= "(#{@resource.send(scope).count})" if scope && @resource.respond_to?(scope) %></li>
|
20
22
|
<% end %>
|
21
23
|
</ul>
|
22
24
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<meta charset="utf-8" />
|
2
|
+
<meta name="apple-mobile-web-app-capable" content="yes" />
|
3
|
+
<meta name="generator" content="Typus <%= Typus::VERSION %>" />
|
4
|
+
|
5
|
+
<%= favicon_link_tag %>
|
6
|
+
|
7
|
+
<title><%= Typus.admin_title %> — <%= yield :title %></title>
|
8
|
+
|
9
|
+
<%= stylesheet_link_tag "/vendor/typus/stylesheets/reset",
|
10
|
+
"/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/jquery-ui-1.8.12.custom.css",
|
11
|
+
"/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.css",
|
12
|
+
"/vendor/typus/vendor/jquery-tokeninput/css/token-input.css",
|
13
|
+
"/vendor/typus/stylesheets/screen",
|
14
|
+
"/vendor/typus/stylesheets/application" %>
|
15
|
+
|
16
|
+
<%= yield :stylesheets -%>
|
17
|
+
|
18
|
+
<%= javascript_include_tag "/vendor/typus/vendor/jquery-ui-1.8.12.custom/js/jquery-1.5.1.min.js",
|
19
|
+
"/vendor/typus/vendor/jquery-ui-1.8.12.custom/js/jquery-ui-1.8.12.custom.min.js",
|
20
|
+
"/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.pack.js",
|
21
|
+
"/vendor/typus/vendor/jquery-tokeninput/js/jquery.tokeninput.js",
|
22
|
+
"/vendor/typus/javascripts/jquery.searchField.js",
|
23
|
+
"/vendor/typus/javascripts/jquery.rails.js",
|
24
|
+
"/vendor/typus/javascripts/jquery.rails.autocomplete.js",
|
25
|
+
"/vendor/typus/javascripts/jquery.application.js",
|
26
|
+
"/vendor/typus/javascripts/application" %>
|
27
|
+
|
28
|
+
<%= yield :javascripts -%>
|
29
|
+
|
30
|
+
<%= csrf_meta_tag %>
|