jquery_context_menu-rails 0.0.4

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,252 @@
1
+ /*!
2
+ * jQuery UI Position 1.8.13
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Position
9
+ */
10
+ (function( $, undefined ) {
11
+
12
+ $.ui = $.ui || {};
13
+
14
+ var horizontalPositions = /left|center|right/,
15
+ verticalPositions = /top|center|bottom/,
16
+ center = "center",
17
+ _position = $.fn.position,
18
+ _offset = $.fn.offset;
19
+
20
+ $.fn.position = function( options ) {
21
+ if ( !options || !options.of ) {
22
+ return _position.apply( this, arguments );
23
+ }
24
+
25
+ // make a copy, we don't want to modify arguments
26
+ options = $.extend( {}, options );
27
+
28
+ var target = $( options.of ),
29
+ targetElem = target[0],
30
+ collision = ( options.collision || "flip" ).split( " " ),
31
+ offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
32
+ targetWidth,
33
+ targetHeight,
34
+ basePosition;
35
+
36
+ if ( targetElem.nodeType === 9 ) {
37
+ targetWidth = target.width();
38
+ targetHeight = target.height();
39
+ basePosition = { top: 0, left: 0 };
40
+ // TODO: use $.isWindow() in 1.9
41
+ } else if ( targetElem.setTimeout ) {
42
+ targetWidth = target.width();
43
+ targetHeight = target.height();
44
+ basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
45
+ } else if ( targetElem.preventDefault ) {
46
+ // force left top to allow flipping
47
+ options.at = "left top";
48
+ targetWidth = targetHeight = 0;
49
+ basePosition = { top: options.of.pageY, left: options.of.pageX };
50
+ } else {
51
+ targetWidth = target.outerWidth();
52
+ targetHeight = target.outerHeight();
53
+ basePosition = target.offset();
54
+ }
55
+
56
+ // force my and at to have valid horizontal and veritcal positions
57
+ // if a value is missing or invalid, it will be converted to center
58
+ $.each( [ "my", "at" ], function() {
59
+ var pos = ( options[this] || "" ).split( " " );
60
+ if ( pos.length === 1) {
61
+ pos = horizontalPositions.test( pos[0] ) ?
62
+ pos.concat( [center] ) :
63
+ verticalPositions.test( pos[0] ) ?
64
+ [ center ].concat( pos ) :
65
+ [ center, center ];
66
+ }
67
+ pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
68
+ pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
69
+ options[ this ] = pos;
70
+ });
71
+
72
+ // normalize collision option
73
+ if ( collision.length === 1 ) {
74
+ collision[ 1 ] = collision[ 0 ];
75
+ }
76
+
77
+ // normalize offset option
78
+ offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
79
+ if ( offset.length === 1 ) {
80
+ offset[ 1 ] = offset[ 0 ];
81
+ }
82
+ offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
83
+
84
+ if ( options.at[0] === "right" ) {
85
+ basePosition.left += targetWidth;
86
+ } else if ( options.at[0] === center ) {
87
+ basePosition.left += targetWidth / 2;
88
+ }
89
+
90
+ if ( options.at[1] === "bottom" ) {
91
+ basePosition.top += targetHeight;
92
+ } else if ( options.at[1] === center ) {
93
+ basePosition.top += targetHeight / 2;
94
+ }
95
+
96
+ basePosition.left += offset[ 0 ];
97
+ basePosition.top += offset[ 1 ];
98
+
99
+ return this.each(function() {
100
+ var elem = $( this ),
101
+ elemWidth = elem.outerWidth(),
102
+ elemHeight = elem.outerHeight(),
103
+ marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
104
+ marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
105
+ collisionWidth = elemWidth + marginLeft +
106
+ ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
107
+ collisionHeight = elemHeight + marginTop +
108
+ ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
109
+ position = $.extend( {}, basePosition ),
110
+ collisionPosition;
111
+
112
+ if ( options.my[0] === "right" ) {
113
+ position.left -= elemWidth;
114
+ } else if ( options.my[0] === center ) {
115
+ position.left -= elemWidth / 2;
116
+ }
117
+
118
+ if ( options.my[1] === "bottom" ) {
119
+ position.top -= elemHeight;
120
+ } else if ( options.my[1] === center ) {
121
+ position.top -= elemHeight / 2;
122
+ }
123
+
124
+ // prevent fractions (see #5280)
125
+ position.left = Math.round( position.left );
126
+ position.top = Math.round( position.top );
127
+
128
+ collisionPosition = {
129
+ left: position.left - marginLeft,
130
+ top: position.top - marginTop
131
+ };
132
+
133
+ $.each( [ "left", "top" ], function( i, dir ) {
134
+ if ( $.ui.position[ collision[i] ] ) {
135
+ $.ui.position[ collision[i] ][ dir ]( position, {
136
+ targetWidth: targetWidth,
137
+ targetHeight: targetHeight,
138
+ elemWidth: elemWidth,
139
+ elemHeight: elemHeight,
140
+ collisionPosition: collisionPosition,
141
+ collisionWidth: collisionWidth,
142
+ collisionHeight: collisionHeight,
143
+ offset: offset,
144
+ my: options.my,
145
+ at: options.at
146
+ });
147
+ }
148
+ });
149
+
150
+ if ( $.fn.bgiframe ) {
151
+ elem.bgiframe();
152
+ }
153
+ elem.offset( $.extend( position, { using: options.using } ) );
154
+ });
155
+ };
156
+
157
+ $.ui.position = {
158
+ fit: {
159
+ left: function( position, data ) {
160
+ var win = $( window ),
161
+ over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
162
+ position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
163
+ },
164
+ top: function( position, data ) {
165
+ var win = $( window ),
166
+ over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
167
+ position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
168
+ }
169
+ },
170
+
171
+ flip: {
172
+ left: function( position, data ) {
173
+ if ( data.at[0] === center ) {
174
+ return;
175
+ }
176
+ var win = $( window ),
177
+ over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
178
+ myOffset = data.my[ 0 ] === "left" ?
179
+ -data.elemWidth :
180
+ data.my[ 0 ] === "right" ?
181
+ data.elemWidth :
182
+ 0,
183
+ atOffset = data.at[ 0 ] === "left" ?
184
+ data.targetWidth :
185
+ -data.targetWidth,
186
+ offset = -2 * data.offset[ 0 ];
187
+ position.left += data.collisionPosition.left < 0 ?
188
+ myOffset + atOffset + offset :
189
+ over > 0 ?
190
+ myOffset + atOffset + offset :
191
+ 0;
192
+ },
193
+ top: function( position, data ) {
194
+ if ( data.at[1] === center ) {
195
+ return;
196
+ }
197
+ var win = $( window ),
198
+ over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
199
+ myOffset = data.my[ 1 ] === "top" ?
200
+ -data.elemHeight :
201
+ data.my[ 1 ] === "bottom" ?
202
+ data.elemHeight :
203
+ 0,
204
+ atOffset = data.at[ 1 ] === "top" ?
205
+ data.targetHeight :
206
+ -data.targetHeight,
207
+ offset = -2 * data.offset[ 1 ];
208
+ position.top += data.collisionPosition.top < 0 ?
209
+ myOffset + atOffset + offset :
210
+ over > 0 ?
211
+ myOffset + atOffset + offset :
212
+ 0;
213
+ }
214
+ }
215
+ };
216
+
217
+ // offset setter from jQuery 1.4
218
+ if ( !$.offset.setOffset ) {
219
+ $.offset.setOffset = function( elem, options ) {
220
+ // set position first, in-case top/left are set even on static elem
221
+ if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
222
+ elem.style.position = "relative";
223
+ }
224
+ var curElem = $( elem ),
225
+ curOffset = curElem.offset(),
226
+ curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
227
+ curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
228
+ props = {
229
+ top: (options.top - curOffset.top) + curTop,
230
+ left: (options.left - curOffset.left) + curLeft
231
+ };
232
+
233
+ if ( 'using' in options ) {
234
+ options.using.call( elem, props );
235
+ } else {
236
+ curElem.css( props );
237
+ }
238
+ };
239
+
240
+ $.fn.offset = function( options ) {
241
+ var elem = this[ 0 ];
242
+ if ( !elem || !elem.ownerDocument ) { return null; }
243
+ if ( options ) {
244
+ return this.each(function() {
245
+ $.offset.setOffset( this, options );
246
+ });
247
+ }
248
+ return _offset.call( this );
249
+ };
250
+ }
251
+
252
+ }( jQuery ));
@@ -0,0 +1,141 @@
1
+ /*!
2
+ * jQuery contextMenu - Plugin for simple contextMenu handling
3
+ *
4
+ * Version: 1.5.20
5
+ *
6
+ * Authors: Rodney Rehm, Addy Osmani (patches for FF)
7
+ * Web: http://medialize.github.com/jQuery-contextMenu/
8
+ *
9
+ * Licensed under
10
+ * MIT License http://www.opensource.org/licenses/mit-license
11
+ * GPL v3 http://opensource.org/licenses/GPL-3.0
12
+ *
13
+ */
14
+
15
+ .context-menu-list {
16
+ margin:0;
17
+ padding:0;
18
+
19
+ min-width: 120px;
20
+ max-width: 250px;
21
+ display: inline-block;
22
+ position: absolute;
23
+ list-style-type: none;
24
+
25
+ border: 1px solid #DDD;
26
+ background: #EEE;
27
+
28
+ -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
29
+ -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
30
+ -ms-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
31
+ -o-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
32
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
33
+
34
+ font-family: Verdana, Arial, Helvetica, sans-serif;
35
+ font-size: 11px;
36
+ }
37
+
38
+ .context-menu-item {
39
+ padding: 2px 2px 2px 24px;
40
+ background-color: #EEE;
41
+ position: relative;
42
+ -webkit-user-select: none;
43
+ -moz-user-select: -moz-none;
44
+ -ms-user-select: none;
45
+ user-select: none;
46
+ }
47
+
48
+ .context-menu-separator {
49
+ padding-bottom:0;
50
+ border-bottom: 1px solid #DDD;
51
+ }
52
+
53
+ .context-menu-item > label > input,
54
+ .context-menu-item > label > textarea {
55
+ -webkit-user-select: text;
56
+ -moz-user-select: text;
57
+ -ms-user-select: text;
58
+ user-select: text;
59
+ }
60
+
61
+ .context-menu-item.hover {
62
+ cursor: pointer;
63
+ background-color: #39F;
64
+ }
65
+
66
+ .context-menu-item.disabled {
67
+ color: #666;
68
+ }
69
+
70
+ .context-menu-input.hover,
71
+ .context-menu-item.disabled.hover {
72
+ cursor: default;
73
+ background-color: #EEE;
74
+ }
75
+
76
+ .context-menu-submenu:after {
77
+ content: ">";
78
+ color: #666;
79
+ position: absolute;
80
+ top: 0;
81
+ right: 3px;
82
+ z-index: 1;
83
+ }
84
+
85
+ /* icons
86
+ #protip:
87
+ In case you want to use sprites for icons (which I would suggest you do) have a look at
88
+ http://css-tricks.com/13224-pseudo-spriting/ to get an idea of how to implement
89
+ .context-menu-item.icon:before {}
90
+ */
91
+ .context-menu-item.icon { min-height: 18px; background-repeat: no-repeat; background-position: 4px 2px; }
92
+ .context-menu-item.icon-edit { background-image: url(images/page_white_edit.png); }
93
+ .context-menu-item.icon-cut { background-image: url(images/cut.png); }
94
+ .context-menu-item.icon-copy { background-image: url(images/page_white_copy.png); }
95
+ .context-menu-item.icon-paste { background-image: url(images/page_white_paste.png); }
96
+ .context-menu-item.icon-delete { background-image: url(images/page_white_delete.png); }
97
+ .context-menu-item.icon-quit { background-image: url(images/door.png); }
98
+
99
+ /* vertically align inside labels */
100
+ .context-menu-input > label > * { vertical-align: top; }
101
+
102
+ /* position checkboxes and radios as icons */
103
+ .context-menu-input > label > input[type="checkbox"],
104
+ .context-menu-input > label > input[type="radio"] {
105
+ margin-left: -17px;
106
+ }
107
+ .context-menu-input > label > span {
108
+ margin-left: 5px;
109
+ }
110
+
111
+ .context-menu-input > label,
112
+ .context-menu-input > label > input[type="text"],
113
+ .context-menu-input > label > textarea,
114
+ .context-menu-input > label > select {
115
+ display: block;
116
+ width: 100%;
117
+
118
+ -webkit-box-sizing: border-box;
119
+ -moz-box-sizing: border-box;
120
+ -ms-box-sizing: border-box;
121
+ -o-box-sizing: border-box;
122
+ box-sizing: border-box;
123
+ }
124
+
125
+ .context-menu-input > label > textarea {
126
+ height: 100px;
127
+ }
128
+ .context-menu-item > .context-menu-list {
129
+ display: none;
130
+ /* re-positioned by js */
131
+ right: -5px;
132
+ top: 5px;
133
+ }
134
+
135
+ .context-menu-item.hover > .context-menu-list {
136
+ display: block;
137
+ }
138
+
139
+ .context-menu-accesskey {
140
+ text-decoration: underline;
141
+ }
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jquery_context_menu-rails
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.4
6
+ platform: ruby
7
+ authors:
8
+ - Bill Dieter
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-07-10 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: jquery-rails
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: rails
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: "3.1"
35
+ type: :development
36
+ version_requirements: *id002
37
+ description: This gem provides jQuery-contextMenufor your Rails 3.1 application. (jQuery-contextMenu source code is at https://github.com/medialize/jQuery-contextMenu.git)
38
+ email:
39
+ - dieter@acm.org
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - .gitignore
48
+ - README.md
49
+ - jquery_context_menu-rails.gemspec
50
+ - lib/jquery_context_menu-rails.rb
51
+ - lib/jquery_context_menu/rails.rb
52
+ - lib/jquery_context_menu/rails/engine.rb
53
+ - lib/jquery_context_menu/rails/version.rb
54
+ - vendor/assets/images/cut.png
55
+ - vendor/assets/images/door.png
56
+ - vendor/assets/images/page_white_copy.png
57
+ - vendor/assets/images/page_white_delete.png
58
+ - vendor/assets/images/page_white_edit.png
59
+ - vendor/assets/images/page_white_paste.png
60
+ - vendor/assets/javascripts/jquery.contextMenu.js
61
+ - vendor/assets/javascripts/jquery.ui.position.js
62
+ - vendor/assets/stylesheets/jquery.contextMenu.css
63
+ homepage: https://github.com/wrdieter/jquery_context_menu-rails
64
+ licenses: []
65
+
66
+ post_install_message:
67
+ rdoc_options: []
68
+
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 1.3.6
83
+ requirements: []
84
+
85
+ rubyforge_project:
86
+ rubygems_version: 1.8.22
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: Use jQuery-contextMenu with Rails 3
90
+ test_files: []
91
+