short 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -0
- data/bin/short +3 -0
- data/lib/shortener/configuration.rb +38 -6
- data/lib/shortener/server/Gemfile +2 -0
- data/lib/shortener/server/Gemfile.lock +5 -0
- data/lib/shortener/server/api/v1.rb +76 -0
- data/lib/shortener/server/auth.rb +117 -0
- data/lib/shortener/server/brief.rb +189 -0
- data/lib/shortener/server/config.ru.template +44 -2
- data/lib/shortener/server/helpers.rb +84 -0
- data/lib/shortener/server/pbkdf2.rb +192 -0
- data/lib/shortener/server/public/css/bootstrap-responsive.min.css +9 -3
- data/lib/shortener/server/public/css/bootstrap.min.css +9 -610
- data/lib/shortener/server/public/css/controls.png +0 -0
- data/lib/shortener/server/public/css/loading.gif +0 -0
- data/lib/shortener/server/public/css/shortener.css +23 -2
- data/lib/shortener/server/public/js/bootstrap.min.js +6 -1
- data/lib/shortener/server/public/js/site.js +2 -2
- data/lib/shortener/server/user.rb +131 -0
- data/lib/shortener/server/views.rb +55 -0
- data/lib/shortener/server/views/add.haml +8 -8
- data/lib/shortener/server/views/display.haml +1 -1
- data/lib/shortener/server/views/index.haml +28 -12
- data/lib/shortener/server/views/layout.haml +38 -12
- data/lib/shortener/server/views/s3/layout.haml +1 -1
- data/lib/shortener/server/views/u/edit.haml +40 -0
- data/lib/shortener/server/views/u/login.haml +13 -0
- data/lib/shortener/server/views/upload.haml +9 -9
- data/lib/shortener/server/warden.rb +29 -0
- data/lib/shortener/short.rb +2 -2
- data/lib/shortener/tasks/heroku.rb +16 -10
- data/lib/shortener/version.rb +1 -1
- metadata +22 -12
- data/lib/shortener/server.rb +0 -350
- data/lib/shortener/server/public/flash/clippy.swf +0 -0
Binary file
|
Binary file
|
@@ -7,10 +7,31 @@ table.table thead .sorting_desc_disabled {
|
|
7
7
|
cursor: pointer;
|
8
8
|
*cursor: hand;
|
9
9
|
}
|
10
|
-
|
10
|
+
|
11
11
|
table.table thead .header { background: url('/images/sort_both.png') no-repeat center right; }
|
12
12
|
table.table thead .headerSortUp { background: url('/images/sort_asc.png') no-repeat center right; }
|
13
13
|
table.table thead .headerSortDown { background: url('/images/sort_desc.png') no-repeat center right; }
|
14
|
-
|
14
|
+
|
15
15
|
table.table thead .sorting_asc_disabled { background: url('/images/sort_asc_disabled.png') no-repeat center right; }
|
16
16
|
table.table thead .sorting_desc_disabled { background: url('/images/sort_desc_disabled.png') no-repeat center right; }
|
17
|
+
|
18
|
+
table.table tbody tr td {min-width: 20px;}
|
19
|
+
|
20
|
+
@media screen and (max-width: 480px) {
|
21
|
+
.shortenWhenSmall {
|
22
|
+
max-width: 150px;
|
23
|
+
overflow: hidden;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
@media screen and (max-width: 768px) {
|
27
|
+
.shortenWhenSmall {
|
28
|
+
max-width: 300px;
|
29
|
+
overflow: hidden;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
@media screen and (max-width: 680px) {
|
33
|
+
.shortenWhenSmall {
|
34
|
+
max-width: 150px;
|
35
|
+
overflow: hidden;
|
36
|
+
}
|
37
|
+
}
|
@@ -1 +1,6 @@
|
|
1
|
-
!function(a){a(function(){"use strict",a.support.transition=function(){var b=document.body||document.documentElement,c=b.style,d=c.transition!==undefined||c.WebkitTransition!==undefined||c.MozTransition!==undefined||c.MsTransition!==undefined||c.OTransition!==undefined;return d&&{end:function(){var b="TransitionEnd";return a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"),b}()}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype={constructor:c,close:function(b){function f(){e.remove(),e.trigger("closed")}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),e.trigger("close"),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()}},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype={constructor:b,setState:function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},toggle:function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")}},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){a(b.target).button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.carousel.defaults,c),this.options.slide&&this.slide(this.options.slide)};b.prototype={cycle:function(){return this.interval=setInterval(a.proxy(this.next,this),this.options.interval),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(){return clearInterval(this.interval),this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;return this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h](),!a.support.transition&&this.$element.hasClass("slide")?(this.$element.trigger("slide"),d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")):(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.trigger("slide"),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})),f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=typeof c=="object"&&c;e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():e.cycle()})},a.fn.carousel.defaults={interval:5e3},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find(".in"),e;d&&d.length&&(e=d.data("collapse"),d.collapse("hide"),e||d.data("collapse",null)),this.$element[b](0),this.transition("addClass","show","shown"),this.$element[b](this.$element[0][c])},hide:function(){var a=this.dimension();this.reset(this.$element[a]()),this.transition("removeClass","hide","hidden"),this.$element[a](0)},reset:function(a){var b=this.dimension();this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element.addClass("collapse")},transition:function(b,c,d){var e=this,f=function(){c=="show"&&e.reset(),e.$element.trigger(d)};this.$element.trigger(c)[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e=c.attr("data-target"),f,g;return e||(e=c.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),f.length||(f=c.parent()),g=f.hasClass("open"),d(),!g&&f.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=a.extend({},a.fn.modal.defaults,c),this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this;if(this.isShown)return;a("body").addClass("modal-open"),this.isShown=!0,this.$element.trigger("show"),g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");!b.$element.parent().length&&b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();if(!this.isShown)return;var e=this;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.trigger("hide").removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=typeof c=="object"&&c;e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.show?c.show():(c.hoverState="in",setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show))},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.hide?c.hide():(c.hoverState="out",setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide))},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip();a.find(".tooltip-inner").html(this.getTitle()),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip=this.$tip||a(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"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,delay:0,selector:!1,placement:"top",trigger:"hover",title:"",template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'}}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var b=this.tip(),c=this.getTitle(),d=this.getContent();b.find(".popover-title")[a.type(c)=="object"?"append":"html"](c),b.find(".popover-content > *")[a.type(d)=="object"?"append":"html"](d),b.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.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(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body").on("click.scroll.data-api",this.selector,d),this.refresh(),this.process()}"use strict",b.prototype={constructor:b,refresh:function(){this.targets=this.$body.find(this.selector).map(function(){var b=a(this).attr("href");return/^#\w/.test(b)&&a(b).length?b:null}),this.offsets=a.map(this.targets,function(b){return a(b).position().top})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.offsets,c=this.targets,d=this.activeTarget,e;for(e=b.length;e--;)d!=c[e]&&a>=b[e]&&(!b[e+1]||a<=b[e+1])&&this.activate(c[e])},activate:function(a){var b;this.activeTarget=a,this.$body.find(this.selector).parent(".active").removeClass("active"),b=this.$body.find(this.selector+'[href="'+a+'"]').parent("li").addClass("active"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],b.trigger({type:"show",relatedTarget:e}),f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g):g(),e.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(a),this.hide()},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){if(c.matcher(a))return a}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){return a.replace(new RegExp("("+this.query+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){a.stopPropagation(),a.preventDefault();switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:this.hide();break;default:this.lookup()}},keypress:function(a){a.stopPropagation();if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault(),this.prev();break;case 40:a.preventDefault(),this.next()}},blur:function(a){var b=this;a.stopPropagation(),a.preventDefault(),setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery);
|
1
|
+
/*!
|
2
|
+
* Bootstrap.js by @fat & @mdo
|
3
|
+
* Copyright 2012 Twitter, Inc.
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0.txt
|
5
|
+
*/
|
6
|
+
!function(a){a(function(){"use strict",a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function f(){e.trigger("closed").remove()}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger(b=a.Event("close"));if(b.isDefaultPrevented())return;e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=c,this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.prototype={cycle:function(b){return b||(this.paused=!1),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(a){return a||(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(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this,j=a.Event("slide");this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h]();if(e.hasClass("active"))return;if(a.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(j);if(j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})}else{this.$element.trigger(j);if(j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=a.extend({},a.fn.carousel.defaults,typeof c=="object"&&c);e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():f.interval&&e.cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(this.transitioning)return;b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in");if(d&&d.length){e=d.data("collapse");if(e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),this.$element[b](this.$element[0][c])},hide:function(){var b;if(this.transitioning)return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c.type=="show"&&e.reset(),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e,f,g;if(c.is(".disabled, :disabled"))return;return f=c.attr("data-target"),f||(f=c.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,"")),e=a(f),e.length||(e=c.parent()),g=e.hasClass("open"),d(),g||e.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;a("body").addClass("modal-open"),this.isShown=!0,g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();var e=this;b=a.Event("hide"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.hide)return c.hide();clearTimeout(this.timeout),c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},isHTML:function(a){return typeof a!="string"||a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.isHTML(b)?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(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"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.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(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.isHTML(b)?"html":"text"](b),a.find(".popover-content > *")[this.isHTML(c)?"html":"text"](c),a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.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(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body"),this.refresh(),this.process()}"use strict",b.prototype={constructor:b,refresh:function(){var b=this,c;this.offsets=a([]),this.targets=a([]),c=this.$body.find(this.selector).map(function(){var b=a(this),c=b.data("target")||b.attr("href"),d=/^#\w/.test(c)&&a(c);return d&&c.length&&[[d.position().top,c]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,c=b-this.$scrollElement.height(),d=this.offsets,e=this.targets,f=this.activeTarget,g;if(a>=c)return f!=(g=e.last()[0])&&this.activate(g);for(g=d.length;g--;)f!=e[g]&&a>=d[g]&&(!d[g+1]||a<=d[g+1])&&this.activate(e[g])},activate:function(b){var c,d;this.activeTarget=b,a(this.selector).parent(".active").removeClass("active"),d=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',c=a(d).parent("li").addClass("active"),c.parent(".dropdown-menu")&&(c=c.closest("li.dropdown").addClass("active")),c.trigger("activate")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f,g;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],g=a.Event("show",{relatedTarget:e}),b.trigger(g);if(g.isDefaultPrevented())return;f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g):g(),e.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),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=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(a)).change(),this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){return c.matcher(a)}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.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()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:if(a.type!="keydown")break;a.preventDefault(),this.prev();break;case 40:if(a.type!="keydown")break;a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery);
|
@@ -13,7 +13,7 @@ $(function(){
|
|
13
13
|
});
|
14
14
|
|
15
15
|
/* Send the data using post and put the results in a div */
|
16
|
-
$.post( this.action
|
16
|
+
$.post( this.action, formData, function( data ) {
|
17
17
|
$( "#display-new-shorts" ).append( data.html );
|
18
18
|
}
|
19
19
|
);
|
@@ -25,7 +25,7 @@ $(function(){
|
|
25
25
|
$('.delete-button').click(function(event){
|
26
26
|
event.preventDefault();
|
27
27
|
var btn = $(this);
|
28
|
-
$.
|
28
|
+
$.post(this.href, function(data){
|
29
29
|
if (data.success === true) {
|
30
30
|
// fadeOut on a tr doesn't work, but on td it does.
|
31
31
|
btn.parent().parent('tr').find('td').fadeOut();
|
@@ -0,0 +1,131 @@
|
|
1
|
+
# much of this code copied directly from
|
2
|
+
# https://github.com/antirez/lamernews/blob/master/app.rb
|
3
|
+
|
4
|
+
require File.join(File.dirname(__FILE__), 'pbkdf2')
|
5
|
+
|
6
|
+
class User
|
7
|
+
|
8
|
+
ATTRS = [:id, :name, :email]
|
9
|
+
|
10
|
+
attr_accessor *ATTRS
|
11
|
+
attr_reader :password, :salt, :username, :token
|
12
|
+
|
13
|
+
def self.authenticate!(username, password)
|
14
|
+
user = get_by_username(username)
|
15
|
+
return false unless user
|
16
|
+
((hash_password(password, user.salt)) == user.password) ? user : false
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.get_by_id(id)
|
20
|
+
attrs = $redis.hgetall("user:#{id}")
|
21
|
+
return nil if attrs.empty?
|
22
|
+
attrs['prehashed_password'] = attrs.delete('password')
|
23
|
+
u = User.new(attrs)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.get_by_username(username)
|
27
|
+
_id = $redis.get("username.to.id:#{username.downcase}")
|
28
|
+
return nil unless _id
|
29
|
+
get_by_id(_id)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.get_by_token(token)
|
33
|
+
_id = $redis.get("auth:#{token}")
|
34
|
+
return nil unless _id
|
35
|
+
get_by_id(_id)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.available?(username)
|
39
|
+
$redis.get("username.to.id:#{username.downcase}").nil?
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize(attrs = {})
|
43
|
+
ATTRS.each do |attr|
|
44
|
+
self.instance_variable_set(:"@#{attr}", attrs[attr.to_s])
|
45
|
+
end
|
46
|
+
@salt = attrs['salt'] || get_rand
|
47
|
+
@token = attrs['token'] || get_rand
|
48
|
+
@username = attrs['username']
|
49
|
+
@password = User.hash_password(attrs['password'], @salt) if attrs['password']
|
50
|
+
@password = attrs['prehashed_password'] if attrs['prehashed_password']
|
51
|
+
end
|
52
|
+
|
53
|
+
def password=(string)
|
54
|
+
@password = User.hash_password(string, @salt)
|
55
|
+
end
|
56
|
+
|
57
|
+
def username=(string)
|
58
|
+
unless string == @username
|
59
|
+
@prev_username = self.username if @prev_username.nil?
|
60
|
+
@username = string
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def token=(string)
|
65
|
+
unless string == @token
|
66
|
+
@prev_token = self.token if @prev_token.nil?
|
67
|
+
@token = string
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def reset_token
|
72
|
+
self.token = get_rand
|
73
|
+
end
|
74
|
+
|
75
|
+
def save
|
76
|
+
self.id = $redis.incr("users.count") unless id
|
77
|
+
$redis.hmset("user:#{id}",
|
78
|
+
"id", id,
|
79
|
+
"name", name,
|
80
|
+
"username", username,
|
81
|
+
"salt", salt,
|
82
|
+
"password", password,
|
83
|
+
"email", email,
|
84
|
+
"token", token)
|
85
|
+
if @prev_username
|
86
|
+
puts "deleting prev_username #{@prev_username}"
|
87
|
+
$redis.del("username.to.id:#{@prev_username.downcase}")
|
88
|
+
@prev_username = nil
|
89
|
+
end
|
90
|
+
if @prev_token
|
91
|
+
$redis.del("auth:#{@prev_token}")
|
92
|
+
@prev_token = nil
|
93
|
+
end
|
94
|
+
$redis.set("username.to.id:#{username.downcase}", id)
|
95
|
+
$redis.set("auth:#{token}", id)
|
96
|
+
return id, nil
|
97
|
+
end
|
98
|
+
|
99
|
+
def delete
|
100
|
+
$redis.del("username.to.id:#{username.downcase}")
|
101
|
+
$redis.del("user:#{id}")
|
102
|
+
$redis.del("auth:#{token}")
|
103
|
+
true
|
104
|
+
end
|
105
|
+
|
106
|
+
def to_json
|
107
|
+
{id: id, username: username, name: name, email: email, token: token}.to_json
|
108
|
+
end
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
# Return the hex representation of an unguessable 160 bit random number.
|
113
|
+
def get_rand
|
114
|
+
rand = "";
|
115
|
+
File.open("/dev/urandom").read(20).each_byte{|x| rand << sprintf("%02x",x)}
|
116
|
+
rand
|
117
|
+
end
|
118
|
+
|
119
|
+
# Turn the password into an hashed one, using PBKDF2 with HMAC-SHA1
|
120
|
+
# and 160 bit output.
|
121
|
+
def self.hash_password(password, salt)
|
122
|
+
p = PBKDF2.new do |p|
|
123
|
+
p.iterations = 1000
|
124
|
+
p.password = password
|
125
|
+
p.salt = salt
|
126
|
+
p.key_length = 160/8
|
127
|
+
end
|
128
|
+
p.hex_string
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'haml'
|
2
|
+
|
3
|
+
class Shortener
|
4
|
+
module Server
|
5
|
+
class Views < Sinatra::Base
|
6
|
+
|
7
|
+
dir = File.expand_path(File.dirname(__FILE__))
|
8
|
+
set :root, dir
|
9
|
+
set :public_folder, File.join(dir, 'public')
|
10
|
+
|
11
|
+
set(:s3_available) {|v| condition {$conf.s3_available == v}}
|
12
|
+
|
13
|
+
helpers ShortServerHelpers
|
14
|
+
|
15
|
+
before do
|
16
|
+
if $conf.auth_route?(env['PATH_INFO']) && !env['warden'].authenticated?
|
17
|
+
session['REDIRECT_TO'] = env['PATH_INFO']
|
18
|
+
return 401, {}, "Not Authorized, specify your auth token." if request.path.include?('.json')
|
19
|
+
redirect('/u/login')
|
20
|
+
end
|
21
|
+
end if $conf.authenticate?
|
22
|
+
|
23
|
+
get('/index') { redirect "/v/index" }
|
24
|
+
|
25
|
+
get '/v/index' do
|
26
|
+
@shortens = Brief.all
|
27
|
+
haml :index
|
28
|
+
end
|
29
|
+
|
30
|
+
get '/v/add' do
|
31
|
+
@boxify = !params['boxify'].nil?
|
32
|
+
haml :add, layout: !@boxify
|
33
|
+
end
|
34
|
+
|
35
|
+
get '/v/upload', s3_available: true do
|
36
|
+
policy = $conf.s3_policy
|
37
|
+
signature = $conf.s3_signature(policy)
|
38
|
+
|
39
|
+
@post = {
|
40
|
+
"key" => "#{$conf.s3_key_prefix}/${filename}",
|
41
|
+
"AWSAccessKeyId" => "#{$conf.s3_access_key_id}",
|
42
|
+
"acl" => "#{$conf.s3_default_acl}",
|
43
|
+
"policy" => "#{policy}",
|
44
|
+
"signature" => "#{signature}",
|
45
|
+
"success_action_status" => "201"
|
46
|
+
}
|
47
|
+
|
48
|
+
@upload_url = "http://#{$conf.s3_bucket}.s3.amazonaws.com/"
|
49
|
+
@boxify = !params['boxify'].nil?
|
50
|
+
haml :upload, layout: !@boxify
|
51
|
+
end
|
52
|
+
|
53
|
+
end # => Views
|
54
|
+
end # => Server
|
55
|
+
end # => Shortener
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#shortener.row(style="margin-top: 40px;margin-bottom:75px;")
|
2
|
-
%form{:id => 'add-form',:name => "shortener", :action => "/add", :method => "post", :class => boxify_class(2, nil, nil, 'form-horizontal')}
|
2
|
+
%form{:id => 'add-form',:name => "shortener", :action => "/api/v1/add", :method => "post", :class => boxify_class(2, nil, nil, 'form-horizontal')}
|
3
3
|
.control-group
|
4
4
|
%label.control-label{:for => "shortener[url]"} Url to Shorten:
|
5
5
|
.controls
|
@@ -11,17 +11,17 @@
|
|
11
11
|
.controls
|
12
12
|
%input{:type => 'text', :name => 'shortener[expire]', :class => 'text advanced'}
|
13
13
|
.control-group.advanced
|
14
|
-
%label{:for => 'shortener[
|
14
|
+
%label{:for => 'shortener[max_clicks]', :class => 'control-label advanced'} Max Clicks:
|
15
15
|
.controls
|
16
|
-
%input{:type => 'text', :name => 'shortener[
|
16
|
+
%input{:type => 'text', :name => 'shortener[max_clicks]', :class => 'text advanced'}
|
17
17
|
.control-group.advanced
|
18
|
-
%label{:for => 'shortener[
|
18
|
+
%label{:for => 'shortener[desired_short]', :class => 'control-label advanced'} Desired Short:
|
19
19
|
.controls
|
20
|
-
%input{:type => 'text', :name => 'shortener[
|
20
|
+
%input{:type => 'text', :name => 'shortener[desired_short]', :class => 'text advanced'}
|
21
21
|
.control-group.advanced
|
22
|
-
%label{:for => 'shortener[
|
22
|
+
%label{:for => 'shortener[allow_override]', :class => 'control-label'} Allow Random Override:
|
23
23
|
.controls
|
24
|
-
%input{:type => 'checkbox', :name => 'shortener[
|
24
|
+
%input{:type => 'checkbox', :name => 'shortener[allow_override]', :class => 'text advanced', :value => 'true'}
|
25
25
|
:javascript
|
26
26
|
$(function(){
|
27
27
|
$('.advanced').addClass('hide');
|
@@ -37,7 +37,7 @@
|
|
37
37
|
});
|
38
38
|
|
39
39
|
/* Send the data using post and put the results in a div */
|
40
|
-
$.post( this.action
|
40
|
+
$.post( this.action , formData, function( data ) {
|
41
41
|
$( "#display-add-new-shorts" ).append( data.html );
|
42
42
|
}
|
43
43
|
);
|
@@ -3,5 +3,5 @@
|
|
3
3
|
%div.span2{class: 'offset1'}
|
4
4
|
%h4= @url
|
5
5
|
%div.span2
|
6
|
-
=
|
6
|
+
%a.btn.btn-mini{rel: 'popover', 'data-content' => "<input type='text' value='#{@url}' data-id='#{@data['shortened']}-d'></input>", 'data-placement' => 'top', 'data-trigger' => 'manual', 'data-toggle' => 'button', 'data-title' => "CMD/CTL + C to Copy", 'data-id'=> "#{@data['shortened']}-d"} Copy
|
7
7
|
%a.close{'data-dismiss' => 'alert', href: '#'}×
|
@@ -5,22 +5,38 @@
|
|
5
5
|
%tr
|
6
6
|
%th Shortened
|
7
7
|
%th Full Url
|
8
|
-
%th Set Count
|
9
|
-
%th Click Count
|
10
|
-
%th TTL
|
11
|
-
%th Max Clicks
|
8
|
+
%th.visible-desktop Set Count
|
9
|
+
%th.hidden-phone Click Count
|
10
|
+
%th.visible-desktop TTL
|
11
|
+
%th.hidden-phone Max Clicks
|
12
12
|
%tbody
|
13
13
|
- @shortens.each do |short|
|
14
14
|
%tr
|
15
15
|
%td= short['shortened']
|
16
|
-
%td
|
16
|
+
%td.shortenWhenSmall
|
17
17
|
%a{href: short['url']}= short['url'][0..50] + ((short['url'].length > 50) ? '...' : '')
|
18
|
-
%td= short['set_count']
|
19
|
-
%td= short['click_count'] || 0
|
20
|
-
%td= ttl_display(short['expire'])
|
21
|
-
%td= short['max-clicks'] || "∞"
|
18
|
+
%td.visible-desktop= short['set_count']
|
19
|
+
%td.hidden-phone= short['click_count'] || 0
|
20
|
+
%td.visible-desktop= ttl_display(short['expire'])
|
21
|
+
%td.hidden-phone= short['max-clicks'] || "∞"
|
22
|
+
%td
|
23
|
+
%a{href: "/api/v1/delete?id=#{short['shortened']}", class: 'delete-button'}
|
24
|
+
%img{src: '/images/delete-icon.png', alt: 'delete!', width: '16px', height: '16px'}
|
22
25
|
%td
|
23
|
-
%a{
|
24
|
-
|
25
|
-
|
26
|
+
%a.btn.btn-mini{rel: 'popover', 'data-content' => "<input type='text' value='#{base_url}/#{short['shortened']}' data-id='#{short['shortened']}'></input>", 'data-placement' => 'top', 'data-trigger' => 'manual', 'data-toggle' => 'button', 'data-title' => "CMD/CTL + C to Copy", 'data-id'=> short['shortened']} Copy
|
27
|
+
-#clippy("#{base_url}/#{short['shortened']}")
|
28
|
+
|
29
|
+
:javascript
|
26
30
|
|
31
|
+
//$('a[rel="popover"]').popover({trigger: 'focus', placement: 'top'});
|
32
|
+
$('a[rel="popover"]').popover();
|
33
|
+
$('a.btn-small').button();
|
34
|
+
$('a[rel="popover"]').live("click", function(){
|
35
|
+
$(this).popover("toggle");
|
36
|
+
$(".popover-content p input:text").select();
|
37
|
+
});
|
38
|
+
$(".popover-content p input:text").live('copy cut', function(){
|
39
|
+
$('a[rel="popover"]').popover('hide');
|
40
|
+
var sel = 'a[data-id="'+$(this).data('id')+'"]';
|
41
|
+
$(sel).button('toggle');
|
42
|
+
});
|
@@ -2,11 +2,12 @@
|
|
2
2
|
%html
|
3
3
|
%head
|
4
4
|
%title Shortener
|
5
|
-
%
|
5
|
+
%meta{name: 'viewport', content: 'width=device-width, initial-scale=1.0'}
|
6
6
|
%link{rel: 'stylesheet', type: 'text/css', href: '/css/bootstrap.min.css'}
|
7
7
|
%link{rel: 'stylesheet', type: 'text/css', href: '/css/bootstrap-responsive.min.css'}
|
8
8
|
%link{rel: 'stylesheet', type: 'text/css', href: '/css/shortener.css'}
|
9
9
|
%link{rel: 'stylesheet', type: 'text/css', href: '/css/colorbox.css'}
|
10
|
+
%script{src: '//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', type: 'text/javascript'}
|
10
11
|
%script{src: '/js/site.js', type: 'text/javascript'}
|
11
12
|
%script{src: '/js/jquery.colorbox.js', type: 'text/javascript'}
|
12
13
|
%script{src: '/js/bootstrap.min.js', type: 'text/javascript'}
|
@@ -16,18 +17,43 @@
|
|
16
17
|
%div.navbar
|
17
18
|
%div.navbar-inner
|
18
19
|
%div.container
|
20
|
+
|
21
|
+
%a.btn.btn-navbar{"data-toggle"=> "collapse", "data-target" => ".nav-collapse"}
|
22
|
+
%span.icon-bar
|
23
|
+
%span.icon-bar
|
24
|
+
%span.icon-bar
|
25
|
+
|
19
26
|
%a{class: 'brand', href: "/"} Shortener
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
|
28
|
+
.nav-collapse
|
29
|
+
%ul.nav
|
30
|
+
- if available?('add')
|
31
|
+
%li
|
32
|
+
%form{:id => 'nav-add-form',:name => "shortener", :action => "/api/v1/add", :method => "post", :class => 'navbar-search pull-left'}
|
33
|
+
%input{:type => "text", :name => "shortener[url]", :class => "search-query span2", placeholder: 'Shorten'}
|
34
|
+
- if available?('index')
|
35
|
+
%li
|
36
|
+
%a{href: '/v/index'} Index
|
37
|
+
- if available?('aadd')
|
38
|
+
%li
|
39
|
+
%a.colorbox{href: '/v/add'} Advanced Add
|
40
|
+
- if $conf.s3_available && available?('upload')
|
41
|
+
%li
|
42
|
+
%a.colorbox{href: '/v/upload'} Upload
|
43
|
+
%ul.nav.pull-right
|
44
|
+
- if $conf.authenticate?
|
45
|
+
- if logged_in?
|
46
|
+
%li.pull-right
|
47
|
+
%a{href: '/api/v1/u/logout', class: 'pull-right'} Log Out
|
48
|
+
%li.pull-right
|
49
|
+
%a{href: '/u/edit', class: 'pull-right'} Edit Me
|
50
|
+
- else
|
51
|
+
%li.pull-right
|
52
|
+
%a{href: '/u/login', class: 'pull-right'} Log In
|
53
|
+
- if $conf.allow_signup
|
54
|
+
%li.pull-right
|
55
|
+
%a{href: '/u/signup', class: 'pull-right'} Sign Up
|
56
|
+
|
31
57
|
|
32
58
|
#main.container(style="margin-top: 40px;")
|
33
59
|
= yield
|
@@ -3,7 +3,7 @@
|
|
3
3
|
%head
|
4
4
|
- (_type = @short['type']) && _type[0] = _type[0].capitalize
|
5
5
|
%title= "#{_type} - #{@short['name']}"
|
6
|
-
%link{rel: 'stylesheet', type: 'text/css', href: '/
|
6
|
+
%link{rel: 'stylesheet', type: 'text/css', href: '/css/bootstrap.min.css'}
|
7
7
|
%script{src: '//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js', type: 'text/javascript'}
|
8
8
|
-#%script{src: 'js/site.js', type: 'text/javascript'}
|
9
9
|
%body{:'padding-top' => '60px'}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
.row
|
2
|
+
%form{action: @action, method: 'post'}
|
3
|
+
%input{type: 'hidden', value: @user.id}
|
4
|
+
.control-group
|
5
|
+
%label.control-label{for: 'user[username]'} Username:
|
6
|
+
.controls
|
7
|
+
%input{type: 'text', name: 'user[username]', class: 'text', value: @user.username}
|
8
|
+
.control-group
|
9
|
+
%label.control-label{for: 'user[email]'} Email
|
10
|
+
.controls
|
11
|
+
%input{type: 'text', name: 'user[email]', class: 'text', value: @user.email}
|
12
|
+
.control-group
|
13
|
+
%label.control-label{for: 'user[name]'} Name
|
14
|
+
.controls
|
15
|
+
%input{type: 'text', name: 'user[name]', class: 'text', value: @user.name}
|
16
|
+
.control-group
|
17
|
+
%label.control-label{for: 'user[password]'} Password:
|
18
|
+
.controls
|
19
|
+
%input{type: 'password', name: 'user[password]', class: 'password'}
|
20
|
+
|
21
|
+
%input{type: 'submit', value: 'Update', class: 'btn primary'}
|
22
|
+
- if @action.include?("update")
|
23
|
+
.row
|
24
|
+
%form{action: '/api/v1/u/reset_token.json', method: 'post', class: 'form-inline'}
|
25
|
+
%fieldset
|
26
|
+
%legend API Access
|
27
|
+
.control-group
|
28
|
+
%label API Token:
|
29
|
+
%label= @user.token
|
30
|
+
.control-group
|
31
|
+
%input{type: 'submit', value: 'RESET', class: 'btn btn-warning', style: "padding: 4px 14px 4px 13px"}
|
32
|
+
%label{style: 'margin-right: 3px;'} Reseting your token will invalidate all the ones stored by your apps.
|
33
|
+
.row
|
34
|
+
%form{action: '/api/v1/u/delete', method: 'post', class: 'form-inline'}
|
35
|
+
%fieldset
|
36
|
+
%legend Danger Zone
|
37
|
+
.control-group
|
38
|
+
%input{type: 'submit', value: 'DELETE', class: 'btn btn-danger'}
|
39
|
+
%label{for: 'user[delete]'} Deleting is Forever™.
|
40
|
+
-#%a{href: '/api/v1/u/delete', class: 'btn btn-warning'} DELETE
|