jmenu-rails 1.9

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1b40a5ac2cd184f874831ba1a74e8c9e93658042
4
+ data.tar.gz: 0c6a05e005f018da5ed7efeef6814785485f6010
5
+ SHA512:
6
+ metadata.gz: e0918407bd32abac8498d6ebc4e29c419537f8afeddbf38908a2a5c2dae446d45ff7aa3cd84a8791d5fc7301fa74fc87ac0697d82f774d239ae7e4e89d8f418c
7
+ data.tar.gz: f39e6ffedeb9c64e677dc68f6842baed4fce8a857bafd347dadddfdf562fa10a9d995a06712fe9c2f90155bbbc2d1275cbefe0a59a826669cfecea8cbc8ca3f7
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Hyoseong Choi
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,118 @@
1
+ # Jmenu::Rails
2
+
3
+ Gemified the jMenu jquery plugin to use with assets pipeline in Rails(~>4.0.0.beta1) projects.
4
+
5
+ Original source : https://github.com/alpixel/jMenu
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'jmenu-rails', github: 'rorlab/jmenu-rails'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install jmenu-rails
20
+
21
+ ## Usage
22
+
23
+ To require jMenu UI modules, add the following to your application.js:
24
+
25
+ ```
26
+ //= require jMenu.jquery
27
+ ```
28
+
29
+ Also add the jMenu UI CSS to your application.css:
30
+
31
+ ```
32
+ /*
33
+ *= require jMenu.jquery
34
+ */
35
+ ```
36
+
37
+ Finally, you can make coffeescript as like:
38
+
39
+ ```
40
+ jQuery ->
41
+ $("#jMenu").jMenu
42
+ openClick: false
43
+ ulWidth: "auto"
44
+ effects:
45
+ effectSpeedOpen: 150
46
+ effectSpeedClose: 150
47
+ effectTypeOpen: "slide"
48
+ effectTypeClose: "hide"
49
+ effectOpen: "linear"
50
+ effectClose: "linear"
51
+
52
+ TimeBeforeOpening: 100
53
+ TimeBeforeClosing: 11
54
+ animatedText: false
55
+ paddingLeft: 1
56
+ ```
57
+
58
+ ## Notes
59
+
60
+ Renamed jMenu.jquery.css to jMenu.jquery.css.erb and inserted ERB code to the url source of background-image tags.
61
+
62
+ ```
63
+ .jMenu li ul li.arrow {
64
+ background-color: #322f32;
65
+ background-image: url(<%= image_path('arrow_down.png') %>);
66
+ background-repeat: no-repeat;
67
+ background-position: center center;
68
+ height: 6px;
69
+ padding: 0;
70
+ border-bottom: none;
71
+ padding-bottom: 10px
72
+ }
73
+
74
+ .jMenu li ul li a.isParent {
75
+ background-color: #3a3a3a;
76
+ background-image: url(<%= image_path('arrow_right.png') %>);
77
+ background-repeat: no-repeat;
78
+ background-position: right center;
79
+ }
80
+ ```
81
+
82
+ ![See the orinal theme.](http://i1184.photobucket.com/albums/z322/hschoimd/jmenu-1.png?t=1363870854)
83
+
84
+ Default theme color is darkgray and so, if you want the light theme color, added the followings to your custom stylesheet:
85
+
86
+ ```
87
+ .jMenu li {
88
+ background-color: #eaeaea !important;
89
+ }
90
+ .jMenu li a {
91
+ color:gray !important;
92
+ }
93
+ .jMenu li ul li {
94
+ background-color: #eaeaea !important;
95
+ border-bottom: 1px solid #eaeaea !important;
96
+ }
97
+ .jMenu li ul li.arrow {
98
+ background-color: #eaeaea !important;
99
+ }
100
+ .jMenu li ul li a.isParent {
101
+ background-color: #eaeaea !important;
102
+ }
103
+ .jMenu li ul li a:hover {
104
+ background-color: #c4c4c4 !important;
105
+ border-top: 1px solid #eaeaea !important;
106
+ border-bottom: 1px solid #eaeaea !important;
107
+ }
108
+ ```
109
+
110
+ [See the example script for light theme](https://github.com/rorlab/jmenu-rails/wiki/Examples-for-light-theme)
111
+
112
+ ## Contributing
113
+
114
+ 1. Fork it
115
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
116
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
117
+ 4. Push to the branch (`git push origin my-new-feature`)
118
+ 5. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ require "jmenu/rails/version"
2
+
3
+ module Jmenu
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Jmenu
2
+ module Rails
3
+ VERSION = "1.9"
4
+ end
5
+ end
@@ -0,0 +1,314 @@
1
+ /************************************************************************
2
+ *************************************************************************
3
+ @Name : jMenu - jQuery Plugin
4
+ @Revison : 1.9
5
+ @Date : 09/2012
6
+ @Author : ALPIXEL - (www.myjqueryplugins.com - www.alpixel.fr)
7
+ @Support : FF, IE7, IE8, MAC Firefox, MAC Safari
8
+ @License : Open Source - MIT License : http://www.opensource.org/licenses/mit-license.php
9
+
10
+ **************************************************************************
11
+ *************************************************************************/
12
+
13
+ /**
14
+ @ IsHovered Plugin
15
+ @ Thanks to Chad Smith fr his isHovered Plugin
16
+ @ source : http://mktgdept.com/jquery-ishovered
17
+ **/
18
+ ;(function(b,c) {
19
+ b('*').hover(function() {
20
+ b(this).data(c, 1)
21
+ },
22
+ function() {
23
+ b(this).data(c, 0)
24
+ }).data(c, 0);
25
+
26
+ b[c] = function(a) {
27
+ return b(a)[c]()
28
+ };
29
+
30
+ b.fn[c] = function(a) {
31
+ a = 0;
32
+ b(this).each(function() {
33
+ a += b(this).data(c)
34
+ });
35
+
36
+ return a > 0;
37
+ }
38
+ })(jQuery, 'isHovered');
39
+
40
+ /** jMenu Plugin **/
41
+ (function($) {
42
+ $.jMenu = {
43
+ /**************/
44
+ /** OPTIONS **/
45
+ /**************/
46
+ defaults: {
47
+ ulWidth: 'auto',
48
+ absoluteTop: 30,
49
+ absoluteLeft: 0,
50
+ TimeBeforeOpening: 100,
51
+ TimeBeforeClosing: 100,
52
+ animatedText: false,
53
+ paddingLeft: 7,
54
+ openClick: false,
55
+ effects: {
56
+ effectSpeedOpen: 150,
57
+ effectSpeedClose: 150,
58
+ effectTypeOpen: 'fade',
59
+ effectTypeClose: 'hide',
60
+ effectOpen: 'linear',
61
+ effectClose: 'linear'
62
+ }
63
+ },
64
+
65
+ /*****************/
66
+ /** Init Method **/
67
+ /*****************/
68
+ init: function(options) {
69
+ /* vars **/
70
+ opts = $.extend({}, $.jMenu.defaults, options);
71
+
72
+ $(".jMenu a:not(.fNiv)").each(function() {
73
+ var $thisChild = $(this);
74
+
75
+ /* Add css - arrow right */
76
+ if($.jMenu._IsParent($thisChild)) {
77
+ $thisChild.addClass('isParent');
78
+ }
79
+
80
+ /* Add the animation on hover **/
81
+ if(opts.animatedText) {
82
+ $.jMenu._animateText($thisChild);
83
+ }
84
+
85
+ /* Actions on hover */
86
+ if(!opts.openClick) {
87
+ $thisChild.bind({
88
+ mouseover:function() {
89
+ $.jMenu._hide($thisChild);
90
+ $.jMenu._showNextChild($thisChild);
91
+ }
92
+ });
93
+ } else {
94
+ $thisChild.bind({
95
+ click:function() {
96
+ $.jMenu._hide($thisChild);
97
+ $.jMenu._showNextChild($thisChild);
98
+ }
99
+ });
100
+ }
101
+ });
102
+
103
+ /* Actions on parents links */
104
+ if(!opts.openClick) {
105
+ $('.jMenu li a.fNiv').bind({
106
+ mouseover: function() {
107
+ var $this = $(this);
108
+ var $child = $this.next();
109
+ if (($child.length > 0) && ($child.is(':hidden') == false)) {
110
+ return;
111
+ }
112
+
113
+ ULWidth = $.jMenu._returnUlWidth($this);
114
+ $.jMenu._closeList($(".jMenu ul"));
115
+ if ($child.is(':hidden')) {
116
+ $.jMenu._showFirstChild($this);
117
+ }
118
+ }
119
+ });
120
+ } else {
121
+ $('.jMenu li a.fNiv').bind({
122
+ click: function(e) {
123
+ e.preventDefault();
124
+ var $this = $(this);
125
+ var $child = $this.next();
126
+ ULWidth = $.jMenu._returnUlWidth($this);
127
+ $.jMenu._closeList($(".jMenu ul"));
128
+ if($child.is(':hidden')) {
129
+ $.jMenu._showFirstChild($this);
130
+ }
131
+ }
132
+ });
133
+ }
134
+
135
+ /* Close all when mouse leaves */
136
+ $('.jMenu').bind({
137
+ mouseleave: function() {
138
+ setTimeout(function(){$.jMenu._closeAll();},opts.TimeBeforeClosing);
139
+ }
140
+ });
141
+ },
142
+
143
+ /****************************
144
+ *****************************
145
+ ** jMenu Methods Below **
146
+ *****************************
147
+ ****************************/
148
+
149
+ /** Show the First Child Lists **/
150
+ _showFirstChild: function(el) {
151
+
152
+ if($.jMenu._IsParent(el)) {
153
+ var SecondList = el.next();
154
+
155
+ if(SecondList.is(":hidden")) {
156
+ var position = el.position();
157
+
158
+ SecondList.
159
+ css({
160
+ top: position.top + opts.absoluteTop,
161
+ left: position.left + opts.absoluteLeft,
162
+ width: ULWidth
163
+ })
164
+ .children().css({
165
+ width: ULWidth
166
+ })
167
+ ;
168
+
169
+ $.jMenu._show(SecondList);
170
+ }
171
+ } else {
172
+ return false;
173
+ }
174
+ },
175
+
176
+ /** Show all others Child lists except the first list **/
177
+ _showNextChild: function(el) {
178
+ if($.jMenu._IsParent(el)) {
179
+ var ChildList = el.next();
180
+
181
+ if(ChildList.is(":hidden")) {
182
+ var position = el.position();
183
+
184
+ ChildList
185
+ .css({
186
+ top: position.top,
187
+ left: position.left + ULWidth,
188
+ width: ULWidth
189
+ })
190
+ .children().css({
191
+ width:ULWidth
192
+ })
193
+ ;
194
+ $.jMenu._show(ChildList);
195
+ }
196
+ } else {
197
+ return false;
198
+ }
199
+ },
200
+
201
+ /**************************************/
202
+ /** Short Methods - Generals actions **/
203
+ /**************************************/
204
+ _hide: function(el) {
205
+ if($.jMenu._IsParent(el) && !el.next().is(':hidden')) {
206
+ $.jMenu._closeList(el.next());
207
+ } else if (($.jMenu._IsParent(el) && el.next().is(':hidden')) || !$.jMenu._IsParent(el)) {
208
+ $.jMenu._closeList(el.parent().parent().find('ul'));
209
+ } else {
210
+ return false;
211
+ }
212
+ },
213
+
214
+ _show: function(el) {
215
+ switch(opts.effects.effectTypeOpen) {
216
+ case 'slide':
217
+ el.stop(true, true).delay(opts.TimeBeforeOpening).slideDown(opts.effects.effectSpeedOpen, opts.effects.effectOpen);
218
+ break;
219
+ case 'fade':
220
+ el.stop(true, true).delay(opts.TimeBeforeOpening).fadeIn(opts.effects.effectSpeedOpen, opts.effects.effectOpen);
221
+ break;
222
+ default:
223
+ el.stop(true, true).delay(opts.TimeBeforeOpening).show();
224
+ }
225
+ },
226
+
227
+ _closeList: function(el) {
228
+ switch(opts.effects.effectTypeClose) {
229
+ case 'slide':
230
+ el.stop(true,true).slideUp(opts.effects.effectSpeedClose, opts.effects.effectClose);
231
+ break;
232
+ case 'fade':
233
+ el.stop(true,true).fadeOut(opts.effects.effectSpeedClose, opts.effects.effectClose);
234
+ break;
235
+ default:
236
+ el.hide();
237
+ }
238
+ },
239
+
240
+ _closeAll: function() {
241
+ if (!$('.jMenu').isHovered()) {
242
+ $('.jMenu ul').each(function() {
243
+ $.jMenu._closeList($(this));
244
+ });
245
+ }
246
+ },
247
+
248
+ _IsParent: function(el) {
249
+ if (el.next().is('ul')) {
250
+ return true;
251
+ } else {
252
+ return false;
253
+ }
254
+ },
255
+
256
+ _returnUlWidth: function(el) {
257
+ switch(opts.ulWidth) {
258
+ case "auto" :
259
+ ULWidth = parseInt(el.outerWidth(true));
260
+ break;
261
+ default:
262
+ ULWidth = parseInt(opts.ulWidth);
263
+ }
264
+
265
+ return ULWidth;
266
+ },
267
+
268
+ _animateText: function(el) {
269
+ var paddingInit = parseInt(el.css('padding-left'));
270
+
271
+ el.hover(
272
+ function() {
273
+ $(this)
274
+ .stop(true,true)
275
+ .animate(
276
+ {
277
+ paddingLeft: paddingInit + opts.paddingLeft
278
+ }, 100)
279
+ ;
280
+ },
281
+ function() {
282
+ $(this)
283
+ .stop(true,true)
284
+ .animate(
285
+ {
286
+ paddingLeft:paddingInit
287
+ }, 100);
288
+ }
289
+ );
290
+ },
291
+
292
+ _isReadable: function() {
293
+ if ($("a.fNiv").length > 0) {
294
+ return true;
295
+ } else {
296
+ return false;
297
+ }
298
+ },
299
+
300
+ _error: function() {
301
+ alert('Please, check you have the \'.fNiv\' class on your first level links.');
302
+ }
303
+ };
304
+
305
+ jQuery.fn.jMenu = function(options){
306
+ $(this).addClass('jMenu');
307
+ $(this).children('li').children('a').addClass('fNiv');
308
+ if($.jMenu._isReadable()) {
309
+ $.jMenu.init(options);
310
+ } else {
311
+ $.jMenu._error();
312
+ }
313
+ };
314
+ })(jQuery);
@@ -0,0 +1,72 @@
1
+ .jMenu {
2
+ display: table;
3
+ margin: 0;
4
+ padding: 0
5
+ }
6
+
7
+ /* First level */
8
+ .jMenu li {
9
+ display: table-cell;
10
+ background-color: #322f32;
11
+ margin: 0;
12
+ }
13
+
14
+ .jMenu li a {
15
+ padding: 10px;
16
+ display: block;
17
+ background-color: transparent;
18
+ color: white;
19
+ text-transform: uppercase;
20
+ cursor: pointer;
21
+ font-size: 12px;
22
+ }
23
+
24
+ /* Lower levels */
25
+ .jMenu li ul {
26
+ display: none;
27
+ position: absolute;
28
+ z-index:9999;
29
+ padding: 0;
30
+ margin: 0;
31
+ }
32
+
33
+ .jMenu li ul li {
34
+ background-color: #322f32;
35
+ display: block;
36
+ border-bottom: 1px solid #484548;
37
+ padding: 0;
38
+ }
39
+
40
+ .jMenu li ul li.arrow {
41
+ background-color: #322f32;
42
+ background-image: url(<%= image_path('arrow_down.png') %>);
43
+ background-repeat: no-repeat;
44
+ background-position: center center;
45
+ height: 6px;
46
+ padding: 0;
47
+ border-bottom: none;
48
+ padding-bottom: 10px
49
+ }
50
+
51
+ .jMenu li ul li a {
52
+ font-size: 11px;
53
+ text-transform: none;
54
+ padding: 7px;
55
+ display: block;
56
+ border-top: 1px solid transparent;
57
+ border-bottom: 1px solid transparent;
58
+ }
59
+
60
+ .jMenu li ul li a.isParent {
61
+ background-color: #3a3a3a;
62
+ background-image: url(<%= image_path('arrow_right.png') %>);
63
+ background-repeat: no-repeat;
64
+ background-position: right center;
65
+ }
66
+
67
+ .jMenu li ul li a:hover {
68
+ background-color: #514c52;
69
+ border-top: 1px solid #322f32;
70
+ border-bottom: 1px solid #322f32;
71
+ }
72
+
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jmenu-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.9'
5
+ platform: ruby
6
+ authors:
7
+ - Hyoseong Choi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: jMenu jquery plugin for rails
42
+ email:
43
+ - rorlab@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/jmenu/rails/version.rb
49
+ - lib/jmenu/rails.rb
50
+ - vendor/assets/images/arrow_down.png
51
+ - vendor/assets/images/arrow_right.png
52
+ - vendor/assets/javascripts/jMenu.jquery.js
53
+ - vendor/assets/stylesheets/jMenu.jquery.css.erb
54
+ - LICENSE.txt
55
+ - README.md
56
+ homepage: https://github.com/rorlab/jmenu-rails
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.0.0
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Gemify jMenu assets for rails
80
+ test_files: []