vidl-toolbox 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,7 +10,8 @@ spec = Gem::Specification.new do |s|
10
10
  s.summary = %q{Davids toolbox to speedup development with rails (mainly view).}
11
11
  s.homepage = %q{http://github.com/vidl/toolbox}
12
12
  s.description = %q{This toolbox goes in the direction of the django admin interface.}
13
- s.files = FileList["[A-Z]*", "{lib,locale,view}/**/*"]
13
+ s.rubyforge_project = %q{toolbox}
14
+ s.files = FileList["[A-Z]*", "{lib,locale,view,public}/**/*"]
14
15
 
15
16
  # rdoc
16
17
  s.has_rdoc = true
@@ -21,6 +22,7 @@ spec = Gem::Specification.new do |s|
21
22
  s.add_dependency "actionpack", ">= 2.1.1"
22
23
  s.add_dependency "gettext", ">= 1.92.0"
23
24
  s.add_dependency "mislav-will_paginate", ">= 2.3.3"
25
+ s.add_dependency "calendar_date_select", ">= 1.15.0"
24
26
 
25
27
  end
26
28
 
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Toolbox
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,498 @@
1
+ /*
2
+ popup.js
3
+
4
+ A lightweight general purpose JavaScript DOM element popup class.
5
+
6
+ Webpage:
7
+ http://www.methods.co.nz/popup/popup.html
8
+
9
+ Inspired by:
10
+ Lightbox2: http://www.huddletogether.com/projects/lightbox2/
11
+ Lightbox Gone Wild: http://particletree.com/features/lightbox-gone-wild/
12
+ Tooltip: http://blog.innerewut.de/pages/tooltip
13
+ Prototype library: http://www.prototypejs.org/
14
+ Scriptaculous library: http://script.aculo.us/
15
+
16
+ Attributions:
17
+ - Uses the getPageSize() function from Lightbox v2.02 by Lokesh Dhakar
18
+ (http://www.huddletogether.com/projects/lightbox2/).
19
+ - Adapted the the modal overlay technique used in Lightbox v2.02 by Lokesh
20
+ Dhakar (http://www.huddletogether.com/projects/lightbox2/).
21
+
22
+ Version: 1.0.1
23
+
24
+ Author: Stuart Rackham <srackham@methods.co.nz>
25
+ License: This source code is released under the MIT license.
26
+
27
+ Copyright (c) Stuart Rackham 2007
28
+
29
+ */
30
+
31
+ var Popup = Class.create();
32
+ Popup.zIndex = 800; // z-index of first popup.
33
+
34
+ Popup.prototype = {
35
+
36
+ /*
37
+ Popup creation
38
+ */
39
+ initialize: function(popup, link) {
40
+ var options = Object.extend({
41
+ modal: false,
42
+ menu: false,
43
+ disable_auto_hide: false,
44
+ effect: 'fade',
45
+ hidden: true,
46
+ closebox: 'popup_closebox', // CSS class name of click-to-close elements.
47
+ draghandle: 'popup_draghandle' // CSS class name of drag handle elements.
48
+ }, arguments[2] || {});
49
+ options.position = options.position || (options.modal ? 'center' : 'auto');
50
+ options.trigger = options.trigger || (options.modal | options.menu ? 'click' : 'mouseover');
51
+ options.duration = this.first_value(options.duration, Popup.duration, 0.5);
52
+ options.show_duration = this.first_value(options.show_duration, options.duration);
53
+ options.hide_duration = this.first_value(options.hide_duration, options.duration);
54
+ options.opacity = this.first_value(options.opacity, Popup.opacity, 0.5);
55
+ options.show_delay = this.first_value(options.show_delay, Popup.show_delay, 500);
56
+ options.hide_delay = this.first_value(options.hide_delay, Popup.hide_delay, 200);
57
+ options.cursor_margin = this.first_value(options.cursor_margin, Popup.cursor_margin, 5);
58
+ this.options = options;
59
+ if (link) {
60
+ this.link = $(link);
61
+ }
62
+ this.popup = $(popup);
63
+ this.popup.popup = this; // Make the popup object a property of the DOM popup element.
64
+ if (options.hidden) {
65
+ this.popup.hide();
66
+ }
67
+ if (options.closebox) {
68
+ this.closeboxes = document.getElementsByClassName(options.closebox, this.popup);
69
+ if (this.popup.hasClassName(options.closebox)) {
70
+ this.closeboxes[this.closeboxes.length] = this.popup;
71
+ }
72
+ }
73
+ else {
74
+ this.closeboxes = [];
75
+ }
76
+ if (options.draghandle) {
77
+ var draghandles = document.getElementsByClassName(options.draghandle, this.popup);
78
+ for (i = 0; i < draghandles.length; i++) {
79
+ new Draggable(this.popup, { handle: draghandles[i] });
80
+ }
81
+ if (this.popup.hasClassName(options.draghandle)) {
82
+ new Draggable(this.popup, { handle: this.popup });
83
+ }
84
+ }
85
+ this.register_events();
86
+ },
87
+
88
+
89
+ /*
90
+ Event functions
91
+ */
92
+
93
+ register_events: function() {
94
+ var trigger_function;
95
+ if (this.is_auto_open()) {
96
+ trigger_function = this.start_show_timer;
97
+ if (this.link) {
98
+ Event.observe(this.link, 'mouseout', this.stop_show_timer.bindAsEventListener(this));
99
+ }
100
+ }
101
+ else {
102
+ trigger_function = this.show;
103
+ }
104
+ if (this.link) {
105
+ Event.observe(this.link, this.options.trigger, trigger_function.bindAsEventListener(this));
106
+ }
107
+ if (!this.options.modal) {
108
+ Event.observe(this.popup, 'click', this.bring_to_front.bindAsEventListener(this));
109
+ }
110
+ if (this.closeboxes.length > 0 || this.options.disable_auto_hide || this.options.menu) {
111
+ for (var i = 0; i < this.closeboxes.length; i++) {
112
+ Event.observe(this.closeboxes[i], 'click', this.hide.bindAsEventListener(this));
113
+ }
114
+ }
115
+ else {
116
+ if (this.link) {
117
+ Event.observe(this.link, 'mouseout', this.start_hide_timer.bindAsEventListener(this));
118
+ }
119
+ Event.observe(this.popup, 'mouseover', this.stop_hide_timer.bindAsEventListener(this));
120
+ Event.observe(this.popup, 'mouseout', this.start_hide_timer.bindAsEventListener(this));
121
+ }
122
+ },
123
+
124
+ bring_to_front: function(event) {
125
+ // Bring to front if not already there.
126
+ if (Number(this.popup.style.zIndex) < Popup.zIndex - 1) {
127
+ this.popup.style.zIndex = Popup.zIndex++;
128
+ }
129
+ },
130
+
131
+ start_show_timer: function(event) {
132
+ // NOTE: event is bound to this.show but it's state changes between being
133
+ // bound here and arriving at this.show -- specifically, the mouse
134
+ // coordinates are reset to zero). I've no idea why. Anyway, this is the
135
+ // reason for passing the event mouse coordinates as properties of this.
136
+ this.stop_show_timer(event);
137
+ this.mouse_x = Event.pointerX(event);
138
+ this.mouse_y = Event.pointerY(event);
139
+ this.show_timer = setTimeout(this.show.bind(this, event), this.options.show_delay);
140
+ },
141
+
142
+ stop_show_timer: function(event) {
143
+ if (this.show_timer) {
144
+ clearTimeout(this.show_timer);
145
+ this.show_timer = null;
146
+ }
147
+ },
148
+
149
+ start_hide_timer: function(event) {
150
+ this.stop_hide_timer(event);
151
+ this.hide_timer = setTimeout(this.hide.bind(this, event), this.options.hide_delay);
152
+ },
153
+
154
+ stop_hide_timer: function(event) {
155
+ if (this.hide_timer) {
156
+ clearTimeout(this.hide_timer);
157
+ this.hide_timer = null;
158
+ }
159
+ },
160
+
161
+ show: function(event) {
162
+ this.stop_show_timer(event);
163
+ this.stop_hide_timer(event);
164
+ if (this.is_open) {
165
+ return;
166
+ }
167
+ if (this.options.menu) {
168
+ if(event)
169
+ event.stop();
170
+ document.observe('click', this.hide.bindAsEventListener(this));
171
+ }
172
+ if (this.options.modal) {
173
+ this.show_overlay();
174
+ }
175
+ var pos;
176
+ if (!event) {
177
+ // We only arrive here if this.show has been called externally.
178
+ pos = this.get_popup_position();
179
+ }
180
+ else if (this.is_auto_open()) {
181
+ // Because auto-open popups calls this.show indirectly via start_show_timer.
182
+ pos = this.get_popup_position(this.mouse_x, this.mouse_y);
183
+ }
184
+ else {
185
+ pos = this.get_popup_position(Event.pointerX(event), Event.pointerY(event));
186
+ }
187
+ Element.setStyle(this.popup, { top: pos.y, left: pos.x, zIndex: Popup.zIndex++ });
188
+ this.is_open = true;
189
+ switch (this.options.effect) {
190
+ case 'slide':
191
+ Effect.SlideDown(this.popup, {duration: this.options.show_duration});
192
+ break;
193
+ case 'grow':
194
+ Effect.Grow(this.popup, {duration: this.options.show_duration});
195
+ break;
196
+ case 'blind':
197
+ Effect.BlindDown(this.popup, {duration: this.options.show_duration});
198
+ break;
199
+ case 'fade':
200
+ default:
201
+ Effect.Appear(this.popup, {duration: this.options.show_duration});
202
+ break;
203
+ }
204
+ },
205
+
206
+ hide: function(event){
207
+ this.is_open = false;
208
+ if (this.options.menu)
209
+ document.stopObserving('click', this.hide);
210
+ switch (this.options.effect) {
211
+ case 'slide':
212
+ Effect.SlideUp(this.popup, {duration: this.options.hide_duration});
213
+ break;
214
+ case 'grow':
215
+ Effect.Shrink(this.popup, {duration: this.options.hide_duration});
216
+ break;
217
+ case 'blind':
218
+ Effect.BlindUp(this.popup, {duration: this.options.hide_duration});
219
+ break;
220
+ case 'fade':
221
+ default:
222
+ Effect.Fade(this.popup, {duration: this.options.hide_duration});
223
+ break;
224
+ }
225
+ if (this.options.modal) {
226
+ this.hide_overlay();
227
+ }
228
+ },
229
+
230
+
231
+ /*
232
+ Helper functions
233
+ */
234
+
235
+ // Return the first function argument that is not undefined.
236
+ // Because when zero numerical value are possible you can't use || chains.
237
+ first_value: function() {
238
+ for (var i = 0; i < arguments.length; i++) {
239
+ if (arguments[i] !== undefined) {
240
+ return arguments[i];
241
+ }
242
+ }
243
+ return undefined;
244
+ },
245
+
246
+ is_auto_open: function() {
247
+ return this.options.trigger == 'mouseover';
248
+ },
249
+
250
+ show_overlay: function() {
251
+ if (!Popup.overlay) {
252
+ var overlay = document.createElement('div');
253
+ overlay.setAttribute('id','popup_overlay');
254
+ overlay.style.display = 'none';
255
+ document.body.appendChild(overlay);
256
+ Popup.overlay = overlay;
257
+ Popup.overlay_levels = [];
258
+ }
259
+ Popup.overlay.style.height = this.get_page_dimensions().height + 'px';
260
+ var z = Popup.zIndex++;
261
+ Popup.overlay.style.zIndex = z;
262
+ Popup.overlay_levels.push(z);
263
+ if ( Popup.overlay_levels.length == 1) { // Opening the first modal popup.
264
+ // Queue the global overlay effect to ensure correct execution order.
265
+ new Effect.Appear(Popup.overlay,
266
+ { duration: this.options.show_duration,
267
+ to: this.options.opacity,
268
+ queue: {position: 'end', scope: 'popup_overlay'}
269
+ });
270
+ }
271
+ else { // There is another modal popup at a lower level so move the overlay forward.
272
+ Popup.overlay.style.zIndex = z;
273
+ }
274
+ },
275
+
276
+ hide_overlay: function() {
277
+ Popup.overlay_levels.pop();
278
+ var z = Popup.overlay_levels.pop();
279
+ if (z) { // There is another modal popup at a lower level so move the overlay back.
280
+ Popup.overlay_levels.push(z);
281
+ Popup.overlay.style.zIndex = z;
282
+ }
283
+ else { // The last modal popup is being closed so hide the overlay
284
+ // Queue the global overlay effect to ensure correct execution order.
285
+ new Effect.Fade(Popup.overlay,
286
+ { duration: this.options.hide_duration,
287
+ queue: {position: 'end', scope: 'popup_overlay'}
288
+ });
289
+ }
290
+ },
291
+
292
+
293
+ /*
294
+ Positioning functions
295
+ */
296
+
297
+ // Return the top and left CSS position strings as an {x,y} object that the
298
+ // popup should be shown at. mouse_x and mouse_y are the mouse x,y coordinates
299
+ // numbers when the popup was triggered.
300
+ get_popup_position: function(mouse_x, mouse_y) {
301
+ var pos;
302
+ switch (this.options.position) {
303
+ case 'auto':
304
+ pos = this.get_auto_position(mouse_x, mouse_y);
305
+ break;
306
+ case 'center':
307
+ pos = this.get_center_position();
308
+ break;
309
+ case 'below':
310
+ pos = this.get_below_position();
311
+ break;
312
+ default:
313
+ // Check for x,y postion format (x and y can be any valid CSS left or
314
+ // top property value).
315
+ if (mo = this.options.position.match(/^\s*([^\s,]+)\s*,\s*([^\s,]+)\s*$/)) {
316
+ pos = {x: mo[1], y: mo[2]};
317
+ // If possible convert to numbers.
318
+ pos.x = Number(pos.x) || pos.x;
319
+ pos.y = Number(pos.y) || pos.y;
320
+ }
321
+ else {
322
+ pos = {x: 0, y: 0};
323
+ }
324
+ break;
325
+ }
326
+ if (typeof pos.x == 'number') {
327
+ pos.x += 'px';
328
+ }
329
+ if (typeof pos.y == 'number') {
330
+ pos.y += 'px';
331
+ }
332
+ return pos;
333
+ },
334
+
335
+ get_below_position: function() {
336
+ var pos = Position.cumulativeOffset(this.link);
337
+ return {x: pos[0], y: pos[1] + Element.getHeight(this.link)};
338
+ },
339
+
340
+ get_center_position: function() {
341
+ dim = Element.getDimensions(this.popup);
342
+ var popup_width = dim.width;
343
+ var popup_height = dim.height;
344
+ dim = this.get_viewport_dimensions();
345
+ var viewport_width = dim.width;
346
+ var viewport_height = dim.height;
347
+
348
+ var x;
349
+ if (popup_width >= viewport_width) {
350
+ x = 0;
351
+ }
352
+ else {
353
+ x = (viewport_width - popup_width)/2;
354
+ }
355
+
356
+ var y;
357
+ if (popup_height >= viewport_height) {
358
+ y = 0;
359
+ }
360
+ else {
361
+ y = (viewport_height - popup_height)/2;
362
+ }
363
+
364
+ y += this.getScrollXY()[1];
365
+ return {x: x, y: y};
366
+ },
367
+
368
+ getScrollXY: function() {
369
+ var scrOfX = 0, scrOfY = 0;
370
+ if( typeof( window.pageYOffset ) == 'number' ) {
371
+ //Netscape compliant
372
+ scrOfY = window.pageYOffset;
373
+ scrOfX = window.pageXOffset;
374
+ } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
375
+ //DOM compliant
376
+ scrOfY = document.body.scrollTop;
377
+ scrOfX = document.body.scrollLeft;
378
+ } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
379
+ //IE6 standards compliant mode
380
+ scrOfY = document.documentElement.scrollTop;
381
+ scrOfX = document.documentElement.scrollLeft;
382
+ }
383
+ return [ scrOfX, scrOfY ];
384
+ },
385
+
386
+ get_auto_position: function(mouse_x, mouse_y) {
387
+ dim = Element.getDimensions(this.popup);
388
+ var popup_width = dim.width;
389
+ var popup_height = dim.height;
390
+ dim = this.get_viewport_dimensions();
391
+ var viewport_width = dim.width;
392
+ var viewport_height = dim.height;
393
+
394
+ var available_right = viewport_width - (mouse_x + this.options.cursor_margin);
395
+ var available_left = mouse_x - this.options.cursor_margin;
396
+ var available_top = mouse_y - this.options.cursor_margin;
397
+ var available_bottom = viewport_height - (mouse_x + this.options.cursor_margin);
398
+ var offset = this.options.cursor_margin;
399
+ var x = mouse_x;
400
+ var y = mouse_y;
401
+
402
+ if (popup_width >= viewport_width) {
403
+ x = 0;
404
+ }
405
+ else if (popup_width <= available_right) {
406
+ x += offset;
407
+ }
408
+ else if (popup_width <= available_left) {
409
+ x -= popup_width + offset;
410
+ }
411
+ else if (available_right >= available_left) {
412
+ x = viewport_width - popup_width;
413
+ }
414
+ else {
415
+ x = 0;
416
+ }
417
+
418
+ if (popup_height >= viewport_height) {
419
+ y = 0;
420
+ }
421
+ else if (popup_height <= available_bottom) {
422
+ y += offset;
423
+ }
424
+ else if (popup_height <= available_top) {
425
+ y -= popup_height + offset;
426
+ }
427
+ else if (available_bottom >= available_top) {
428
+ y = viewport_height - popup_height;
429
+ }
430
+ else {
431
+ y = 0;
432
+ }
433
+
434
+ return {x: x, y: y};
435
+ },
436
+
437
+ get_viewport_dimensions: function() {
438
+ var dim = this.getPageSize();
439
+ return {width: dim[2], height: dim[3]};
440
+ },
441
+
442
+ get_page_dimensions: function() {
443
+ var dim = this.getPageSize();
444
+ return {width: dim[0], height: dim[1]};
445
+ },
446
+
447
+ // This function from Lightbox v2.02 by Lokesh Dhakar
448
+ // (http://www.huddletogether.com/projects/lightbox2/).
449
+ //
450
+ // Returns array with page width, height and window width, height
451
+ // Core code from - quirksmode.org
452
+ // Edit for Firefox by pHaez
453
+ //
454
+ getPageSize: function() {
455
+ var xScroll, yScroll;
456
+
457
+ if (window.innerHeight && window.scrollMaxY) {
458
+ xScroll = document.body.scrollWidth;
459
+ yScroll = window.innerHeight + window.scrollMaxY;
460
+ } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
461
+ xScroll = document.body.scrollWidth;
462
+ yScroll = document.body.scrollHeight;
463
+ } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
464
+ xScroll = document.body.offsetWidth;
465
+ yScroll = document.body.offsetHeight;
466
+ }
467
+
468
+ var windowWidth, windowHeight;
469
+ if (self.innerHeight) { // all except Explorer
470
+ windowWidth = self.innerWidth;
471
+ windowHeight = self.innerHeight;
472
+ } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
473
+ windowWidth = document.documentElement.clientWidth;
474
+ windowHeight = document.documentElement.clientHeight;
475
+ } else if (document.body) { // other Explorers
476
+ windowWidth = document.body.clientWidth;
477
+ windowHeight = document.body.clientHeight;
478
+ }
479
+
480
+ // for small pages with total height less then height of the viewport
481
+ if(yScroll < windowHeight){
482
+ pageHeight = windowHeight;
483
+ } else {
484
+ pageHeight = yScroll;
485
+ }
486
+
487
+ // for small pages with total width less then width of the viewport
488
+ if(xScroll < windowWidth){
489
+ pageWidth = windowWidth;
490
+ } else {
491
+ pageWidth = xScroll;
492
+ }
493
+
494
+ arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
495
+ return arrayPageSize;
496
+ }
497
+
498
+ }
@@ -0,0 +1,18 @@
1
+ // Place your application-specific JavaScript functions and classes here
2
+ // This file is automatically included by javascript_include_tag :defaults
3
+
4
+ function auto_complete_update_hidden(el, selectedElement) {
5
+ var nodes = $(selectedElement).select('.autocomplete_id') || [];
6
+ var value = '';
7
+ if(nodes.length > 0)
8
+ value = Element.collectTextNodes(nodes[0], '.autocomplete_id');
9
+
10
+ $(el.id + '_id').value = value;
11
+ }
12
+
13
+ function show_context_menu(event, url) {
14
+ if (!event) var event = window.event; // IE
15
+ Element.update("context_menu_id", "<img alt=\"Spinner\" src=\"/images/toolbox/spinner.gif\" />");
16
+ $('context_menu_id').popup.show(event);
17
+ new Ajax.Request(url, {asynchronous:true, evalScripts:true, method:'get'});
18
+ }
@@ -0,0 +1,168 @@
1
+ /* GENERAL STYLES */
2
+
3
+ div.menu {
4
+ position: absolute;
5
+ top: 0;
6
+ left: 0;
7
+ font-family: verdana;
8
+ }
9
+ div.menu a {
10
+ display: block;
11
+ text-decoration: none;
12
+ cursor: default;
13
+ outline: none;
14
+ font-size: 11px;
15
+ }
16
+ .menu .separator {
17
+ height: 1px;
18
+ padding: 0;
19
+ overflow: hidden;
20
+ display: block;
21
+ font-size: 1px;
22
+ }
23
+ .menu ul, .menu li {
24
+ margin: 0;
25
+ padding: 0;
26
+ list-style: none;
27
+ }
28
+ .menu li {
29
+ list-style-position: outside;
30
+ }
31
+
32
+
33
+ /* FIREFOX STYLES */
34
+
35
+ .menu.firefox {
36
+ width: 12em;
37
+ background: #F4F5EB;
38
+ border-top: 1px solid #ddd;
39
+ border-left: 1px solid #ddd;
40
+ border-right: 1px solid #666;
41
+ border-bottom: 1px solid #666;
42
+ padding: 2px 0;
43
+ }
44
+ .menu.firefox a {
45
+ color: #555;
46
+ padding: 4px 15px;
47
+ margin: 0 2px;
48
+ }
49
+ .menu.firefox a:hover {
50
+ background: #006;
51
+ color: #fff;
52
+ }
53
+ .menu.firefox a.disabled {
54
+ color: #bbb;
55
+ }
56
+ .menu.firefox a.disabled:hover {
57
+ background: #F4F5EB;
58
+ color: #bbb;
59
+ }
60
+ .menu.firefox .separator {
61
+ border-bottom: 1px solid #fff;
62
+ background: #999;
63
+ margin: 2px 4px;
64
+ }
65
+
66
+
67
+ /* GOOGLE STYLES */
68
+
69
+ .menu.google {
70
+ width: 10.5em;
71
+ background: #fff;
72
+ border-top: 1px solid #ccc;
73
+ border-left: 1px solid #ccc;
74
+ border-bottom: 1px solid #676767;
75
+ border-right: 1px solid #676767;
76
+ }
77
+ .menu.google a {
78
+ color: #00c;
79
+ text-decoration: none;
80
+ padding: 2px 5px;
81
+ cursor: pointer;
82
+ font-size: 12px;
83
+ }
84
+ .menu.google a:hover {
85
+ background: #D3E3FE;
86
+ }
87
+ .menu.google a.disabled {
88
+ color: #bbb;
89
+ }
90
+ .menu.google a.disabled:hover {
91
+ background: #fff;
92
+ color: #bbb;
93
+ }
94
+ .menu.google .separator {
95
+ background: #ccc;
96
+ }
97
+
98
+ /* DESKTOP STYLES */
99
+
100
+ .menu.desktop {
101
+ width: 14em;
102
+ background: #f9f8f7;
103
+ border: 1px solid #999;
104
+ padding: 0;
105
+ }
106
+ .menu.desktop ul, .menu.desktop li {
107
+ margin: 0;
108
+ padding: 0;
109
+ }
110
+ .menu.desktop li.separator {
111
+ height: 1px;
112
+ }
113
+ .menu.desktop a {
114
+ color: #555;
115
+ padding: 3px 0 3px 25px;
116
+ margin: 0;
117
+ border: 1px solid #f9f8f7;
118
+ }
119
+ .menu.desktop a.disabled {
120
+ opacity: 0.25;
121
+ filter: alpha(opacity=25);
122
+ zoom: 1;
123
+ }
124
+ .menu.desktop li.separator {
125
+ border-bottom: 1px solid #fff;
126
+ background: #aaa;
127
+ margin: 1px 1px 0 1px;
128
+ line-height: 1px !important;
129
+ }
130
+
131
+ .menu.desktop a.show {
132
+ background: #f9f8f7 url(/images/toolbox/page.png) 2px 50% no-repeat;
133
+ }
134
+ .menu.desktop a.new {
135
+ background: #f9f8f7 url(/images/toolbox/page_add.png) 2px 50% no-repeat;
136
+ }
137
+ .menu.desktop a.list {
138
+ background: #f9f8f7 url(/images/toolbox/page_list.png) 2px 50% no-repeat;
139
+ }
140
+ .menu.desktop a.edit {
141
+ background: #f9f8f7 url(/images/toolbox/page_edit.png) 2px 50% no-repeat;
142
+ }
143
+ .menu.desktop a.copy {
144
+ background: #f9f8f7 url(/images/toolbox/page_copy.png) 2px 50% no-repeat;
145
+ }
146
+ .menu.desktop a.destroy {
147
+ background: #f9f8f7 url(/images/toolbox/page_delete.png) 2px 50% no-repeat;
148
+ }
149
+ .menu.desktop a.save {
150
+ background: #f9f8f7 url(/images/toolbox/page_save.png) 2px 50% no-repeat;
151
+ }
152
+ .menu.desktop a.xsl {
153
+ background: #f9f8f7 url(/images/toolbox/page_excel.png) 2px 50% no-repeat;
154
+ }
155
+ .menu.desktop a.doc {
156
+ background: #f9f8f7 url(/images/toolbox/page_word.png) 2px 50% no-repeat;
157
+ }
158
+ .menu.desktop a.pdf {
159
+ background: #f9f8f7 url(/images/toolbox/page_acrobat.png) 2px 50% no-repeat;
160
+ }
161
+ .menu.desktop a.send {
162
+ background: #f9f8f7 url(/images/toolbox/email.png) 2px 50% no-repeat;
163
+ }
164
+ /* we need explicit enabled class to overcome css deficiences (without creating unnecessary markup) */
165
+ .menu.desktop a.enabled:hover {
166
+ background-color: #0A246A;
167
+ color: #fff;
168
+ }
@@ -0,0 +1,30 @@
1
+ /*
2
+ popup.js
3
+ */
4
+ div.popup {
5
+ max-width: 600px;
6
+ border: 1px solid red;
7
+ padding: 5px;
8
+ background-color: white;
9
+ /* The following properties should not be changed */
10
+ position: absolute;
11
+ }
12
+
13
+ #popup_overlay {
14
+ background-color: black;
15
+ /* The following properties should not be changed */
16
+ position: absolute;
17
+ top: 0;
18
+ left: 0;
19
+ width: 100%;
20
+ height: 500px;
21
+ }
22
+
23
+ span.popup_link, a.popup_link {
24
+ cursor: pointer;
25
+ border-bottom: 1px dotted;
26
+ }
27
+
28
+ .popup_draghandle {
29
+ cursor: move;
30
+ }
@@ -0,0 +1,107 @@
1
+
2
+ td.record, td.record-title {
3
+ padding: 3px 4px;
4
+ background-color: #fff;
5
+ /*border-bottom: solid 1px #cc341f;
6
+ border-left: solid 1px #cc341f;*/
7
+ }
8
+
9
+ tr:hover td.record {
10
+ background-color: lightblue; /*#cc341f;*/
11
+ color: black;
12
+ /*cursor: pointer; */
13
+ /*border-left: solid 1px white;*/
14
+ }
15
+
16
+ td.even-record {
17
+ background-color: #ccc;
18
+ }
19
+
20
+ td.record-title {
21
+ background-color: #fff;
22
+ border-bottom: solid 2px #cc341f;
23
+ }
24
+
25
+ a.sort-asc:after {
26
+ content: url(/images/toolbox/arrow_up.gif);
27
+ }
28
+
29
+ a.sort-desc:after {
30
+ content: url(/images/toolbox/arrow_down.gif);
31
+ }
32
+
33
+ a.sort-none:after {
34
+ content: url(/images/clear.gif);
35
+ width: 16px;
36
+ height: 7px;
37
+ }
38
+
39
+ fieldset {
40
+ float: left;
41
+ }
42
+
43
+ .error {
44
+ background-color: red;
45
+ }
46
+
47
+ div.show_value {
48
+ float: left;
49
+ }
50
+
51
+ div.show_value ul {
52
+ margin:0;
53
+ padding:0;
54
+ width:100%;
55
+ list-style-type:none;
56
+ }
57
+
58
+ div.show_value ul li {
59
+ margin: 0;
60
+ }
61
+
62
+ div.toolbar
63
+ {
64
+ clear: left;
65
+ padding-top: 5px;
66
+ }
67
+
68
+ div.searchfield {
69
+ float: right;
70
+ }
71
+
72
+ form {
73
+ display: inline;
74
+ }
75
+
76
+ form.inplaceeditor-form input {
77
+ margin-right: 10px;
78
+ }
79
+
80
+ div.auto_complete {
81
+ width: 350px;
82
+ background: #fff;
83
+ }
84
+
85
+ div.auto_complete ul {
86
+ border:1px solid #888;
87
+ margin:0;
88
+ padding:0;
89
+ width:100%;
90
+ list-style-type:none;
91
+ }
92
+
93
+ div.auto_complete ul li {
94
+ margin:0;
95
+ padding:3px;
96
+ }
97
+
98
+ div.auto_complete ul li.selected {
99
+ background-color: #ffb;
100
+ }
101
+
102
+ div.auto_complete ul strong.highlight {
103
+ color: #800;
104
+ margin:0;
105
+ padding:0;
106
+ }
107
+
@@ -0,0 +1,6 @@
1
+ <div id="dialog_id" class="popup" style="display:none"></div>
2
+ <%= javascript_tag "new Popup('dialog_id', null, {modal:true, disable_auto_hide: true, duration: 0.2});" %>
3
+
4
+ <div id="context_menu_id" class="menu desktop" style="display:none">
5
+ </div>
6
+ <%= javascript_tag "new Popup('context_menu_id', null, {menu:true, position:'auto', duration: 0.2});" %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidl-toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Nyffenegger
@@ -62,6 +62,16 @@ dependencies:
62
62
  - !ruby/object:Gem::Version
63
63
  version: 2.3.3
64
64
  version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: calendar_date_select
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 1.15.0
74
+ version:
65
75
  description: This toolbox goes in the direction of the django admin interface.
66
76
  email: vidl@sunrise.ch
67
77
  executables: []
@@ -90,6 +100,7 @@ files:
90
100
  - view/toolbox/_collection.html.erb
91
101
  - view/toolbox/_collection_header.html.erb
92
102
  - view/toolbox/_context_menu.html.erb
103
+ - view/toolbox/_dialogs.html.erb
93
104
  - view/toolbox/_form.html.erb
94
105
  - view/toolbox/_form_collection_row.html.erb
95
106
  - view/toolbox/_form_fieldset.html.erb
@@ -104,6 +115,33 @@ files:
104
115
  - view/toolbox/index.html.erb
105
116
  - view/toolbox/new.html.erb
106
117
  - view/toolbox/show.html.erb
118
+ - public/images
119
+ - public/images/add.png
120
+ - public/images/arrow_down.gif
121
+ - public/images/arrow_up.gif
122
+ - public/images/close.png
123
+ - public/images/edit.gif
124
+ - public/images/email.png
125
+ - public/images/page.png
126
+ - public/images/page_acrobat.png
127
+ - public/images/page_add.png
128
+ - public/images/page_copy.png
129
+ - public/images/page_delete.png
130
+ - public/images/page_edit.png
131
+ - public/images/page_excel.png
132
+ - public/images/page_list.png
133
+ - public/images/page_save.png
134
+ - public/images/page_word.png
135
+ - public/images/remove.png
136
+ - public/images/show.gif
137
+ - public/images/spinner.gif
138
+ - public/javascripts
139
+ - public/javascripts/popup.js
140
+ - public/javascripts/toolbox.js
141
+ - public/stylesheets
142
+ - public/stylesheets/context_menu.css
143
+ - public/stylesheets/popup.css
144
+ - public/stylesheets/toolbox.css
107
145
  has_rdoc: true
108
146
  homepage: http://github.com/vidl/toolbox
109
147
  post_install_message: