bootstrap3_mootools 0.0.1

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.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +47 -0
  6. data/Rakefile +1 -0
  7. data/app/assets/javascripts/bootstrap3_mootools.js +245 -0
  8. data/bootstrap3_mootools.gemspec +24 -0
  9. data/lib/bootstrap3_mootools.rb +5 -0
  10. data/lib/bootstrap3_mootools/version.rb +3 -0
  11. data/test/dummy/.gitignore +16 -0
  12. data/test/dummy/Gemfile +41 -0
  13. data/test/dummy/README.rdoc +28 -0
  14. data/test/dummy/Rakefile +6 -0
  15. data/test/dummy/app/assets/images/.keep +0 -0
  16. data/test/dummy/app/assets/javascripts/application.js +17 -0
  17. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  18. data/test/dummy/app/controllers/application_controller.rb +5 -0
  19. data/test/dummy/app/controllers/concerns/.keep +0 -0
  20. data/test/dummy/app/helpers/application_helper.rb +2 -0
  21. data/test/dummy/app/mailers/.keep +0 -0
  22. data/test/dummy/app/models/.keep +0 -0
  23. data/test/dummy/app/models/concerns/.keep +0 -0
  24. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  25. data/test/dummy/bin/bundle +3 -0
  26. data/test/dummy/bin/rails +8 -0
  27. data/test/dummy/bin/rake +8 -0
  28. data/test/dummy/bin/spring +18 -0
  29. data/test/dummy/config.ru +4 -0
  30. data/test/dummy/config/application.rb +23 -0
  31. data/test/dummy/config/boot.rb +4 -0
  32. data/test/dummy/config/database.yml +25 -0
  33. data/test/dummy/config/environment.rb +5 -0
  34. data/test/dummy/config/environments/development.rb +37 -0
  35. data/test/dummy/config/environments/production.rb +83 -0
  36. data/test/dummy/config/environments/test.rb +39 -0
  37. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  39. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  40. data/test/dummy/config/initializers/inflections.rb +16 -0
  41. data/test/dummy/config/initializers/mime_types.rb +4 -0
  42. data/test/dummy/config/initializers/session_store.rb +3 -0
  43. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  44. data/test/dummy/config/locales/en.yml +23 -0
  45. data/test/dummy/config/routes.rb +56 -0
  46. data/test/dummy/config/secrets.yml +22 -0
  47. data/test/dummy/db/seeds.rb +7 -0
  48. data/test/dummy/lib/assets/.keep +0 -0
  49. data/test/dummy/lib/tasks/.keep +0 -0
  50. data/test/dummy/log/.keep +0 -0
  51. data/test/dummy/public/404.html +67 -0
  52. data/test/dummy/public/422.html +67 -0
  53. data/test/dummy/public/500.html +66 -0
  54. data/test/dummy/public/favicon.ico +0 -0
  55. data/test/dummy/public/robots.txt +5 -0
  56. data/test/dummy/test/controllers/.keep +0 -0
  57. data/test/dummy/test/fixtures/.keep +0 -0
  58. data/test/dummy/test/helpers/.keep +0 -0
  59. data/test/dummy/test/integration/.keep +0 -0
  60. data/test/dummy/test/mailers/.keep +0 -0
  61. data/test/dummy/test/models/.keep +0 -0
  62. data/test/dummy/test/test_helper.rb +13 -0
  63. data/test/dummy/vendor/assets/javascripts/.keep +0 -0
  64. data/test/dummy/vendor/assets/stylesheets/.keep +0 -0
  65. metadata +203 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 32067dec6317ead529940af723abe1badb044e75
4
+ data.tar.gz: 5b0590b813b2a5845bec652a71fe39f31b4b876e
5
+ SHA512:
6
+ metadata.gz: 04b6ede543472b796ad1e21138eb3804ac64976b0f6d96c575075d79905469f700e06b16adeeb121524a6312116fca45038e3545487f8308377a962cc06428af
7
+ data.tar.gz: 83951c0051b662f193d4b25962d185b7b600583ab6cd95c2b2ea57ac45f5c886f50eed5130f72dada8f30df40c15268ede2ee009ca13912276eb10a644ff0ed9
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bootstrap3_mootools.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Alain ANDRE
2
+
3
+ MIT License
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:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
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.
@@ -0,0 +1,47 @@
1
+ # Bootstrap3Mootools
2
+
3
+ A gem file allowing to use the basics of twitter bootstrap 3 with mootools in secondes.
4
+
5
+ This allow the following elements to work :
6
+ - Alert
7
+ - Modal
8
+ - Tabs
9
+ - DropDown
10
+ - Tooltip
11
+ - Popover
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ gem 'bootstrap3_mootools'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install bootstrap3_mootools
26
+
27
+ ## Usage
28
+
29
+ Dependency : "railties", "~> 4.1"
30
+
31
+ Add to your Gemfile
32
+
33
+ gem "bootstrap3_mootools"
34
+
35
+ Then bundle install and add to app/assets/javascripts/application.js
36
+
37
+ //= require bootstrap3_mootools
38
+
39
+ That's it. Your Bootstrap 3 components do not need JQuery any more.
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it ( https://github.com/[my-github-username]/bootstrap3_mootools/fork )
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create a new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,245 @@
1
+ /**
2
+ * @copyright Copyright © 2013 - 2014.
3
+ * @author Alain ANDRE <wordsbybird@gmail.com> https://github.com/alain-andre
4
+ */
5
+
6
+ /**
7
+ * Actions sur .alert
8
+ */
9
+ var Alert = new Class({
10
+ /* @param el L'element alert */
11
+ initialize: function(el){
12
+ this.el = el; var self = this;
13
+ el.getElement('.close').removeEvent('click').addEvent('click', function(){
14
+ var parent = this.get('data-dismiss');
15
+ self.close(this.getParent('.'+parent));
16
+ });
17
+ }
18
+ , close: function(el){
19
+ el.destroy();
20
+ }
21
+ });
22
+
23
+ /**
24
+ * Actions sur .modal
25
+ * @use var modal = new Modal(document.id('modal-exemple')).show();
26
+ */
27
+ var Modal = new Class({
28
+ /* @param el L'element alert */
29
+ initialize: function(el){
30
+ this.el = el; var self = this;
31
+ el.getElement('.close').removeEvent('click').addEvent('click', function(){
32
+ var parent = this.get('data-dismiss');
33
+ self.hide(this.getParent('.'+parent));
34
+ });
35
+ }
36
+ , hide: function(el){
37
+ el.removeClass('show');
38
+ }
39
+ , show: function(){
40
+ this.el.addClass('show');
41
+ }
42
+ });
43
+
44
+ /**
45
+ * Actions sur .nav-tabs
46
+ */
47
+ var Tabs = new Class({
48
+ /* @param el L'element nav-tabs */
49
+ initialize: function(el){
50
+ var self = this; this.el = el;
51
+ el.getElements('li').each(function(li){
52
+ var link = li.getElement('[data-toggle]');
53
+ if(link.get('data-toggle').contains("tab")){
54
+ link.removeEvent('click').addEvent('click', function(){
55
+ var div = this.getParent('.nav-tabs').getParent('div').getElement('.tab-content');
56
+ self.show(div, li, this.get('href').replace('#', ''));
57
+ });
58
+ }
59
+ });
60
+ }
61
+ , show: function(div, liSelected, tabId){
62
+ this.el.getElements('li').each(function(li){
63
+ if(liSelected == li) li.addClass('active');
64
+ else li.removeClass('active');
65
+ });
66
+ div.getElements('.tab-pane').each(function(pane){
67
+ if(pane.get('id') == tabId || pane.hasClass(tabId)) pane.addClass('active');
68
+ else pane.removeClass('active');
69
+ });
70
+ }
71
+ });
72
+
73
+ /**
74
+ * Actions sur .dropdown-toggle
75
+ */
76
+ var DropDown = new Class({
77
+ /* @param el L'element dropdown-toggle */
78
+ initialize: function(el){
79
+ var self = this, dropDown = el.getParent('li')
80
+ , dropdownMenu = dropDown.getElement('.dropdown-menu');
81
+ el.removeEvent('click').addEvent('click', function(){
82
+ self.clearMenu();
83
+ dropDown.addClass('open');
84
+ dropdownMenu.setStyle('display', 'block')
85
+ .removeEvent('mouseleave').addEvent('mouseleave', function(){
86
+ this.setStyle('display', 'none');
87
+ dropDown.removeClass('open');
88
+ });
89
+ });
90
+ document.getElement('body').addEvent('click', function(evt){
91
+ var click = 0;
92
+ document.getElements('[data-toggle="dropdown"]').each(function(el){
93
+ if(evt.target == el) click = 1;
94
+ });
95
+ if(click == 0) self.clearMenu(); // on ferme si pas clic sur un menu
96
+ });
97
+ }
98
+ , clearMenu : function(){
99
+ document.getElements('[data-toggle="dropdown"]').each(function(el){
100
+ var li = el.getParent('li');
101
+ li.removeClass('open').getElement('.dropdown-menu').setStyle('display', 'none');
102
+ });
103
+ }
104
+ });
105
+
106
+
107
+ /**
108
+ * Actions sur [data-toggle="tooltip"]
109
+ */
110
+ var Tooltip = new Class({
111
+ /* @param el L'element tooltip */
112
+ initialize: function(el, pop){
113
+ if(pop) this.divContainer = document.id(pop); // pour les popover
114
+ else this.divContainer = document.id('tooltip');
115
+ this.el = el , this.placement = this.el.get('data-placement');
116
+ el.set('data-original-title', el.get('title')).set('title', '');
117
+ this.create();
118
+ }
119
+ , create: function(){
120
+ var self = this;
121
+ this.el.addEvent('mouseenter', function(){ self.show(); });
122
+ this.el.addEvent('mouseleave', function(){ self.hide(); });
123
+ if(!this.divContainer){
124
+ this.divContainer = new Element('div', { 'id': 'tooltip', 'class': 'tooltip in ', 'style': '' })
125
+ .setStyle('display', 'none')
126
+ .grab(new Element('div', { 'class': 'tooltip-arrow' }))
127
+ .grab(new Element('div', { 'class': 'tooltip-inner' }));
128
+ document.getElement('body').grab( this.divContainer );
129
+ }
130
+ }
131
+ , show: function(){
132
+ this.divContainer.setStyle('display', 'block');
133
+ this.setTitle().setPlacement();
134
+ }
135
+ ,setPlacement: function(){
136
+ var actualHeight = this.divContainer.getCoordinates().height
137
+ , actualWidth = this.divContainer.getCoordinates().width
138
+ , coordinates = this.el.getCoordinates();
139
+ switch(this.placement){
140
+ case 'top':
141
+ var styleHash = { top: coordinates.top - actualHeight
142
+ , left: coordinates.left + coordinates.width / 2 - actualWidth / 2 };
143
+ this.divContainer.removeClass('bottom').removeClass('left').removeClass('right').addClass('top');
144
+ break;
145
+ case 'bottom':
146
+ var styleHash = { top: coordinates.top + coordinates.height
147
+ , left: coordinates.left + coordinates.width / 2 - actualWidth / 2 };
148
+ this.divContainer.removeClass('top').removeClass('left').removeClass('right').addClass('bottom');
149
+ break;
150
+ case 'left':
151
+ var styleHash = { top: coordinates.top + coordinates.height / 2 - actualHeight / 2
152
+ , left: coordinates.left - actualWidth };
153
+ this.divContainer.removeClass('bottom').removeClass('top').removeClass('right').addClass('left');
154
+ break;
155
+ case 'right':
156
+ var styleHash = { top: coordinates.top + coordinates.height / 2 - actualHeight / 2
157
+ , left: coordinates.left + coordinates.width };
158
+ this.divContainer.removeClass('bottom').removeClass('left').removeClass('top').addClass('right');
159
+ break;
160
+ default :
161
+ var styleHash = { top: coordinates.top + coordinates.height / 2 - actualHeight / 2
162
+ , left: coordinates.left - actualWidth };
163
+ this.divContainer.removeClass('bottom').removeClass('top').removeClass('right').addClass('left');
164
+ break;
165
+ }
166
+ this.divContainer.setStyles( styleHash );
167
+ }
168
+ , setTitle: function(){
169
+ var title = this.el.get('data-original-title');
170
+ this.divContainer.getElement('.tooltip-inner').set('html', title);
171
+ return this;
172
+ }
173
+ , hide: function(){
174
+ this.divContainer.setStyle('display', 'none');
175
+ }
176
+ });
177
+
178
+ /**
179
+ * Actions sur [data-toggle="popover"]
180
+ */
181
+ var Popover = new Class({
182
+ Extends: Tooltip
183
+ /* @param el L'element popover */
184
+ , initialize: function(el){
185
+ this.parent(el, 'popover');
186
+ }
187
+ , create: function(){
188
+ var self = this;
189
+ if(!this.divContainer){
190
+ this.divContainer = new Element('div', { 'id': 'popover', 'class': 'popover in ', 'style': '' })
191
+ .setStyle('display', 'none')
192
+ .grab(new Element('div', { 'class': 'arrow' }))
193
+ .grab(new Element('h3', { 'class': 'popover-title' }))
194
+ .grab(new Element('div', { 'class': 'popover-content' }));
195
+ document.getElement('body').grab( this.divContainer );
196
+ }
197
+ switch(self.el.get('data-fire')){
198
+ case "mouseenter":
199
+ this.el.addEvent('mouseenter', function(){ self.show(); });
200
+ this.el.addEvent('mouseleave', function(){ self.hide(); });
201
+ break;
202
+ default :
203
+ self.el.removeEvent('click').addEvent('click', function(){
204
+ if(self.divContainer.getStyle('display') == 'none') self.show();
205
+ else self.hide();
206
+ });
207
+ break;
208
+ }
209
+ }
210
+ , show: function(){
211
+ this.divContainer.setStyle('display', 'block');
212
+ this.setTitle().setContent().setPlacement();
213
+ }
214
+ , setContent: function(){
215
+ var content = this.el.get('data-content');
216
+ this.divContainer.getElement('.popover-content').set('html', content);
217
+ return this;
218
+ }
219
+ , setTitle: function(){
220
+ var title = this.el.get('data-original-title');
221
+ this.divContainer.getElement('.popover-title').set('html', title);
222
+ return this;
223
+ }
224
+ });
225
+
226
+ /**
227
+ * Chargement des scripts pour le framework bootstrap
228
+ */
229
+ window.addEvent('domready', function(){
230
+ try{ // dropdown
231
+ document.getElements('.dropdown-toggle').each(function(el){ var dropdown = new DropDown(el); });
232
+ }catch(e){}
233
+ try{ // Alerts
234
+ document.getElements('.alert').each(function(el){ var alert = new Alert(el); });
235
+ }catch(e){}
236
+ try{ // Tabs
237
+ document.getElements('.nav-tabs').each(function(el){ var tab = new Tabs(el); });
238
+ }catch(e){}
239
+ try{ // Tooltip, Popover
240
+ document.getElements('[data-toggle]').each(function(el){
241
+ if(el.get('data-toggle').contains("tooltip")) var tooltip = new Tooltip(el);
242
+ if(el.get('data-toggle').contains("popover")) var popover = new Popover(el);
243
+ });
244
+ }catch(e){}
245
+ });
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bootstrap3_mootools/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bootstrap3_mootools"
8
+ spec.version = Bootstrap3Mootools::VERSION
9
+ spec.authors = ["Alain ANDRE"]
10
+ spec.email = ["wordsbybird@gmail.com"]
11
+ spec.summary = "Allow the use of common boostrap 3 script with mootools"
12
+ spec.description = ""
13
+ spec.homepage = "https://github.com/alain-andre/bootstrap3_mootools"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "railties", "~> 4.1"
24
+ end
@@ -0,0 +1,5 @@
1
+ require "bootstrap3_mootools/version"
2
+
3
+ module Bootstrap3Mootools
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module Bootstrap3Mootools
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,16 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*.log
16
+ /tmp
@@ -0,0 +1,41 @@
1
+ source 'https://rubygems.org'
2
+
3
+
4
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
+ gem 'rails', '4.1.0'
6
+ # Use sqlite3 as the database for Active Record
7
+ gem 'sqlite3'
8
+ # Use SCSS for stylesheets
9
+ gem 'sass-rails', '~> 4.0.3'
10
+ # Use Uglifier as compressor for JavaScript assets
11
+ gem 'uglifier', '>= 1.3.0'
12
+ # Use CoffeeScript for .js.coffee assets and views
13
+ gem 'coffee-rails', '~> 4.0.0'
14
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
15
+ # gem 'therubyracer', platforms: :ruby
16
+
17
+ # Use mootools as the JavaScript library
18
+ gem 'mootools-rails'
19
+ # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
20
+ gem 'turbolinks'
21
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
22
+ gem 'jbuilder', '~> 2.0'
23
+ # bundle exec rake doc:rails generates the API under doc/api.
24
+ gem 'sdoc', '~> 0.4.0', group: :doc
25
+
26
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
27
+ gem 'spring', group: :development
28
+
29
+ # Use ActiveModel has_secure_password
30
+ # gem 'bcrypt', '~> 3.1.7'
31
+
32
+ # Use unicorn as the app server
33
+ # gem 'unicorn'
34
+
35
+ # Use Capistrano for deployment
36
+ # gem 'capistrano-rails', group: :development
37
+
38
+ # Use debugger
39
+ # gem 'debugger', group: [:development, :test]
40
+
41
+ gem "bootstrap3_mootools", :path =>"../../"