introjs-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Pablo Fernandez
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.md ADDED
@@ -0,0 +1,45 @@
1
+ # intro.js-rails
2
+ **Intro.js for rails asset pipeline**
3
+
4
+ [Intro.js][0] is a better way for new feature introduction and step-by-step users guide for your website and project.
5
+
6
+ ## Usage
7
+
8
+ ### Install introjs-rails gem
9
+
10
+ Add `introjs-rails` to your Gemfile and run `bundle install`:
11
+
12
+ gem "introjs-rails"
13
+
14
+ ### Include introjs-rails javascript assets
15
+
16
+ Add the following to your `app/assets/javascripts/application.js`:
17
+
18
+ //= require introjs
19
+
20
+ ### Include introjs-rails stylesheet assets
21
+
22
+ Add to your `app/assets/stylesheets/application.css`:
23
+
24
+ *= require introjs
25
+
26
+ ## Version
27
+
28
+ `introjs-rails` tracks [Intro.js][0]'s versions.
29
+
30
+ ## Contributions
31
+
32
+ If you want to contribute, please:
33
+
34
+ * Fork the project.
35
+ * Make your feature addition or bug fix.
36
+ * Send me a pull request on Github.
37
+
38
+ ## Copyright
39
+
40
+ ### MIT Licensed
41
+
42
+ Copyright (c) 2013 Pablo Fernandez. See [LICENSE][1] for details.
43
+
44
+ [0]: https://github.com/usablica/intro.js
45
+ [1]: https://github.com/heelhook/intro.js-rails/blob/master/LICENSE
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require "bundler/gem_tasks"
4
+ require File.expand_path('../lib/introjs-rails/source_file', __FILE__)
5
+
6
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
7
+ require 'introjs-rails/version'
8
+
9
+ task default: :update
10
+
11
+ desc "Update library"
12
+ task :update do
13
+ files = SourceFile.new
14
+ files.fetch
15
+ end
16
+
17
+ task gem: :build
18
+ task :build do
19
+ system "gem build introjs-rails.gemspec"
20
+ end
21
+
22
+ task release: :build do
23
+ version = Introjs::Rails::VERSION
24
+ system "git tag -a v#{version} -m 'Tagging #{version}'"
25
+ system "git push --tags"
26
+ system "gem push introjs-#{version}.gem"
27
+ system "rm introjs-#{version}.gem"
28
+ end
@@ -0,0 +1 @@
1
+ (function(){function t(e){this._targetElement=e}function n(e){var t=e.querySelectorAll("*[data-intro]"),n=[],o=this;if(t.length<1){return}for(var a=0,f=t.length;a<f;a++){var l=t[a];n.push({element:l,intro:l.getAttribute("data-intro"),step:parseInt(l.getAttribute("data-step"))})}n.sort(function(e,t){return e.step-t.step});o._introItems=n;if(u(e)){r.call(o);var c=e.querySelector(".introjs-skipbutton"),h=e.querySelector(".introjs-nextbutton");e.onkeydown=function(t){if(t.keyCode==27){s(e)}if([37,39].indexOf(t.keyCode)>=0){if(t.keyCode==37){i.call(o)}else if(t.keyCode==39){r.call(o)}}}}return false}function r(){if(this._currentStep==undefined){this._currentStep=0}else{++this._currentStep}if(this._introItems.length<=this._currentStep){s(this._targetElement);return}o.call(this,this._introItems[this._currentStep].element)}function i(){if(this._currentStep==0)return;o.call(this,this._introItems[--this._currentStep].element)}function s(e){var t=e.querySelector(".introjs-overlay");t.style.opacity=0;setTimeout(function(){t.parentNode.removeChild(t)},500);var n=e.querySelector(".introjs-helperLayer");n.parentNode.removeChild(n);var r=document.querySelector(".introjs-showElement");r.className=r.className.replace(/introjs-showElement/,"").trim();e.onkeydown=null}function o(e){var t=this,n=document.querySelector(".introjs-helperLayer"),i=a(e);if(n!=null){var o=n.querySelector(".introjs-helperNumberLayer"),u=n.querySelector(".introjs-tooltiptext"),f=n.querySelector(".introjs-tooltip");n.setAttribute("style","width: "+(i.width+10)+"px; "+"height:"+(i.height+10)+"px; "+"top:"+(i.top-5)+"px;"+"left: "+(i.left-5)+"px;");o.innerHTML=e.getAttribute("data-step");u.innerHTML=e.getAttribute("data-intro");var l=document.querySelector(".introjs-showElement");l.className=l.className.replace(/introjs-showElement/,"").trim();e.className+=" introjs-showElement";setTimeout(function(){f.style.bottom="-"+(a(f).height+10)+"px"},300)}else{e.className+=" introjs-showElement";var c=document.createElement("div"),h=document.createElement("span"),p=document.createElement("div");c.className="introjs-helperLayer";c.setAttribute("style","width: "+(i.width+10)+"px; "+"height:"+(i.height+10)+"px; "+"top:"+(i.top-5)+"px;"+"left: "+(i.left-5)+"px;");document.body.appendChild(c);h.className="introjs-helperNumberLayer";p.className="introjs-tooltip";h.innerHTML=e.getAttribute("data-step");p.innerHTML="<div class='introjs-tooltiptext'>"+e.getAttribute("data-intro")+"</div><div class='introjs-tooltipbuttons'></div>";c.appendChild(h);c.appendChild(p);var d=document.createElement("a");d.className="introjs-skipbutton";d.href="javascript:void(0);";d.innerHTML="Skip";var v=document.createElement("a");v.onclick=function(){r.call(t)};v.className="introjs-nextbutton";v.href="javascript:void(0);";v.innerHTML="Next →";d.onclick=function(){s(t._targetElement)};var m=p.querySelector(".introjs-tooltipbuttons");m.appendChild(d);m.appendChild(v);p.style.bottom="-"+(a(p).height+10)+"px"}if(typeof e.scrollIntoViewIfNeeded==="function"){e.scrollIntoViewIfNeeded()}}function u(e){var t=document.createElement("div"),n="";t.className="introjs-overlay";var r=a(e);if(r){n+="width: "+r.width+"px; height:"+r.height+"px; top:"+r.top+"px;left: "+r.left+"px;";t.setAttribute("style",n)}e.appendChild(t);t.onclick=function(){s(e)};setTimeout(function(){n+="opacity: .5;";t.setAttribute("style",n)},10);return true}function a(e){var t={};t.width=e.offsetWidth;t.height=e.offsetHeight;var n=0;var r=0;while(e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop)){n+=e.offsetLeft;r+=e.offsetTop;e=e.offsetParent}t.top=r;t.left=n;return t}var e="0.1.0";var f=function(e){if(typeof e==="object"){return new t(e)}else if(typeof e==="string"){var n=document.querySelector(e);if(n){return new t(n)}else{throw new Error("There's no element with given selector.")}}else{return new t(document.body)}};f.version=e;f.fn=t.prototype={clone:function(){return t(this)},start:function(){return n.call(this,this._targetElement)}};this["introJs"]=f})()
@@ -0,0 +1 @@
1
+ .introjs-overlay{position:absolute;z-index:999999;background-color:#000;opacity:0;-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-o-transition:all .3s ease-out;-ms-transition:all .3s ease-out;transition:all .3s ease-out}.introjs-showElement{z-index:9999999;position:relative}.introjs-helperLayer{background-color:rgba(255,255,255,0.9);z-index:9999998;position:absolute;border-radius:4px;border:1px solid rgba(0,0,0,0.5);box-shadow:0 2px 15px rgba(0,0,0,0.4);-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-o-transition:all .3s ease-out;-ms-transition:all .3s ease-out;transition:all .3s ease-out}.introjs-helperNumberLayer{z-index:9999999999!important;padding:2px;background:#ff3019;background:-moz-linear-gradient(top,#ff3019 0,#cf0404 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#ff3019),color-stop(100%,#cf0404));background:-webkit-linear-gradient(top,#ff3019 0,#cf0404 100%);background:-o-linear-gradient(top,#ff3019 0,#cf0404 100%);background:-ms-linear-gradient(top,#ff3019 0,#cf0404 100%);background:linear-gradient(to bottom,#ff3019 0,#cf0404 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3019',endColorstr='#cf0404',GradientType=0);color:white;position:absolute;border-radius:50%;font-family:Arial,verdana,tahoma;font-size:13px;font-weight:bold;text-align:center;width:20px;border:3px solid white;box-shadow:0 2px 5px rgba(0,0,0,0.4);text-shadow:1px 1px 1px rgba(0,0,0,0.3);left:-16px;top:-16px}.introjs-tooltip:before{border:5px solid white;content:'';border-top-color:transparent;border-right-color:transparent;border-bottom-color:white;border-left-color:transparent;position:absolute;top:-10px}.introjs-tooltip{position:absolute;padding:10px;background-color:white;border-radius:3px;box-shadow:0 1px 10px rgba(0,0,0,0.4);-webkit-transition:all .1s ease-out;-moz-transition:all .1s ease-out;-o-transition:all .1s ease-out;-ms-transition:all .1s ease-out;transition:all .1s ease-out}.introjs-tooltipbuttons{font-size:10px;text-align:right}.introjs-tooltipbuttons .introjs-skipbutton{margin-right:5px;color:gray}.introjs-tooltipbuttons .introjs-nextbutton{font-weight:bold;color:#2071d3;font-size:11px}
@@ -0,0 +1,20 @@
1
+ require File.expand_path("../lib/introjs-rails/version", __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "introjs-rails"
5
+ s.version = Introjs::Rails::VERSION
6
+ s.authors = ["Pablo Fernandez"]
7
+ s.email = ["heelhook@littleq.net"]
8
+ s.homepage = "https://github.com/heelhook/introjs-rails"
9
+ s.summary = %q{Integrate the excellent Intro.js javascript library with Rails asset pipeline}
10
+ s.description = %q{A better way for new feature introduction and step-by-step users guide for your website and project.}
11
+
12
+ s.files = `git ls-files`.split("\n")
13
+ s.require_paths = ["lib"]
14
+
15
+ s.add_dependency "thor", "~> 0.14"
16
+ s.add_runtime_dependency "sass-rails", ">= 3.2"
17
+ s.add_development_dependency "bundler", "~> 1.0"
18
+ s.add_development_dependency "rails", "~> 3.0"
19
+ s.add_development_dependency "httpclient", "~> 2.2"
20
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ module Introjs
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,33 @@
1
+ require "thor"
2
+ require "json"
3
+ require "httpclient"
4
+
5
+ class SourceFile < Thor
6
+ include Thor::Actions
7
+
8
+ desc "fetch source files", "fetch source files from GitHub"
9
+ def fetch
10
+ filtered_tags = fetch_tags
11
+ tag = select("Which tag do you want to fetch?", filtered_tags)
12
+ self.destination_root = "app/assets"
13
+ remote = "https://github.com/usablica/intro.js"
14
+ get "#{remote}/raw/#{tag}/minified/intro.min.js", "javascripts/introjs.js"
15
+ get "#{remote}/raw/#{tag}/minified/introjs.min.css", "stylesheets/introjs.css"
16
+ end
17
+
18
+ private
19
+
20
+ def fetch_tags
21
+ http = HTTPClient.new
22
+ response = JSON.parse(http.get("https://api.github.com/repos/usablica/intro.js/tags").body)
23
+ response.map{|tag| tag["name"]}.sort
24
+ end
25
+
26
+ def select msg, elements
27
+ elements.each_with_index do |element, index|
28
+ say(block_given? ? yield(element, index + 1) : ("#{index + 1}. #{element.to_s}"))
29
+ end
30
+ result = ask(msg).to_i
31
+ elements[result - 1]
32
+ end
33
+ end
@@ -0,0 +1,5 @@
1
+ module Introjs
2
+ module Rails
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: introjs-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Pablo Fernandez
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '0.14'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '0.14'
30
+ - !ruby/object:Gem::Dependency
31
+ name: sass-rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '3.2'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '3.2'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rails
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '3.0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '3.0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: httpclient
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '2.2'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '2.2'
94
+ description: A better way for new feature introduction and step-by-step users guide
95
+ for your website and project.
96
+ email:
97
+ - heelhook@littleq.net
98
+ executables: []
99
+ extensions: []
100
+ extra_rdoc_files: []
101
+ files:
102
+ - .gitignore
103
+ - Gemfile
104
+ - LICENSE
105
+ - README.md
106
+ - Rakefile
107
+ - app/assets/javascripts/introjs.js
108
+ - app/assets/stylesheets/introjs.css
109
+ - introjs-rails.gemspec
110
+ - lib/introjs-rails.rb
111
+ - lib/introjs-rails/engine.rb
112
+ - lib/introjs-rails/source_file.rb
113
+ - lib/introjs-rails/version.rb
114
+ homepage: https://github.com/heelhook/introjs-rails
115
+ licenses: []
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ segments:
127
+ - 0
128
+ hash: -2165148443092454672
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ segments:
136
+ - 0
137
+ hash: -2165148443092454672
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 1.8.25
141
+ signing_key:
142
+ specification_version: 3
143
+ summary: Integrate the excellent Intro.js javascript library with Rails asset pipeline
144
+ test_files: []