planit-rails 0.0.0 → 0.1.0.pre.p1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb05f8dc5c1733d90ea1c3d3292007c8604c6d9e
4
- data.tar.gz: d47f57be6029f8dd4dea2a7b57cd98a026ebeef4
3
+ metadata.gz: 27a89abc1885b861ce4398b54aaeff5f05f3b7c3
4
+ data.tar.gz: d66aff91910a83d89da626f4fc4e85c2f8c7b57d
5
5
  SHA512:
6
- metadata.gz: a509475c58a150b2257061d19f1f8dcd69f070261b63b264f7490f0b06026f0c409ab8dde7bf3224ef382be62fbe7d00fab1652784dae11a3f920145d3cbbb03
7
- data.tar.gz: c09fc488dec807620e96a7675d1349b597a43e6493a5046d7a4f9c8fa84dbbef4b394b515b1734d66e2d8b002cfef0c793a811a91488752943c67c3d2332ac73
6
+ metadata.gz: b2a2d71d6cf269847928b4737813ff7c97256cae42f6564d9648e2050342cc9a05a333a108aa48204463f251f2fe5229d48469a311671f839659a607759573cd
7
+ data.tar.gz: 86bc8d72d5bd6389c96dc7dd69dff5e6d296a7a6ff38dafa41aff30019e650aa5c7234cfec0015a543c4b412425b7491f9aeaaa1ddd1631f1e1395827bd9c731
data/LICENSE.txt CHANGED
@@ -2,21 +2,20 @@ Copyright (c) 2015 Sean C Davis
2
2
 
3
3
  MIT License
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
15
14
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,3 +1,52 @@
1
- # Planit Rails
1
+ Planit Rails
2
+ ================
2
3
 
3
- The planit library is still being developed. This gem will be published when the library is available.
4
+ PlanitJS is a tool built on jQuery to help you interact with markers/hotspots
5
+ on an image or blank container. This gem adds the script and stylesheet to your
6
+ asset pipeline.
7
+
8
+ Refer to [PlanitJS](https://github.com/planitjs/planit) for PlanitJS's usage.
9
+
10
+ Installation
11
+ ----------------
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'planit-rails'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install planit-rails
26
+
27
+ ## Usage
28
+
29
+ Load the scripts, and don't forget jQuery:
30
+
31
+ **application.js**
32
+
33
+ ```js
34
+ //= require jquery
35
+ //= require planit
36
+ ```
37
+
38
+ You can also add the stylesheet as well:
39
+
40
+ **application.scss**
41
+
42
+ ```scss
43
+ @import "planit";
44
+ ```
45
+
46
+ ## Contributing
47
+
48
+ 1. Fork it ( https://github.com/[my-github-username]/planit-rails/fork )
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
51
+ 4. Push to the branch (`git push origin my-new-feature`)
52
+ 5. Create a new Pull Request
@@ -0,0 +1,6 @@
1
+ module Planit
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  module Planit
2
2
  module Rails
3
- VERSION = "0.0.0"
3
+ VERSION = "0.1.0-p1"
4
4
  end
5
5
  end
data/lib/planit/rails.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "planit/rails/engine"
1
2
  require "planit/rails/version"
2
3
 
3
4
  module Planit
data/lib/planit.rb ADDED
@@ -0,0 +1 @@
1
+ require 'planit/rails'
data/planit-rails.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "jquery-rails"
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.7"
22
24
  spec.add_development_dependency "rake", "~> 10.0"
23
25
  end
@@ -0,0 +1 @@
1
+ var Planit,__bind=function(t,n){return function(){return t.apply(n,arguments)}};Planit=function(){function t(){this.initMarkers=__bind(this.initMarkers,this)}return t.prototype["new"]=function(t){return this.options=t,this.options||(this.options={}),this.setOptions(),this.initPlan(),$(window).load(this.initMarkers)},t.prototype.setOptions=function(){return this.setDefaultOptions(),this.options.container&&(this.planOptions.container=$("#"+this.options.container)),this.options.backgroundImage?this.planOptions.backgroundImage=this.options.backgroundImage:void 0},t.prototype.setDefaultOptions=function(){return this.planOptions={container:$("#planit")}},t.prototype.initPlan=function(){return this.plan=new t.Plan(this.planOptions)},t.prototype.initMarkers=function(){var n,i,r,o,a;for(this.markers=new t.Marker({plan:this.planOptions.container}),o=this.options.markers,a=[],i=0,r=o.length;r>i;i++)n=o[i],a.push(this.markers.add(n));return a},t}(),window.planit=new Planit,Planit.Plan=function(){function t(t){this.options=t,this.initContainers(),this.options.backgroundImage&&this.addBackgroundImage()}return t.prototype.initContainers=function(){return this.options.container.addClass("planit-container"),this.options.container.append('<div class="planit-markers-container"></div>')},t.prototype.addBackgroundImage=function(){return this.options.container.append('<img src="'+this.options.backgroundImage+'">'),this.options.container.find(".planit-markers-container").css({backgroundImage:"url('"+this.options.backgroundImage+"')"}),$(window).load(function(t){return function(){return t.options.container.css({height:t.options.container.find("img").first().height()}),t.options.container.find("img").first().remove()}}(this))},t}(),Planit.Marker=function(){function t(t){this.options=t,this.mousemove=__bind(this.mousemove,this),this.mouseup=__bind(this.mouseup,this),this.mousedown=__bind(this.mousedown,this),this.setOptions(),this.bindDraggable()}return t.prototype.setOptions=function(){return this.plan=this.options.plan,this.markersContainer=this.plan.find(".planit-markers-container")},t.prototype.add=function(t){var n,i;return this.markersContainer.append($('<div><div class="planit-marker-content"></div></div>').addClass("planit-marker").css({left:t.coords[0]+"%",top:t.coords[1]+"%"})),t.draggable&&(this.lastMarker().addClass("draggable"),this.lastMarker().on("mousedown",this.mousedown)),t.infobox?(n=this.randomString(16),this.lastMarker().find(".planit-marker-content").append('<div class="planit-infobox" id="info-'+n+'">'+t.infobox+"</div>"),this.lastMarker().attr("data-infobox","info-"+n),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 n;return n=$(t.target).closest(".planit-marker"),i=$("#"+n.attr("data-infobox")),i.removeClass("active")}}(this)),this.lastMarker().on("mouseover",function(t){return function(n){var r;return r=$(n.target).closest(".planit-marker"),i=$("#"+r.attr("data-infobox")),r.hasClass("is-dragging")||t.draggingMarker().length>0?i.removeClass("active"):i.addClass("active")}}(this))):void 0},t.prototype.mousedown=function(t){var n,i;return i=$(t.target).closest(".planit-marker"),i.addClass("is-dragging"),n=$(t.target).closest(".planit-marker").attr("data-infobox"),$("#"+n).removeClass("active")},t.prototype.mouseup=function(t){var n;return $(t.target).hasClass("planit-marker-content")&&(n=$(t.target).closest(".planit-marker"),$("#"+n.attr("data-infobox")).addClass("active")),this.draggingMarker().removeClass("is-dragging")},t.prototype.mousemove=function(t){var n,i,r,o,a,s,e,p,u,d,h,l,c,g;return d=this.markersContainer.find(".planit-marker.is-dragging"),d.length>0?(n=d.first(),h=t.pageX-this.plan.offset().left,l=t.pageY-this.plan.offset().top,g=this.plan.width(),c=this.plan.height(),o=h-n.outerWidth()/2,s=l-n.outerHeight()/2,a=h+n.outerWidth()/2,i=l+n.outerHeight()/2,e=n.outerWidth(),r=n.outerHeight(),p=0>=o?0:g>a?o:g-e,u=0>=s?0:c>i?s:c-r,n.css({left:p,top:u})):void 0},t.prototype.bindDraggable=function(){return $(document).on("mousemove",this.mousemove),$(document).on("mouseup",this.mouseup)},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.randomString=function(t){var n;return null==t&&(t=16),n=Math.random().toString(36).slice(2),n+=Math.random().toString(36).slice(2),n.substring(0,t-1)},t}();
@@ -0,0 +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:#abc123}.planit-container .planit-markers-container .planit-marker.draggable:hover{cursor:move;opacity:.8}.planit-container .planit-markers-container .planit-marker.draggable.is-dragging{background:#00f}.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 .planit-infobox{min-width:200px;display:none;position:relative;padding:5px 15px;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,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: planit-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0.pre.p1
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-03 00:00:00.000000000 Z
11
+ date: 2015-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jquery-rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -50,9 +64,13 @@ files:
50
64
  - LICENSE.txt
51
65
  - README.md
52
66
  - Rakefile
67
+ - lib/planit.rb
53
68
  - lib/planit/rails.rb
69
+ - lib/planit/rails/engine.rb
54
70
  - lib/planit/rails/version.rb
55
71
  - planit-rails.gemspec
72
+ - vendor/assets/javascripts/planit.js
73
+ - vendor/assets/stylesheets/planit.css
56
74
  homepage: ''
57
75
  licenses:
58
76
  - MIT
@@ -68,9 +86,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
68
86
  version: '0'
69
87
  required_rubygems_version: !ruby/object:Gem::Requirement
70
88
  requirements:
71
- - - ">="
89
+ - - ">"
72
90
  - !ruby/object:Gem::Version
73
- version: '0'
91
+ version: 1.3.1
74
92
  requirements: []
75
93
  rubyforge_project:
76
94
  rubygems_version: 2.2.0