planit-rails 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/planit/rails/version.rb +1 -1
- data/vendor/assets/javascripts/planit.js +1 -1
- data/vendor/assets/stylesheets/planit.css +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85d62ca544c161bac5763f1bf6b429edc30ac5cb
|
4
|
+
data.tar.gz: 08e092d1b46bda133a9e81a699abd995c34803a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e84c0a1e0213525d20d6d177e21755ad9f238fe744bf1f31a7c4d7980cf8fe0cf4dac02a7e7b616774dcc0d394df7dddb1da6e9ad0aa5cc96ced073987871065
|
7
|
+
data.tar.gz: f848c4ed57d23d6b2acc682b16f95a6eadacd417490a927044030de32ca41496724755af5957562e7c463d9bdc3d59bf960314567867e6f18ea0d652e0286e84
|
data/lib/planit/rails/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var Planit,__bind=function(t,
|
1
|
+
var Planit,__bind=function(t,r){return function(){return t.apply(r,arguments)}};Planit=function(){function t(){this.dragEnd=__bind(this.dragEnd,this),this.getAllMarkers=__bind(this.getAllMarkers,this),this.getMarker=__bind(this.getMarker,this),this.addMarker=__bind(this.addMarker,this)}return t.containerClass="planit-container",t.markerContainerClass="planit-markers-container",t.markerClass="planit-marker",t.markerContentClass="planit-marker-content",t.prototype["new"]=function(r){return this.options=null!=r?r:{},this.options.container=$(this.options.container?"#"+this.options.container:"#planit"),this.options.container.addClass("planit-container"),this.options.container.append('<div class="'+t.markerContainerClass+'"></div>'),this.container=this.options.container,this.markersContainer=this.container.find("."+t.markerContainerClass).first(),this.options.backgroundImage&&(this.container.append('<img src="'+this.options.backgroundImage+'">'),this.markersContainer.css({backgroundImage:"url('"+this.options.backgroundImage+"')"}),$(window).load(function(t){return function(){return t.container.css({height:t.container.find("img").first().height()}),t.container.find("img").first().remove()}}(this))),this.options.markers&&$(window).load(function(t){return function(){var r,i,n,a,o;for(a=t.options.markers,o=[],i=0,n=a.length;n>i;i++)r=a[i],o.push(t.addMarker(r));return o}}(this)),new t.Plan.Events({container:this.container,planit:this}),this},t.prototype.addMarker=function(r){return r.container=this.container,new t.Marker.Creator(r)},t.prototype.getMarker=function(r){return new t.Marker(this.container,r)},t.prototype.getAllMarkers=function(){var r;return r=new t.Plan(this.container),r.getAllMarkers()},t.prototype.dragEnd=function(t,r){return this.options.dragEnd?this.options.dragEnd(t,r):void 0},t.randomString=function(t){var r;return null==t&&(t=16),r=Math.random().toString(36).slice(2),r+=Math.random().toString(36).slice(2),r.substring(0,t-1)},t}(),window.planit=new Planit,Planit.Plan=function(){function t(t){this.container=t,this.getAllMarkers=__bind(this.getAllMarkers,this),this.markersContainer=this.container.find("."+Planit.markerContainerClass).first()}return t.prototype.getAllMarkers=function(){var t,r,i,n,a,o;for(i=[],o=this.markersContainer.find(".planit-marker"),n=0,a=o.length;a>n;n++)r=o[n],t=new Planit.Marker(this.container,$(r).attr("data-marker")),r={coords:t.position(),draggable:t.isDraggable(),color:t.color()},t.infoboxHTML()&&(r.infobox=t.infoboxHTML()),i.push(r);return i},t}(),Planit.Plan.Events=function(){function t(t){this.options=t,this.mousemove=__bind(this.mousemove,this),this.mouseup=__bind(this.mouseup,this),this.lastMarker=__bind(this.lastMarker,this),this.draggingMarker=__bind(this.draggingMarker,this),this.markers=__bind(this.markers,this),this.container=this.options.container,this.markersContainer=this.container.find("."+Planit.markerContainerClass),$(document).on("mousemove",this.mousemove),$(document).on("mouseup",this.mouseup)}return t.prototype.markers=function(){return this.markersContainer.find(".planit-marker")},t.prototype.draggingMarker=function(){return this.markersContainer.find(".planit-marker.is-dragging")},t.prototype.lastMarker=function(){return this.markers().last()},t.prototype.mouseup=function(t){var r,i;return $(t.target).hasClass("planit-marker-content")&&(i=$(t.target).closest(".planit-marker"),$("#"+i.attr("data-infobox")).addClass("active")),i=this.markersContainer.find(".is-dragging").first(),this.draggingMarker().length>0?(r=new Planit.Marker(this.container,i.attr("data-marker")),this.options.planit.dragEnd(t,r),this.draggingMarker().removeClass("is-dragging")):void 0},t.prototype.mousemove=function(t){var r,i,n,a,o,e,s,h,l,d,c,p,u,g;return d=this.markersContainer.find(".planit-marker.is-dragging"),d.length>0?(r=d.first(),c=t.pageX-this.container.offset().left,p=t.pageY-this.container.offset().top,g=this.container.width(),u=this.container.height(),a=c-r.outerWidth()/2,e=p-r.outerHeight()/2,o=c+r.outerWidth()/2,i=p+r.outerHeight()/2,s=r.outerWidth(),n=r.outerHeight(),h=0>=a?0:g>o?a:g-s,l=0>=e?0:u>i?e:u-n,r.css({left:h,top:l})):void 0},t}(),Planit.Marker=function(){function t(t,r){this.container=t,this.remove=__bind(this.remove,this),this.update=__bind(this.update,this),this.isDraggable=__bind(this.isDraggable,this),this.infoboxHTML=__bind(this.infoboxHTML,this),this.id=__bind(this.id,this),this.color=__bind(this.color,this),this.position=__bind(this.position,this),this.markersContainer=this.container.find("."+Planit.markerContainerClass),this.marker=this.markersContainer.find("."+Planit.markerClass+"[data-marker='"+r+"']").first()}return t.prototype.position=function(){var t,r,i,n;return r=this.marker.position().left+this.marker.outerWidth()/2,n=this.marker.position().top+this.marker.outerHeight()/2,t=r/this.container.width()*100,i=n/this.container.height()*100,[t,i]},t.prototype.color=function(){return this.marker.css("backgroundColor")},t.prototype.id=function(){return this.marker.attr("data-marker")},t.prototype.infoboxHTML=function(){var t;return t=this.marker.find(".planit-infobox"),t.length>0?t.html():null},t.prototype.isDraggable=function(){return this.marker.hasClass("draggable")},t.prototype.update=function(t){var r,i;return t.color&&this.marker.css({backgroundColor:t.color}),t.infobox&&this.marker.find(".planit-infobox").html(t.infobox),t.draggable&&(this.marker.removeClass("draggable"),t.draggable===!0&&this.marker.addClass("draggable")),t.coords?(r=parseFloat(t.coords[0])/100*this.container.width()-15,i=parseFloat(t.coords[1])/100*this.container.height()-15,this.marker.css({left:r+"px",top:i+"px"})):void 0},t.prototype.remove=function(){return this.marker.remove()},t}(),Planit.Marker.Events=function(){function t(t){var r,i;this.options=t,this.container=this.options.container,this.markersContainer=this.container.find("."+Planit.markerContainerClass),this.marker=this.markersContainer.find("."+Planit.markerClass+"[data-marker='"+this.options.id+"']").first(),this.options.draggable&&(this.lastMarker().addClass("draggable"),this.lastMarker().on("mousedown",function(){return function(t){var r,i;return"planit-marker-content"===$(t.target).attr("class")?(i=$(t.target).closest(".planit-marker"),i.addClass("is-dragging"),r=$(t.target).closest(".planit-marker").attr("data-infobox"),$("#"+r).removeClass("active")):void 0}}(this))),this.options.infobox&&(r=Planit.randomString(16),this.lastMarker().find(".planit-marker-content").append('<div class="planit-infobox" id="info-'+r+'">'+this.options.infobox+"</div>"),this.lastMarker().attr("data-infobox","info-"+r),i=$("#"+this.lastMarker().attr("data-infobox")),i.css({left:-(i.width()/2),bottom:i.outerHeight()+5}),this.lastMarker().on("mouseleave",function(){return function(t){var r;return r=$(t.target).closest(".planit-marker"),i=$("#"+r.attr("data-infobox")),i.removeClass("active")}}(this)),this.lastMarker().on("mouseover",function(t){return function(r){var n;return n=$(r.target).closest(".planit-marker"),i=$("#"+n.attr("data-infobox")),n.hasClass("is-dragging")||t.draggingMarker().length>0?i.removeClass("active"):i.addClass("active")}}(this)))}return t.prototype.markers=function(){return this.markersContainer.find(".planit-marker")},t.prototype.draggingMarker=function(){return this.markersContainer.find(".planit-marker.is-dragging")},t.prototype.lastMarker=function(){return this.markers().last()},t}(),Planit.Marker.Creator=function(){function t(t){var r,i,n;this.options=t,this.container=this.options.container,this.markersContainer=this.container.find("."+Planit.markerContainerClass).first(),this.options.id||(this.options.id=Planit.randomString(20)),r=this.options.color?this.options.color:"#FC5B3F",i=parseFloat(this.options.coords[0])/100*this.container.width()-15,n=parseFloat(this.options.coords[1])/100*this.container.height()-15,this.markersContainer.append($('<div><div class="planit-marker-content"></div></div>').addClass("planit-marker").attr("data-marker",this.options.id).css({left:i+"px",top:n+"px",backgroundColor:r})),new Planit.Marker.Events(this.options),new Planit.Marker(this.container,this.options.id)}return t}();
|
@@ -1 +1 @@
|
|
1
|
-
.planit-container{position:relative;display:block;width:600px;height:600px;margin:25px auto;background:rgba(239,239,239,.8)}.planit-container img{position:absolute;top:0;left:0;width:100%}.planit-container .planit-markers-container{position:relative;width:100%;height:100%;background-size:100%;background-repeat:no-repeat;background-position:top left}.planit-container .planit-markers-container .planit-marker{position:absolute;width:30px;height:30px;z-index:999;border-radius:50%;background:#
|
1
|
+
.planit-container{position:relative;display:block;width:600px;height:600px;margin:25px auto;background:rgba(239,239,239,.8)}.planit-container img{position:absolute;top:0;left:0;width:100%}.planit-container .planit-markers-container{position:relative;width:100%;height:100%;background-size:100%;background-repeat:no-repeat;background-position:top left}.planit-container .planit-markers-container .planit-marker{position:absolute;width:30px;height:30px;z-index:999;border-radius:50%;background:#FC5B3F}.planit-container .planit-markers-container .planit-marker.draggable:hover{opacity:.8}.planit-container .planit-markers-container .planit-marker .planit-marker-content{position:relative;width:100%;height:100%}.planit-container .planit-markers-container .planit-marker .planit-marker-content:hover{cursor:move}.planit-container .planit-markers-container .planit-marker .planit-marker-content .planit-infobox{min-width:200px;display:none;position:relative;padding:5px 15px;cursor:initial;background:#fff;border-radius:3px}.planit-container .planit-markers-container .planit-marker .planit-marker-content .planit-infobox.active{display:inline-block}.planit-container .planit-markers-container .planit-marker .planit-marker-content .planit-infobox:after{content:'';position:absolute;top:100%;left:50%;margin-left:-10px;width:0;height:0;border-top:solid 10px #fff;border-left:solid 10px transparent;border-right:solid 10px transparent}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: planit-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean C Davis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|