rails_admin_glyph_theme 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +10 -0
- data/Rakefile +27 -0
- data/lib/rails_admin_glyph_theme.rb +4 -0
- data/lib/rails_admin_glyph_theme/engine.rb +7 -0
- data/lib/rails_admin_glyph_theme/version.rb +3 -0
- data/vendor/assets/javascripts/rails_admin_glyph_theme/lib/bootstrap-fileupload.min.js +7 -0
- data/vendor/assets/javascripts/rails_admin_glyph_theme/lib/bootstrap-select.min.js +1 -0
- data/vendor/assets/javascripts/rails_admin_glyph_theme/lib/custom_checkbox_and_radio.js +42 -0
- data/vendor/assets/javascripts/rails_admin_glyph_theme/lib/custom_radio.js +28 -0
- data/vendor/assets/javascripts/rails_admin_glyph_theme/lib/modernizr-custom.js +12 -0
- data/vendor/assets/javascripts/rails_admin_glyph_theme/lib/spinner.js +198 -0
- data/vendor/assets/javascripts/rails_admin_glyph_theme/src/glyph-theme.coffee +125 -0
- data/vendor/assets/javascripts/rails_admin_glyph_theme/theme.js +3 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_bootstrap-fileupload.css +128 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_bootstrap-select.min.css +1 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_button.css.sass +27 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_dropdown.css.sass +37 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_form.css.sass +137 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_fuelUX.css.sass +95 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_jquery-ui.css.sass +147 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_middle-content.css.sass +164 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_navigation.css.sass +87 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_rich-editor.css.sass +63 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/_scrollbar.css.sass +67 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/images/sprites-arrows-hor.png +0 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/images/sprites-arrows-vert.png +0 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/mixins.css.sass +29 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/theming.css.sass +96 -0
- data/vendor/assets/stylesheets/rails_admin/themes/glyph/variables.css.sass +230 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2c7feb4fbf6f6a462e0fb5ceb9f4b24075e48c53
|
4
|
+
data.tar.gz: 5d67e630630cadfe12477efeb2605651b8f24ccc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 84347ca7ca9e9c0e6f64dd119c4644f8344655ae1b788c25a132f300f364d351f7ba59c7c1c9a24049e757a8d8d193af5cbde86eff55f303904155d5cef08d82
|
7
|
+
data.tar.gz: 31a0286af58fbbd11e899ff84f0c257e512b8f6052754c85042a161a3853a07b6924f4aebec99f1db463b4a0b9c9e54d3d955acfb70ab4f468be6c1f6777c805
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
= Rails_admin Theme by Glyph
|
2
|
+
|
3
|
+
Then add to your application Gemfile (before RailsAdmin):
|
4
|
+
|
5
|
+
gem 'rails_admin_glyph_theme', git: 'git://github.com/vala/rails_admin_glyph_theme.git'
|
6
|
+
|
7
|
+
|
8
|
+
Inside your rails_admin application config/application.rb, just after Bundler.require:
|
9
|
+
|
10
|
+
ENV['RAILS_ADMIN_THEME'] = 'glyph'
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'RailsAdminGlyphTheme'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/**
|
2
|
+
* Bootstrap.js by @mdo and @fat, extended by @ArnoldDaniels.
|
3
|
+
* plugins: bootstrap-fileupload.js
|
4
|
+
* Copyright 2012 Twitter, Inc.
|
5
|
+
* http://www.apache.org/licenses/LICENSE-2.0.txt
|
6
|
+
*/
|
7
|
+
!function(e){var t=function(t,n){this.$element=e(t),this.type=this.$element.data("uploadtype")||(this.$element.find(".thumbnail").length>0?"image":"file"),this.$input=this.$element.find(":file");if(this.$input.length===0)return;this.name=this.$input.attr("name")||n.name,this.$hidden=this.$element.find('input[type=hidden][name="'+this.name+'"]'),this.$hidden.length===0&&(this.$hidden=e('<input type="hidden" />'),this.$element.prepend(this.$hidden)),this.$preview=this.$element.find(".fileupload-preview");var r=this.$preview.css("height");this.$preview.css("display")!="inline"&&r!="0px"&&r!="none"&&this.$preview.css("line-height",r),this.original={exists:this.$element.hasClass("fileupload-exists"),preview:this.$preview.html(),hiddenVal:this.$hidden.val()},this.$remove=this.$element.find('[data-dismiss="fileupload"]'),this.$element.find('[data-trigger="fileupload"]').on("click.fileupload",e.proxy(this.trigger,this)),this.listen()};t.prototype={listen:function(){this.$input.on("change.fileupload",e.proxy(this.change,this)),e(this.$input[0].form).on("reset.fileupload",e.proxy(this.reset,this)),this.$remove&&this.$remove.on("click.fileupload",e.proxy(this.clear,this))},change:function(e,t){if(t==="clear")return;var n=e.target.files!==undefined?e.target.files[0]:e.target.value?{name:e.target.value.replace(/^.+\\/,"")}:null;if(!n){this.clear();return}this.$hidden.val(""),this.$hidden.attr("name",""),this.$input.attr("name",this.name);if(this.type==="image"&&this.$preview.length>0&&(typeof n.type!="undefined"?n.type.match("image.*"):n.name.match(/\.(gif|png|jpe?g)$/i))&&typeof FileReader!="undefined"){var r=new FileReader,i=this.$preview,s=this.$element;r.onload=function(e){i.html('<img src="'+e.target.result+'" '+(i.css("max-height")!="none"?'style="max-height: '+i.css("max-height")+';"':"")+" />"),s.addClass("fileupload-exists").removeClass("fileupload-new")},r.readAsDataURL(n)}else this.$preview.text(n.name),this.$element.addClass("fileupload-exists").removeClass("fileupload-new")},clear:function(e){this.$hidden.val(""),this.$hidden.attr("name",this.name),this.$input.attr("name","");if(navigator.userAgent.match(/msie/i)){var t=this.$input.clone(!0);this.$input.after(t),this.$input.remove(),this.$input=t}else this.$input.val("");this.$preview.html(""),this.$element.addClass("fileupload-new").removeClass("fileupload-exists"),e&&(this.$input.trigger("change",["clear"]),e.preventDefault())},reset:function(e){this.clear(),this.$hidden.val(this.original.hiddenVal),this.$preview.html(this.original.preview),this.original.exists?this.$element.addClass("fileupload-exists").removeClass("fileupload-new"):this.$element.addClass("fileupload-new").removeClass("fileupload-exists")},trigger:function(e){this.$input.trigger("click"),e.preventDefault()}},e.fn.fileupload=function(n){return this.each(function(){var r=e(this),i=r.data("fileupload");i||r.data("fileupload",i=new t(this,n)),typeof n=="string"&&i[n]()})},e.fn.fileupload.Constructor=t,e(document).on("click.fileupload.data-api",'[data-provides="fileupload"]',function(t){var n=e(this);if(n.data("fileupload"))return;n.fileupload(n.data());var r=e(t.target).closest('[data-dismiss="fileupload"],[data-trigger="fileupload"]');r.length>0&&(r.trigger("click.fileupload"),t.preventDefault())})}(window.jQuery)
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(b){var a=function(d,c,f){if(f){f.stopPropagation();f.preventDefault()}this.$element=b(d);this.$newElement=null;this.button=null;this.options=b.extend({},b.fn.selectpicker.defaults,this.$element.data(),typeof c=="object"&&c);if(this.options.title==null){this.options.title=this.$element.attr("title")}this.val=a.prototype.val;this.render=a.prototype.render;this.init()};a.prototype={constructor:a,init:function(o){this.$element.hide();this.multiple=this.$element.prop("multiple");var f=this.$element.attr("class")!==undefined?this.$element.attr("class").split(/\s+/):"";var d=this.$element.attr("id");this.$element.after(this.createView());this.$newElement=this.$element.next(".bootstrap-select");var s=this.$newElement;var g=this.$newElement.find(".dropdown-menu");var n=g.find("li > a");var r=parseInt(n.css("line-height"))+n.outerHeight();var k=g.find("li .divider").outerHeight(true);var j=this.$newElement.offset().top;var u=0;var h=0;var m=this.$newElement.outerHeight();this.button=this.$newElement.find("> button");if(d!==undefined){this.button.attr("id",d);b('label[for="'+d+'"]').click(function(){s.find("button#"+d).focus()})}for(var l=0;l<f.length;l++){if(f[l]!="selectpicker"){this.$newElement.addClass(f[l])}}if(this.multiple){this.$newElement.addClass("show-tick")}this.button.addClass(this.options.style);this.checkDisabled();this.checkTabIndex();this.clickListener();var c=parseInt(g.css("padding-top"))+parseInt(g.css("padding-bottom"))+parseInt(g.css("border-top-width"))+parseInt(g.css("border-bottom-width"));if(this.options.size=="auto"){function t(){var e=j-b(window).scrollTop();var w=window.innerHeight;var i=c+parseInt(g.css("margin-top"))+parseInt(g.css("margin-bottom"))+2;var v=w-e-m-i;h=v;if(s.hasClass("dropup")){h=e-i}g.css({"max-height":h+"px","overflow-y":"auto","min-height":r*3+"px"})}t();b(window).resize(t);b(window).scroll(t);this.$element.bind("DOMNodeInserted",t)}else{if(this.options.size&&this.options.size!="auto"&&g.find("li").length>this.options.size){var q=g.find("li > *").filter(":not(.div-contain)").slice(0,this.options.size).last().parent().index();var p=g.find("li").slice(0,q+1).find(".div-contain").length;h=r*this.options.size+p*k+c;g.css({"max-height":h+"px","overflow-y":"scroll"})}}this.$element.bind("DOMNodeInserted",b.proxy(this.reloadLi,this));this.render()},createDropdown:function(){var c="<div class='btn-group bootstrap-select'><button class='btn dropdown-toggle clearfix' data-toggle='dropdown'><span class='filter-option pull-left'></span> <span class='caret'></span></button><ul class='dropdown-menu' role='menu'></ul></div>";return b(c)},createView:function(){var c=this.createDropdown();var d=this.createLi();c.find("ul").append(d);return c},reloadLi:function(){this.destroyLi();$li=this.createLi();this.$newElement.find("ul").append($li);this.render()},destroyLi:function(){this.$newElement.find("li").remove()},createLi:function(){var h=this;var e=[];var g=[];var c="";this.$element.find("option").each(function(){e.push(b(this).text())});this.$element.find("option").each(function(k){var n=b(this).attr("class")!==undefined?b(this).attr("class"):"";var m=b(this).text();var l=b(this).data("subtext")!==undefined?'<small class="muted">'+b(this).data("subtext")+"</small>":"";m+=l;if(b(this).parent().is("optgroup")&&b(this).data("divider")!=true){if(b(this).index()==0){var j=b(this).parent().attr("label");var i=b(this).parent().data("subtext")!==undefined?'<small class="muted">'+b(this).parent().data("subtext")+"</small>":"";j+=i;if(b(this)[0].index!=0){g.push('<div class="div-contain"><div class="divider"></div></div><dt>'+j+"</dt>"+h.createA(m,"opt "+n))}else{g.push("<dt>"+j+"</dt>"+h.createA(m,"opt "+n))}}else{g.push(h.createA(m,"opt "+n))}}else{if(b(this).data("divider")==true){g.push('<div class="div-contain"><div class="divider"></div></div>')}else{g.push(h.createA(m,n))}}});if(e.length>0){for(var d=0;d<e.length;d++){var f=this.$element.find("option").eq(d);c+="<li rel="+d+">"+g[d]+"</li>"}}if(this.$element.find("option:selected").length==0&&!h.options.title){this.$element.find("option").eq(0).prop("selected",true).attr("selected","selected")}return b(c)},createA:function(d,c){return'<a tabindex="-1" href="#" class="'+c+'"><span class="pull-left">'+d+'</span><i class="icon-ok pull-right check-mark"></i></a>'},render:function(){var f=this;this.$element.find("option").each(function(g){f.setDisabled(g,b(this).is(":disabled")||b(this).parent().is(":disabled"));f.setSelected(g,b(this).is(":selected"))});var e=this.$element.find("option:selected").map(function(g,h){if(b(this).attr("title")!=undefined){return b(this).attr("title")}else{return b(this).text()}}).toArray();var d=e.join(", ");if(f.multiple&&f.options.selectedTextFormat.indexOf("count")>-1){var c=f.options.selectedTextFormat.split(">");if((c.length>1&&e.length>c[1])||(c.length==1&&e.length>=2)){d=e.length+" of "+this.$element.find("option").length+" selected"}}if(!d){d=f.options.title!=undefined?f.options.title:f.options.noneSelectedText}this.$element.next(".bootstrap-select").find(".filter-option").html(d)},setSelected:function(c,d){if(d){this.$newElement.find("li").eq(c).addClass("selected")}else{this.$newElement.find("li").eq(c).removeClass("selected")}},setDisabled:function(c,d){if(d){this.$newElement.find("li").eq(c).addClass("disabled")}else{this.$newElement.find("li").eq(c).removeClass("disabled")}},checkDisabled:function(){if(this.$element.is(":disabled")){this.button.addClass("disabled");this.button.click(function(c){c.preventDefault()})}},checkTabIndex:function(){if(this.$element.is("[tabindex]")){var c=this.$element.attr("tabindex");this.button.attr("tabindex",c)}},clickListener:function(){var c=this;b("body").on("touchstart.dropdown",".dropdown-menu",function(d){d.stopPropagation()});this.$newElement.on("click","li a",function(i){var g=b(this).parent().index(),h=b(this).parent(),d=h.parents(".bootstrap-select");if(c.multiple){i.stopPropagation()}i.preventDefault();if(d.prev("select").not(":disabled")&&!b(this).parent().hasClass("disabled")){if(!c.multiple){d.prev("select").find("option").removeAttr("selected");d.prev("select").find("option").eq(g).prop("selected",true).attr("selected","selected")}else{var f=d.prev("select").find("option").eq(g).prop("selected");if(f){d.prev("select").find("option").eq(g).removeAttr("selected")}else{d.prev("select").find("option").eq(g).prop("selected",true).attr("selected","selected")}}d.find(".filter-option").html(h.text());d.find("button").focus();d.prev("select").trigger("change")}});this.$newElement.on("click","li.disabled a, li dt, li .div-contain",function(d){d.preventDefault();d.stopPropagation();$select=b(this).parent().parents(".bootstrap-select");$select.find("button").focus()});this.$element.on("change",function(d){c.render()})},val:function(c){if(c!=undefined){this.$element.val(c);this.$element.trigger("change");return this.$element}else{return this.$element.val()}}};b.fn.selectpicker=function(e,f){var c=arguments;var g;var d=this.each(function(){var l=b(this),k=l.data("selectpicker"),h=typeof e=="object"&&e;if(!k){l.data("selectpicker",(k=new a(this,h,f)))}else{for(var j in e){k[j]=e[j]}}if(typeof e=="string"){property=e;if(k[property] instanceof Function){[].shift.apply(c);g=k[property].apply(k,c)}else{g=k[property]}}});if(g!=undefined){return g}else{return d}};b.fn.selectpicker.defaults={style:null,size:"auto",title:null,selectedTextFormat:"values",noneSelectedText:"Nothing selected"}}(window.jQuery);
|
@@ -0,0 +1,42 @@
|
|
1
|
+
// Custom checkbox and radios
|
2
|
+
function setupLabel() {
|
3
|
+
// Checkbox
|
4
|
+
var checkBox = ".checkbox";
|
5
|
+
var checkBoxInput = checkBox + " input[type='checkbox']";
|
6
|
+
var checkBoxChecked = "checked";
|
7
|
+
var checkBoxDisabled = "disabled";
|
8
|
+
|
9
|
+
// Radio
|
10
|
+
var radio = ".radio";
|
11
|
+
var radioInput = radio + " input[type='radio']";
|
12
|
+
var radioOn = "checked";
|
13
|
+
var radioDisabled = "disabled";
|
14
|
+
|
15
|
+
// Checkboxes
|
16
|
+
if ($(checkBoxInput).length) {
|
17
|
+
$(checkBox).each(function(){
|
18
|
+
$(this).removeClass(checkBoxChecked);
|
19
|
+
});
|
20
|
+
$(checkBoxInput + ":checked").each(function(){
|
21
|
+
$(this).parent(checkBox).addClass(checkBoxChecked);
|
22
|
+
});
|
23
|
+
$(checkBoxInput + ":disabled").each(function(){
|
24
|
+
$(this).parent(checkBox).addClass(checkBoxDisabled);
|
25
|
+
});
|
26
|
+
};
|
27
|
+
|
28
|
+
// Radios
|
29
|
+
if ($(radioInput).length) {
|
30
|
+
$(radio).each(function(){
|
31
|
+
$(this).removeClass(radioOn);
|
32
|
+
});
|
33
|
+
$(radioInput + ":checked").each(function(){
|
34
|
+
$(this).parent(radio).addClass(radioOn);
|
35
|
+
});
|
36
|
+
$(radioInput + ":disabled").each(function(){
|
37
|
+
$(this).parent(radio).addClass(radioDisabled);
|
38
|
+
});
|
39
|
+
};
|
40
|
+
};
|
41
|
+
|
42
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
var toggleHandler = function(toggle) {
|
2
|
+
var toggle = toggle;
|
3
|
+
var radio = $(toggle).find("input");
|
4
|
+
|
5
|
+
var checkToggleState = function() {
|
6
|
+
if (radio.eq(0).is(":checked")) {
|
7
|
+
$(toggle).removeClass("toggle-off");
|
8
|
+
} else {
|
9
|
+
$(toggle).addClass("toggle-off");
|
10
|
+
}
|
11
|
+
};
|
12
|
+
|
13
|
+
checkToggleState();
|
14
|
+
|
15
|
+
radio.eq(0).click(function() {
|
16
|
+
$(toggle).toggleClass("toggle-off");
|
17
|
+
});
|
18
|
+
|
19
|
+
radio.eq(1).click(function() {
|
20
|
+
$(toggle).toggleClass("toggle-off");
|
21
|
+
});
|
22
|
+
};
|
23
|
+
|
24
|
+
$(document).ready(function() {
|
25
|
+
$(".toggle").each(function(index, toggle) {
|
26
|
+
toggleHandler(toggle);
|
27
|
+
});
|
28
|
+
});
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
|
2
|
+
* Build: http://modernizr.com/download/#-cssclasses-addtest-teststyles
|
3
|
+
*/
|
4
|
+
;window.Modernizr=function(a,b,c){function v(a){j.cssText=a}function w(a,b){return v(prefixes.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m={},n={},o={},p=[],q=p.slice,r,s=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},t={}.hasOwnProperty,u;!x(t,"undefined")&&!x(t.call,"undefined")?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=q.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(q.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(q.call(arguments)))};return e});for(var A in m)u(m,A)&&(r=A.toLowerCase(),e[r]=m[A](),p.push((e[r]?"":"no-")+r));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)u(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},v(""),i=k=null,e._version=d,e.testStyles=s,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+p.join(" "):""),e}(this,this.document);
|
5
|
+
|
6
|
+
// Detects if the browser is wrongly adding padding to min-height
|
7
|
+
// by Volker Rose | @riddla
|
8
|
+
// http://volker-rose.de/blog/box-sizing-and-min-height-css-trouble-within-firefox/
|
9
|
+
// http://jsfiddle.net/riddla/4bP73/
|
10
|
+
Modernizr.testStyles('#modernizr { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 100px; padding-top: 10px; position: absolute; top: -2000em; }', function(elem, rule){
|
11
|
+
Modernizr.addTest('padding-added-to-minheight', elem.scrollHeight === 110);
|
12
|
+
});
|
@@ -0,0 +1,198 @@
|
|
1
|
+
/*
|
2
|
+
* Fuel UX Spinner
|
3
|
+
* https://github.com/ExactTarget/fuelux
|
4
|
+
*
|
5
|
+
* Copyright (c) 2012 ExactTarget
|
6
|
+
* Licensed under the MIT license.
|
7
|
+
*/
|
8
|
+
|
9
|
+
!function ($) {
|
10
|
+
|
11
|
+
// SPINNER CONSTRUCTOR AND PROTOTYPE
|
12
|
+
|
13
|
+
var Spinner = function (element, options) {
|
14
|
+
this.$element = $(element);
|
15
|
+
this.options = $.extend({}, $.fn.spinner.defaults, options);
|
16
|
+
this.$input = this.$element.find('.spinner-input');
|
17
|
+
this.$element.on('keyup', this.$input, $.proxy(this.change, this));
|
18
|
+
|
19
|
+
if (this.options.hold) {
|
20
|
+
this.$element.on('mousedown', '.spinner-up', $.proxy(function() { this.startSpin(true); } , this));
|
21
|
+
this.$element.on('mouseup', '.spinner-up, .spinner-down', $.proxy(this.stopSpin, this));
|
22
|
+
this.$element.on('mouseout', '.spinner-up, .spinner-down', $.proxy(this.stopSpin, this));
|
23
|
+
this.$element.on('mousedown', '.spinner-down', $.proxy(function() {this.startSpin(false);} , this));
|
24
|
+
} else {
|
25
|
+
this.$element.on('click', '.spinner-up', $.proxy(function() { this.step(true); } , this));
|
26
|
+
this.$element.on('click', '.spinner-down', $.proxy(function() { this.step(false); }, this));
|
27
|
+
}
|
28
|
+
|
29
|
+
this.switches = {
|
30
|
+
count: 1,
|
31
|
+
enabled: true
|
32
|
+
};
|
33
|
+
|
34
|
+
if (this.options.speed === 'medium') {
|
35
|
+
this.switches.speed = 300;
|
36
|
+
} else if (this.options.speed === 'fast') {
|
37
|
+
this.switches.speed = 100;
|
38
|
+
} else {
|
39
|
+
this.switches.speed = 500;
|
40
|
+
}
|
41
|
+
|
42
|
+
this.lastValue = null;
|
43
|
+
|
44
|
+
this.render();
|
45
|
+
|
46
|
+
if (this.options.disabled) {
|
47
|
+
this.disable();
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
Spinner.prototype = {
|
52
|
+
constructor: Spinner,
|
53
|
+
|
54
|
+
render: function () {
|
55
|
+
this.$input.val(this.options.value);
|
56
|
+
this.$input.attr('maxlength',(this.options.max + '').split('').length);
|
57
|
+
},
|
58
|
+
|
59
|
+
change: function () {
|
60
|
+
var newVal = this.$input.val();
|
61
|
+
|
62
|
+
if(newVal/1){
|
63
|
+
this.options.value = newVal/1;
|
64
|
+
}else{
|
65
|
+
newVal = newVal.replace(/[^0-9]/g,'');
|
66
|
+
this.$input.val(newVal);
|
67
|
+
this.options.value = newVal/1;
|
68
|
+
}
|
69
|
+
|
70
|
+
this.triggerChangedEvent();
|
71
|
+
},
|
72
|
+
|
73
|
+
stopSpin: function () {
|
74
|
+
clearTimeout(this.switches.timeout);
|
75
|
+
this.switches.count = 1;
|
76
|
+
this.triggerChangedEvent();
|
77
|
+
},
|
78
|
+
|
79
|
+
triggerChangedEvent: function () {
|
80
|
+
var currentValue = this.value();
|
81
|
+
if (currentValue === this.lastValue) return;
|
82
|
+
|
83
|
+
this.lastValue = currentValue;
|
84
|
+
|
85
|
+
// Primary changed event
|
86
|
+
this.$element.trigger('changed', currentValue);
|
87
|
+
|
88
|
+
// Undocumented, kept for backward compatibility
|
89
|
+
this.$element.trigger('change');
|
90
|
+
},
|
91
|
+
|
92
|
+
startSpin: function (type) {
|
93
|
+
|
94
|
+
if (!this.options.disabled) {
|
95
|
+
var divisor = this.switches.count;
|
96
|
+
|
97
|
+
if (divisor === 1) {
|
98
|
+
this.step(type);
|
99
|
+
divisor = 1;
|
100
|
+
} else if (divisor < 3){
|
101
|
+
divisor = 1.5;
|
102
|
+
} else if (divisor < 8){
|
103
|
+
divisor = 2.5;
|
104
|
+
} else {
|
105
|
+
divisor = 4;
|
106
|
+
}
|
107
|
+
|
108
|
+
this.switches.timeout = setTimeout($.proxy(function() {this.iterator(type);} ,this),this.switches.speed/divisor);
|
109
|
+
this.switches.count++;
|
110
|
+
}
|
111
|
+
},
|
112
|
+
|
113
|
+
iterator: function (type) {
|
114
|
+
this.step(type);
|
115
|
+
this.startSpin(type);
|
116
|
+
},
|
117
|
+
|
118
|
+
step: function (dir) {
|
119
|
+
var curValue = this.options.value;
|
120
|
+
var limValue = dir ? this.options.max : this.options.min;
|
121
|
+
|
122
|
+
if ((dir ? curValue < limValue : curValue > limValue)) {
|
123
|
+
var newVal = curValue + (dir ? 1 : -1) * this.options.step;
|
124
|
+
|
125
|
+
if (dir ? newVal > limValue : newVal < limValue) {
|
126
|
+
this.value(limValue);
|
127
|
+
} else {
|
128
|
+
this.value(newVal);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
},
|
132
|
+
|
133
|
+
value: function (value) {
|
134
|
+
if (!isNaN(parseFloat(value)) && isFinite(value)) {
|
135
|
+
value = parseFloat(value);
|
136
|
+
this.options.value = value;
|
137
|
+
this.$input.val(value);
|
138
|
+
return this;
|
139
|
+
} else {
|
140
|
+
return this.options.value;
|
141
|
+
}
|
142
|
+
},
|
143
|
+
|
144
|
+
disable: function () {
|
145
|
+
this.options.disabled = true;
|
146
|
+
this.$input.attr('disabled','');
|
147
|
+
this.$element.find('button').addClass('disabled');
|
148
|
+
},
|
149
|
+
|
150
|
+
enable: function () {
|
151
|
+
this.options.disabled = false;
|
152
|
+
this.$input.removeAttr("disabled");
|
153
|
+
this.$element.find('button').removeClass('disabled');
|
154
|
+
}
|
155
|
+
};
|
156
|
+
|
157
|
+
|
158
|
+
// SPINNER PLUGIN DEFINITION
|
159
|
+
|
160
|
+
$.fn.spinner = function (option,value) {
|
161
|
+
var methodReturn;
|
162
|
+
|
163
|
+
var $set = this.each(function () {
|
164
|
+
var $this = $(this);
|
165
|
+
var data = $this.data('spinner');
|
166
|
+
var options = typeof option === 'object' && option;
|
167
|
+
|
168
|
+
if (!data) $this.data('spinner', (data = new Spinner(this, options)));
|
169
|
+
if (typeof option === 'string') methodReturn = data[option](value);
|
170
|
+
});
|
171
|
+
|
172
|
+
return (methodReturn === undefined) ? $set : methodReturn;
|
173
|
+
};
|
174
|
+
|
175
|
+
$.fn.spinner.defaults = {
|
176
|
+
value: 1,
|
177
|
+
min: 1,
|
178
|
+
max: 999,
|
179
|
+
step: 1,
|
180
|
+
hold: true,
|
181
|
+
speed: 'medium',
|
182
|
+
disabled: false
|
183
|
+
};
|
184
|
+
|
185
|
+
$.fn.spinner.Constructor = Spinner;
|
186
|
+
|
187
|
+
|
188
|
+
// SPINNER DATA-API
|
189
|
+
|
190
|
+
$(function () {
|
191
|
+
$('body').on('mousedown.spinner.data-api', '.spinner', function (e) {
|
192
|
+
var $this = $(this);
|
193
|
+
if ($this.data('spinner')) return;
|
194
|
+
$this.spinner($this.data());
|
195
|
+
});
|
196
|
+
});
|
197
|
+
|
198
|
+
}(window.jQuery);
|
@@ -0,0 +1,125 @@
|
|
1
|
+
class FileUploadBuilder
|
2
|
+
template:
|
3
|
+
"""
|
4
|
+
<div class=\"fileupload fileupload-new\" data-provides=\"fileupload\">
|
5
|
+
<div class=\"input-append\">
|
6
|
+
<div class=\"uneditable-input span3\">
|
7
|
+
<i class=\"icon-file fileupload-exists\"></i>
|
8
|
+
<span class=\"fileupload-preview\"></span>
|
9
|
+
</div>
|
10
|
+
<span class=\"btn btn-file\">
|
11
|
+
<span class=\"fileupload-new\">Sélectionnez</span>
|
12
|
+
<span class=\"fileupload-exists\">Changer</span>
|
13
|
+
</span>
|
14
|
+
<a class=\"btn fileupload-exists\" data-dismiss=\"fileupload\" href=\"#\">Supprimer</a>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
"""
|
18
|
+
|
19
|
+
constructor: (@$el) ->
|
20
|
+
$uploadedFile = @$el.parent().find('a, img').addClass('uploaded-file').remove()
|
21
|
+
|
22
|
+
unless @$el.data("file-upload")
|
23
|
+
$container = @$el.parent().html(@template)
|
24
|
+
# Append input to file buttons
|
25
|
+
$container.find(".btn-file").append(@$el)
|
26
|
+
# Add preview link if existing
|
27
|
+
$container.prepend($uploadedFile) if $uploadedFile.length
|
28
|
+
# Store object in "file-upload" data key on dom element
|
29
|
+
@$el.data("file-upload", this)
|
30
|
+
|
31
|
+
|
32
|
+
class CheckboxBuilder
|
33
|
+
constructor: (@$el) ->
|
34
|
+
unless @$el.data("checkbox")
|
35
|
+
@$el.wrap('<label class="checkbox"/>')
|
36
|
+
@$el.closest('.checkbox').prepend("<span class='icon'></span><span class='icon-to-fade'></span>")
|
37
|
+
@$el.closest(".checkbox").on 'click', ->
|
38
|
+
setupLabel()
|
39
|
+
setupLabel()
|
40
|
+
# Store object in "checkbox" data key on dom element
|
41
|
+
@$el.data("checkbox", this)
|
42
|
+
|
43
|
+
|
44
|
+
class SpinnerBuilder
|
45
|
+
template:
|
46
|
+
"""
|
47
|
+
<div class='spinner-buttons btn-group btn-group-vertical'>
|
48
|
+
<button class='btn spinner-up' type='button'>
|
49
|
+
<i class='icon-chevron-up'></i>
|
50
|
+
</button>
|
51
|
+
<button class='btn spinner-down' type='button'>
|
52
|
+
<i class='icon-chevron-down'></i>
|
53
|
+
</button>
|
54
|
+
</div>
|
55
|
+
"""
|
56
|
+
|
57
|
+
# input custom constructor
|
58
|
+
constructor: (@$el) ->
|
59
|
+
unless @$el.data("spinner")
|
60
|
+
@$el.addClass "spinner-input"
|
61
|
+
$spinner_wrapper = @$el.wrap("<div class='spinner'/>")
|
62
|
+
$(@template).insertAfter @$el
|
63
|
+
# @$el.closest(".spinner").spinner('value')
|
64
|
+
# Store object in "spinner" data key on dom element
|
65
|
+
@$el.data("spinner", this)
|
66
|
+
|
67
|
+
|
68
|
+
class SelectBuilder
|
69
|
+
# input custom constructor
|
70
|
+
constructor: (@$el) ->
|
71
|
+
$jquerySelect = @$el.closest('.controls').find('.filtering-select')
|
72
|
+
if $jquerySelect.length
|
73
|
+
else
|
74
|
+
unless @$el.data("select")
|
75
|
+
$jqueryMultiSelect = @$el.closest('.controls').find('.ra-multiselect').remove()
|
76
|
+
@$el.closest('select').selectpicker(
|
77
|
+
title: '-- Selectionnez --'
|
78
|
+
)
|
79
|
+
# Store object in "spinner" data key on dom element
|
80
|
+
@$el.data("select", this)
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
class FormInputs
|
85
|
+
fieldTypes:
|
86
|
+
'input[type="file"]': FileUploadBuilder
|
87
|
+
'input[type="number"]': SpinnerBuilder
|
88
|
+
'input[type="checkbox"]:visible': CheckboxBuilder
|
89
|
+
'select': SelectBuilder
|
90
|
+
|
91
|
+
constructor: (@selector, options = {}) ->
|
92
|
+
# # Constructor when page is loaded by pjax
|
93
|
+
$(document).on "ready pjax:end nested:fieldAdded", =>
|
94
|
+
@$el = $(@selector)
|
95
|
+
@processFields()
|
96
|
+
|
97
|
+
processFields: ->
|
98
|
+
$.each @fieldTypes, (selector, klass) =>
|
99
|
+
@$el.find(selector).each ->
|
100
|
+
new klass($(this))
|
101
|
+
|
102
|
+
$ ->
|
103
|
+
# Hack for Ipad
|
104
|
+
$("body").on "touchstart.dropdown", ".dropdown-menu", (e) ->
|
105
|
+
e.stopPropagation()
|
106
|
+
|
107
|
+
# Add class
|
108
|
+
$("body.rails_admin").addClass 'glyph-theme-js'
|
109
|
+
|
110
|
+
# Form Inputs constructor
|
111
|
+
new FormInputs("form")
|
112
|
+
|
113
|
+
# Toggle checkbox list & export
|
114
|
+
$(document).on "click", "#list input.toggle", ->
|
115
|
+
$("#list [name='bulk_ids[]']").prop("checked", $(this).is(":checked")).closest('.checkbox').toggleClass('checked')
|
116
|
+
|
117
|
+
$(document).on "click", "#fields_to_export label input#check_all", ->
|
118
|
+
elems = $("#fields_to_export label input")
|
119
|
+
$checbox_checked = $("#fields_to_export label input#check_all").is(":checked")
|
120
|
+
if $checbox_checked
|
121
|
+
$(elems).closest('.checkbox').addClass 'checked'
|
122
|
+
$(elems).prop "checked", true
|
123
|
+
else
|
124
|
+
$(elems).closest('.checkbox').removeClass 'checked'
|
125
|
+
$(elems).prop "checked", false
|