From 6c514770bcfb98d2967be138a9ef970d0c30e70a Mon Sep 17 00:00:00 2001 From: Spen Date: Fri, 9 Aug 2013 15:07:05 +0800 Subject: [PATCH] solved conflict for member_new_ui --- app/assets/images/person.png | Bin 0 -> 2036 bytes .../javascripts/basic/orbit_js_1.0.1.js | 15 +- .../lib/bootstrap-datetimepicker.js | 1 - .../lib/datetimepicker/date.time.picker.js | 18 +- .../lib/jquery-scrolltofixed-min.js | 1 + .../lib/jquery-ui-1.10.3.custom.min.js | 6 + .../javascripts/lib/jquery.mu.image.resize.js | 147 ++++++++ .../javascripts/lib/jquery.pageslide.js | 3 +- app/assets/javascripts/lib/jquery.tmpl.min.js | 10 + app/assets/javascripts/lib/member/member.js | 8 +- .../javascripts/lib/member/role-forms.js | 81 +++-- app/assets/javascripts/member.js | 6 + app/assets/stylesheets/lib/main-list.css | 193 +++++++++++ app/assets/stylesheets/lib/member.css | 32 +- app/assets/stylesheets/lib/wrap-nav.css | 3 + app/assets/stylesheets/member.css | 7 + app/controllers/admin/infos_controller.rb | 2 +- .../admin/role_filters_controller.rb | 92 +++-- app/controllers/admin/roles_controller.rb | 142 ++++++-- .../admin/users_new_interface_controller.rb | 64 +++- app/controllers/orbit_member_controller.rb | 54 +++ app/helpers/attribute_fields_helper.rb | 316 +++++++++++++----- app/helpers/attribute_values_helper.rb | 74 ++-- app/models/user/attribute_value.rb | 24 +- .../admin/attributes/_attribute.html.erb | 31 ++ app/views/admin/attributes/_index.html.erb | 12 + app/views/admin/attributes/destroy.js.erb | 1 + app/views/admin/attributes/edit.html.erb | 226 ++++--------- app/views/admin/attributes/index.html.erb | 71 +--- app/views/admin/attributes/index.js.erb | 3 + app/views/admin/attributes/new.html.erb | 13 +- app/views/admin/role_filters/_edit.html.erb | 11 + app/views/admin/role_filters/_form.html.erb | 37 +- app/views/admin/role_filters/_index.html.erb | 18 + app/views/admin/role_filters/_new.html.erb | 11 + .../admin/role_filters/_role_filter.html.erb | 53 +-- app/views/admin/role_filters/edit.html.erb | 1 + app/views/admin/role_filters/index.html.erb | 59 ++-- app/views/admin/role_filters/index.js.erb | 3 + app/views/admin/role_filters/new.html.erb | 1 + .../admin/roles/_attribute_field.html.erb | 251 +++++++------- .../admin/roles/_sub_role_attribute.html.erb | 24 ++ .../admin/roles/_sub_role_index.html.erb | 12 + app/views/admin/roles/add_sub_role.html.erb | 86 ++--- app/views/admin/roles/destroy.js.erb | 1 + app/views/admin/roles/edit.html.erb | 32 ++ app/views/admin/roles/edit_sub_role.html.erb | 84 ++--- app/views/admin/roles/new.html.erb | 36 +- app/views/admin/roles/role_field.html.erb | 156 ++------- app/views/admin/roles/sub_role.html.erb | 76 ++--- app/views/admin/roles/sub_role.js.erb | 3 + app/views/admin/roles/sub_role_field.html.erb | 155 ++------- .../_clear_filters.html.erb | 3 + .../users_new_interface/_filter.html.erb | 90 +---- .../admin/users_new_interface/_form.html.erb | 92 ++++- .../_index_paginator.html.erb | 12 +- .../admin/users_new_interface/_info.html.erb | 11 +- .../users_new_interface/_js_and_css.html.erb | 11 +- .../admin/users_new_interface/_role.html.erb | 140 +++++--- .../admin/users_new_interface/_roles.html.erb | 2 +- .../users_new_interface/_show_roles.html.erb | 40 +-- .../users_new_interface/_side_bar.html.erb | 78 +++-- .../users_new_interface/_user_basic.html.erb | 233 +++++++------ .../_user_basic_passwd.html.erb | 70 ++-- .../_user_for_listing.html.erb | 52 +-- .../_user_for_summary.html.erb | 68 ++-- .../_user_for_thumbnail.html.erb | 43 ++- .../users_new_interface/_user_role.html.erb | 66 ++-- .../admin/users_new_interface/edit.html.erb | 52 +-- .../users_new_interface/edit_passwd.html.erb | 49 +-- .../admin/users_new_interface/index.html.erb | 55 ++- .../index_summary.html.erb | 44 ++- .../index_thumbnail.html.erb | 45 ++- .../admin/users_new_interface/new.html.erb | 52 +-- .../admin/users_new_interface/show.html.erb | 107 +++--- app/views/js/_support_member_form_js.erb | 266 +++++++++++++++ app/views/layouts/member.html.erb | 43 +++ .../attribute_field/_attribute_field.html.erb | 250 +++++++------- .../attribute_field/_list_block.html.erb | 70 ++-- .../_placeholder_block.html.erb | 24 +- config/routes.rb | 16 +- .../personal_book/plugin/_profile.html.erb | 45 ++- .../plugin/_profile.html.erb | 43 ++- .../personal_diploma/plugin/_profile.html.erb | 45 ++- .../plugin/_profile.html.erb | 44 ++- .../personal_honor/plugin/_profile.html.erb | 43 ++- .../personal_journal/plugin/_profile.html.erb | 53 ++- .../plugin/writing_journals/_form.html.erb | 6 +- .../personal_lab/plugin/_profile.html.erb | 47 ++- .../personal_patent/plugin/_profile.html.erb | 46 ++- .../personal_project/plugin/_profile.html.erb | 45 ++- .../plugin/_profile.html.erb | 45 ++- 92 files changed, 3207 insertions(+), 2105 deletions(-) create mode 100644 app/assets/images/person.png create mode 100644 app/assets/javascripts/lib/jquery-scrolltofixed-min.js create mode 100644 app/assets/javascripts/lib/jquery-ui-1.10.3.custom.min.js create mode 100644 app/assets/javascripts/lib/jquery.mu.image.resize.js create mode 100644 app/assets/javascripts/lib/jquery.tmpl.min.js create mode 100644 app/assets/javascripts/member.js create mode 100644 app/assets/stylesheets/lib/main-list.css create mode 100644 app/assets/stylesheets/member.css create mode 100644 app/controllers/orbit_member_controller.rb create mode 100644 app/views/admin/attributes/_attribute.html.erb create mode 100644 app/views/admin/attributes/_index.html.erb create mode 100644 app/views/admin/attributes/destroy.js.erb create mode 100644 app/views/admin/attributes/index.js.erb create mode 100644 app/views/admin/role_filters/_edit.html.erb create mode 100644 app/views/admin/role_filters/_index.html.erb create mode 100644 app/views/admin/role_filters/_new.html.erb create mode 100644 app/views/admin/role_filters/edit.html.erb create mode 100644 app/views/admin/role_filters/index.js.erb create mode 100644 app/views/admin/role_filters/new.html.erb create mode 100644 app/views/admin/roles/_sub_role_attribute.html.erb create mode 100644 app/views/admin/roles/_sub_role_index.html.erb create mode 100644 app/views/admin/roles/destroy.js.erb create mode 100644 app/views/admin/roles/edit.html.erb create mode 100644 app/views/admin/roles/sub_role.js.erb create mode 100644 app/views/admin/users_new_interface/_clear_filters.html.erb create mode 100644 app/views/js/_support_member_form_js.erb create mode 100644 app/views/layouts/member.html.erb diff --git a/app/assets/images/person.png b/app/assets/images/person.png new file mode 100644 index 0000000000000000000000000000000000000000..f0493974cc8e8e49e1048eef058ec50949e90a6c GIT binary patch literal 2036 zcmaJ?X;c&E8XiI*Hl=8)P}VpN;6lm9Dv{Vi2HIGXvI$%^3CR$0A(=6mNZ5|Fih$mN z6^gaca%E9KEGUJDmTMFQ4T}ZsIdauDqNuSVAW%3^dhW!Ey+1B@&dhw@_n!B8-t9Rv z#bLq^-y%DZ0RVW5{}B{{uVJQV4FP|fso+I?vB!dAu}CBp%M>YLAW(v&z#v~PlEM+N zNRqYZIvfB1=B~1+SS(f$$`K=ShREc@(8y674FCb}YfzCm9mc>ESSnL+X_FT((LkAm zON;RlummU%PLq9Kog@V1yN&M8lLH&CCJg&vraGScD0($Kf+4Cj1O<7K zzTg&tNGwyB3|n6!1Og6Up~6H8G0ca!G@OGWlSw#%Y!)lXlLz_uu)NspV9%gnRuB~8 z=NA&f^V=5a&0fJmh*&L$71#<^@)tIERjf%2aukmY!AjX)SQ4T{J<~NAJg`=aPh-y>B9|x(NEgnz=PU9qKFZ*-m{kIy$=9$&!RKFo=}d_)hM?kt-r9OT zx28zS9i!;Kpa1soUG(0Oj>l7u4=!eK`f{^}CaY$a2JM>)3M_>DG5-Q1X@Rs*$zMLc z@7eFa=VoTkKYH}YU@$B$#?=nnecpTEz=5i&s`Ka1BNkRisHM`pyyZ7;Kc3+qC009H zS#~8M?Qy~3-j##Z=w|nka~rHIovr)E#%k_N{I;|_xzE0}^6Rh3WU}N9tH5;aonsXh z;6Hd5THD*(Pn-x$)rrO8va&MK?xgT=(b?G0O_2)4cUJi%OG_|6JajapV`xZtvVX*2 z0Bz~lj9AT*`Fgt-H}!h*;?v}JG!h9h?|NcF!Ut|*ik<%1__$kel10Aj|l6 zZ;nw*jYavQm;u^UPY;nYH9Lznki-vlt+2W?0lRnQ)~yZkI{Xt+H!(akWF4&8rCVq)AG+k0BMT>h1f_5A(8iHS3JCa4Y$WXt_u#Q*x_Nken9yL35;1$0DA71$#;T>lUb}U>a|+!UHR*}yu7^P0&&K>=I-s()){if(!x()||!J){n();F.trigger("preAbsolute.ScrollToFixed");b();F.trigger("unfixed.ScrollToFixed")}}else{if(K>=C-s()){if(!o()||!J){n();F.trigger("preFixed.ScrollToFixed");w();e=-1;F.trigger("fixed.ScrollToFixed")}v(H)}else{if(!g()||!J){n();F.trigger("preUnfixed.ScrollToFixed");j();F.trigger("unfixed.ScrollToFixed")}}}}else{if(I>0){if(K+a(window).height()-F.outerHeight(true)>=I-(s()||-l())){if(o()){n();F.trigger("preUnfixed.ScrollToFixed");if(D==="absolute"){b()}else{j()}F.trigger("unfixed.ScrollToFixed")}}else{if(!o()){n();F.trigger("preFixed.ScrollToFixed");w()}v(H);F.trigger("fixed.ScrollToFixed")}}else{v(H)}}}}function l(){if(!k.options.bottom){return 0}return k.options.bottom}function n(){var H=F.css("position");if(H=="absolute"){F.trigger("postAbsolute.ScrollToFixed")}else{if(H=="fixed"){F.trigger("postFixed.ScrollToFixed")}else{F.trigger("postUnfixed.ScrollToFixed")}}}var B=function(H){if(F.is(":visible")){c=false;z()}};var E=function(H){z()};var A=function(){var I=document.body;if(document.createElement&&I&&I.appendChild&&I.removeChild){var K=document.createElement("div");if(!K.getBoundingClientRect){return null}K.innerHTML="x";K.style.cssText="position:fixed;top:100px;";I.appendChild(K);var L=I.style.height,M=I.scrollTop;I.style.height="3000px";I.scrollTop=500;var H=K.getBoundingClientRect().top;I.style.height=L;var J=(H===100);I.removeChild(K);I.scrollTop=M;return J}return null};var r=function(H){H=H||window.event;if(H.preventDefault){H.preventDefault()}H.returnValue=false};k.init=function(){k.options=a.extend({},a.ScrollToFixed.defaultOptions,h);k.$el.css("z-index",k.options.zIndex);t=a("
");G=F.css("position");D=F.css("position");p=a.extend({},F.offset());if(g()){k.$el.after(t)}a(window).bind("resize.ScrollToFixed",B);a(window).bind("scroll.ScrollToFixed",E);if(k.options.preFixed){F.bind("preFixed.ScrollToFixed",k.options.preFixed)}if(k.options.postFixed){F.bind("postFixed.ScrollToFixed",k.options.postFixed)}if(k.options.preUnfixed){F.bind("preUnfixed.ScrollToFixed",k.options.preUnfixed)}if(k.options.postUnfixed){F.bind("postUnfixed.ScrollToFixed",k.options.postUnfixed)}if(k.options.preAbsolute){F.bind("preAbsolute.ScrollToFixed",k.options.preAbsolute)}if(k.options.postAbsolute){F.bind("postAbsolute.ScrollToFixed",k.options.postAbsolute)}if(k.options.fixed){F.bind("fixed.ScrollToFixed",k.options.fixed)}if(k.options.unfixed){F.bind("unfixed.ScrollToFixed",k.options.unfixed)}if(k.options.spacerClass){t.addClass(k.options.spacerClass)}F.bind("resize.ScrollToFixed",function(){t.height(F.height())});F.bind("scroll.ScrollToFixed",function(){F.trigger("preUnfixed.ScrollToFixed");j();F.trigger("unfixed.ScrollToFixed");z()});F.bind("detach.ScrollToFixed",function(H){r(H);F.trigger("preUnfixed.ScrollToFixed");j();F.trigger("unfixed.ScrollToFixed");a(window).unbind("resize.ScrollToFixed",B);a(window).unbind("scroll.ScrollToFixed",E);F.unbind(".ScrollToFixed");k.$el.removeData("ScrollToFixed")});B()};k.init()};a.ScrollToFixed.defaultOptions={marginTop:0,limit:0,bottom:-1,zIndex:1000};a.fn.scrollToFixed=function(b){return this.each(function(){(new a.ScrollToFixed(this,b))})}})(jQuery); \ No newline at end of file diff --git a/app/assets/javascripts/lib/jquery-ui-1.10.3.custom.min.js b/app/assets/javascripts/lib/jquery-ui-1.10.3.custom.min.js new file mode 100644 index 000000000..3fb1ff614 --- /dev/null +++ b/app/assets/javascripts/lib/jquery-ui-1.10.3.custom.min.js @@ -0,0 +1,6 @@ +/*! jQuery UI - v1.10.3 - 2013-06-05 +* http://jqueryui.com +* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.tooltip.js +* Copyright 2013 jQuery Foundation and other contributors Licensed MIT */ + +(function(e,t){function i(t,i){var a,n,r,o=t.nodeName.toLowerCase();return"area"===o?(a=t.parentNode,n=a.name,t.href&&n&&"map"===a.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&s(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||i:i)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var a=0,n=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var s,a,n=e(this[0]);n.length&&n[0]!==document;){if(s=n.css("position"),("absolute"===s||"relative"===s||"fixed"===s)&&(a=parseInt(n.css("zIndex"),10),!isNaN(a)&&0!==a))return a;n=n.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++a)})},removeUniqueId:function(){return this.each(function(){n.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var s=e.attr(t,"tabindex"),a=isNaN(s);return(a||s>=0)&&i(t,!a)}}),e("").outerWidth(1).jquery||e.each(["Width","Height"],function(i,s){function a(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===s?["Left","Right"]:["Top","Bottom"],r=s.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+s]=function(i){return i===t?o["inner"+s].call(this):this.each(function(){e(this).css(r,a(this,i)+"px")})},e.fn["outer"+s]=function(t,i){return"number"!=typeof t?o["outer"+s].call(this,t):this.each(function(){e(this).css(r,a(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,s){var a,n=e.ui[t].prototype;for(a in s)n.plugins[a]=n.plugins[a]||[],n.plugins[a].push([i,s[a]])},call:function(e,t,i){var s,a=e.plugins[t];if(a&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(s=0;a.length>s;s++)e.options[a[s][0]]&&a[s][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",a=!1;return t[s]>0?!0:(t[s]=1,a=t[s]>0,t[s]=0,a)}})})(jQuery);(function(e,t){var i=0,s=Array.prototype.slice,n=e.cleanData;e.cleanData=function(t){for(var i,s=0;null!=(i=t[s]);s++)try{e(i).triggerHandler("remove")}catch(a){}n(t)},e.widget=function(i,s,n){var a,r,o,h,l={},u=i.split(".")[0];i=i.split(".")[1],a=u+"-"+i,n||(n=s,s=e.Widget),e.expr[":"][a.toLowerCase()]=function(t){return!!e.data(t,a)},e[u]=e[u]||{},r=e[u][i],o=e[u][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new o(e,i)},e.extend(o,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),h=new s,h.options=e.widget.extend({},h.options),e.each(n,function(i,n){return e.isFunction(n)?(l[i]=function(){var e=function(){return s.prototype[i].apply(this,arguments)},t=function(e){return s.prototype[i].apply(this,e)};return function(){var i,s=this._super,a=this._superApply;return this._super=e,this._superApply=t,i=n.apply(this,arguments),this._super=s,this._superApply=a,i}}(),t):(l[i]=n,t)}),o.prototype=e.widget.extend(h,{widgetEventPrefix:r?h.widgetEventPrefix:i},l,{constructor:o,namespace:u,widgetName:i,widgetFullName:a}),r?(e.each(r._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete r._childConstructors):s._childConstructors.push(o),e.widget.bridge(i,o)},e.widget.extend=function(i){for(var n,a,r=s.call(arguments,1),o=0,h=r.length;h>o;o++)for(n in r[o])a=r[o][n],r[o].hasOwnProperty(n)&&a!==t&&(i[n]=e.isPlainObject(a)?e.isPlainObject(i[n])?e.widget.extend({},i[n],a):e.widget.extend({},a):a);return i},e.widget.bridge=function(i,n){var a=n.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,h=s.call(arguments,1),l=this;return r=!o&&h.length?e.widget.extend.apply(null,[r].concat(h)):r,o?this.each(function(){var s,n=e.data(this,a);return n?e.isFunction(n[r])&&"_"!==r.charAt(0)?(s=n[r].apply(n,h),s!==n&&s!==t?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'")}):this.each(function(){var t=e.data(this,a);t?t.option(r||{})._init():e.data(this,a,new n(r,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{disabled:!1,create:null},_createWidget:function(t,s){s=e(s||this.defaultElement||this)[0],this.element=e(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),s!==this&&(e.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===s&&this.destroy()}}),this.document=e(s.style?s.ownerDocument:s.document||s),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,s){var n,a,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},n=i.split("."),i=n.shift(),n.length){for(a=o[i]=e.widget.extend({},this.options[i]),r=0;n.length-1>r;r++)a[n[r]]=a[n[r]]||{},a=a[n[r]];if(i=n.pop(),s===t)return a[i]===t?null:a[i];a[i]=s}else{if(s===t)return this.options[i]===t?null:this.options[i];o[i]=s}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var a,r=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=a=e(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,a=this.widget()),e.each(n,function(n,o){function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t}"string"!=typeof o&&(h.guid=o.guid=o.guid||h.guid||e.guid++);var l=n.match(/^(\w+)\s*(.*)$/),u=l[1]+r.eventNamespace,c=l[2];c?a.delegate(c,u,h):s.bind(u,h)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var r,o=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),r=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),r&&e.effects&&e.effects.effect[o]?s[t](n):o!==t&&s[o]?s[o](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}})})(jQuery);(function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!t){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,a="string"==typeof this.options.cancel&&i.target.nodeName?e(i.target).closest(this.options.cancel).length:!1;return n&&!a&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===e.data(i.target,this.widgetName+".preventClickEvent")&&e.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return s._mouseMove(e)},this._mouseUpDelegate=function(e){return s._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(t,e){function i(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)]}function s(e,i){return parseInt(t.css(e,i),10)||0}function n(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(a!==e)return a;var i,s,n=t("
"),o=n.children()[0];return t("body").append(n),i=o.offsetWidth,n.css("overflow","scroll"),s=o.offsetWidth,i===s&&(s=n[0].clientWidth),n.remove(),a=i-s},getScrollInfo:function(e){var i=e.isWindow?"":e.element.css("overflow-x"),s=e.isWindow?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widths?"left":i>0?"right":"center",vertical:0>a?"top":n>0?"bottom":"middle"};u>p&&p>r(i+s)&&(h.horizontal="center"),d>m&&m>r(n+a)&&(h.vertical="middle"),h.important=o(r(i),r(s))>o(r(n),r(a))?"horizontal":"vertical",e.using.call(this,t,h)}),c.offset(t.extend(C,{using:l}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-o-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-o-a,(0>i||r(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>r(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-o-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-o-a,t.top+p+f+m>c&&(0>s||r(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,t.top+p+f+m>u&&(i>0||u>r(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,i,s,n,a,o=document.getElementsByTagName("body")[0],r=document.createElement("div");e=document.createElement(o?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&t.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(a in s)e.style[a]=s[a];e.appendChild(r),i=o||document.documentElement,i.insertBefore(e,i.firstChild),r.style.cssText="position: absolute; left: 10.7432222px;",n=t(r).offset().left,t.support.offsetFractions=n>10&&11>n,e.innerHTML="",i.removeChild(e)}()})(jQuery);(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var i=this.options;return this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){e("
").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;return n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===n.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):n.containment.constructor===Array?(this.containment=n.containment,undefined):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined)},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:n.scrollTop(),left:n.scrollLeft()}),{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*s}},_generatePosition:function(t){var i,s,n,a,o=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=t.pageX,l=t.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.lefti[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i){var s=e(this).data("ui-draggable"),n=s.options,a=e.extend({},i,{item:s.element});s.sortables=[],e(n.connectToSortable).each(function(){var i=e.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,a))})},stop:function(t,i){var s=e(this).data("ui-draggable"),n=e.extend({},i,{item:s.element});e.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,n))})},drag:function(t,i){var s=e(this).data("ui-draggable"),n=this;e.each(s.sortables,function(){var a=!1,o=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(a=!0,e.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(o.instance.element[0],this.instance.element[0])&&(a=!1),a})),a?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",t),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",t),s.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),i=e(this).data("ui-draggable").options;t.css("cursor")&&(i._cursor=t.css("cursor")),t.css("cursor",i.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(t,i){var s=e(this).data("ui-draggable").options;s._opacity&&e(i.helper).css("opacity",s._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var i=e(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-t.pageY=0;c--)r=p.snapElements[c].left,h=r+p.snapElements[c].width,l=p.snapElements[c].top,u=l+p.snapElements[c].height,r-m>v||g>h+m||l-m>y||b>u+m||!e.contains(p.snapElements[c].item.ownerDocument,p.snapElements[c].item)?(p.snapElements[c].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(s=m>=Math.abs(l-y),n=m>=Math.abs(u-b),a=m>=Math.abs(r-v),o=m>=Math.abs(h-g),s&&(i.position.top=p._convertPositionTo("relative",{top:l-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h}).left-p.margins.left)),d=s||n||a||o,"outer"!==f.snapMode&&(s=m>=Math.abs(l-b),n=m>=Math.abs(u-y),a=m>=Math.abs(r-g),o=m>=Math.abs(h-v),s&&(i.position.top=p._convertPositionTo("relative",{top:l,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u-p.helperProportions.height,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[c].snapping&&(s||n||a||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=s||n||a||o||d)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,i=this.data("ui-draggable").options,s=e.makeArray(e(i.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});s.length&&(t=parseInt(e(s[0]).css("zIndex"),10)||0,e(s).each(function(i){e(this).css("zIndex",t+i)}),this.css("zIndex",t+s.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(t,i){var s=e(this).data("ui-draggable").options;s._zIndex&&e(i.helper).css("zIndex",s._zIndex)}})})(jQuery);(function(e){function t(e,t,i){return e>t&&t+i>e}e.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,i=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(i)?i:function(e){return e.is(i)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,i=e.ui.ddmanager.droppables[this.options.scope];i.length>t;t++)i[t]===this&&i.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){"accept"===t&&(this.accept=e.isFunction(i)?i:function(e){return e.is(i)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===s.options.scope&&t.accept.call(t.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(n=!0,!1):undefined}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,i,s){if(!i.offset)return!1;var n,a,o=(e.positionAbs||e.position.absolute).left,r=o+e.helperProportions.width,h=(e.positionAbs||e.position.absolute).top,l=h+e.helperProportions.height,u=i.offset.left,c=u+i.proportions.width,d=i.offset.top,p=d+i.proportions.height;switch(s){case"fit":return o>=u&&c>=r&&h>=d&&p>=l;case"intersect":return o+e.helperProportions.width/2>u&&c>r-e.helperProportions.width/2&&h+e.helperProportions.height/2>d&&p>l-e.helperProportions.height/2;case"pointer":return n=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,a=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(a,d,i.proportions.height)&&t(n,u,i.proportions.width);case"touch":return(h>=d&&p>=h||l>=d&&p>=l||d>h&&l>p)&&(o>=u&&c>=o||r>=u&&c>=r||u>o&&r>c);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions.height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions={width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight})}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===n}),a.length&&(s=e.data(a[0],"ui-droppable"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}}})(jQuery);(function(e){function t(e){return parseInt(e,10)||0}function i(e){return!isNaN(parseInt(e,10))}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("
"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=e(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(i){var s,n,a,o=this.options,r=this.element.position(),h=this.element;return this.resizing=!0,/absolute/.test(h.css("position"))?h.css({position:"absolute",top:h.css("top"),left:h.css("left")}):h.is(".ui-draggable")&&h.css({position:"absolute",top:r.top,left:r.left}),this._renderProxy(),s=t(this.helper.css("left")),n=t(this.helper.css("top")),o.containment&&(s+=e(o.containment).scrollLeft()||0,n+=e(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:s,top:n},this.size=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalSize=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalPosition={left:s,top:n},this.sizeDiff={width:h.outerWidth()-h.width(),height:h.outerHeight()-h.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,a=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===a?this.axis+"-resize":a),h.addClass("ui-resizable-resizing"),this._propagate("start",i),!0},_mouseDrag:function(t){var i,s=this.helper,n={},a=this.originalMousePosition,o=this.axis,r=this.position.top,h=this.position.left,l=this.size.width,u=this.size.height,c=t.pageX-a.left||0,d=t.pageY-a.top||0,p=this._change[o];return p?(i=p.apply(this,[t,c,d]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),this.position.top!==r&&(n.top=this.position.top+"px"),this.position.left!==h&&(n.left=this.position.left+"px"),this.size.width!==l&&(n.width=this.size.width+"px"),this.size.height!==u&&(n.height=this.size.height+"px"),s.css(n),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(n)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&e.ui.hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,s,n,a,o,r=this.options;o={minWidth:i(r.minWidth)?r.minWidth:0,maxWidth:i(r.maxWidth)?r.maxWidth:1/0,minHeight:i(r.minHeight)?r.minHeight:0,maxHeight:i(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||e)&&(t=o.minHeight*this.aspectRatio,n=o.minWidth/this.aspectRatio,s=o.maxHeight*this.aspectRatio,a=o.maxWidth/this.aspectRatio,t>o.minWidth&&(o.minWidth=t),n>o.minHeight&&(o.minHeight=n),o.maxWidth>s&&(o.maxWidth=s),o.maxHeight>a&&(o.maxHeight=a)),this._vBoundaries=o},_updateCache:function(e){this.offset=this.helper.offset(),i(e.left)&&(this.position.left=e.left),i(e.top)&&(this.position.top=e.top),i(e.height)&&(this.size.height=e.height),i(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,s=this.size,n=this.axis;return i(e.height)?e.width=e.height*this.aspectRatio:i(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===n&&(e.left=t.left+(s.width-e.width),e.top=null),"nw"===n&&(e.top=t.top+(s.height-e.height),e.left=t.left+(s.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,s=this.axis,n=i(e.width)&&t.maxWidth&&t.maxWidthe.width,r=i(e.height)&&t.minHeight&&t.minHeight>e.height,h=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,u=/sw|nw|w/.test(s),c=/nw|ne|n/.test(s);return o&&(e.width=t.minWidth),r&&(e.height=t.minHeight),n&&(e.width=t.maxWidth),a&&(e.height=t.maxHeight),o&&u&&(e.left=h-t.minWidth),n&&u&&(e.left=h-t.maxWidth),r&&c&&(e.top=l-t.minHeight),a&&c&&(e.top=l-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,i,s,n,a=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(n=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],i=[n.css("borderTopWidth"),n.css("borderRightWidth"),n.css("borderBottomWidth"),n.css("borderLeftWidth")],s=[n.css("paddingTop"),n.css("paddingRight"),n.css("paddingBottom"),n.css("paddingLeft")],t=0;i.length>t;t++)this.borderDif[t]=(parseInt(i[t],10)||0)+(parseInt(s[t],10)||0);n.css({height:a.height()-this.borderDif[0]-this.borderDif[2]||0,width:a.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("
"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).data("ui-resizable"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&e.ui.hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var i,s,n,a,o,r,h,l=e(this).data("ui-resizable"),u=l.options,c=l.element,d=u.containment,p=d instanceof e?d.get(0):/parent/.test(d)?c.parent().get(0):d;p&&(l.containerElement=e(p),/document/.test(d)||d===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(i=e(p),s=[],e(["Top","Right","Left","Bottom"]).each(function(e,n){s[e]=t(i.css("padding"+n))}),l.containerOffset=i.offset(),l.containerPosition=i.position(),l.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},n=l.containerOffset,a=l.containerSize.height,o=l.containerSize.width,r=e.ui.hasScroll(p,"left")?p.scrollWidth:o,h=e.ui.hasScroll(p)?p.scrollHeight:a,l.parentData={element:p,left:n.left,top:n.top,width:r,height:h}))},resize:function(t){var i,s,n,a,o=e(this).data("ui-resizable"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,c={top:0,left:0},d=o.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(c=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-c.left),u&&(o.size.height=o.size.width/o.aspectRatio),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio),o.position.top=o._helper?h.top:0),o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top,i=Math.abs((o._helper?o.offset.left-c.left:o.offset.left-c.left)+o.sizeDiff.width),s=Math.abs((o._helper?o.offset.top-c.top:o.offset.top-h.top)+o.sizeDiff.height),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a&&(i-=o.parentData.left),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio))},stop:function(){var t=e(this).data("ui-resizable"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,s=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)})},resize:function(t,i){var s=e(this).data("ui-resizable"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0},h=function(t,s){e(t).each(function(){var t=e(this),n=e(this).data("ui-resizable-alsoresize"),a={},o=s&&s.length?s:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var i=(n[t]||0)+(r[t]||0);i&&i>=0&&(a[t]=i||null)}),t.css(a)})};"object"!=typeof n.alsoResize||n.alsoResize.nodeType?h(n.alsoResize):e.each(n.alsoResize,function(e,t){h(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).data("ui-resizable"),i=t.options,s=t.size,n=t.originalSize,a=t.originalPosition,o=t.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=r[0]||1,l=r[1]||1,u=Math.round((s.width-n.width)/h)*h,c=Math.round((s.height-n.height)/l)*l,d=n.width+u,p=n.height+c,f=i.maxWidth&&d>i.maxWidth,m=i.maxHeight&&p>i.maxHeight,g=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=r,g&&(d+=h),v&&(p+=l),f&&(d-=h),m&&(p-=l),/^(se|s|e)$/.test(o)?(t.size.width=d,t.size.height=p):/^(ne)$/.test(o)?(t.size.width=d,t.size.height=p,t.position.top=a.top-c):/^(sw)$/.test(o)?(t.size.width=d,t.size.height=p,t.position.left=a.left-u):(t.size.width=d,t.size.height=p,t.position.top=a.top-c,t.position.left=a.left-u)}})})(jQuery);(function(e){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("
")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):undefined}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}})})(jQuery);(function(t){function e(t,e,i){return t>e&&e+i>t}function i(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var t=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===t.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(e,i){"disabled"===e?(this.options[e]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):t.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(e,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,a.widgetName+"-item")===a?(s=t(this),!1):undefined}),t.data(e.target,a.widgetName+"-item")===a&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=t("").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=t.left,o=a+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>a&&o>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var i="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),s="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),n=i&&s,a=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return n?this.floating?o&&"right"===o||"down"===a?2:1:a&&("down"===a?2:1):!1},_intersectsWithSides:function(t){var i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),s=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&s||"left"===a&&!s:n&&("down"===n&&i||"up"===n&&!i)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){var i,s,n,a,o=[],r=[],h=this._connectWith();if(h&&e)for(i=h.length-1;i>=0;i--)for(n=t(h[i]),s=n.length-1;s>=0;s--)a=t.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&r.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(r.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=r.length-1;i>=0;i--)r[i][0].each(function(){o.push(this)});return t(o)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i]),s=n.length-1;s>=0;s--)a=t.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(u.push([t.isFunction(a.options.items)?a.options.items.call(a.element[0],e,{item:this.currentItem}):t(a.options.items,a.element),a]),this.containers.push(a));for(i=u.length-1;i>=0;i--)for(o=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",o),c.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]).addClass(i||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?e.currentItem.children().each(function(){t(" ",e.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(n)}):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_contactContainers:function(s){var n,a,o,r,h,l,c,u,d,p,f=null,m=null;for(n=this.containers.length-1;n>=0;n--)if(!t.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(f&&t.contains(this.containers[n].element[0],f.element[0]))continue;f=this.containers[n],m=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",s,this._uiHash(this)),this.containers[n].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[m].containerCache.over||(this.containers[m]._trigger("over",s,this._uiHash(this)),this.containers[m].containerCache.over=1);else{for(o=1e4,r=null,p=f.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",c=this.positionAbs[h]+this.offset.click[h],a=this.items.length-1;a>=0;a--)t.contains(this.containers[m].element[0],this.items[a].item[0])&&this.items[a].item[0]!==this.currentItem[0]&&(!p||e(this.positionAbs.top+this.offset.click.top,this.items[a].top,this.items[a].height))&&(u=this.items[a].item.offset()[h],d=!1,Math.abs(u-c)>Math.abs(u+this.items[a][l]-c)&&(d=!0,u+=this.items[a][l]),o>Math.abs(u-c)&&(o=Math.abs(u-c),r=this.items[a],this.direction=d?"up":"down"));if(!r&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[m])return;r?this._rearrange(s,r,null,!0):this._rearrange(s,null,this.containers[m].element,!0),this._trigger("change",s,this._uiHash()),this.containers[m]._trigger("change",s,this._uiHash(this)),this.currentContainer=this.containers[m],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[m]._trigger("over",s,this._uiHash(this)),this.containers[m].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,a=e.pageX,o=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.leftthis.containment[2]&&(a=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)e||s.push(function(t){return function(e){t._trigger("deactivate",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(function(t){return function(e){t._trigger("out",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!e){for(this._trigger("beforeStop",t,this._uiHash()),i=0;s.length>i;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}if(e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!e){for(i=0;s.length>i;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})})(jQuery);(function(t){function e(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))}function i(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")}var s=0;t.widget("ui.tooltip",{version:"1.10.3",options:{content:function(){var e=t(this).attr("title")||"";return t("
").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(e,i){var s=this;return"disabled"===e?(this[i?"_disable":"_enable"](),this.options[e]=i,void 0):(this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e)}),void 0)},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.is("[title]")&&e.data("ui-tooltip-title",e.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))})},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,a=e?e.type:null;return"string"==typeof s?this._open(e,t,s):(i=s.call(t[0],function(i){t.data("ui-tooltip-open")&&n._delay(function(){e&&(e.type=a),this._open(e,t,i)})}),i&&this._open(e,t,i),void 0)},_open:function(i,s,n){function a(t){l.of=t,o.is(":hidden")||o.position(l)}var o,r,h,l=t.extend({},this.options.position);if(n){if(o=this._find(s),o.length)return o.find(".ui-tooltip-content").html(n),void 0;s.is("[title]")&&(i&&"mouseover"===i.type?s.attr("title",""):s.removeAttr("title")),o=this._tooltip(s),e(s,o.attr("id")),o.find(".ui-tooltip-content").html(n),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:a}),a(i)):o.position(t.extend({of:s},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){o.is(":visible")&&(a(l.of),clearInterval(h))},t.fx.interval)),this._trigger("open",i,{tooltip:o}),r={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var i=t.Event(e);i.currentTarget=s[0],this.close(i,!0)}},remove:function(){this._removeTooltip(o)}},i&&"mouseover"!==i.type||(r.mouseleave="close"),i&&"focusin"!==i.type||(r.focusout="close"),this._on(!0,s,r)}},close:function(e){var s=this,n=t(e?e.currentTarget:this.element),a=this._find(n);this.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&n.attr("title",n.data("ui-tooltip-title")),i(n),a.stop(!0),this._hide(a,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),this.closing=!0,this._trigger("close",e,{tooltip:a}),this.closing=!1)},_tooltip:function(e){var i="ui-tooltip-"+s++,n=t("
").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return t("
").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[i]=e,n},_find:function(e){var i=e.data("ui-tooltip-id");return i?t("#"+i):t()},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0),t("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})})(jQuery); \ No newline at end of file diff --git a/app/assets/javascripts/lib/jquery.mu.image.resize.js b/app/assets/javascripts/lib/jquery.mu.image.resize.js new file mode 100644 index 000000000..484a96460 --- /dev/null +++ b/app/assets/javascripts/lib/jquery.mu.image.resize.js @@ -0,0 +1,147 @@ +(function( $ ) { + $.fn.muImageResize = function( params ) { + var _defaultSettings = { + width:300, + height:300, + wrap_fix:true // Let image display like in-line. + }; + var _set = $.extend(_defaultSettings, params); + // var isIE7 = $.browser.msie && (7 == ~~ $.browser.version); + + //var anyDynamicSource = $(this).attr("src"); + //$(this).attr("src",anyDynamicSource+ "?" + new Date().getTime()); + + // Just bind load event once per element. + return this.one('load', function() { + // Remove all attributes and CSS rules. + this.removeAttribute( "width" ); + this.removeAttribute( "height" ); + this.style.width = this.style.height = ""; + + var ow, oh; + + //[workaround] - msie need get width early + if (/MSIE/g.test($ua)) + { + // Get original size for calcutation. + ow = this.width; + oh = this.height; + } + + if (_set.wrap_fix) { + $(this).wrap(function(){ + return '
'; + }); + } + + if (!/MSIE/g.test($ua)) + { + // Get original size for calcutation. + ow = this.width; + oh = this.height; + } + + // if cannot get width or height. + if (0==ow || 0==oh){ + $(this).width(_set.width); + $(this).height(_set.height); + }else{ + + // Merge position settings + var sh_margin_type=''; + + // if original image's width > height. + if (ow > oh) { + p = oh / _set.height; + oh = _set.height; + ow = ow / p; + + // original image width smaller than settings. + if (ow < _set.width){ + // need to resize again, + // because new image size range must can cover settings' range, than we can crop it correctly. + p = ow / _set.width; + ow = _set.width; + oh = oh / p; + + // the crop range would be in the center of new image size. + sh = (oh-_set.height)/2; + t=sh+'px'; + r=_set.width+'px'; + b=(_set.height+sh)+'px'; + l='0px'; + + // need to be adjust top position latter. + sh_margin_type = 'margin-top'; + + // original image width bigger than settings. + }else{ + // new image range can cover settings' range. + sh = (ow-_set.width)/2; + t='0px'; + r=(_set.width+sh)+'px'; + b=_set.height+'px'; + l=sh+'px'; + // need to be adjust left position latter. + sh_margin_type = 'margin-left'; + } + // ref above, change width to height then do same things. + }else{ + p = ow / _set.width; + ow = _set.width; + oh = oh / p; + + if (oh < _set.height) { + p = oh / _set.height; + oh = _set.height; + ow = ow / p; + + sh = (ow-_set.width)/2; + t='0px'; + r=(_set.width+sh)+'px'; + b=_set.height+'px'; + l=sh+'px'; + sh_margin_type = 'margin-left'; + }else{ + sh = (oh-_set.height)/2; + t=sh+'px'; + r=_set.width+'px'; + b=(_set.height+sh)+'px'; + l='0px'; + sh_margin_type = 'margin-top'; + } + } + + // Resize img. + $(this).width(ow); + $(this).height(oh); + + // Crop img by set clip style. + $(this).css('clip','rect('+t+' '+r+' '+b+' '+l+')'); + + var osh = 0; + if('auto' != $(this).css(sh_margin_type)){ + osh = parseInt($(this).css(sh_margin_type)); + } + + if (0 < sh) {sh*=-1;} + sh += osh; + + $(this).css(sh_margin_type, sh+'px'); + // $(this).css('position','absolute'); + } + $(this).fadeIn('slow'); + }) + .one( "error", function() { + //$(this).hide(); + }) + .each(function() { + $(this).hide(); + // Trigger load event (for Gecko and MSIE) + if ( this.complete || /MSIE/g.test($ua) ) { + $( this ).trigger( "load" ).trigger( "error" ); + } + }); + }; + +})( jQuery ); \ No newline at end of file diff --git a/app/assets/javascripts/lib/jquery.pageslide.js b/app/assets/javascripts/lib/jquery.pageslide.js index 2455bb514..06877480a 100644 --- a/app/assets/javascripts/lib/jquery.pageslide.js +++ b/app/assets/javascripts/lib/jquery.pageslide.js @@ -136,9 +136,8 @@ }); } } - console.log("ff") - $pageName = $self.closest('.item-menu').siblings('a').text(); + $pageName = $self.parents('.item-title').children('a').text(); $('.page-name').text($pageName); } else if($('.tags-groups').length) { $(this).parents('li').addClass("active").siblings().removeClass("active").parent('ul').siblings().children('li').removeClass("active"); diff --git a/app/assets/javascripts/lib/jquery.tmpl.min.js b/app/assets/javascripts/lib/jquery.tmpl.min.js new file mode 100644 index 000000000..a615f5b21 --- /dev/null +++ b/app/assets/javascripts/lib/jquery.tmpl.min.js @@ -0,0 +1,10 @@ +/* + * jQuery Templates Plugin 1.0.0pre + * http://github.com/jquery/jquery-tmpl + * Requires jQuery 1.4.2 + * + * Copyright 2011, Software Freedom Conservancy, Inc. + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + */ +(function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i").join(">").split('"').join(""").split("'").join("'")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery); \ No newline at end of file diff --git a/app/assets/javascripts/lib/member/member.js b/app/assets/javascripts/lib/member/member.js index 05935113a..9b6fdfbe7 100644 --- a/app/assets/javascripts/lib/member/member.js +++ b/app/assets/javascripts/lib/member/member.js @@ -35,7 +35,7 @@ $(function() { checkHeight(); $(window).resize(function() { checkHeight(); - setModuleBlockWidth(); + // setModuleBlockWidth(); }); $('#member-roles h4 > span').each(function() { $(this).css('margin-left',function() { @@ -48,8 +48,8 @@ $(function() { $('#module-navbar').scrollToFixed({ marginTop: $('#orbit-bar').outerHeight(true), }); - $('.member-avatar').imagesLoaded(function() { - $('#basic-info .member-avatar img').muImageResize({width: 100, height:100}); - }); + // $('.member-avatar').imagesLoaded(function() { + // $('#basic-info .member-avatar img').muImageResize({width: 100, height:100}); + // }); $('#member-roles').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true }); }) \ No newline at end of file diff --git a/app/assets/javascripts/lib/member/role-forms.js b/app/assets/javascripts/lib/member/role-forms.js index 2c244bfc9..185709e6c 100644 --- a/app/assets/javascripts/lib/member/role-forms.js +++ b/app/assets/javascripts/lib/member/role-forms.js @@ -68,7 +68,7 @@ function temporary() { // Determine the Append input length function inputAppendLength() { $('.add-target').each(function(i) { - if($(this).children('.input-append:not(:hidden)').length == 1) { + if($(this).children('.input-append:not(:hidden)').length == 1 || $(this).children('.input-append').length == 1) { $(this).children('.input-append').each(function() { if($(this).children('div').hasClass('tab-content')) { var btnLength = $(this).children('.btn').length; @@ -96,7 +96,7 @@ function inputAppendLength() { // Role Attribute Template Data function setData(l, type, ol) { - var fields = "role[attribute_fields]", + var fields = $('#info').length ? "info[attribute_fields]" : $('#sub_role').length ? "sub_role[attribute_fields]" : "role[attribute_fields]", data = { _add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"], _calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"], @@ -122,7 +122,7 @@ function getAddressForm(trigger, element, decide) { addressVal.length = addressArray.length = 0; var addressAllVal = []; var inputNameArray = []; - trigger.parents('.input-append').find('.tab-pane').each(function() { + trigger.closest('.input-append').find('.tab-pane').each(function() { var adderssText = $(this).children('input[type="text"]').val(), addersshidden = '', addressData = {}, @@ -210,7 +210,7 @@ $(function() { $('.control-group').delegate('.btn[data-toggle="modal"]', 'click', function() { var $trigger = $(this); addressInputId.length = 0; - $(this).parents('.input-append').find('.tab-pane').each(function() { + $(this).closest('.input-append').find('.tab-pane').each(function() { addressInputId.push($(this).attr('id')); }); $('#address-field').on('show', getAddressForm($trigger, $('#address-field'), true)); @@ -220,14 +220,14 @@ $(function() { if($(this).hasClass('disabled')) { $(this).find('.toggle-check') .attr('value', 'false') - .parents('.attributes') + .closest('.attributes') .removeClass('disabled') .find('.attributes-body') .fadeIn(300); } else { $(this).find('.toggle-check') .attr('value', 'true') - .parents('.attributes') + .closest('.attributes') .addClass('disabled') .find('.attributes-body') .fadeOut(300); @@ -235,19 +235,22 @@ $(function() { $(this).toggleClass('disabled'); }; if($(this).hasClass('remove-input')) { - $(this).parents('.input-append').fadeOut(300, function() { + $(this).closest('.input-append').fadeOut(300, function() { + $(this).remove(); inputAppendLength(); }); }; if($(this).hasClass('trigger')) { - appendIndex = $(this).parents('.controls').find('.input-append').length; + appendIndex = $(this).closest('.controls').find('.input-append').length; + nameNumber = $(this).closest('.controls').find('.input-append:eq(0)').find('input').eq(0).attr('name'); + nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0]; roleType = $(this).data('roles') if($(this).hasClass('textInput')) { - $("#template-text").tmpl().appendTo($(this).parents('.controls').find('.add-target')); + $("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target')); } else if ($(this).hasClass('textLengInput')) { - $("#template-text-language").tmpl().appendTo($(this).parents('.controls').find('.add-target')); + $("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target')); } else if ($(this).hasClass('address')) { - $("#template-address").tmpl().appendTo($(this).parents('.controls').find('.add-target')); + $("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target')); } inputAppendLength(); }; @@ -256,7 +259,6 @@ $(function() { inputAppendLength(); } else { attributesArray = []; - attributesLength = $('#attributes-area .attributes').length; attributesHeaderLength = null; templateType = null; attributeIndex = null; @@ -274,9 +276,9 @@ $(function() { $('#attributes-area').removeClass('clickHere'); }; attributesHeaderLength = $('.attributes:not(:hidden)').length+1; + attributesLength = $('#attributes-area .attributes').length; $("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" ); $('.toggle-check').togglebox(); - attributesLength = $('#attributes-area .attributes').length; }); @@ -295,9 +297,9 @@ $(function() { switch(e) { case 'text': var val = $(this).val(); - if(!$(this).parents('.field-type').length) { + if(!$(this).closest('.field-type').length) { $data = attributesArray[i][$data]; - } else if(!$(this).parents('.add-target').length) { + } else if(!$(this).closest('.add-target').length) { $data = attributesArray[i].select[$data]; } else { appendIndex = $(this).parent('.input-append').index() @@ -305,21 +307,21 @@ $(function() { $data = attributesArray[i].select.option[appendIndex][optionIndex]; } if(val != $data) { - $(this).parents('.attributes').find('.reply').removeClass('hide'); + $(this).closest('.attributes').find('.reply').removeClass('hide'); } break; case 'radio': var checked = $(this).prop("checked"); $data = attributesArray[i][$data]; if(checked != $data) { - $(this).parents('.attributes').find('.reply').removeClass('hide'); + $(this).closest('.attributes').find('.reply').removeClass('hide'); } break; case 'checkbox': var checked = $(this).prop("checked"); $data = attributesArray[i].select[$data]; if(checked != $data) { - $(this).parents('.attributes').find('.reply').removeClass('hide'); + $(this).closest('.attributes').find('.reply').removeClass('hide'); } break; case 'select-one': @@ -329,7 +331,7 @@ $(function() { ref = $(this).attr('ref'); }); if(ref != $data) { - $(this).parents('.attributes').find('.reply').removeClass('hide'); + $(this).closest('.attributes').find('.reply').removeClass('hide'); } break; }; @@ -378,7 +380,7 @@ $(function() { if($(this).hasClass('disabled')) { $(this).find('.toggle-check') .attr('value', 'false') - .parents('.attributes') + .closest('.attributes') .removeClass('disabled') .find('input, select') .removeAttr('disabled') @@ -386,13 +388,13 @@ $(function() { .find('.btn-group .btn') .removeClass('disabled') .end().find('.attribute_field_disabled').attr('value', 'false'); - if($(this).parents('.attributes').find('.dataType').children("option:selected").attr('ref')) { - $(this).parents('.attributes').find('.field-type').addClass('in').find('.control-group').delay(150).fadeIn(300); + if($(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref')) { + $(this).closest('.attributes').find('.field-type').addClass('in').find('.control-group').delay(150).fadeIn(300); } } else { $(this).find('.toggle-check') .attr('value', 'true') - .parents('.attributes') + .closest('.attributes') .addClass('disabled') .find('.attributes-body input, .attributes-body select') .attr({'disabled': 'disabled'}) @@ -407,7 +409,7 @@ $(function() { $(this).toggleClass('disabled'); }; if($(this).hasClass('delete')) { - $(this).parents('.attributes').fadeOut(300, function() { + $(this).closest('.attributes').fadeOut(300, function() { $('.attributes:not(:hidden)').each(function(i) { $(this).find('.attributes-header h4 span').text(i+1); }); @@ -418,13 +420,19 @@ $(function() { }).find('.attribute_field_to_delete').attr('value', 'true');; }; if($(this).hasClass('trigger')) { - appendIndex = $(this).parents('.controls').find('.input-append').length; - attributeIndex = $(this).parents('.attributes').index(); - $("#template-input-append").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo($(this).parents('.controls').find('.add-target')); + // appendIndex = $(this).closest('.controls').find('.input-append').length; + appendIndex = $(this).closest('.controls').find('.input-append:last-child').children('input:first-child').attr('name'); + appendIndex = appendIndex.split("]["); + appendIndex = parseInt(appendIndex[appendIndex.length-2])+1; + attributeIndex = $(this).closest('.attributes').index(); + templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref'); + $("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target')); + inputAppendLength(); }; if($(this).hasClass('remove-input')) { $(this).parent('.input-append').fadeOut(300, function() { + $(this).remove() inputAppendLength(); }); @@ -433,20 +441,21 @@ $(function() { }); $('#attributes-area').delegate('.dataType', 'change', function() { $(this).children("option:selected").each(function () { - var target = $(this).parents('.attributes').find('.field-type').not('.default'); - attributeIndex = $(this).parents('.attributes').index(); - appendIndex = $(this).parents('.attributes').find('.add-target').find('.input-append').length; - if($(this).parents('.attributes').hasClass('default')){ - var i = $(this).parents('.attributes').index() + var target = $(this).closest('.attributes').find('.field-type').not('.default'); + attributeIndex = $(this).closest('.attributes').index(); + appendIndex = 0 + // $(this).closest('.attributes').find('.add-target').find('.input-append').length; + if($(this).closest('.attributes').hasClass('default')){ + var i = $(this).closest('.attributes').index() if($(this).attr('ref') == attributesArray[i].select.name) { - $(this).parents('.attributes').find('.field-type.default').show() + $(this).closest('.attributes').find('.field-type.default').show() target.empty().hide(); } else { - $(this).parents('.attributes').find('.field-type.default').hide() + $(this).closest('.attributes').find('.field-type.default').hide() if($(this).attr('ref')) { templateType = $(this).attr('ref'); target.removeAttr('class').addClass('field-type fade in ' + templateType).empty(); - $("#template-type").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo(target); + $("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target); if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') { inputAppendLength(); } @@ -460,7 +469,7 @@ $(function() { if($(this).attr('ref')) { templateType = $(this).attr('ref'); target.removeAttr('class').addClass('field-type fade in ' + templateType).empty(); - $("#template-type").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo(target); + $("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target); if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') { inputAppendLength(); } diff --git a/app/assets/javascripts/member.js b/app/assets/javascripts/member.js new file mode 100644 index 000000000..0b2af80ec --- /dev/null +++ b/app/assets/javascripts/member.js @@ -0,0 +1,6 @@ +//= require basic +//= require lib/footable-0.1.js +//= require lib/all-list +//= require lib/jquery.fastLiveFilter.js +//= require lib/checkbox.card.js +//= require lib/jquery.form.js \ No newline at end of file diff --git a/app/assets/stylesheets/lib/main-list.css b/app/assets/stylesheets/lib/main-list.css new file mode 100644 index 000000000..0d56d37f1 --- /dev/null +++ b/app/assets/stylesheets/lib/main-list.css @@ -0,0 +1,193 @@ +/* Main List */ +.main-list { + margin-bottom: 10px; +} +.main-list tbody { + border: 1px solid #dddddd; +} +.main-list thead { + border: 1px solid #454545; +} +.main-list thead th { + vertical-align: middle; + background-color: #454545; + white-space: nowrap; + color: #FFFFFF; +} +.main-list tbody tr.disable td { + color: #C5C5C5; + background-color: #eeeeee; +} +.main-list tbody tr.disable td .label-info { + background-color: #999999; +} +.main-list tbody tr.active td:first-child { + position: relative; +} +.main-list tbody tr.active td:first-child:before { + content: ""; + width: 0px; + height: 0px; + left: -21px; + top: 50%; + margin-top: -6px; + position: absolute; + border-style: solid; + border-width: 6px 0 6px 6px; + border-color: transparent transparent transparent #333333; +} +.main-list td { + background-color: #FFFFFF; +} +.main-list td.action { + vertical-align: middle; + text-align: right; +} +.main-list td.preview img { + width: 100%; +} +.main-list td .banner-link { + width: 100px; + max-width: 120px; + display: inline-block; + text-overflow: ellipsis; + overflow: hidden; +} +.main-list td .file-list { + display: inline-block; + margin: 0 0 -6px; +} +.main-list td .file-list:after { + content: ""; + clear: both; + display: block; + height: 0; + visibility: hidden; +} +.main-list td .file-type { + position: relative; + list-style: none; + float: left; + display: inline-block; +} +.main-list td .file-type a { + background-color: #A6A6A6; + color: #FFFFFF; + margin-right: 10px; + padding: 2px 5px 2px 3px; + border-radius: 3px; + text-decoration: none; + text-shadow: 0px -1px 0px rgba(100, 100, 100, .6); +} +.main-list td .file-type i, +.main-forms fieldset .input-area .controls .file-type i { + width: 16px; + height: 16px; + margin-bottom: -1px; + display: inline-block; +} +.main-list td .file-type[class^="type-"] i, +.main-list td .file-type[class*=" type-"] i, +.main-forms fieldset .input-area .controls .file-type[class*=" type-"] i, +.main-forms fieldset .input-area .controls .file-type[class^="type-"] i { + background-image: url(/orbit_4.0.1/assets/images/file_type.png); +} +.file-type.type-pdf i {background-position: 0px 0px;} +.file-type.type-psd i {background-position: -16px 0px;} +.file-type.type-ai i {background-position: -32px 0px;} +.file-type.type-fla i {background-position: -48px 0px;} +.file-type.type-in i {background-position: -64px 0px;} +.file-type.type-acc i {background-position: 0px -16px;} +.file-type.type-do i {background-position: -16px -16px;} +.file-type.type-xl i {background-position: -32px -16px;} +.file-type.type-pp i {background-position: -48px -16px;} +.file-type.type-zip i {background-position: -64px -16px;} +.file-type.type-txt i {background-position: 0px -32px;} +.file-type.type-jp i {background-position: -16px -32px;} +.file-type.type-gif i {background-position: -32px -32px;} +.file-type.type-png i {background-position: -48px -32px;} +.file-type.type-audio i {background-position: -64px -32px;} + +.main-list td .quick-edit { + height: 24px; + margin-top: 5px; +} +.main-list td .quick-edit .nav { + display: none; + margin-bottom: 0; +} +.main-list tr:hover .quick-edit .nav { + display: block; +} +.main-list td .quick-edit .nav > li > a { + padding-top: 4px; + padding-bottom: 4px; + margin-top: 0px; + margin-bottom: 0px; + border: 1px dotted #d1d1d1; +} +.main-list td .quick-edit .nav > li > a:hover { + border: 1px dotted transparent; +} +.main-list thead tr.sort-header th a { + padding: 8px; + margin: -8px; + display: block; + color: #FFFFFF; + text-decoration: none; +} +.main-list thead tr.sort-header th.active a { + padding-bottom: 4px; + border-bottom: 4px solid #08c; +} +.main-list .footable-row-detail td { + padding: 0; + border-top: none; +} +.main-list .footable-row-detail td .footable-row-detail-inner { + display: none; + padding: 8px; + position: relative; + border-radius: 5px; + margin: 0 8px 8px; + background-color: #ededed; +} +.main-list .footable-row-detail td .footable-row-detail-inner:after { + display: block; + height: 0px; + width: 0px; + position: absolute; + top: -6px; + left: 50%; + margin-left: -3px; + content: ""; + border-style: solid; + border-width: 0 6px 6px 6px; + border-color: transparent transparent #ededed transparent; +} +.main-list .footable-row-detail td .footable-row-detail-inner div { + margin: 10px 0; +} +#preview .preview { + margin: 0 auto; +} + + +/* For Retina */ +@media screen and (-webkit-min-device-pixel-ratio: 2), screen and (max--moz-device-pixel-ratio: 2) { + .main-list td .file-type[class^="type-"] i, + .main-list td .file-type[class*=" type-"] i, + .main-forms fieldset .input-area .controls .file-type[class*=" type-"] i, + .main-forms fieldset .input-area .controls .file-type[class^="type-"] i { + background-image: url(/orbit_4.0.1/assets/images/file_type@2x.png); + background-size: 80px 48px; + } +} + + +/* Responsive */ +@media (max-width: 480px) { + .main-list td .quick-edit .nav { + display: block; + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/lib/member.css b/app/assets/stylesheets/lib/member.css index d4a890527..63882f908 100644 --- a/app/assets/stylesheets/lib/member.css +++ b/app/assets/stylesheets/lib/member.css @@ -11,10 +11,13 @@ padding: 0; } #list-view #member-list td.gender-man { - background-color: #34ADFF + background-color: #34ADFF; } #list-view #member-list td.gender-woman { - background-color: #FF3196 + background-color: #FF3196; +} +#list-view #member-list td.gender-none { + background-color: #DDDDDD; } /* Abstract */ @@ -53,12 +56,15 @@ left: 0; z-index: 1; } -#list-view #member-abstract .gender-men { +#list-view #member-abstract .gender-man { border-color: #34ADFF transparent transparent transparent; } -#list-view #member-abstract .gender-women { +#list-view #member-abstract .gender-woman { border-color: #FF3196 transparent transparent transparent; } +#list-view #member-abstract .gender-none { + border-color: #DDDDDD transparent transparent transparent; +} #list-view #member-abstract .member-avatar { position: relative; -webkit-border-radius: 5px 5px 0 0; @@ -171,12 +177,15 @@ left: 0; top: 0; } -#list-view #member-card .member-avatar.gender-men { +#list-view #member-card .member-avatar.gender-man { border-color: #34ADFF; } -#list-view #member-card .member-avatar.gender-women { +#list-view #member-card .member-avatar.gender-woman { border-color: #FF3196; } +#list-view #member-card .member-avatar.gender-none { + border-color: #DDDDDD; +} #list-view #member-card .member-avatar img { /*width: 100%;*/ max-width: none; @@ -248,9 +257,9 @@ text-overflow: ellipsis; white-space: nowrap; } -#profile #basic-info .basic-profile .btn { +#profile #basic-info .basic-profile .btn-group { display: block; - margin-top: 40px; + margin-top: 20px; } #profile #basic-info .member-avatar { width: 106px; @@ -262,12 +271,15 @@ width: 100%; max-width: none; } -#profile #basic-info .member-avatar.gender-men img { +#profile #basic-info .member-avatar.gender-man img { border-color: #34ADFF; } -#profile #basic-info .member-avatar.gender-women img { +#profile #basic-info .member-avatar.gender-woman img { border-color: #FF3196; } +#profile #basic-info .member-avatar.gender-none img { + border-color: #DDDDDD; +} #profile #member-roles { clear: both; margin-top: 30px; diff --git a/app/assets/stylesheets/lib/wrap-nav.css b/app/assets/stylesheets/lib/wrap-nav.css index b26c20f3e..75fc22d87 100644 --- a/app/assets/stylesheets/lib/wrap-nav.css +++ b/app/assets/stylesheets/lib/wrap-nav.css @@ -44,6 +44,9 @@ .bottomnav .pagination { margin: 0; } +#module-content .bottomnav { + left: 451px; +} /* Breadcrumb */ .topnav .breadcrumb { diff --git a/app/assets/stylesheets/member.css b/app/assets/stylesheets/member.css new file mode 100644 index 000000000..9106a19bb --- /dev/null +++ b/app/assets/stylesheets/member.css @@ -0,0 +1,7 @@ +/* + *= require basic + *= require lib/wrap-nav + *= require lib/main-list + *= require lib/filter + *= require lib/pageslide +*/ \ No newline at end of file diff --git a/app/controllers/admin/infos_controller.rb b/app/controllers/admin/infos_controller.rb index 7d7b3ee96..6c86935b6 100644 --- a/app/controllers/admin/infos_controller.rb +++ b/app/controllers/admin/infos_controller.rb @@ -1,4 +1,4 @@ -class Admin::InfosController < OrbitBackendController +class Admin::InfosController < OrbitMemberController before_filter :authenticate_user! before_filter :is_admin? diff --git a/app/controllers/admin/role_filters_controller.rb b/app/controllers/admin/role_filters_controller.rb index ad48ab887..53c8a70ca 100644 --- a/app/controllers/admin/role_filters_controller.rb +++ b/app/controllers/admin/role_filters_controller.rb @@ -1,8 +1,8 @@ -class Admin::RoleFiltersController < OrbitBackendController +class Admin::RoleFiltersController < OrbitMemberController include OrbitControllerLib::DivisionForDisable - layout "new_admin" + # layout "new_admin" before_filter :authenticate_user! before_filter :is_admin? @@ -49,13 +49,22 @@ class Admin::RoleFiltersController < OrbitBackendController get_types @role_filter = @types.new(:display => 'List') + + # @url = polymorphic_path([:admin, @role_filter]) + + if @app_type == 'role_statuses' + @url = eval("admin_#{@app_type}_path(:role_id=>params[:role_id])") + else + @url = eval("admin_#{@app_type}s_path(:role_id=>params[:role_id])") + end @verb = :post - respond_to do |format| - format.html # new.html.erb - format.js - end + render layout: false + # respond_to do |format| + # format.html # new.html.erb + # format.js + # end end @@ -69,12 +78,13 @@ class Admin::RoleFiltersController < OrbitBackendController @verb = :put - respond_to do |format| - format.html - format.js - end - end + render layout: false + # respond_to do |format| + # format.html + # format.js + # end + end def create @@ -82,11 +92,18 @@ class Admin::RoleFiltersController < OrbitBackendController @role_filter = @types.new(params[:role_filter]) - respond_to do |format| - if @role_filter.save - format.html { redirect_to(admin_role_filter_url(params[:role_filter][:role_id])) } - format.js - end + if @app_type == 'role_statuses' + @url = eval("admin_#{@app_type}_path(:role_id=>params[:role_filter][:role_id])") + else + @url = eval("admin_#{@app_type}s_path(:role_id=>params[:role_filter][:role_id])") + end + + if @role_filter.save + redirect_to @url + else + @role_filter = @types.new(params[:role_filter]) + flash.now[:error] = t('create.error.category') + render action: :new end end @@ -102,16 +119,21 @@ class Admin::RoleFiltersController < OrbitBackendController # @url = eval("admin_role_filter_#{@app_type}_path(#{@role_filter})") @url = polymorphic_path([:admin, @role_filter]) - respond_to do |format| - if @role_filter.update_attributes(params[:role_filter]) - format.html { redirect_to(admin_role_filter_role_filters_url(params[:role_id]), :notice => t('role_filter.update_role_filter_success')) } - # format.xml { head :ok } - format.js - else - format.html { render :action => "edit" } - format.js { render :action => "edit" } - end + if @app_type == 'role_statuses' + @url = eval("admin_#{@app_type}_path(:role_id=>@role_filter.role_id)") + else + @url = eval("admin_#{@app_type}s_path(:role_id=>@role_filter.role_id)") end + + + @role_filter = @types.find(params[:id]) + if @role_filter.update_attributes(params[:role_filter]) + redirect_to @url + else + flash.now[:error] = t('update.error.category') + render action: :edit + end + end @@ -134,6 +156,26 @@ class Admin::RoleFiltersController < OrbitBackendController end end + + def toggle + + get_types + + if @app_type == 'role_statuses' + @role_filter = @types.find(params[:role_status_id]) + @url = eval("admin_#{@app_type}_path(:role_id=>@role_filter.role_id)") + else + @role_filter = @types.find(params[:role_category_id]) + @url = eval("admin_#{@app_type}s_path(:role_id=>@role_filter.role_id)") + end + + @role_filter.disable = @role_filter.disable ? false : true + + @role_filter.save! + + redirect_to @url + + end protected diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb index 17e25fe43..0a8d40ccd 100644 --- a/app/controllers/admin/roles_controller.rb +++ b/app/controllers/admin/roles_controller.rb @@ -1,4 +1,4 @@ -class Admin::RolesController < OrbitBackendController +class Admin::RolesController < OrbitMemberController before_filter :authenticate_user! before_filter :is_admin? @@ -6,7 +6,7 @@ class Admin::RolesController < OrbitBackendController helper Admin::AttributeValuesViewHelper def index - @attributes = Role.all.entries + @attributes = Role.all.asc("_id").entries render :template => 'admin/attributes/index' end @@ -36,7 +36,7 @@ class Admin::RolesController < OrbitBackendController @sub_attribute = SubRole.new @sub_attribute.role_id = params[:role_id] - + render layout: false end def edit_sub_role @@ -46,7 +46,7 @@ class Admin::RolesController < OrbitBackendController @attribute = Role.find(@sub_attribute.role_id) @sub_attribute.role_id = @sub_attribute.role_id - + render layout: false end def sub_role_field @@ -94,20 +94,50 @@ class Admin::RolesController < OrbitBackendController end end + + # def get_variables_for_new + # @designs = Design.all.entries + # @themes = Design.first.themes + # @module_apps = ModuleApp.for_frontend_select + # @app_frontend_urls = nil + # @categories = nil + # @tags = nil + # @page_frontend_data_counts = nil + # @frontend_styles = nil + # @selected={ + # :design => @designs.first, + # :theme=> @themes.first, + # :module_app=>nil,#@module_apps.first + # :app_frontend_url=> nil, #@module_apps.first + # :category=>nil, + # :tag=>nil, + # :page_frontend_data_count=>nil, + # :frontend_style => nil + # } + # end + + # def new + # @item = Page.new(params[:page]) + # @item.parent = Item.find(params[:parent_id]) rescue nil + # get_variables_for_new + # render layout: false + # end + def new @attribute = Role.new - if !params[:parent_id] - render :template => 'admin/attributes/new' - end - + # if !params[:parent_id] + # render :template => 'admin/attributes/new' + # end + render layout: false end def edit @attribute = Role.find(params[:id]) @attribute_fields_upper_object = @attribute.sub_roles - render :template => 'admin/attributes/edit' + # render :template => 'admin/attributes/edit' + render layout: false end def create @@ -118,18 +148,28 @@ class Admin::RolesController < OrbitBackendController # @sub_role.role_id = params[:id] - respond_to do |format| - if @sub_role.save - format.html { redirect_to(admin_role_sub_role_url(params[:sub_role][:role_id])) } - end + + if @sub_role.save + redirect_to admin_role_sub_role_url(params[:sub_role][:role_id]) + else + @sub_role = SubRole.new(params[:sub_role]) + flash.now[:error] = t('create.error.category') + render action: :new end - else + else @attribute = Role.new(params[:role]) - @attribute.save - redirect_to :action => :index - + # if @attribute.save + # redirect_to :action => :index + # end + if @attribute.save + redirect_to admin_roles_url + else + @attribute = Role.new(params[:role]) + flash.now[:error] = t('create.error.category') + render action: :new + end end end @@ -139,21 +179,35 @@ class Admin::RolesController < OrbitBackendController if params[:sub_role] @sub_role = SubRole.find(params[:sub_role][:id]) - @sub_role.update_attributes(params[:sub_role]) - @sub_role.attribute_fields.each{|t| t.destroy if t["to_delete"] == true} - respond_to do |format| - format.html { redirect_to(admin_role_sub_role_url(@sub_role.role_id)) } - format.js { render 'toggle_enable' } + if @sub_role.update_attributes(params[:sub_role]) + @sub_role.attribute_fields.each{|t| t.destroy if t["to_delete"] == true} + # respond_to do |format| + # format.html { redirect_to(admin_role_sub_role_url(@sub_role.role_id)) } + # format.js { render 'toggle_enable' } + # end + + redirect_to admin_role_sub_role_url(@sub_role.role_id) + else + flash.now[:error] = t('update.error.category') + render action: :edit end - else + else @attribute = Role.find(params[:id]) - @attribute.update_attributes(params[:role]) - @attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true} - respond_to do |format| - format.html { redirect_to :action => :index } - format.js { render 'admin/attributes/toggle_enable' } + # @attribute.update_attributes(params[:role]) + # @attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true} + # respond_to do |format| + # format.html { redirect_to :action => :index } + # format.js { render 'admin/attributes/toggle_enable' } + # end + + if @attribute.update_attributes(params[:role]) + @attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true} + redirect_to admin_roles_url + else + flash.now[:error] = t('update.error.category') + render action: :edit end end @@ -164,11 +218,12 @@ class Admin::RolesController < OrbitBackendController if params[:sub_role] - @sub_role = SubRole.find(params[:sub_role][:id]) + @attribute = SubRole.find(params[:sub_role][:id]) respond_to do |format| - if @sub_role.destroy - format.html { redirect_to(admin_role_sub_role_url(@sub_role.role_id)) } + if @attribute.destroy + format.html { redirect_to(admin_role_sub_role_url(@attribute.role_id)) } + format.js end end @@ -176,11 +231,32 @@ class Admin::RolesController < OrbitBackendController @attribute = Role.find(params[:id]) @attribute.destroy - redirect_to :action => :index - + respond_to do |format| + format.html { redirect_to admin_roles_url } + format.js { render 'admin/attributes/destroy' } + end end end + + def toggle + @attribute = Role.find(params[:role_id]) + @attribute.disabled = @attribute.disabled ? false : true + @attribute.save! + redirect_to action: :index + end + + def sub_role_toggle + + @sub_attribute = SubRole.find(params[:role_id]) + + @sub_attribute.disabled = @sub_attribute.disabled ? false : true + @sub_attribute.save! + + redirect_to admin_role_sub_role_url(@sub_attribute.role_id) + + end + protected diff --git a/app/controllers/admin/users_new_interface_controller.rb b/app/controllers/admin/users_new_interface_controller.rb index a805c9cd3..fd62c29f8 100644 --- a/app/controllers/admin/users_new_interface_controller.rb +++ b/app/controllers/admin/users_new_interface_controller.rb @@ -1,4 +1,4 @@ -class Admin::UsersNewInterfaceController < OrbitBackendController +class Admin::UsersNewInterfaceController < OrbitMemberController helper MemberHelper @@ -19,20 +19,62 @@ class Admin::UsersNewInterfaceController < OrbitBackendController get_tags get_sub_roles + @roles = Role.excludes('disabled' => true).asc("_id") + page_num = params[:page] || 1 @users = [] - - render case params[:at] - when 'summary' - @users=User.not_guest_user.page(page_num).per(12).asc("_id").includes('avatar') - "index_summary" - when 'thumbnail' - @users=User.not_guest_user.page(page_num).per(36).asc("_id").includes('avatar') - "index_thumbnail" + + + @filter = params[:filter] + new_filter = params[:new_filter] + + if @filter && params[:clear] + @filter.delete(params[:type]) + elsif @filter && new_filter + if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s) + @filter[new_filter[:type]].delete(new_filter[:id].to_s) + elsif @filter.has_key?(new_filter[:type]) + @filter[new_filter[:type]] << new_filter[:id].to_s else - @users=User.not_guest_user.page(page_num).per(10).asc("_id").includes('avatar') - "index" + @filter.merge!({new_filter[:type] => [new_filter[:id].to_s]}) + end + elsif new_filter + @filter = {new_filter[:type] => [new_filter[:id].to_s]} end + + + + + if @filter.blank? + + render case params[:at] + when 'summary' + @users=User.not_guest_user.page(page_num).per(12).asc("_id").includes('avatar') + "index_summary" + when 'thumbnail' + @users=User.not_guest_user.page(page_num).per(36).asc("_id").includes('avatar') + "index_thumbnail" + else + @users=User.not_guest_user.page(page_num).per(10).asc("_id").includes('avatar') + "index" + end + + else + + render case params[:at] + when 'summary' + @users=User.not_guest_user.any_in(:role_ids=>@filter['role']).page(page_num).per(12).asc("_id").includes('avatar') + "index_summary" + when 'thumbnail' + @users=User.not_guest_user.any_in(:role_ids=>@filter['role']).page(page_num).per(36).asc("_id").includes('avatar') + "index_thumbnail" + else + @users=User.not_guest_user.any_in(:role_ids=>@filter['role']).page(page_num).per(10).asc("_id").includes('avatar') + "index" + end + + end + end def show diff --git a/app/controllers/orbit_member_controller.rb b/app/controllers/orbit_member_controller.rb new file mode 100644 index 000000000..a018fc002 --- /dev/null +++ b/app/controllers/orbit_member_controller.rb @@ -0,0 +1,54 @@ +class OrbitMemberController < ApplicationController + include OrbitCategory::Categorizing + include OrbitCoreLib::AppBackendUtility + include OrbitCoreLib::PermissionUtility + include OrbitTag::Tagging + include AdminHelper + include ApplicationHelper + + helper :default_index + + layout "member" + + def setup_vars + @app_title ||= controller_path.split('/')[1].singularize + @module_app ||= ModuleApp.first(conditions: {:key => @app_title} ) + raise ModuleAppError, 'Can not find ModuleApp' if @module_app.nil? + end + + def get_statuses + status = [] + status << 'is_top' + status << 'is_hot' + status << 'is_hidden' unless is_guest? + if @module_app.is_approvable && is_manager? + status << 'is_pending' + status << 'is_checked' + status << 'is_rejected' + end + status + end + + private + + def force_order_for_visitor + check_backend_openness + setup_vars + set_current_user + end + + + def force_order_for_user + setup_vars + set_current_user + authenticate_user! + check_user_can_use + end + + def check_user_can_use + unless check_permission + #redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) + redirect_to root_url + end + end +end diff --git a/app/helpers/attribute_fields_helper.rb b/app/helpers/attribute_fields_helper.rb index be1b39ee1..d11916d0e 100644 --- a/app/helpers/attribute_fields_helper.rb +++ b/app/helpers/attribute_fields_helper.rb @@ -8,6 +8,8 @@ module AttributeFieldsHelper include ActionView::Context include OrbitBasis::RenderAnywhere + include OrbitFormHelper + def block_helper(user,index,disable = false) unless self.disabled @index = index @@ -49,24 +51,82 @@ module AttributeFieldsHelper @prefiled_value ||=[] control_group_wrapper do a = self[:option_list].collect do |key,value| - label_tag(key,check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"control-label")) + label_tag(key,check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline")) end.join rescue "" end end def render_date + + d = DateTime.now() + if date_is_range? - fill_from = @attribute_value.get_date(:from) rescue nil - fill_to = @attribute_value.get_date(:to) rescue nil + # fill_from = @attribute_value.get_date(:from) rescue nil + # fill_to = @attribute_value.get_date(:to) rescue nil control_group_wrapper do - buf = date_select(get_field_name_base+'[from]',nil,@markup_options.merge(:default=>fill_from),:class=>"input-small") - buf << ' ~ ' - buf << date_select(get_field_name_base+'[to]',nil,@markup_options.merge(:default=>fill_to),:class=>"input-small") + + case self.typeC['format'] + when 'format1' + fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m/%d %H:%M") + fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/%d %H:%M") + buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM/dd hh:mm', true) + buf << ' ~ ' + buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM/dd hh:mm', true) + when 'format2' + fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m/%d") + fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/%d") + buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM/dd') + buf << ' ~ ' + buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM/dd') + when 'format3' + fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m") + fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/") + buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM') + buf << ' ~ ' + buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM') + when 'format4' + fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y") + fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y") + buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy') + buf << ' ~ ' + buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy') + end + + # buf = date_select(get_field_name_base+'[from]',nil,@markup_options.merge(:default=>fill_from),:class=>"input-small") + # buf << ' ~ ' + # buf << date_select(get_field_name_base+'[to]',nil,@markup_options.merge(:default=>fill_to),:class=>"input-small") buf end else - @prefiled_value = @attribute_value.get_date - control_group_wrapper{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")} + # @prefiled_value = @attribute_value.get_date + # @prefiled_value = @attribute_value.get_date + + case self.typeC['format'] + when 'format1' + tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d %H:%M")), 'yyyy/MM/dd hh:mm', true) + when 'format2' + tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), 'yyyy/MM/dd') + when 'format3' + tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM') + when 'format4' + tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy') + end + + control_group_wrapper{tmp} + # control_group_wrapper{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")} + + end + end + + def datetime_picker(object_name, value, format, time=false) + content_tag :div, :class => "input-append datetimepick", "data-date-format"=>format, "data-picktime"=>"#{time}" do + concat text_field_tag(object_name, value, :placeholder=>format) + concat (content_tag :span, :class => 'add-on clearDate' do + content_tag :i, nil, :class => 'icons-cross-3' + end) + concat (content_tag :span, :class => 'add-on iconbtn' do + content_tag :i, nil, 'data-time-icon' => 'icons-clock', 'data-date-icon' => 'icons-calendar', :class=>"icons-calendar" + end) end end @@ -78,7 +138,7 @@ module AttributeFieldsHelper @prefiled_value ||=[] control_group_wrapper do self[:option_list].collect do |key,value| - label_tag(key,radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>" radio inline")) + label_tag(key,radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"radio inline")) end.join end end @@ -100,64 +160,134 @@ module AttributeFieldsHelper def render_text_field a = control_group_wrapper do |key,value| - add_more_blank = can_add_more ? "[]" : "" + add_more_blank = can_add_more ? "[]" : "" key_field = can_muti_lang_input? ? "[#{key}]" : "" place_holder= @panel_setting["placeholder"][key] rescue '' text_field_tag([get_field_name_base,add_more_blank,key_field].join, value,@markup_options.merge(:placeholder=>place_holder)) end -end - -def date_is_range? - is_range = "false" - data = get_data - if !data.nil? - is_range = data['is_range'] if data.has_key? "is_range" end - is_range == "true" -end + + def date_is_range? + is_range = "false" + data = get_data + if !data.nil? + is_range = data['is_range'] if data.has_key? "is_range" + end + is_range == "true" + end protected def lang_panel_tabbable_wrapper(add_more_params,&block) add_more_counter = '' - content_tag :div,:class=>"tabbable" do - tmp = content_tag :div,:class=> (add_more || self.markup=='address') ? "tab-content input-append" : "tab-content" do - buff = VALID_LOCALES.collect do |key| - value = @prefiled_value[key] rescue nil - div_class_ary = ["tab-pane" ,"fade",key,get_pairing_tab_class({})] + + if self.markup=='text_area' or self.markup=='address' + + tmp1 = VALID_LOCALES.collect do |key| + value = @prefiled_value[key] rescue nil + # div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"] + div_class_ary = ["tab-pane" ,"fade"] + + div_id = "#{get_pairing_tab_class({})}_#{key}" + + if can_add_more + add_more_value = add_more_params[0][:value] + add_more_counter = add_more_params[0][:counter] + value = add_more_value[key] rescue nil + div_class_ary << "add_more_item_#{add_more_counter}" + end + + div_class = div_class_ary.join(" ") + div_class << (key == I18n.locale.to_s ? " active in" : '') + content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class) + end# of VALID_LOCALES.collect for tabed input - if can_add_more - add_more_value = add_more_params[0][:value] - add_more_counter = add_more_params[0][:counter] - value = add_more_value[key] rescue nil - div_class_ary << "add_more_item_#{add_more_counter}" - end - - div_class = div_class_ary.join(" ") - div_class << (key == I18n.locale.to_s ? " active in" : '') - content_tag(:div,yield(key,value),:class=>div_class) - end# of VALID_LOCALES.collect for tabed input - buff << link_to((content_tag :i,'',:class=>'icon-edit'),"##{get_pairing_tab_class({})}_m_window",:class=>'btn edit-btn',:type=>'button',:data=>{:toggle=>"modal"}) if self.markup == 'address' - buff << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn removeInput") if self.add_more - - buff.join('').html_safe - end - tmp << content_tag(:ul,:class=> 'nav nav-pills') do - VALID_LOCALES.each.collect do |key| + tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do + buff2 = VALID_LOCALES.each.collect do |key| # link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}" - link_entry_ary = [".#{get_pairing_tab_class({})}",".#{key}"] + link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"] link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more link_entry = link_entry_ary.join - content_tag(:li,link_to(I18nVariable.from_locale(key),link_entry,:data=>{:toggle=>"tab"}),:class=>(key == I18n.locale.to_s ? "active" : nil),:for=>key) - end.join.html_safe # of VALID_LOCALES.collect for tabs - end # of content ul + link_to(I18nVariable.from_locale(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale.to_s ? "active" : nil)}",:for=>key) + end # of VALID_LOCALES.collect for tabs + + buff2 << link_to((content_tag :i,'',:class=>'icon-edit'),"##{get_pairing_tab_class({})}_m_window", :role=>"button",:class=>'btn',:data=>{:toggle=>"modal"}) if self.markup == 'address' + buff2 << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") if self.add_more + buff2.join.html_safe + end # of content ul + + + tmp = content_tag :div,:class=> "tab-content textarea-lang" do + tmp2 << tmp1.join('').html_safe + end + + else + + # tmp = content_tag :div,:class=> (add_more || self.markup=='address') ? "input-append" : "tab-content" do + tmp1 = + content_tag :div,:class=> "tab-content" do + + buff = VALID_LOCALES.collect do |key| + value = @prefiled_value[key] rescue nil + # div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"] + div_class_ary = ["tab-pane" ,"fade"] + + div_id = "#{get_pairing_tab_class({})}_#{key}" + + + if can_add_more + add_more_value = add_more_params[0][:value] + add_more_counter = add_more_params[0][:counter] + value = add_more_value[key] rescue nil + div_class_ary << "add_more_item_#{add_more_counter}" + end + + div_class = div_class_ary.join(" ") + div_class << (key == I18n.locale.to_s ? " active in" : '') + content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class) + end# of VALID_LOCALES.collect for tabed input + + buff.join('').html_safe + + end + + tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do + buff2 = VALID_LOCALES.each.collect do |key| + # link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}" + link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"] + link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more + link_entry = link_entry_ary.join + link_to(I18nVariable.from_locale(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale.to_s ? "active" : nil)}",:for=>key) + end # of VALID_LOCALES.collect for tabs + + buff2 << link_to((content_tag :i,'',:class=>'icon-edit'),"##{get_pairing_tab_class({})}_m_window", :role=>"button",:class=>'btn',:data=>{:toggle=>"modal"}) if self.markup == 'address' + buff2 << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") if self.add_more + buff2.join.html_safe + end # of content ul + + + + tmp = content_tag :div,:class=> "input-append" do + tmp1 << tmp2 + end + + # tmp << content_tag(:ul,:class=> 'nav nav-pills') do + # VALID_LOCALES.each.collect do |key| + # # link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}" + # link_entry_ary = [".#{get_pairing_tab_class({})}",".#{key}"] + # link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more + # link_entry = link_entry_ary.join + # content_tag(:li,link_to(I18nVariable.from_locale(key),link_entry,:data=>{:toggle=>"tab"}),:class=>(key == I18n.locale.to_s ? "active" : nil),:for=>key) + # end.join.html_safe # of VALID_LOCALES.collect for tabs + # end # of content ul + end + end def controls_wrapper(*add_more_params,&block) - content_tag :div,:class=>'controls' do result = '' add_more_counter = "" @@ -171,12 +301,15 @@ protected if can_muti_lang_input? result << lang_panel_tabbable_wrapper(add_more_params,&block) result << gen_modal_dialog if self.markup == "address" + + # result << add_more_unt if can_add_more else #cross lang field case can_add_more when true value = add_more_params[0][:value] - result << content_tag(:div,:class=>"input-append"){yield(nil,value) + link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn removeInput") } + result << content_tag(:div,:class=>"input-append"){yield(nil,value) + link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") } + # result << add_more_unt else value = @prefiled_value result << yield(nil,value) @@ -186,54 +319,77 @@ protected end result.html_safe - end # of controls div + end # of def controls_wrapper(&block) def control_group_wrapper(&block) - div_class = can_muti_lang_input? ? "control-group language-swich" : "control-group" + div_class = can_muti_lang_input? ? "control-group" : "control-group" + # div_class = can_muti_lang_input? ? "control-group language-swich" : "control-group" result ="" - case self.markup - when "text_field" - if can_add_more - multipleInput_ary = %w{multipleInput} - add_more_seri = "add_more_group_#{id}" - multipleInputs = content_tag :div,:class=> multipleInput_ary.join(' ') ,:ext_class=>get_pairing_tab_class({}) do - @attribute_value.add_more_counter.times.collect do |t| - controls_wrapper(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block) - end.join('').html_safe # of add_more fields - end # of div multipleInput editMore - result = label + multipleInputs + add_more_unt - # result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields - else - temp = label + controls_wrapper(&block) - result = content_tag(:div,temp,:class=>div_class) - end - when "address" - address = content_tag :div,:class=>"multipleInput editMore" do - controls_wrapper(&block) - end # of div multipleInput editMore - result = label + address + case self.markup + + when "text_field" + + if can_add_more + + multipleInputs = + content_tag(:div,:class=>"add-target") do + @attribute_value.add_more_counter.times.collect do |t| + controls_wrapper(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block) + end.join('').html_safe # of add_more fields + end + + + temp = label + content_tag(:div, multipleInputs + add_more_unt, :class=>'controls add-input') + + result = content_tag(:div,temp,:class=>div_class) + + # result = label + multipleInputs + add_more_unt + # result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields + else + temp = label + content_tag(:div, controls_wrapper(&block), :class=>'controls') + result = content_tag(:div,temp,:class=>div_class) + + end + + when "address" + + # address = content_tag :div,:class=>"multipleInput editMore" do + address = content_tag :div,:class=>"control-group" do + label + content_tag(:div, controls_wrapper(&block), :class=>'controls') + end # of div multipleInput editMore + + result = address + else - temp = label + controls_wrapper(&block) - result = content_tag(:div,temp,:class=>div_class) + temp = label + content_tag(:div, controls_wrapper(&block), :class=>'controls') + result = content_tag(:div,temp,:class=>div_class) + end result << end_block result.html_safe + end - def add_more_unt + def add_more_unt temp_field_name = get_basic_field_name_base + '[temp]' - add_more = content_tag :div,:class=> 'controls' do - content_tag :span,:class=> 'help-block' do - content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus-sign"),"#",:class=>'addinput' + add_more = content_tag :p,:class=> 'add-btn' do + content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus"),"#","data-roles"=>"role_a",:class=>"trigger #{can_muti_lang_input? ? 'textLengInput' : 'textInput' } btn btn-small btn-primary" content << hidden_field_tag("#{temp_field_name}[count]",@attribute_value.add_more_counter ,:class=>"list_count") content << hidden_field_tag("#{temp_field_name}[count]",get_basic_field_name_base,:class=>"field_name") content - end # of span end # of div + # add_more = content_tag :div,:class=> 'controls' do + # content_tag :span,:class=> 'help-block' do + # content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus-sign"),"#",:class=>'addinput' + # content << hidden_field_tag("#{temp_field_name}[count]",@attribute_value.add_more_counter ,:class=>"list_count") + # content << hidden_field_tag("#{temp_field_name}[count]",get_basic_field_name_base,:class=>"field_name") + # content + # end # of span + # end # of div end def end_block @@ -256,7 +412,7 @@ protected def get_pairing_tab_class(opts) prefix = opts[:prefix] suffix = opts[:suffix] - str = get_basic_field_name_base.gsub("[","-").gsub("]",'') + str = get_basic_field_name_base.gsub("[","_").gsub("]",'') str = prefix.nil? ? str : prefix+ str suffix.nil? ? str : str + suffix end @@ -274,7 +430,7 @@ protected end def label - label_tag(key,title,:class=>"control-label",:func => "field_label") + label_tag(key,title,:class=>"control-label muted",:func => "field_label") end def can_muti_lang_input? diff --git a/app/helpers/attribute_values_helper.rb b/app/helpers/attribute_values_helper.rb index 2bc314324..c72a7b6aa 100644 --- a/app/helpers/attribute_values_helper.rb +++ b/app/helpers/attribute_values_helper.rb @@ -9,20 +9,21 @@ module AttributeValuesHelper date = get_date end - case self.attribute_field["typeC"]["format"] - when 'format1' # Y/M/D h:m - date.strftime("%Y/%m/%d %H:%M") - when 'format2' # Y/M/D - date.strftime("%Y/%m/%d") - when 'format3' # Y/M - date.strftime("%Y/%m") - when 'format4' # Y - date.strftime("%Y") - end # of case west cal format + # case self.attribute_field["typeC"]["format"] + # when 'format1' # Y/M/D h:m + # date.strftime("%Y/%m/%d %H:%M") + # when 'format2' # Y/M/D + # date.strftime("%Y/%m/%d") + # when 'format3' # Y/M + # date.strftime("%Y/%m") + # when 'format4' # Y + # date.strftime("%Y") + # end # of case west cal format end def show_minguo_calendar(from_to=nil) get_minguo + case from_to when :to date = get_date(:to) @@ -31,37 +32,62 @@ module AttributeValuesHelper when nil date = get_date end + + @date = date.split('/') + date_year = @date[0].to_i + year_str = "" - unless date.year == 1912 - m_year = (date.year - 1912).abs.to_s + I18n.t("date.minguo_calendar.year") + unless date_year == 1912 + m_year = (date_year - 1912).abs.to_s + I18n.t("date.minguo_calendar.year") year_str = minguo_format_year(m_year) end - get_minguo_year + minguo_m_y_d_time + get_minguo_year(from_to) + minguo_m_y_d_time(from_to) end - def get_minguo_year - date = get_date - m_year = (date.year - 1911).abs + def get_minguo_year(from_to=nil) + case from_to + when :to + date = get_date(:to) + when :from + date = get_date(:from) + when nil + date = get_date + end + + @date = date.split('/') + date_year = @date[0].to_i + + m_year = (date_year - 1911).abs year_end = I18n.t("date.minguo_calendar.year") case - when date.year <1912 + when date_year <1912 I18n.t("date.minguo_calendar.before") + (m_year+1).to_s + year_end - when date.year ==1912 + when date_year ==1912 I18n.t("date.minguo_calendar.first_year") - when date.year >1912 + when date_year >1912 I18n.t("date.minguo_calendar.after")+ (m_year).to_s + year_end end # of case tw_calendar year end - def minguo_m_y_d_time - date = get_date + def minguo_m_y_d_time(from_to=nil) + case from_to + when :to + date = get_date(:to) + when :from + date = get_date(:from) + when nil + date = get_date + end + @date = date.split('/') + case self.attribute_field["typeC"]["format"] when 'format1' # Y/M/D h:m - date.strftime(" %m/%d %H:%M") + "/#{@date[1]}/#{@date[2]}" when 'format2' # Y/M/D - date.strftime(" %m/%d") + "/#{@date[1]}/#{@date[2]}" when 'format3' # Y/M - date.strftime(" %m#{I18n.t("date.minguo_calendar.month")}") + + "/#{@date[1]}#{I18n.t("date.minguo_calendar.month")}"\ when 'format4' # Y '' end # of case diff --git a/app/models/user/attribute_value.rb b/app/models/user/attribute_value.rb index 38fcf0810..b7248eb03 100644 --- a/app/models/user/attribute_value.rb +++ b/app/models/user/attribute_value.rb @@ -30,8 +30,14 @@ class AttributeValue else self.attribute_field.get_data["cross_lang"] =="true" ? self["val"] : Hash[VALID_LOCALES.collect{|lang| [lang,self[lang.to_sym]]}] end - when 'select','date','radio_button','address' + when 'select','radio_button','address' self["val"] + when 'date' + if !self["val"].blank? and !self["val"]['(1i)'].blank? + "#{self["val"]['(1i)']}/#{self["val"]['(2i)']}/#{self["val"]['(3i)']}" + else + self["val"] + end when 'checkbox' self["val"] end #end of case self.attribute_field.markup @@ -50,7 +56,7 @@ class AttributeValue case self.attribute_field.add_more when true if self.attribute_field.locale - add_more_index.nil? ? self.value.collect{|t| t[locale]}.join(",") : self.value(add_more_index)[locale] + add_more_index.nil? ? self.value.collect{|t| t[locale.to_s]}.join(",") : self.value(add_more_index)[locale] else add_more_index.nil? ? self.value.join(",") : self.value(add_more_index) end @@ -69,8 +75,10 @@ class AttributeValue when "date" if self.attribute_field.date_is_range? get_date_by_format(:from) + ' ~ ' + get_date_by_format(:to) + # self.value["from"] + ' ~ ' + self.value["to"] else get_date_by_format + # self.value end when "address" @@ -95,13 +103,17 @@ class AttributeValue def get_date(item = nil) case item when :from - data = self[:val]["from"] + # data = self[:val]["from"] + data = self.value["from"] when :to - data = self[:val]["to"] + # data = self[:val]["to"] + data = self.value["to"] when nil - data = self[:val] + # data = self[:val] + data = self.value end - Date.new(data["(1i)"].to_i,data["(2i)"].to_i,data["(3i)"].to_i) rescue nil + + # Date.new(data["(1i)"].to_i,data["(2i)"].to_i,data["(3i)"].to_i) rescue nil end diff --git a/app/views/admin/attributes/_attribute.html.erb b/app/views/admin/attributes/_attribute.html.erb new file mode 100644 index 000000000..649f5818e --- /dev/null +++ b/app/views/admin/attributes/_attribute.html.erb @@ -0,0 +1,31 @@ + + + + <%= attribute.title %> +
+ +
+ + +
+
+ <%= link_to (check_box_tag 'accept', false , :class => 'toggle-check', :data=>{:deploy=>"right"}) , eval("admin_#{@attribute_type}_toggle_path(attribute)"), method: :post, remote: true, class: "switch" %> + +
+
+ <% if !attribute.is_built_in? %> + <%= link_to (content_tag :i,'',:class=>'icon-trash')+t(:delete_), eval("admin_#{@attribute_type}_path(attribute)"), :type=>"button", :class => 'btn btn-mini btn-danger', :confirm => t('sure?'), :method => :delete, :remote => true %> + <% end %> + + + + diff --git a/app/views/admin/attributes/_index.html.erb b/app/views/admin/attributes/_index.html.erb new file mode 100644 index 000000000..cd07e099b --- /dev/null +++ b/app/views/admin/attributes/_index.html.erb @@ -0,0 +1,12 @@ + + + + + + + + + <%= render partial: 'admin/attributes/attribute', collection: @attributes %> + + +
<%= t("#{@attribute_type}") %>
\ No newline at end of file diff --git a/app/views/admin/attributes/destroy.js.erb b/app/views/admin/attributes/destroy.js.erb new file mode 100644 index 000000000..d83d4997f --- /dev/null +++ b/app/views/admin/attributes/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @attribute %>").remove(); \ No newline at end of file diff --git a/app/views/admin/attributes/edit.html.erb b/app/views/admin/attributes/edit.html.erb index 4e9e04c03..c5e2b9a8c 100644 --- a/app/views/admin/attributes/edit.html.erb +++ b/app/views/admin/attributes/edit.html.erb @@ -1,162 +1,78 @@ <% content_for :side_bar do %> - <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %> + <%= render :partial => 'admin/users_new_interface/side_bar' %> <% end %> - <%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %> -
-
-

<%= t(eval(":#{@attribute_type}"))%>

-
-
- -
- -
- <% if @attribute.new_record? %> - <%= f.text_field :key, :placeholder => t(:key) %> - <% else %> -
<%= @attribute.key%>
- <% end %> -
-
- <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t(:item_name),:field_name=>"#{@attribute_type}[title_translations]"}%> - - - -
- -
- - -
-
- -
-
-
- <% if @attribute._type == "Info" %> - -
-

<%= @attribute.title+ t(:field)%>

-
- <%= render :partial=>"shared/attribute_field/attribute_field",:collection=>@attribute.attribute_fields%> -
-
- -
- <%= ( link_to content_tag(:i,t(:add_attribute_field),:class=>"icon-plus icon-white"),admin_info_add_attribute_field_path(@attribute),:class=>"btn btn-primary",:remote => true )%> -
- - <% end %> - -
-
- <%= f.submit t(:submit),:class=>"btn btn-primary"%> - <%= link_to t('cancel'), get_go_back, :class=>"btn" %> -
- <% end %> <% content_for :page_specific_css do -%> - <%= stylesheet_link_tag "member" %> - <%= stylesheet_link_tag "site-map" %> -<% end %> + <%= stylesheet_link_tag "lib/wrap-nav.css" %> + <%= stylesheet_link_tag "lib/pageslide.css" %> + <%= stylesheet_link_tag "lib/main-forms.css" %> + <%= stylesheet_link_tag "lib/togglebox.css" %> +<% end -%> <% content_for :page_specific_javascript do -%> - + <%= javascript_include_tag "lib/jquery.tmpl.min.js" %> + <%= javascript_include_tag "lib/member/role-forms.js" %> <% end -%> + +<%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") , :html => { :class=> "form-horizontal main-forms", :id=>'info' } do |f| %> +

<%= t(eval(":#{@attribute_type}"))%>

+
+
+
+
+

Basic

+
+
+
+ +
+ + <% if @attribute.new_record? %> + <%= f.text_field :key, :placeholder => t(:key) %> + <% else %> +
<%= @attribute.key %>
+ <% end %> +
+
+ <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t(:item_name),:field_name=>"#{@attribute_type}[title_translations]"}%> +
+ +
+ + +
+
+
+
+
+
+

<%= @attribute.title %>

+
+ +
+ + <%= render :partial=>"shared/attribute_field/attribute_field",:collection=>@attribute.attribute_fields%> + +
+ +
+ + <%= hidden_field_tag 'id', params[:role_id] if !params[:role_id].blank? %> + <%= f.submit t(:submit),:class=>"btn btn-primary"%> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
+
+<% end %> + + + +<% content_for :page_specific_javascript do -%> + <%= render 'js/support_member_form_js' %> +<% end -%> + diff --git a/app/views/admin/attributes/index.html.erb b/app/views/admin/attributes/index.html.erb index 9ac6f29e7..62d2888a0 100644 --- a/app/views/admin/attributes/index.html.erb +++ b/app/views/admin/attributes/index.html.erb @@ -1,60 +1,25 @@ <% content_for :side_bar do %> - <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %> + <%= render :partial => 'admin/users_new_interface/side_bar' %> <% end %> +<% content_for :page_specific_css do -%> + <%= stylesheet_link_tag "lib/wrap-nav.css" %> + <%= stylesheet_link_tag "lib/pageslide.css" %> + <%= stylesheet_link_tag "lib/main-forms.css" %> + <%= stylesheet_link_tag "lib/togglebox.css" %> +<% end -%> +
+
+ <%= link_to content_tag(:i,t("new.#{@attribute_type}"),:class=>"icon-plus"),eval("new_admin_#{@attribute_type}_path"),:class=>"btn btn-primary open-slide"%> +
+
- - - - - - - - - - <% @attributes.each do |attribute| %> - - - - <% end %> - - -
- <%= attribute.title %> -
- -
-
-
- <%= link_to content_tag(:i,t("new.#{@attribute_type}"),:class=>"icon-plus icon-white"),eval("new_admin_#{@attribute_type}_path"),:class=>"btn btn-primary pull-right"%> +
+<%= render 'admin/attributes/index' %>
+<%#= link_to content_tag(:i, nil, class: "icon-edit"), eval("edit_admin_#{node.class.to_s.downcase}_path(node)"), class: "open-slide tip", title: t(:edit) %> +<%#= link_to content_tag(:i, nil, class: "icons-newspaper"), new_admin_page_path(:parent_id => node.id), class: "open-slide tip", title: t(:add_page) if node.class.to_s.eql?('Page') %> + +<%#= javascript_include_tag "lib/jquery.pageslide.js" %> \ No newline at end of file diff --git a/app/views/admin/attributes/index.js.erb b/app/views/admin/attributes/index.js.erb new file mode 100644 index 000000000..2a246c253 --- /dev/null +++ b/app/views/admin/attributes/index.js.erb @@ -0,0 +1,3 @@ +$("#attributes_index").html("<%= j render 'admin/attributes/index' %>") +$.pageslide.close(); +openSlide(); \ No newline at end of file diff --git a/app/views/admin/attributes/new.html.erb b/app/views/admin/attributes/new.html.erb index bffc37587..404a2db5f 100644 --- a/app/views/admin/attributes/new.html.erb +++ b/app/views/admin/attributes/new.html.erb @@ -10,11 +10,11 @@
@@ -29,7 +29,14 @@ <% end %>
- <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t(:item_name),:field_name=>"#{@attribute_type}[title_translations]"}%> + + <% @site_valid_locales.each_with_index do |locale, i| %> + + + "> + + <% end %> + <%#= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t(:item_name),:field_name=>"#{@attribute_type}[title_translations]"}%>
diff --git a/app/views/admin/role_filters/_edit.html.erb b/app/views/admin/role_filters/_edit.html.erb new file mode 100644 index 000000000..988228057 --- /dev/null +++ b/app/views/admin/role_filters/_edit.html.erb @@ -0,0 +1,11 @@ + +<%= form_for(:role_filter, :remote => true, :url => @url, :method => @verb, :html => { :id => 'form_role_filter' } ) do |f| %> +
+ Edit + <%= render :partial => 'form', :locals => {:f => f} %> +
+
+ <%= t(:cancel) %> + <%= f.submit t(:update_), class: 'btn btn-primary btn-small' %> +
+<% end %> diff --git a/app/views/admin/role_filters/_form.html.erb b/app/views/admin/role_filters/_form.html.erb index ac599bc19..6c14f1aa6 100644 --- a/app/views/admin/role_filters/_form.html.erb +++ b/app/views/admin/role_filters/_form.html.erb @@ -1,31 +1,14 @@ -<% # encoding: utf-8 %> -<%= form_for(:role_filter, :remote => true, :url => @url, :method => @verb, :html => { :id => 'form_role_filter' } ) do |f| %> +<%= flash_messages %> +<%= f.error_messages %> -

<%= (@role_filter.new_record? ? 'Add' : 'Edit') %>

+<%= label_tag "key","key", :class=>"muted" %> +<%= f.text_field :key, :class=>"input-large" %> -
- <%= f.label :key %> - <%= f.text_field :key %> -
- -
- <%= f.fields_for :title_translations do |f| %> - <% @site_valid_locales.each do |locale| %> -
- <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> -
- <%= f.text_field locale, :class =>' input-xxlarge', :value => (@role_filter.title_translations[locale] rescue nil) %> -
-
- <% end %> - <% end %> -
- -
- <%= f.hidden_field :role_id, :value => params[:role_id] if !params[:role_id].blank? %> - <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %> -
- +<%= f.fields_for :title_translations do |f| %> + <% @site_valid_locales.each do |locale| %> + <%= label_tag "name-#{locale}", "#{t(:name)} (#{I18nVariable.from_locale(locale)})" %> + <%= f.text_field locale, :class => 'input-large', :value => (@role_filter.title_translations[locale] rescue ''), placeholder: t(:name) %> + <% end %> <% end %> - \ No newline at end of file +<%= f.hidden_field :role_id, :value => params[:role_id] if !params[:role_id].blank? %> diff --git a/app/views/admin/role_filters/_index.html.erb b/app/views/admin/role_filters/_index.html.erb new file mode 100644 index 000000000..0063775fb --- /dev/null +++ b/app/views/admin/role_filters/_index.html.erb @@ -0,0 +1,18 @@ + + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + + + <%= render :partial => 'role_filter', :collection => @role_filters %> + + +
Key<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
+ + diff --git a/app/views/admin/role_filters/_new.html.erb b/app/views/admin/role_filters/_new.html.erb new file mode 100644 index 000000000..8c90d68a7 --- /dev/null +++ b/app/views/admin/role_filters/_new.html.erb @@ -0,0 +1,11 @@ + +<%= form_for(:role_filter, :remote => true, :url => @url, :method => @verb, :html => { :id => 'form_role_filter' } ) do |f| %> +
+ Add + <%= render :partial => 'form', :locals => {:f => f} %> +
+
+ <%= t(:cancel) %> + <%= f.submit t(:create_), class: 'btn btn-primary btn-small' %> +
+<% end %> diff --git a/app/views/admin/role_filters/_role_filter.html.erb b/app/views/admin/role_filters/_role_filter.html.erb index 555859d27..83b0f532b 100644 --- a/app/views/admin/role_filters/_role_filter.html.erb +++ b/app/views/admin/role_filters/_role_filter.html.erb @@ -1,23 +1,32 @@ - - - <%= role_filter.key %> -
- -
- - <% if @types.is_localized?(:title) %> - <% @site_valid_locales.each do |locale| %> - <%= role_filter.title_translations[locale] rescue nil %> - <% end %> - <% else %> - <%= role_filter.title %> - <% end %> - + + <%= role_filter.key %> + <% if @types.is_localized?(:title) %> + <% @site_valid_locales.each_with_index do |locale, i| %> + + <%= role_filter.title_translations[locale] rescue nil %> + <% if i == 0 %> +
+ +
+ <% end %> + + <% end %> + <% else %> + <%= role_filter.title %> + <% end %> + + + <%#= link_to role_filter.disable ? t(:disable) : t(:enable), polymorphic_path([:admin, role_filter]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"btn btn-mini btn-success", :type=>"button" %> + +
+
+ <%= link_to (check_box_tag 'accept', false , :class => 'toggle-check', :data=>{:deploy=>"right"}) , eval("admin_#{@app_type == 'role_statuses' ? 'role_status' : @app_type }_toggle_path(role_filter)"), method: :post, remote: true, class: "switch" %> + +
+
+ + + \ No newline at end of file diff --git a/app/views/admin/role_filters/edit.html.erb b/app/views/admin/role_filters/edit.html.erb new file mode 100644 index 000000000..9e91e9ef2 --- /dev/null +++ b/app/views/admin/role_filters/edit.html.erb @@ -0,0 +1 @@ +<%= render 'edit' %> \ No newline at end of file diff --git a/app/views/admin/role_filters/index.html.erb b/app/views/admin/role_filters/index.html.erb index 925124c13..e6d12464a 100644 --- a/app/views/admin/role_filters/index.html.erb +++ b/app/views/admin/role_filters/index.html.erb @@ -1,49 +1,30 @@ - <% content_for :side_bar do %> - <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %> + <%= render :partial => 'admin/users_new_interface/side_bar' %> <% end %> -