Last active
August 29, 2015 14:11
-
-
Save vincentwoo/9839a44a10e2270e6457 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gitignore | |
16)config/data | |
17)data/ | |
18).powrc | |
Gemfile | |
139) gem 'factory_girl_rails' | |
140) gem 'faker' | |
Gemfile.lock | |
323) addressable (~> 2.3) | |
app/assets/javascripts/admin.js | |
6) | |
app/assets/javascripts/admin/bootstrap.min.js | |
6)!function(e){e(function(){"use strict";e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},n;for(n in t)if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("closed").remove()}var n=e(this),r=n.attr("data-target"),i;r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),i=e(r),t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()},e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("alert");i||r.data("alert",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e(function(){e("body").on("click.alert.data-api",t,n.prototype.close)})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.data(),i=n.is("input")?"val":"html";e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.parent('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")},e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e(function(){e("body").on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=n,this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},to:function(t){var n=this.$element.find(".active"),r=n.parent().children(),i=r.index(n),s=this;if(t>r.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){s.to(t)}):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",e(r[t]))},pause:function(e){return e||(this.paused=!0),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(t,n){var r=this.$element.find(".active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this,f=e.Event("slide");this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u]();if(i.hasClass("active"))return;if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}},e.fn.carousel=function(n){return this.each(function(){var r=e(this),i=r.data("carousel"),s=e.extend({},e.fn.carousel.defaults,typeof n=="object"&&n);i||r.data("carousel",i=new t(this,s)),typeof n=="number"?i.to(n):typeof n=="string"||(n=s.slide)?i[n]():s.interval&&i.cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Constructor=t,e(function(){e("body").on("click.carousel.data-api","[data-slide]",function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=!i.data("modal")&&e.extend({},i.data(),n.data());i.carousel(s),t.preventDefault()})})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning)return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning)return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=typeof n=="object"&&n;i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e(function(){e("body").on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();e(i).collapse(s)})})}(window.jQuery),!function(e){"use strict";function r(){e(t).parent().removeClass("open")}var t='[data-toggle="dropdown"]',n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),i,s,o;if(n.is(".disabled, :disabled"))return;return s=n.attr("data-target"),s||(s=n.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,"")),i=e(s),i.length||(i=n.parent()),o=i.hasClass("open"),r(),o||i.toggleClass("open"),!1}},e.fn.dropdown=function(t){return this.each(function(){var r=e(this),i=r.data("dropdown");i||r.data("dropdown",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.dropdown.Constructor=n,e(function(){e("html").on("click.dropdown.data-api",r),e("body").on("click.dropdown",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown.data-api",t,n.prototype.toggle)})}(window.jQuery),!function(e){"use strict";function n(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),r.call(t)},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),r.call(t)})}function r(e){this.$element.hide().trigger("hidden"),i.call(this)}function i(t){var n=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&r;this.$backdrop=e('<div class="modal-backdrop '+r+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(e.proxy(this.hide,this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),i?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,e.proxy(s,this)):s.call(this)):t&&t()}function s(){this.$backdrop.remove(),this.$backdrop=null}function o(){var t=this;this.isShown&&this.options.keyboard?e(document).on("keyup.dismiss.modal",function(e){e.which==27&&t.hide()}):this.isShown||e(document).off("keyup.dismiss.modal")}var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this))};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n);if(this.isShown||n.isDefaultPrevented())return;e("body").addClass("modal-open"),this.isShown=!0,o.call(this),i.call(this,function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in"),n?t.$element.one(e.support.transition.end,function(){t.$element.trigger("shown")}):t.$element.trigger("shown")})},hide:function(t){t&&t.preventDefault();var i=this;t=e.Event("hide"),this.$element.trigger(t);if(!this.isShown||t.isDefaultPrevented())return;this.isShown=!1,e("body").removeClass("modal-open"),o.call(this),this.$element.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?n.call(this):r.call(this)}},e.fn.modal=function(n){return this.each(function(){var r=e(this),i=r.data("modal"),s=e.extend({},e.fn.modal.defaults,r.data(),typeof n=="object"&&n);i||r.data("modal",i=new t(this,s)),typeof n=="string"?i[n]():s.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e(function(){e("body").on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=i.data("modal")?"toggle":e.extend({},i.data(),n.data());t.preventDefault(),i.modal(s)})})}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,s;this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.enabled=!0,this.options.trigger!="manual"&&(i=this.options.trigger=="hover"?"mouseenter":"focus",s=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(i,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s,this.options.selector,e.proxy(this.leave,this))),this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,t,this.$element.data()),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);if(!n.options.delay||!n.options.delay.show)return n.show();clearTimeout(this.timeout),n.hoverState="in",this.timeout=setTimeout(function(){n.hoverState=="in"&&n.show()},n.options.delay.show)},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var e,t,n,r,i,s,o;if(this.hasContent()&&this.enabled){e=this.tip(),this.setContent(),this.options.animation&&e.addClass("fade"),s=typeof this.options.placement=="function"?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,t=/in/.test(s),e.remove().css({top:0,left:0,display:"block"}).appendTo(t?this.$element:document.body),n=this.getPosition(t),r=e[0].offsetWidth,i=e[0].offsetHeight;switch(t?s.split(" ")[1]:s){case"bottom":o={top:n.top+n.height,left:n.left+n.width/2-r/2};break;case"top":o={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":o={top:n.top+n.height/2-i/2,left:n.left-r};break;case"right":o={top:n.top+n.height/2-i/2,left:n.left+n.width}}e.css(o).addClass(s).addClass("in")}},isHTML:function(e){return typeof e!="string"||e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(e)},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.isHTML(t)?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function r(){var t=setTimeout(function(){n.off(e.support.transition.end).remove()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.remove()})}var t=this,n=this.tip();n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?r():n.remove()},fixTitle:function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(t){return e.extend({},t?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},tip:function(){return this.$tip=this.$tip||e(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.isHTML(t)?"html":"text"](t),e.find(".popover-content > *")[this.isHTML(n)?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-content")||(typeof n.content=="function"?n.content.call(t[0]):n.content),e},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip}}),e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),s=typeof n=="object"&&n;i||r.data("popover",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(e){"use strict";function t(t,n){var r=e.proxy(this.process,this),i=e(t).is("body")?e(window):e(t),s;this.options=e.extend({},e.fn.scrollspy.defaults,n),this.$scrollElement=i.on("scroll.scroll.data-api",r),this.selector=(this.options.target||(s=e(t).attr("href"))&&s.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=e("body"),this.refresh(),this.process()}t.prototype={constructor:t,refresh:function(){var t=this,n;this.offsets=e([]),this.targets=e([]),n=this.$body.find(this.selector).map(function(){var t=e(this),n=t.data("target")||t.attr("href"),r=/^#\w/.test(n)&&e(n);return r&&n.length&&[[r.position().top,n]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},process:function(){var e=this.$scrollElement.scrollTop()+this.options.offset,t=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,n=t-this.$scrollElement.height(),r=this.offsets,i=this.targets,s=this.activeTarget,o;if(e>=n)return s!=(o=i.last()[0])&&this.activate(o);for(o=r.length;o--;)s!=i[o]&&e>=r[o]&&(!r[o+1]||e<=r[o+1])&&this.activate(i[o])},activate:function(t){var n,r;this.activeTarget=t,e(this.selector).parent(".active").removeClass("active"),r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',n=e(r).parent("li").addClass("active"),n.parent(".dropdown-menu")&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate")}},e.fn.scrollspy=function(n){return this.each(function(){var r=e(this),i=r.data("scrollspy"),s=typeof n=="object"&&n;i||r.data("scrollspy",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.defaults={offset:10},e(function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(window.jQuery),!function(e){"use strict";var t=function(t){this.element=e(t)};t.prototype={constructor:t,show:function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.attr("data-target"),i,s,o;r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;i=n.find(".active a").last()[0],o=e.Event("show",{relatedTarget:i}),t.trigger(o);if(o.isDefaultPrevented())return;s=e(r),this.activate(t.parent("li"),n),this.activate(s,s.parent(),function(){t.trigger({type:"shown",relatedTarget:i})})},activate:function(t,n,r){function o(){i.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),r&&r()}var i=n.find("> .active"),s=r&&e.support.transition&&i.hasClass("fade");s?i.one(e.support.transition.end,o):o(),i.removeClass("in")}},e.fn.tab=function(n){return this.each(function(){var r=e(this),i=r.data("tab");i||r.data("tab",i=new t(this)),typeof n=="string"&&i[n]()})},e.fn.tab.Constructor=t,e(function(){e("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=e(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};t.prototype={constructor:t,select:function(){var e=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(e)).change(),this.hide()},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:t.top+t.height,left:t.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(t){var n=this,r,i;return this.query=this.$element.val(),this.query?(r=e.grep(this.source,function(e){return n.matcher(e)}),r=this.sorter(r),r.length?this.render(r.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){var t=[],n=[],r=[],i;while(i=e.shift())i.toLowerCase().indexOf(this.query.toLowerCase())?~i.indexOf(this.query)?n.push(i):r.push(i):t.push(i);return t.concat(n,r)},highlighter:function(e){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return e.replace(new RegExp("("+t+")","ig"),function(e,t){return"<strong>"+t+"</strong>"})},render:function(t){var n=this;return t=e(t).map(function(t,r){return t=e(n.options.item).attr("data-value",r),t.find("a").html(n.highlighter(r)),t[0]}),t.first().addClass("active"),this.$menu.html(t),this},next:function(t){var n=this.$menu.find(".active").removeClass("active"),r=n.next();r.length||(r=e(this.$menu.find("li")[0])),r.addClass("active")},prev:function(e){var t=this.$menu.find(".active").removeClass("active"),n=t.prev();n.length||(n=this.$menu.find("li").last()),n.addClass("active")},listen:function(){this.$element.on("blur",e.proxy(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),(e.browser.webkit||e.browser.msie)&&this.$element.on("keydown",e.proxy(this.keypress,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this))},keyup:function(e){switch(e.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation(),e.preventDefault()},keypress:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:if(e.type!="keydown")break;e.preventDefault(),this.prev();break;case 40:if(e.type!="keydown")break;e.preventDefault(),this.next()}e.stopPropagation()},blur:function(e){var t=this;setTimeout(function(){t.hide()},150)},click:function(e){e.stopPropagation(),e.preventDefault(),this.select()},mouseenter:function(t){this.$menu.find(".active").removeClass("active"),e(t.currentTarget).addClass("active")}},e.fn.typeahead=function(n){return this.each(function(){var r=e(this),i=r.data("typeahead"),s=typeof n=="object"&&n;i||r.data("typeahead",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},e.fn.typeahead.Constructor=t,e(function(){e("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(t){var n=e(this);if(n.data("typeahead"))return;t.preventDefault(),n.typeahead(n.data())})})}(window.jQuery); | |
app/assets/javascripts/admin/collections.js | |
22) } | |
app/controllers/admin/credits_controller.rb | |
3) def new | |
6) end | |
app/controllers/admin/dashboard_controller.rb | |
10) rescue ActionView::MissingTemplate | |
14) def search | |
24) if term1 && term2 | |
26) @search_type = "user" | |
30) @search_type = "order" | |
34) @search_type = "shipment" | |
38) @search_type = "return" | |
56) end | |
57) end | |
app/controllers/admin/images_controller.rb | |
1)class Admin::ImagesController < Admin::ResourcesController | |
2) | |
app/controllers/admin/menus_controller.rb | |
1)class Admin::MenusController < Admin::ResourcesController | |
2) def index | |
5) end | |
7) def new | |
15) end | |
16) end | |
17) | |
18) def edit | |
21) end | |
22)end | |
app/controllers/admin/restocks_controller.rb | |
1)class Admin::RestocksController < Admin::ResourcesController | |
14)end | |
app/controllers/admin/return_authorizations_controller.rb | |
3) def edit | |
4) @item = ReturnAuthorization.find(params[:id]) | |
5) end | |
7) def update | |
11) params[:return_authorization][:return_units].each do |unit| | |
13) current_unit.quantity = unit[:quantity] | |
14) current_unit.save | |
16) @item.return_units.new(unit) | |
17) end | |
18) end | |
app/controllers/checkout_controller.rb | |
40) current_order.reload | |
41) end | |
43) def empty_cart | |
44) unless current_order.nil? || current_order.line_items.empty? | |
45) redirect_to checkout_state_path | |
46) end | |
192) def adjust | |
194) end | |
app/controllers/orders_controller.rb | |
15) end | |
16) | |
17) def returns | |
app/controllers/return_authorizations_controller.rb | |
4) | |
5) def new | |
7) end | |
32) end | |
33) end | |
35) def index | |
36) @order = Order.find_by_id_and_user params[:order_id], current_user | |
38) | |
51) def cancel | |
52) @order = Order.find_by_id_and_user params[:order_id], current_user | |
56) end | |
97)end | |
app/controllers/stocked_items_controller.rb | |
5) @line_item.update_attributes(:disabled=>true,:quantity=>0) | |
7) respond_to { |format| format.js { render 'line_items/destroy', :locals => { :line_item => @line_item } } } | |
app/helpers/products_helper.rb | |
4) def round_money amount | |
5) amount.round(2) | |
6) end | |
7) | |
13) def full_format_price price | |
15) end | |
app/models/content_node.rb | |
21)class ContentNode < ActiveRecord::Base | |
22) belongs_to :viewable, :polymorphic => true | |
23) acts_as_list :scope => :viewable | |
24) store :settings | |
30) has_many :images, | |
33) :dependent => :destroy | |
35) accepts_nested_attributes_for :images | |
36) | |
37) validates :name, :presence => true | |
38) | |
39)end | |
app/models/line_item.rb | |
33) belongs_to :restock | |
88) def restock_date | |
90) end | |
95) end | |
207) end | |
app/models/menu.rb | |
36) :dependent => :destroy | |
50) end | |
54) end | |
74)end | |
app/models/order.rb | |
194) | |
252) end | |
329) def calculate_cash_payout refund_amount | |
331) end | |
333) def calculate_credit_payout refund_amount | |
334) round_money(refund_amount - calculate_cash_payout(refund_amount)) | |
335) end | |
344) def order_subtotal | |
app/models/payment.rb | |
115) logger.info "Payment Settled. Prior. payment id #{self.braintree_id} settled, msg: Success, #{Time.now}" | |
120) logger.info "Payment Settled. payment id #{self.braintree_id} settled, msg: Success, #{Time.now}" | |
app/models/product.rb | |
76) :through => :variants | |
117) | |
160) | |
app/models/product_group.rb | |
19) has_many :products | |
app/models/restock.rb | |
19)class Restock < ActiveRecord::Base | |
21) belongs_to :variant | |
22) has_many :line_items | |
37) def available_quantity | |
39) end | |
45) end | |
app/models/return_authorization.rb | |
54) | |
82) end | |
83) | |
176) return 0 unless return_unit | |
177) line_item = self.order.line_items.find_by_variant_id(return_unit.variant_id) | |
180) end | |
279) def return_units_subtotal | |
283) def total_units_quantity | |
app/models/return_unit.rb | |
24) belongs_to :line_item | |
app/models/shipment.rb | |
41) after_destroy :update_order | |
200) def shipped_items_subtotal | |
app/models/shipping_method.rb | |
35) } | |
36) | |
43) def carrier | |
44) self.name.match("(#{CARRIER_INFO.keys.join('|')})").to_s | |
45) end | |
50) end | |
52) def carrier_phone | |
58) end | |
app/models/tax_adjustment.rb | |
65) | |
app/models/user.rb | |
61) has_many :orders | |
63) has_many :line_items, :through => :orders | |
83) has_one :user_invite, :foreign_key => :from_user_id | |
272) def is_super? | |
273) self.has_role? 'super' | |
274) end | |
421) def valid_children | |
422) self.children.where(:opt_in => true).where(:bounced => false) | |
423) end | |
425) def childrens_orders_sum | |
430) end | |
app/models/variant.rb | |
60) has_many :restocks | |
113) | |
114) # | |
115) # Inventory Related Methods | |
116) # | |
117) | |
121) end | |
123) # Returns adjusted quantity (if not enough) or total quantity if no amount passed in | |
127) | |
132) | |
133) # Returns adjusted quantity (if not enough) or total quantity if no amount passed in (at system level) | |
137) end | |
138) | |
139) def orderable_state | |
152) end | |
168) end | |
174) def increment_preordered qty | |
179) end | |
232) def display_name | |
234) end | |
348) | |
app/views/admin/collections/_form.html.erb | |
1)<div class="tabbable"> <!-- Only required for left/right tabs --> | |
8) <% end %> | |
9) </ul> | |
11) <div class="tab-content"> | |
14) </div> | |
20) </div> | |
26) <% end %> | |
app/views/admin/collections/_form_edit.html.erb | |
1)<% collection ||= collection %> | |
2) | |
3)<%= render "helpers/admin/resources/errors" %> | |
100)<% end # form %> | |
app/views/admin/collections/_manage_products.html.erb | |
1)<% collection ||= @item %> | |
14)</div> | |
app/views/admin/collections/_thumb.html.erb | |
2) <div class="container"> | |
9) </div> | |
21) </div> | |
app/views/admin/credits/_form.html.erb | |
27) <% end %> | |
app/views/admin/dashboard/search.html.erb | |
9)<br /> | |
11)<%= render :partial => 'admin/users/list', :locals => { :items => @users } %> | |
app/views/admin/menus/_form.html.erb | |
122) | |
app/views/admin/menus/_item.html.erb | |
9)</li> | |
app/views/admin/menus/_list.html.erb | |
3)</ul> | |
app/views/admin/orders/_form.html.erb | |
19)<div class="tabbable"> <!-- Only required for left/right tabs --> | |
36) </ul> | |
38) <div class="tab-content"> | |
54)</div> | |
app/views/admin/orders/_form_edit.html.erb | |
92) | |
134) <% end %> | |
135) | |
app/views/admin/orders/_line_items.html.erb | |
1)<% order ||= @item %> | |
2)<h2>Line Items</h2> | |
4) <thead> | |
5) <tr> | |
6) <th>SKU</th> | |
7) <th>Description</th> | |
8) <th>Color</th> | |
9) <th>Size</th> | |
10) <th>Price</th> | |
11) <th>Qty. in order</th> | |
12) <th width="60px">Total</th> | |
13) </tr> | |
14) </thead> | |
15) <tbody> | |
16) <% order.line_items.sort_by{|li| li.variant.andand.sku ? li.variant.sku : '' }.each do |li| %> | |
17) <tr> | |
18) <td><%= li.variant.andand.sku %></td> | |
19) <td><%= li.product.name %></td> | |
20) <td><%= li.variant.andand.product_color.blank? ? ("No Color Defined: " + li.variant.andand.color.to_s) : li.variant.product_color.name %></td> | |
23) <td><%= li.andand.quantity %></td> | |
24) <td style="text-align:right;"><%= full_format_price (li.andand.quantity * li.andand.price) %></td> | |
25) </tr> | |
26) <% end %> | |
27) <tr> | |
28) <td colspan="6" style="text-align:right;"> | |
29) Item Subtotal | |
30) </td> | |
31) <td style="text-align:right;"><%= full_format_price (order.line_items.sum{|li| li.andand.quantity * li.andand.price } )%> | |
32) </tr> | |
33) </tbody> | |
34)</table> | |
35) | |
36)<h2>Adjustments</h2> | |
38) <thead> | |
39) <tr> | |
40) <th>Updated</th> | |
41) <th>Type</th> | |
42) <th>Source</th> | |
43) <th>Originator</th> | |
44) <th width="60px">Amount</th> | |
45) </tr> | |
46) </thead> | |
47) <tbody> | |
48) <% order.adjustments.each do |aj| %> | |
49) <tr> | |
50) <td><%= aj.updated_at %></td> | |
51) <td><%= aj.label %></td> | |
52) <td><%= aj.andand.source_type %> ID #<%= aj.andand.source.andand.id %></td> | |
53) <td><%= aj.andand.originator_type %> ID #<%= aj.andand.originator.andand.id %></td> | |
54) <td style="text-align:right;"><%= full_format_price aj.andand.amount %></td> | |
55) </tr> | |
56) <% end %> | |
57) <tr> | |
58) <td colspan="4" style="text-align:right;"> | |
59) Adjustment Subtotal | |
60) </td> | |
61) <td style="text-align:right;"> | |
62) <%= full_format_price order.adjustments.sum(&:amount) %> | |
63) </td> | |
64) </tr> | |
65) </tbody> | |
66)</table> | |
67)<h2>Order Total: <%= full_format_price order.total %></h2> | |
app/views/admin/orders/_payments.html.erb | |
1)<% order ||= @item %> | |
2)<h2>Payments</h2> | |
4) <thead> | |
5) <tr> | |
6) <th>Created At</th> | |
7) <th>Updated At</th> | |
9) <th>Source</th> | |
10) <th>State</th> | |
11) <th>Response Code</th> | |
12) <th>Amount</th> | |
13) </tr> | |
14) </thead> | |
15) <tbody> | |
16) <% order.payments.andand.each do |p| %> | |
17) <tr> | |
18) <td><%= p.created_at.strftime('%m/%d/%Y %r') %></td> | |
19) <td><%= p.updated_at.strftime('%m/%d/%Y %r') %></td> | |
20) <td><strong><%= p.braintree_id %></strong></td> | |
21) <td><%= p.source_id %></td> | |
34) <td><%= p.response_code %></td> | |
35) <td><%= p.amount %></td> | |
36) </tr> | |
37) <% end %> | |
38) </tbody> | |
39)</table> | |
40) | |
app/views/admin/orders/_shipments.html.erb | |
1)<% order ||= @item %> | |
2)<h2>Shipments</h2> | |
4) <thead> | |
5) <tr> | |
6) <th>Shipped To</th> | |
7) <th>Number</th> | |
9) <th>Method</th> | |
10) <th>Tracking</th> | |
14) <th>Cost</th> | |
15) </tr> | |
16) </thead> | |
17) <tbody> | |
18) <% order.shipments.andand.each do |s| %> | |
19) <tr> | |
20) <td> | |
25) <td><%= s.number %></td> | |
33) <td><%= s.shipping_method.andand.name %></td> | |
35) <td><%= s.state %></td> | |
38) <td><%= s.cost %></td> | |
39) </tr> | |
40) <% end %> | |
41) </tbody> | |
42)</table> | |
43) | |
app/views/admin/product_colors/_form.html.erb | |
1)<div class="tabbable"> <!-- Only required for left/right tabs --> | |
5) <li><a href="#tab2" data-toggle="tab">Related Products</a></li> | |
6) </ul> | |
8) <div class="tab-content"> | |
11) </div> | |
15) </div> | |
16) </div> | |
app/views/admin/product_colors/_form_edit.html.erb | |
1)<% product_color ||= @item %> | |
34)<% end %> | |
35) | |
36) | |
app/views/admin/product_colors/_related_products.html.erb | |
1)<h2>Related Products</h2> | |
app/views/admin/product_groups/_form.html.erb | |
1)<div class="tabbable"> <!-- Only required for left/right tabs --> | |
3) <li class="active"><a href="#tab1" data-toggle="tab">Edit</a></li> | |
4) <li><a href="#tab2" data-toggle="tab">Products in Group</a></li> | |
5) </ul> | |
6) <div class="tab-content"> | |
7) <div class="tab-pane active" id="tab1"> | |
9) </div> | |
12) </div> | |
13) </div> | |
app/views/admin/product_groups/_form_edit.html.erb | |
1)<% group ||= @item %> | |
24)</div> | |
app/views/admin/product_groups/_products_in_group.html.erb | |
1)<h2>Products in Group | |
2) <small> | |
3) <span class="label label-info">Group: <%= @item.name %></span> | |
4) </small> | |
5)</h2> | |
6)<%= partial 'admin/products/list', items: @item.products %> | |
app/views/admin/product_sizes/_form.html.erb | |
13) </div> | |
app/views/admin/product_sizes/_item.html.erb | |
4) <% variant = item.variants.first %> | |
6) <% end %> | |
app/views/admin/product_sizes/_list.html.erb | |
5) <th>Size</th> | |
6) <th>Details</th> | |
app/views/admin/products/_form.html.erb | |
49) </div> | |
50) </div> | |
app/views/admin/products/_form_edit.html.erb | |
4) | |
6) | |
8) | |
21) | |
35) </div> | |
app/views/admin/products/_item.html.erb | |
3) <td> | |
app/views/admin/products/_manage_variants.html.erb | |
2)<h2> | |
4) <small> | |
6) </small> | |
7)</h2> | |
9)<%= render :partial => 'admin/variants/summary_table', :locals => { :product => @item } %> | |
app/views/admin/products/_product_images.html.erb | |
1)<% div_id = disabled ? "disabled_images" : "images" %> | |
2)<% div_class = disabled ? "collapse" : "" %> | |
3)<% data_path = disabled ? "" : reorder_admin_product_images_path(product) %> | |
4)<div id="<%= div_id %>" class="<%= div_class %>"> | |
5) <ul class="draggables clearfix" data-path="<%= data_path %>"> | |
7) <%= render :partial => "admin/products/thumb", :locals => { :product => product, :image => image } %> | |
8) <% end %> | |
9) </ul> | |
app/views/admin/products/_products_in_group.html.erb | |
2)<h2>Related Group Members: <%= item.product_group.name %> | |
3) <small> | |
5) </small> | |
6)</h2> | |
app/views/admin/products/_related_collections.html.erb | |
1)<h2>Related Collections</h2> | |
app/views/admin/products/_thumb.html.erb | |
2) <div class="container"> | |
6) </div> | |
7)<br/> | |
app/views/admin/reports/_form.html.erb | |
40) | |
app/views/admin/resources/_actions.html.erb | |
1)<div class="Support"> | |
app/views/admin/resources/edit.html.erb | |
34)</div> | |
app/views/admin/return_authorizations/_form.html.erb | |
7)<% end %> | |
8) | |
10) <div class="alert alert-info"> | |
14)<% end %> | |
18) | |
48) <% end %> | |
49) | |
57) | |
app/views/admin/shared/_switch_user.html.erb | |
4) <span> | |
5) <strong>Debug: </strong> | |
7) current_user.email : | |
8) "#{current_user.first_name} #{current_user.last_name}" | |
9) %> | |
11) Please <%= link_to 'Stop Switching Users', stop_switching_users_url %> after debugging. | |
app/views/admin/shared/bootstrap/_head.html.erb | |
1)<meta charset="utf-8" /> | |
2)<meta name="apple-mobile-web-app-capable" content="yes" /> | |
3)<meta name="generator" content="Typus <%= Typus::VERSION %>" /> | |
4) | |
5)<%= favicon_link_tag %> | |
6) | |
7)<title><%= Typus.admin_title %> — <%= yield :title %></title> | |
8) | |
9)<%= stylesheet_link_tag 'admin' %> | |
11) | |
12)<%= yield :stylesheets -%> | |
13)<style> | |
15) | |
16)</style> | |
17)<%= yield :javascripts -%> | |
18) | |
19)<%= csrf_meta_tag %> | |
app/views/admin/users/_invited.html.erb | |
1)<table class="table table-bordered"> | |
2) <thead> | |
3) <tr> | |
4) <th>#</th> | |
5) <th>User</th> | |
6) <th>Email</th> | |
7) <th>Opted In?</th> | |
8) <th>Bounced?</th> | |
9) <th>Orders</th> | |
10) </tr> | |
11) </thead> | |
12) <tbody> | |
13) <% children.each_with_index do |user, idx| %> | |
14) <tr> | |
15) <td><%= idx + 1 %>.</td> | |
16) <td><%= "#{user.first_name} #{user.last_name}" %></td> | |
17) <td><%= user.email %></td> | |
19) <td> | |
21) </td> | |
23) <% if user.orders.count > 0 %> | |
25) <br /> | |
27) <% end %> | |
28) </td> | |
29) </tr> | |
30) <% end %> | |
32) </tbody> | |
app/views/admin/users/_item.html.erb | |
8) <td> | |
135) | |
195)</tr> | |
app/views/admin/users/_item_return_auth.html.erb | |
3) edit_admin_return_authorization_path(return_auth.id), | |
4) :rel => "popover", | |
5) 'data-html' => true, | |
6) 'data-original-title' => "Return RMA##{return_auth.number}", | |
7) 'data-content' => (render :partial=>'admin/users/item_return_popover', :locals=>{:return_authorization=>return_auth} ) | |
8) %> | |
9) <small> | |
10) (<%= return_auth.created_at.andand.strftime('%m/%d/%Y') %>) | |
11) <strong><%= return_auth.state %></strong> | |
12) </small> | |
app/views/admin/users/_item_return_popover.html.erb | |
1)<% return_authorization.return_units.sort_by{|u| u.variant ? u.variant.sku : " " }.each do |ru| %> | |
2) <%= ru.variant.sku %> - <%= ru.quantity %><br /> | |
3)<% end %> | |
app/views/admin/users/_item_shipment_popover.html.erb | |
1)<strong>state:</strong> <%= shipment.state %> | |
2)<br /> | |
3)<strong>shipped at:</strong> <%= shipment.shipped_at ? shipment.shipped_at.andand.strftime('%m/%d/%Y') : "Not Yet Shipped" %> | |
app/views/admin/users/_list.html.erb | |
3) <thead> | |
4) <tr> | |
7) <th>Info</th> | |
8) </tr> | |
9) </thead> | |
13)</table> | |
app/views/admin/variants/_summary_row.html.erb | |
15) <td> | |
16) <%= variant.shippable_quantity %> shippable | |
17) <br /> | |
25) data-content=" | |
26) Total Expected: <%= restock.expected %><br /> | |
27) Already Received: <%= restock.received %><br /> | |
28) Total Preordered: <%= restock.preordered %><br /> | |
29) Still Available for Preorder: <%= restock.available_quantity %> | |
31) data-html="true" | |
32) > | |
33) ? | |
34) </span> | |
35) <br /> | |
37) </td> | |
41) | |
app/views/checkout/confirm.html.erb | |
50) | |
66) | |
67)<% end %> | |
app/views/helpers/admin/base/_flash_message.html.erb | |
1)<div id="flash" class="alert alert-<%= flash_type %>"> | |
app/views/helpers/admin/resources/_errors.html.erb | |
1)<% item ||= @item %> | |
app/views/helpers/admin/resources/_filters.html.erb | |
1)<div class="pull-right"> | |
3) <% filters.each do |filter| %> | |
4) <% key, value = filter[:key], filter[:value] %> | |
9) <% end %> | |
10) | |
11) <% hidden_filters.each do |key, value| %> | |
12) <%= hidden_field_tag key, value %> | |
13) <% end %> | |
14) | |
16) <% end %> | |
app/views/helpers/admin/resources/_search.html.erb | |
7) <%= form_tag nil, :method => :get, :class => "form-horizontal" do %> | |
app/views/kaminari/_first_page.html.erb | |
1)<%# Link to the "First" page | |
2) - available local variables | |
3) url: url to the first page | |
4) current_page: a page object for the currently displayed page | |
5) num_pages: total number of pages | |
6) per_page: number of items to fetch per page | |
7) remote: data-remote | |
8)-%> | |
9)<li class="first"> | |
10) <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> | |
11)</li> | |
app/views/kaminari/_gap.html.erb | |
1)<%# Non-link tag that stands for skipped pages... | |
2) - available local variables | |
3) current_page: a page object for the currently displayed page | |
4) num_pages: total number of pages | |
5) per_page: number of items to fetch per page | |
6) remote: data-remote | |
7)-%> | |
8)<li class="disabled"><a href="#">...</a></li> | |
app/views/kaminari/_last_page.html.erb | |
1)<%# Link to the "Last" page | |
2) - available local variables | |
3) url: url to the last page | |
4) current_page: a page object for the currently displayed page | |
5) num_pages: total number of pages | |
6) per_page: number of items to fetch per page | |
7) remote: data-remote | |
8)-%> | |
9)<span class="last"> | |
10) <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %> | |
11)</span> | |
app/views/kaminari/_next_page.html.erb | |
1)<%# Link to the "Next" page | |
2) - available local variables | |
3) url: url to the next page | |
4) current_page: a page object for the currently displayed page | |
5) num_pages: total number of pages | |
6) per_page: number of items to fetch per page | |
7) remote: data-remote | |
8)-%> | |
9)<li class="<%= 'disabled' if current_page.last? %>"> | |
10) <%= link_to raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %> | |
11)</li> | |
app/views/kaminari/_page.html.erb | |
1)<%# Link showing page number | |
2) - available local variables | |
3) page: a page object for "this" page | |
4) url: url to this page | |
5) current_page: a page object for the currently displayed page | |
6) num_pages: total number of pages | |
7) per_page: number of items to fetch per page | |
8) remote: data-remote | |
9)-%> | |
10)<li class="<%= 'active disabled' if page.current? %>"> | |
11) <%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : '#'} %> | |
12)</li> | |
app/views/kaminari/_paginator.html.erb | |
1)<%# The container tag | |
2) - available local variables | |
3) current_page: a page object for the currently displayed page | |
4) num_pages: total number of pages | |
5) per_page: number of items to fetch per page | |
6) remote: data-remote | |
7) paginator: the paginator that renders the pagination tags inside | |
8)-%> | |
9)<%= paginator.render do -%> | |
10) <div class="pagination"> | |
12) <%= prev_page_tag %> | |
13) <% each_page do |page| -%> | |
14) <% if page.left_outer? || page.right_outer? || page.inside_window? -%> | |
15) <%= page_tag page %> | |
16) <% elsif !page.was_truncated? -%> | |
17) <%= page_tag page %> | |
18) <% end -%> | |
19) <% end -%> | |
20) <%= next_page_tag%> | |
21) </ul> | |
22) </div> | |
app/views/kaminari/_prev_page.html.erb | |
1)<%# Link to the "Previous" page | |
2) - available local variables | |
3) url: url to the previous page | |
4) current_page: a page object for the currently displayed page | |
5) num_pages: total number of pages | |
6) per_page: number of items to fetch per page | |
7) remote: data-remote | |
8)-%> | |
9)<li class="<%= 'disabled' if current_page.first? %>"> | |
10) <%= link_to raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %> | |
11)</li> | |
app/views/layouts/admin/_bootstrap.html.erb | |
1)<!DOCTYPE html> | |
2) | |
3)<html lang="<%= I18n.locale %>"> | |
4) | |
5)<head> | |
6) <%= render 'admin/shared/bootstrap/head' %> | |
7)</head> | |
8) | |
9)<body> | |
10) <%= render "admin/shared/switch_user" %> | |
46)</body> | |
47) | |
48)</html> | |
app/views/layouts/admin/base.html.erb | |
1)<% custom_layout = "bootstrap" %> | |
2)<% @design = custom_layout ||= "base" %> | |
4)<%= render :partial => "layouts/admin/#{@design}"%> | |
app/views/order_mailer/return_created.text.erb | |
1)Order#<%= @rma.order.number %> -- RMA#<%= @rma.number %> | |
2)========================================= | |
3) | |
4)Requesting User: <%= @rma.order.user.first_name %> <%= @rma.order.user.last_name %> | |
5) | |
15) | |
19) | |
29)There are a total of <%= @rma.total_units_quantity %> return units specified: | |
35) | |
36)https://admin.everlane.com/admin/return_authorizations/<%=@rma.id%>/edit | |
37) | |
app/views/orders/create_alert.js.erb | |
15) | |
30) .removeClass('preorderable shippable sold_out') | |
app/views/return_authorizations/new.html.erb | |
16) | |
85) | |
88)</div> | |
app/views/return_authorizations/show.html.erb | |
2) | |
144)</div> | |
config/environments/development.rb | |
53) # use your own API key here to use the stats/heroku stuff in dev | |
config/routes.rb | |
123) get 'print' => :print, :on => :member | |
124) post 'cancel' => :cancel, :on => :member | |
126) end | |
config/typus/application.yml | |
1)Credits: | |
2) actions: | |
3) index: new | |
config/typus/asset.yml | |
7) relationships: products, collections | |
config/typus/collection.yml | |
8) relationships: images | |
10) options: | |
config/typus/credit.yml | |
11) order_by: -credits.created_at | |
13) search: ^users.email | |
config/typus/image.yml | |
7) relationships: product, collection | |
config/typus/menu.yml | |
1)# Use the README file as a reference to customize settings. | |
2) | |
3)Menu: | |
5) fields: | |
config/typus/menu_item.yml | |
1)# Use the README file as a reference to customize settings. | |
2) | |
3)MenuItem: | |
4) fields: | |
5) list: name, url, menu_id, position, | |
6) default: name, url, menu_id, position | |
7) form: name, url, menu_id, position | |
8) relationships: roles | |
9) | |
config/typus/password_reset.yml | |
8) # application: Application | |
config/typus/product.yml | |
9) relationships: product_colors, product_groups, product_types, variants, images | |
12) per_page: 25 | |
config/typus/product_color.yml | |
12) options: | |
13) per_page: 10 | |
config/typus/report.yml | |
9) order_by: name | |
config/typus/restock.yml | |
1)Restock: | |
4) fields: | |
6) default: id | |
11) relationships: variant | |
14) options: | |
config/typus/role.yml | |
6) form: name | |
config/typus/shipping_method.yml | |
6) form: name | |
config/typus/state.yml | |
6) form: name, abbr | |
config/typus/state_event.yml | |
7) # relationships: user | |
db/migrate/20120613174520_create_menus.rb | |
1)class CreateMenus < ActiveRecord::Migration | |
2) def change | |
3) create_table :menus do |t| | |
4) t.string :name, :null => false | |
5) t.string :url, :null => true | |
6) t.string :type, :null => true | |
7) t.integer :position, :default => 0 | |
8) t.integer :collection_id, :null => true | |
9) t.integer :menu_id, :null => true | |
10) t.timestamps | |
11) end | |
13) add_index :menus, [:menu_id] | |
14) add_index :menus, [:type] | |
15) end | |
16)end | |
db/migrate/20120613181758_create_menu_roles.rb | |
1)class CreateMenuRoles < ActiveRecord::Migration | |
2) def change | |
3) create_table :menu_roles do |t| | |
4) t.integer :menu_id | |
5) t.integer :role_id | |
6) t.boolean :active, :null => false, :default => false | |
7) t.timestamps | |
8) end | |
9) add_index( :menu_roles, [:menu_id,:role_id], :unique => true ) | |
10) end | |
11) | |
12)end | |
db/migrate/20120614182844_seed_menus.rb | |
1)class SeedMenus < ActiveRecord::Migration | |
5)end | |
db/migrate/20120614185952_seed_menu_items.rb | |
1)class SeedMenuItems < ActiveRecord::Migration | |
5)end | |
db/migrate/20120615185717_add_product_types_index_to_products.rb | |
1)class AddProductTypesIndexToProducts < ActiveRecord::Migration | |
2) def change | |
3) add_index :products, [:product_type_id] | |
4) end | |
5)end | |
db/migrate/20120618232248_create_gift_cards.rb | |
1)class CreateGiftCards < ActiveRecord::Migration | |
2) def change | |
3) create_table :gift_cards do |t| | |
4) t.string :gift_code, :null => false, :unique => true | |
5) t.string :hashed_gift_code, :null => false, :unique => true | |
6) t.integer :serial_number, :null => false, :unique => true | |
7) t.decimal :amount, :precision => 8, :scale => 2, :null => true, :default => 0 | |
8) t.datetime :redeemed_at | |
9) t.boolean :active, :null => false, :default => true | |
10) t.timestamps | |
11) end | |
12) add_index :gift_cards, [:hashed_gift_code] | |
13) end | |
14)end | |
db/migrate/20120619210015_seed_gift_cards.rb | |
1)class SeedGiftCards < ActiveRecord::Migration | |
2) def up | |
3) end | |
4) | |
5) def down | |
6) puts "doing nothing" | |
7) end | |
8)end | |
db/migrate/20120619215623_add_gift_card_id_to_credits.rb | |
1)class AddGiftCardIdToCredits < ActiveRecord::Migration | |
2) def change | |
3) add_column :credits, :gift_card_id, :integer, :null => true | |
4) end | |
5)end | |
db/migrate/20120621003856_add_custom_partial_to_product_colors.rb | |
1)class AddCustomPartialToProductColors < ActiveRecord::Migration | |
2) def change | |
3) add_column :product_colors, :custom_partial, :string | |
4) end | |
5)end | |
db/migrate/20120621191534_add_disabled_to_assets.rb | |
1)class AddDisabledToAssets < ActiveRecord::Migration | |
2) def change | |
3) add_column :assets, :disabled, :boolean, :null => false, :default => false | |
5) dbhandle = Asset.connection.raw_connection | |
6) update_sql = "UPDATE assets SET disabled = 0" | |
7) dbhandle.query(update_sql) | |
8) affected_rows = dbhandle.affected_rows | |
9) puts " #{affected_rows} assets had the disabled flag set to 0 (false)" if (affected_rows > 0) | |
11) end | |
12)end | |
db/migrate/20120621214457_create_fulfillment_centers.rb | |
1)class CreateFulfillmentCenters < ActiveRecord::Migration | |
2) def change | |
3) create_table :fulfillment_centers do |t| | |
4) t.string :name, :null => false | |
5) t.boolean :active, :null => false, :default => true | |
6) t.timestamps | |
7) end | |
8) end | |
9)end | |
db/migrate/20120621214806_seed_fulfillment_centers.rb | |
1)class SeedFulfillmentCenters < ActiveRecord::Migration | |
2) def up | |
3) puts "" | |
4) puts "Seeding Fulfillment Centers" | |
5) puts "" | |
6) | |
8) center = FulfillmentCenter.new(:name=>center,:active=>true) | |
9) center.save | |
10) end | |
11) end | |
12) | |
13) def down | |
14) puts "doing nothing" | |
15) end | |
16)end | |
db/migrate/20120621215503_add_fulfillment_center_id_to_variants.rb | |
1)class AddFulfillmentCenterIdToVariants < ActiveRecord::Migration | |
2) def change | |
3) add_column :variants, :fulfillment_center_id, :integer | |
4) end | |
5)end | |
db/migrate/20120621220311_populate_variants_with_fulfillment_ids.rb | |
1)class PopulateVariantsWithFulfillmentIds < ActiveRecord::Migration | |
2) def up | |
4) puts "" | |
5) puts "Populating Variants with Fulfillment_center_id = OWD FulfillmentCenter ID" | |
6) puts "" | |
8) owd_id = FulfillmentCenter.find_by_name("One World Direct").id | |
9) dbhandle = Variant.connection.raw_connection | |
10) update_sql = "UPDATE variants SET fulfillment_center_id = #{owd_id}" | |
11) dbhandle.query(update_sql) | |
12) affected_rows = dbhandle.affected_rows | |
13) puts " #{affected_rows} variants updated to have fulfillment_center_id=#{owd_id}" if (affected_rows > 0) | |
14) | |
15) end | |
16) | |
17) def down | |
18) puts "nothing to see here" | |
19) end | |
20)end | |
db/migrate/20120625194549_seed_giftcard_into_product_types.rb | |
1)class SeedGiftcardIntoProductTypes < ActiveRecord::Migration | |
2) def up | |
3) end | |
4) | |
5) def down | |
6) puts "Doing Nothing..." | |
7) end | |
8)end | |
db/migrate/20120625212831_seed_giftcards_into_product_groups.rb | |
1)class SeedGiftcardsIntoProductGroups < ActiveRecord::Migration | |
2) def up | |
4) | |
8)end | |
db/migrate/20120625215853_seed_giftcards_into_products.rb | |
1)class SeedGiftcardsIntoProducts < ActiveRecord::Migration | |
2) def up | |
4) | |
8)end | |
db/migrate/20120625223044_populate_giftcard_variants_for_related_products.rb | |
1)class PopulateGiftcardVariantsForRelatedProducts < ActiveRecord::Migration | |
2) def up | |
4) | |
8)end | |
db/migrate/20120712220148_create_content_nodes.rb | |
1)class CreateContentNodes < ActiveRecord::Migration | |
2) def change | |
3) create_table :content_nodes do |t| | |
4) t.string :name, :null => false | |
5) t.text :content_blob, :null => true | |
6) t.string :url, :null => true | |
7) t.string :type, :limit => 50, :null => true | |
8) t.integer :position, :default => 0 | |
9) t.integer :viewable_id, :null => true | |
10) t.string :viewable_type, :limit => 50 | |
11) t.integer :parent_id, :null => true | |
12) t.timestamps | |
13) end | |
14) | |
15) add_index :content_nodes, [:parent_id] | |
16) add_index :content_nodes, [:viewable_type, :viewable_id, :type, :position], :name => 'node_viewable_index' | |
17) end | |
18)end | |
db/migrate/20120712231837_populate_content_nodes_from_old_menus.rb | |
1)class PopulateContentNodesFromOldMenus < ActiveRecord::Migration | |
2) puts "" | |
3) puts "Populating Content Nodes from Old Menus" | |
4) puts "" | |
6) dbhandle = ContentNode.connection.raw_connection | |
7) | |
8) insert_sql = " | |
9) INSERT into content_nodes | |
10) (id,name,content_blob,url,type,position,viewable_id,viewable_type,parent_id,created_at,updated_at) | |
11) SELECT menus.id, menus.name ,'' as content_blob, menus.url,'Menu' as type, menus.position, menus.collection_id as viewable_id, 'Collection' as viewable_type, menus.menu_id as parent_id, menus.created_at, menus.updated_at FROM menus | |
12) " | |
13) dbhandle.query(insert_sql) | |
14) # affected_rows = dbhandle.affected_rows | |
15) # puts " #{affected_rows} content_nodes updated to have fulfillment_center_id=#{owd_id}" if (affected_rows > 0) | |
16)end | |
db/migrate/20120713201841_create_content_node_roles.rb | |
1)class CreateContentNodeRoles < ActiveRecord::Migration | |
2) def change | |
3) create_table :content_node_roles do |t| | |
4) t.integer :content_node_id | |
5) t.integer :role_id | |
6) t.boolean :active, :null => false, :default => false | |
7) t.timestamps | |
8) end | |
9) add_index( :content_node_roles, [:content_node_id,:role_id], :unique => true ) | |
10) end | |
11) | |
12)end | |
db/migrate/20120713202325_populate_content_node_roles_from_old_menus_roles.rb | |
1)class PopulateContentNodeRolesFromOldMenusRoles < ActiveRecord::Migration | |
2) def up | |
3) puts "" | |
4) puts "Populating ContentNodeRoles from Old MenuRoles" | |
5) puts "" | |
7) dbhandle = ContentNodeRole.connection.raw_connection | |
8) | |
9) insert_sql = " | |
10) INSERT into content_node_roles | |
11) SELECT * FROM menu_roles | |
12) " | |
13) dbhandle.query(insert_sql) | |
14) end | |
15) def down | |
16) puts "doing nothing" | |
17) end | |
18)end | |
db/migrate/20120718023625_add_settings_to_content_nodes.rb | |
1)class AddSettingsToContentNodes < ActiveRecord::Migration | |
2) def change | |
3) add_column :content_nodes, :settings, :text | |
4) end | |
5)end | |
db/migrate/20120718193550_add_slide_controls_to_collections.rb | |
1)class AddSlideControlsToCollections < ActiveRecord::Migration | |
2) def change | |
3) add_column :collections, :display_slides, :boolean, :null => false, :default => false | |
4) add_column :collections, :show_slide_images_only, :boolean, :null => false, :default => false | |
5) end | |
6)end | |
db/migrate/20120801233402_create_restocks.rb | |
1)class CreateRestocks < ActiveRecord::Migration | |
2) def change | |
3) | |
4) puts "" | |
5) puts "Create Restocks Table" | |
6) puts "" | |
7) | |
8) create_table :restocks do |t| | |
9) t.integer :expected, :null => false, :default => 0 | |
10) t.integer :preordered, :null => false, :default => 0 | |
11) t.integer :received, :null => false, :default => 0 | |
12) t.boolean :closed, :null => false, :default => false | |
13) t.text :notes | |
14) t.date :restock_date, :null => false | |
15) t.integer :variant_id, :null => false | |
16) t.timestamps | |
17) end | |
18) | |
19) add_index :restocks, [:variant_id,:expected,:preordered,:received], :name => 'available_quantity_index' | |
20) | |
21) end | |
22) | |
23)end | |
db/migrate/20120802190655_add_restock_id_to_line_items.rb | |
1)class AddRestockIdToLineItems < ActiveRecord::Migration | |
2) def change | |
3) add_column :line_items, :restock_id, :integer | |
4) end | |
5)end | |
db/migrate/20120807181027_add_index_to_adjustments.rb | |
1)class AddIndexToAdjustments < ActiveRecord::Migration | |
2) def change | |
3) add_index :adjustments, [:source_id,:source_type] | |
4) end | |
5)end | |
db/migrate/20120823051900_modify_columns_for_credit_cards.rb | |
1)class ModifyColumnsForCreditCards < ActiveRecord::Migration | |
2) def change | |
3) change_column :credit_cards, :bin, :string, :limit => 20 | |
4) change_column :credit_cards, :last_digits, :string, :limit => 20 | |
5) change_column :credit_cards, :cc_type, :string, :limit => 20 | |
6) change_column :credit_cards, :expiration_month, :string, :limit => 20 | |
7) change_column :credit_cards, :expiration_year, :string, :limit => 20 | |
8) change_column :credit_cards, :zip_code, :string, :limit => 20 | |
9) end | |
10)end | |
db/migrate/20120905174429_drop_menus.rb | |
1)class DropMenus < ActiveRecord::Migration | |
2) def change | |
3) puts "menus was replaced with content_nodes" | |
4) drop_table :menus | |
5) end | |
6)end | |
db/migrate/20120905174448_drop_menu_roles.rb | |
1)class DropMenuRoles < ActiveRecord::Migration | |
2) def change | |
3) puts "this was replaced with content_node_roles" | |
4) drop_table :menu_roles | |
5) end | |
6)end | |
db/migrate/20120913232453_add_main_reason_to_return_authorizations.rb | |
1)class AddMainReasonToReturnAuthorizations < ActiveRecord::Migration | |
2) def change | |
4) end | |
5)end | |
db/migrate/20121003201726_add_line_item_to_return_unit.rb | |
1)class AddLineItemToReturnUnit < ActiveRecord::Migration | |
2) def change | |
3) add_column :return_units, :line_item_id, :integer | |
4) end | |
5)end | |
db/migrate/20121012234944_add_shipping_method_code_to_shipping_methods.rb | |
1)class AddShippingMethodCodeToShippingMethods < ActiveRecord::Migration | |
2) def change | |
3) add_column :shipping_methods, :code, :string, :limit => 64 | |
4) end | |
5)end | |
db/migrate/20121016235158_add_parent_unique_id_to_shipments.rb | |
1)class AddParentUniqueIdToShipments < ActiveRecord::Migration | |
2) def change | |
3) add_column :shipments, :parent_unique_id, :string | |
4) end | |
5)end | |
doc/testing.txt | |
1)Steps for setting up for local testing | |
2) | |
3)1. create entry in database.yml for 'test' environment and then create actual test database | |
4)2. run 'rake db:test:prepare' to set up your database | |
5)3. run 'rspec -fd' to run rspec with a 'documented' output to see what's going on | |
6) | |
lib/scripts/adjust_order.rb | |
7)# Credits and partial refunds are separate transactions | |
lib/tasks/rspec.rake | |
1)begin | |
2) require "rspec/core/rake_task" | |
3) | |
4) desc "Run all examples" | |
5) RSpec::Core::RakeTask.new(:spec) do |t| | |
6) t.rspec_opts = %w[--color] | |
7) t.pattern = 'spec/*/*_spec.rb' | |
8) end | |
9)rescue LoadError | |
public/img/glyphicons-halflings-white.png | |
Binary file (standard input) matches | |
public/img/glyphicons-halflings.png | |
Binary file (standard input) matches | |
spec/factories/addresses.rb | |
25)require 'faker' | |
26) | |
27)FactoryGirl.define do | |
28) factory :address do | |
29) first_name { Faker::Name.first_name } | |
30) last_name { Faker::Name.last_name } | |
31) street_address {Faker::Address.street_address} | |
32) extended_address {[Faker::Address.secondary_address, nil][rand(2)]} | |
33) city {Faker::Address.city} | |
34) postal_code {Faker::Address.zip_code} | |
35) state | |
36) primary 1 | |
41) end | |
spec/factories/credit_cards.rb | |
24)require 'faker' | |
25) | |
26)FactoryGirl.define do | |
27) factory :credit_card do | |
28) first_name { Faker::Name.first_name } | |
29) last_name { Faker::Name.last_name } | |
30) cc_type "Visa" | |
31) last_digits "1111" | |
32) expiration_month "07" | |
33) expiration_year {(Date.today.year + 1).to_s} | |
34) security_code "123" | |
35) token 'hz2br' | |
36) zip_code {Faker::Address.zip_code} | |
37) disabled 0 | |
38) primary 1 | |
41) end | |
42)end | |
spec/factories/line_items.rb | |
22)FactoryGirl.define do | |
23) factory :line_item do | |
24) variant | |
25) product | |
26) order | |
27) collection | |
28) quantity 1 | |
29) end | |
30)end | |
spec/factories/order.rb | |
1)FactoryGirl.define do | |
2) factory :order do | |
24) end | |
spec/factories/product_sizes.rb | |
14)require 'faker' | |
15) | |
16)FactoryGirl.define do | |
17) factory :product_size do | |
19) short_name 'S' | |
20) position 0 | |
21) end | |
spec/factories/products.rb | |
32)FactoryGirl.define do | |
33) factory :product do | |
38) end | |
spec/factories/states.rb | |
13)require 'faker' | |
14) | |
15)FactoryGirl.define do | |
16) factory :state do | |
19) end | |
20)end | |
21) | |
spec/factories/stocked_items.rb | |
18)# Read about factories at http://github.com/thoughtbot/factory_girl | |
19) | |
20)FactoryGirl.define do | |
21) factory :stocked_item do | |
22) variant | |
23) product | |
24) collection | |
26) quantity 1 | |
27) end | |
spec/factories/user.rb | |
1)require 'faker' | |
2) | |
3)FactoryGirl.define do | |
4) factory :user do | |
5) first_name { Faker::Name.first_name } | |
6) last_name { Faker::Name.last_name } | |
7) email { Faker::Internet.email } | |
8) password 'password' | |
9) end | |
10)end | |
11) | |
spec/factories/variants.rb | |
39)# Read about factories at http://github.com/thoughtbot/factory_girl | |
40) | |
41)FactoryGirl.define do | |
42) factory :variant do | |
45) price { [400, 50, 25].sample } | |
46) product_size | |
52) end | |
53)end | |
spec/models/address_spec.rb | |
27)describe Address do | |
33) it "is invalid without a street_address" do | |
35) end | |
37) it "is invalid without a city" do | |
39) end | |
41) it "is invalid without a state" do | |
43) end | |
45) it "is invalid without a properly formatted postal_code" do | |
47) end | |
spec/models/user_spec.rb | |
42) | |
45) end | |
49) end | |
spec/spec_helper.rb | |
12)require 'factory_girl' | |
15) | |
35) config.use_transactional_fixtures = false | |
36) config.include FactoryGirl::Syntax::Methods | |
38) config.before :suite do | |
39) DatabaseCleaner.strategy = :transaction | |
40) DatabaseCleaner.clean_with(:truncation) | |
48) end | |
50) config.before do | |
51) DatabaseCleaner.start | |
52) end | |
53) config.after do |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment