drg_cms 0.5.9 → 0.5.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.log +13 -0
- data/MIT-LICENSE +1 -1
- data/README.md +1 -1
- data/app/assets/javascripts/drg_cms/drg_cms.js +7 -0
- data/app/assets/javascripts/drg_cms/jquery-migrate.js +231 -40
- data/app/assets/javascripts/drg_cms_application.js +1 -1
- data/app/assets/javascripts/drg_cms_cms.js +1 -1
- data/app/assets/stylesheets/drg_cms/drg_cms.css +38 -18
- data/app/controllers/cmsedit_controller.rb +7 -8
- data/app/controllers/dc_application_controller.rb +0 -0
- data/app/helpers/cmsedit_helper.rb +25 -11
- data/app/helpers/dc_application_helper.rb +7 -7
- data/app/models/dc_filter.rb +1 -1
- data/app/models/drgcms_form_fields.rb +5 -3
- data/config/locales/datetimepicker.yml +2 -2
- data/config/locales/drgcms_en.yml +1 -0
- data/config/locales/drgcms_sl.yml +1 -0
- data/config/locales/en.yml +8 -2
- data/drg_cms.gemspec +3 -0
- data/lib/drg_cms/version.rb +1 -1
- data/test/test_helper.rb +2 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 731ea3ef7879ed33a901605b0a9dddb861d1ec31
|
4
|
+
data.tar.gz: 8760d04c45460f00c4083babcb75470d7bdd5b5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46394f7291cc085caf7957769d8f91bbf6ad3e1e282b6a83f49d7c32a7910c00e66b60855bb8cc3ee01259ef93c946158b93eed46d84cf585ba262d55b68b7f7
|
7
|
+
data.tar.gz: dd46dc3424bb88f5053f1d2e9d313f12f71553127754147ea4de7719645d57c6cd3b7c2f1c57baebaef489a05347efee310c85ab97d3dadeaf99aebd6aab418e
|
data/History.log
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
|
2
|
+
New features for DRG CMS version 0.5.10
|
3
|
+
|
4
|
+
jQuery javascript library forced to jQuery2
|
5
|
+
Choices for select fields are now UTF-8 sorted since MongoDB does not provide utf sorting.
|
6
|
+
Placeholder text added for text_autocomplete field. It can also be defined in form field html options.
|
7
|
+
|
8
|
+
Bugs resolved for DRG CMS version 0.5.10
|
9
|
+
|
10
|
+
jQuery migrate udated to version 1.3. This was required by jquery-rails gem which included latest version of jQuery which resulted in an runtime error.
|
11
|
+
Call before_new callback only when new empty record has been created.
|
12
|
+
|
13
|
+
--
|
14
|
+
|
2
15
|
New features for DRG CMS version 0.5.9
|
3
16
|
|
4
17
|
Main CMS menu was becoming to large and was divided into two menus.
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -27,7 +27,7 @@ Please see the DRG CMS website for up-to-date documentation:
|
|
27
27
|
License (MIT LICENCE)
|
28
28
|
---------------------
|
29
29
|
|
30
|
-
Copyright (c) 2012-
|
30
|
+
Copyright (c) 2012-2016 Damjan Rems
|
31
31
|
|
32
32
|
Permission is hereby granted, free of charge, to any person obtaining
|
33
33
|
a copy of this software and associated documentation files (the
|
@@ -140,6 +140,9 @@ process_json_result = function(json) {
|
|
140
140
|
case 'url':
|
141
141
|
window.location.href = val;
|
142
142
|
break;
|
143
|
+
case 'alert':
|
144
|
+
alert(val);
|
145
|
+
break;
|
143
146
|
case 'window':
|
144
147
|
w = window.open(val, what);
|
145
148
|
w.focus();
|
@@ -311,10 +314,14 @@ $(document).ready( function() {
|
|
311
314
|
type: req,
|
312
315
|
dataType: "json",
|
313
316
|
data: data,
|
317
|
+
// success: function(files,data,xhr) {
|
318
|
+
// document.getElementById('if_priponkas').contentDocument.location.reload(true);
|
319
|
+
// }
|
314
320
|
success: function(data) {
|
315
321
|
process_json_result(data);
|
316
322
|
$('#dc-spinner').toggleClass('div-hidden');
|
317
323
|
}
|
324
|
+
|
318
325
|
});
|
319
326
|
});
|
320
327
|
|
@@ -1,13 +1,15 @@
|
|
1
1
|
/*!
|
2
|
-
* jQuery Migrate - v1.
|
3
|
-
*
|
4
|
-
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
|
2
|
+
* jQuery Migrate - v1.3.0 - 2016-01-13
|
3
|
+
* Copyright jQuery Foundation and other contributors
|
5
4
|
*/
|
6
5
|
(function( jQuery, window, undefined ) {
|
7
6
|
// See http://bugs.jquery.com/ticket/13335
|
8
7
|
// "use strict";
|
9
8
|
|
10
9
|
|
10
|
+
jQuery.migrateVersion = "1.3.0";
|
11
|
+
|
12
|
+
|
11
13
|
var warnedAbout = {};
|
12
14
|
|
13
15
|
// List of warnings already given; public read only
|
@@ -17,8 +19,8 @@ jQuery.migrateWarnings = [];
|
|
17
19
|
// jQuery.migrateMute = false;
|
18
20
|
|
19
21
|
// Show a message on the console so devs know we're active
|
20
|
-
if ( !jQuery.migrateMute && window.console && console.log ) {
|
21
|
-
console.log("JQMIGRATE: Logging is active");
|
22
|
+
if ( !jQuery.migrateMute && window.console && window.console.log ) {
|
23
|
+
window.console.log("JQMIGRATE: Logging is active");
|
22
24
|
}
|
23
25
|
|
24
26
|
// Set to false to disable traces that appear with warnings
|
@@ -33,10 +35,11 @@ jQuery.migrateReset = function() {
|
|
33
35
|
};
|
34
36
|
|
35
37
|
function migrateWarn( msg) {
|
38
|
+
var console = window.console;
|
36
39
|
if ( !warnedAbout[ msg ] ) {
|
37
40
|
warnedAbout[ msg ] = true;
|
38
41
|
jQuery.migrateWarnings.push( msg );
|
39
|
-
if (
|
42
|
+
if ( console && console.warn && !jQuery.migrateMute ) {
|
40
43
|
console.warn( "JQMIGRATE: " + msg );
|
41
44
|
if ( jQuery.migrateTrace && console.trace ) {
|
42
45
|
console.trace();
|
@@ -151,7 +154,7 @@ jQuery.attr = function( elem, name, value, pass ) {
|
|
151
154
|
|
152
155
|
// Warn only for attributes that can remain distinct from their properties post-1.9
|
153
156
|
if ( ruseDefault.test( lowerName ) ) {
|
154
|
-
migrateWarn( "jQuery.fn.attr('" + lowerName + "')
|
157
|
+
migrateWarn( "jQuery.fn.attr('" + lowerName + "') might use property instead of attribute" );
|
155
158
|
}
|
156
159
|
}
|
157
160
|
|
@@ -189,36 +192,70 @@ jQuery.attrHooks.value = {
|
|
189
192
|
var matched, browser,
|
190
193
|
oldInit = jQuery.fn.init,
|
191
194
|
oldParseJSON = jQuery.parseJSON,
|
192
|
-
|
193
|
-
|
195
|
+
rspaceAngle = /^\s*</,
|
196
|
+
// Note: XSS check is done below after string is trimmed
|
197
|
+
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
|
194
198
|
|
195
199
|
// $(html) "looks like html" rule change
|
196
200
|
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
197
|
-
var match;
|
201
|
+
var match, ret;
|
198
202
|
|
199
203
|
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
|
200
|
-
(match = rquickExpr.exec( selector )) && match[
|
204
|
+
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
|
201
205
|
// This is an HTML string according to the "old" rules; is it still?
|
202
|
-
if (
|
206
|
+
if ( !rspaceAngle.test( selector ) ) {
|
203
207
|
migrateWarn("$(html) HTML strings must start with '<' character");
|
204
208
|
}
|
209
|
+
if ( match[ 3 ] ) {
|
210
|
+
migrateWarn("$(html) HTML text after last tag is ignored");
|
211
|
+
}
|
212
|
+
|
213
|
+
// Consistently reject any HTML-like string starting with a hash (#9521)
|
214
|
+
// Note that this may break jQuery 1.6.x code that otherwise would work.
|
215
|
+
if ( match[ 0 ].charAt( 0 ) === "#" ) {
|
216
|
+
migrateWarn("HTML string cannot start with a '#' character");
|
217
|
+
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
|
218
|
+
}
|
205
219
|
// Now process using loose rules; let pre-1.8 play too
|
206
220
|
if ( context && context.context ) {
|
207
221
|
// jQuery object as context; parseHTML expects a DOM object
|
208
222
|
context = context.context;
|
209
223
|
}
|
210
224
|
if ( jQuery.parseHTML ) {
|
211
|
-
return oldInit.call( this,
|
212
|
-
|
225
|
+
return oldInit.call( this,
|
226
|
+
jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
|
227
|
+
context || document, true ), context, rootjQuery );
|
228
|
+
}
|
229
|
+
}
|
230
|
+
|
231
|
+
// jQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
|
232
|
+
if ( selector === "#" ) {
|
233
|
+
migrateWarn( "jQuery( '#' ) is not a valid selector" );
|
234
|
+
selector = [];
|
235
|
+
}
|
236
|
+
|
237
|
+
ret = oldInit.apply( this, arguments );
|
238
|
+
|
239
|
+
// Fill in selector and context properties so .live() works
|
240
|
+
if ( selector && selector.selector !== undefined ) {
|
241
|
+
// A jQuery object, copy its properties
|
242
|
+
ret.selector = selector.selector;
|
243
|
+
ret.context = selector.context;
|
244
|
+
|
245
|
+
} else {
|
246
|
+
ret.selector = typeof selector === "string" ? selector : "";
|
247
|
+
if ( selector ) {
|
248
|
+
ret.context = selector.nodeType? selector : context || document;
|
213
249
|
}
|
214
250
|
}
|
215
|
-
|
251
|
+
|
252
|
+
return ret;
|
216
253
|
};
|
217
254
|
jQuery.fn.init.prototype = jQuery.fn;
|
218
255
|
|
219
256
|
// Let $.parseJSON(falsy_value) return null
|
220
257
|
jQuery.parseJSON = function( json ) {
|
221
|
-
if ( !json
|
258
|
+
if ( !json ) {
|
222
259
|
migrateWarn("jQuery.parseJSON requires a valid JSON string");
|
223
260
|
return null;
|
224
261
|
}
|
@@ -264,6 +301,11 @@ if ( !jQuery.browser ) {
|
|
264
301
|
// Warn if the code tries to get jQuery.browser
|
265
302
|
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
|
266
303
|
|
304
|
+
// jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7
|
305
|
+
jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");
|
306
|
+
migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" );
|
307
|
+
migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" );
|
308
|
+
|
267
309
|
jQuery.sub = function() {
|
268
310
|
function jQuerySub( selector, context ) {
|
269
311
|
return new jQuerySub.fn.init( selector, context );
|
@@ -274,11 +316,10 @@ jQuery.sub = function() {
|
|
274
316
|
jQuerySub.fn.constructor = jQuerySub;
|
275
317
|
jQuerySub.sub = this.sub;
|
276
318
|
jQuerySub.fn.init = function init( selector, context ) {
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
319
|
+
var instance = jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
320
|
+
return instance instanceof jQuerySub ?
|
321
|
+
instance :
|
322
|
+
jQuerySub( instance );
|
282
323
|
};
|
283
324
|
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
284
325
|
var rootjQuerySub = jQuerySub(document);
|
@@ -286,6 +327,57 @@ jQuery.sub = function() {
|
|
286
327
|
return jQuerySub;
|
287
328
|
};
|
288
329
|
|
330
|
+
// The number of elements contained in the matched element set
|
331
|
+
jQuery.fn.size = function() {
|
332
|
+
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
|
333
|
+
return this.length;
|
334
|
+
};
|
335
|
+
|
336
|
+
|
337
|
+
var internalSwapCall = false;
|
338
|
+
|
339
|
+
// If this version of jQuery has .swap(), don't false-alarm on internal uses
|
340
|
+
if ( jQuery.swap ) {
|
341
|
+
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
|
342
|
+
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
|
343
|
+
|
344
|
+
if ( oldHook ) {
|
345
|
+
jQuery.cssHooks[ name ].get = function() {
|
346
|
+
var ret;
|
347
|
+
|
348
|
+
internalSwapCall = true;
|
349
|
+
ret = oldHook.apply( this, arguments );
|
350
|
+
internalSwapCall = false;
|
351
|
+
return ret;
|
352
|
+
};
|
353
|
+
}
|
354
|
+
});
|
355
|
+
}
|
356
|
+
|
357
|
+
jQuery.swap = function( elem, options, callback, args ) {
|
358
|
+
var ret, name,
|
359
|
+
old = {};
|
360
|
+
|
361
|
+
if ( !internalSwapCall ) {
|
362
|
+
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
|
363
|
+
}
|
364
|
+
|
365
|
+
// Remember the old values, and insert the new ones
|
366
|
+
for ( name in options ) {
|
367
|
+
old[ name ] = elem.style[ name ];
|
368
|
+
elem.style[ name ] = options[ name ];
|
369
|
+
}
|
370
|
+
|
371
|
+
ret = callback.apply( elem, args || [] );
|
372
|
+
|
373
|
+
// Revert the old values
|
374
|
+
for ( name in options ) {
|
375
|
+
elem.style[ name ] = old[ name ];
|
376
|
+
}
|
377
|
+
|
378
|
+
return ret;
|
379
|
+
};
|
380
|
+
|
289
381
|
|
290
382
|
// Ensure that $.ajax gets the new parseJSON defined in core.js
|
291
383
|
jQuery.ajaxSetup({
|
@@ -314,13 +406,7 @@ jQuery.fn.data = function( name ) {
|
|
314
406
|
};
|
315
407
|
|
316
408
|
|
317
|
-
var rscriptType = /\/(java|ecma)script/i
|
318
|
-
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
319
|
-
|
320
|
-
jQuery.fn.andSelf = function() {
|
321
|
-
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
322
|
-
return oldSelf.apply( this, arguments );
|
323
|
-
};
|
409
|
+
var rscriptType = /\/(java|ecma)script/i;
|
324
410
|
|
325
411
|
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
326
412
|
if ( !jQuery.clean ) {
|
@@ -378,6 +464,7 @@ var eventAdd = jQuery.event.add,
|
|
378
464
|
oldToggle = jQuery.fn.toggle,
|
379
465
|
oldLive = jQuery.fn.live,
|
380
466
|
oldDie = jQuery.fn.die,
|
467
|
+
oldLoad = jQuery.fn.load,
|
381
468
|
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
382
469
|
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
383
470
|
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
@@ -412,17 +499,34 @@ jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
|
412
499
|
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
413
500
|
};
|
414
501
|
|
415
|
-
jQuery.
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
502
|
+
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
|
503
|
+
|
504
|
+
jQuery.fn[ name ] = function() {
|
505
|
+
var args = Array.prototype.slice.call( arguments, 0 );
|
506
|
+
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
|
507
|
+
|
508
|
+
// If this is an ajax load() the first arg should be the string URL;
|
509
|
+
// technically this could also be the "Anything" arg of the event .load()
|
510
|
+
// which just goes to show why this dumb signature has been deprecated!
|
511
|
+
// jQuery custom builds that exclude the Ajax module justifiably die here.
|
512
|
+
if ( name === "load" && typeof arguments[ 0 ] === "string" ) {
|
513
|
+
return oldLoad.apply( this, arguments );
|
514
|
+
}
|
515
|
+
|
516
|
+
args.splice( 0, 0, name );
|
517
|
+
if ( arguments.length ) {
|
518
|
+
return this.bind.apply( this, args );
|
519
|
+
}
|
520
|
+
|
521
|
+
// Use .triggerHandler here because:
|
522
|
+
// - load and unload events don't need to bubble, only applied to window or image
|
523
|
+
// - error event should not bubble to window, although it does pre-1.7
|
524
|
+
// See http://bugs.jquery.com/ticket/11820
|
525
|
+
this.triggerHandler.apply( this, args );
|
526
|
+
return this;
|
527
|
+
};
|
528
|
+
|
529
|
+
});
|
426
530
|
|
427
531
|
jQuery.fn.toggle = function( fn, fn2 ) {
|
428
532
|
|
@@ -491,7 +595,7 @@ jQuery.each( ajaxEvents.split("|"),
|
|
491
595
|
// The document needs no shimming; must be !== for oldIE
|
492
596
|
if ( elem !== document ) {
|
493
597
|
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
494
|
-
jQuery.event.trigger( name,
|
598
|
+
jQuery.event.trigger( name, Array.prototype.slice.call( arguments, 1 ), elem, true );
|
495
599
|
});
|
496
600
|
jQuery._data( this, name, jQuery.guid++ );
|
497
601
|
}
|
@@ -507,5 +611,92 @@ jQuery.each( ajaxEvents.split("|"),
|
|
507
611
|
}
|
508
612
|
);
|
509
613
|
|
614
|
+
jQuery.event.special.ready = {
|
615
|
+
setup: function() { migrateWarn( "'ready' event is deprecated" ); }
|
616
|
+
};
|
617
|
+
|
618
|
+
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
|
619
|
+
oldFind = jQuery.fn.find;
|
620
|
+
|
621
|
+
jQuery.fn.andSelf = function() {
|
622
|
+
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
623
|
+
return oldSelf.apply( this, arguments );
|
624
|
+
};
|
625
|
+
|
626
|
+
jQuery.fn.find = function( selector ) {
|
627
|
+
var ret = oldFind.apply( this, arguments );
|
628
|
+
ret.context = this.context;
|
629
|
+
ret.selector = this.selector ? this.selector + " " + selector : selector;
|
630
|
+
return ret;
|
631
|
+
};
|
632
|
+
|
633
|
+
|
634
|
+
// jQuery 1.6 did not support Callbacks, do not warn there
|
635
|
+
if ( jQuery.Callbacks ) {
|
636
|
+
|
637
|
+
var oldDeferred = jQuery.Deferred,
|
638
|
+
tuples = [
|
639
|
+
// action, add listener, callbacks, .then handlers, final state
|
640
|
+
[ "resolve", "done", jQuery.Callbacks("once memory"),
|
641
|
+
jQuery.Callbacks("once memory"), "resolved" ],
|
642
|
+
[ "reject", "fail", jQuery.Callbacks("once memory"),
|
643
|
+
jQuery.Callbacks("once memory"), "rejected" ],
|
644
|
+
[ "notify", "progress", jQuery.Callbacks("memory"),
|
645
|
+
jQuery.Callbacks("memory") ]
|
646
|
+
];
|
647
|
+
|
648
|
+
jQuery.Deferred = function( func ) {
|
649
|
+
var deferred = oldDeferred(),
|
650
|
+
promise = deferred.promise();
|
651
|
+
|
652
|
+
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
|
653
|
+
var fns = arguments;
|
654
|
+
|
655
|
+
migrateWarn( "deferred.pipe() is deprecated" );
|
656
|
+
|
657
|
+
return jQuery.Deferred(function( newDefer ) {
|
658
|
+
jQuery.each( tuples, function( i, tuple ) {
|
659
|
+
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
|
660
|
+
// deferred.done(function() { bind to newDefer or newDefer.resolve })
|
661
|
+
// deferred.fail(function() { bind to newDefer or newDefer.reject })
|
662
|
+
// deferred.progress(function() { bind to newDefer or newDefer.notify })
|
663
|
+
deferred[ tuple[1] ](function() {
|
664
|
+
var returned = fn && fn.apply( this, arguments );
|
665
|
+
if ( returned && jQuery.isFunction( returned.promise ) ) {
|
666
|
+
returned.promise()
|
667
|
+
.done( newDefer.resolve )
|
668
|
+
.fail( newDefer.reject )
|
669
|
+
.progress( newDefer.notify );
|
670
|
+
} else {
|
671
|
+
newDefer[ tuple[ 0 ] + "With" ](
|
672
|
+
this === promise ? newDefer.promise() : this,
|
673
|
+
fn ? [ returned ] : arguments
|
674
|
+
);
|
675
|
+
}
|
676
|
+
});
|
677
|
+
});
|
678
|
+
fns = null;
|
679
|
+
}).promise();
|
680
|
+
|
681
|
+
};
|
682
|
+
|
683
|
+
deferred.isResolved = function() {
|
684
|
+
migrateWarn( "deferred.isResolved is deprecated" );
|
685
|
+
return deferred.state() === "resolved";
|
686
|
+
};
|
687
|
+
|
688
|
+
deferred.isRejected = function() {
|
689
|
+
migrateWarn( "deferred.isRejected is deprecated" );
|
690
|
+
return deferred.state() === "rejected";
|
691
|
+
};
|
692
|
+
|
693
|
+
if ( func ) {
|
694
|
+
func.call( deferred, deferred );
|
695
|
+
}
|
696
|
+
|
697
|
+
return deferred;
|
698
|
+
};
|
699
|
+
|
700
|
+
}
|
510
701
|
|
511
702
|
})( jQuery, window );
|
@@ -42,9 +42,9 @@ article, aside, canvas, details, embed,
|
|
42
42
|
figure, figcaption, footer, header, hgroup,
|
43
43
|
menu, nav, output, ruby, section, summary,
|
44
44
|
time, mark, audio, video {
|
45
|
-
margin:
|
46
|
-
padding:
|
47
|
-
border:
|
45
|
+
margin: 0px;
|
46
|
+
padding: 0px;
|
47
|
+
border: 0px;
|
48
48
|
font-size: 100%;
|
49
49
|
font: inherit;
|
50
50
|
vertical-align: baseline;
|
@@ -74,6 +74,11 @@ table {
|
|
74
74
|
}
|
75
75
|
/* END */
|
76
76
|
|
77
|
+
/* Firefox only
|
78
|
+
@-moz-document url-prefix() {
|
79
|
+
}
|
80
|
+
*/
|
81
|
+
|
77
82
|
body {
|
78
83
|
font-family: helvetica;
|
79
84
|
font-size: 12px;
|
@@ -89,6 +94,10 @@ border: solid 1px #bbb;
|
|
89
94
|
border-radius: 2px;
|
90
95
|
}
|
91
96
|
|
97
|
+
input.file {
|
98
|
+
border: none;
|
99
|
+
}
|
100
|
+
|
92
101
|
select {
|
93
102
|
padding: 4px 0px;
|
94
103
|
background: #fff;
|
@@ -237,6 +246,14 @@ transition: 0.3s;
|
|
237
246
|
background-color: #eee;
|
238
247
|
}
|
239
248
|
|
249
|
+
.dc-link-icon {
|
250
|
+
padding: 3px;
|
251
|
+
border-radius: 3px;
|
252
|
+
background: transparent linear-gradient(to bottom, #FFF 0%, #F2F2F2 100%) repeat scroll 0% 0%;
|
253
|
+
border: 1px solid #ddd;
|
254
|
+
}
|
255
|
+
|
256
|
+
|
240
257
|
.dc-link-selected {
|
241
258
|
text-align: center;
|
242
259
|
border:1px solid #888;
|
@@ -329,23 +346,26 @@ background: transparent linear-gradient(to bottom, #ddd 0%, #FFF 100%) repeat sc
|
|
329
346
|
color: #fff;
|
330
347
|
background-color: #888;
|
331
348
|
}
|
332
|
-
/*
|
333
|
-
.
|
334
|
-
border:
|
335
|
-
padding
|
349
|
+
/* Pagination */
|
350
|
+
.pagination span {
|
351
|
+
border: 1px solid #ddd;
|
352
|
+
padding: 4px 4px 3px 6px;
|
353
|
+
margin-left: 1px;
|
354
|
+
background: transparent linear-gradient(to bottom, #FFF 0%, #F2F2F2 100%) repeat scroll 0% 0%;
|
355
|
+
border-radius: 1px;
|
336
356
|
}
|
337
357
|
|
338
|
-
.
|
339
|
-
|
340
|
-
|
358
|
+
.pagination .current {
|
359
|
+
background: #888;
|
360
|
+
color: #fff;
|
361
|
+
border: 1px solid #888;
|
341
362
|
}
|
342
|
-
*/
|
343
363
|
|
344
364
|
.dc-title {
|
345
365
|
font-weight: bold;
|
346
366
|
color: #333;
|
347
367
|
font-size: 1.2em;
|
348
|
-
padding:
|
368
|
+
padding: 5px 1px;
|
349
369
|
border-spacing: 0px;
|
350
370
|
width: 100%;
|
351
371
|
margin: 0px;
|
@@ -799,10 +819,10 @@ color: #222;
|
|
799
819
|
|
800
820
|
.dc-action-menu ul {
|
801
821
|
margin-top: 1px;
|
802
|
-
background:#fff;
|
822
|
+
/*background:#fff; */
|
803
823
|
position:absolute;
|
804
824
|
left:-9999px;
|
805
|
-
border-radius:
|
825
|
+
border-radius: 2px;
|
806
826
|
}
|
807
827
|
|
808
828
|
.dc-action-menu ul li {
|
@@ -826,8 +846,8 @@ white-space:nowrap;
|
|
826
846
|
left:0;
|
827
847
|
margin-top:3px;
|
828
848
|
background-color: #fff;
|
829
|
-
border: 1px solid #
|
830
|
-
box-shadow: 1px 1px 2px #ccc
|
849
|
+
border: 1px solid #ccc;
|
850
|
+
/*box-shadow: 1px 1px 2px #ccc;*/
|
831
851
|
}
|
832
852
|
|
833
853
|
.dc-action-menu li:hover ul li a {
|
@@ -839,8 +859,8 @@ color: #222;
|
|
839
859
|
}
|
840
860
|
.dc-action-menu li:hover ul li:hover {
|
841
861
|
border: 0px;
|
842
|
-
background: #
|
843
|
-
border-radius:
|
862
|
+
background: #eee;
|
863
|
+
border-radius: 2px;
|
844
864
|
}
|
845
865
|
|
846
866
|
.menu-filter {
|
@@ -195,7 +195,6 @@ def check_filter_options() #:nodoc:
|
|
195
195
|
model
|
196
196
|
end
|
197
197
|
end
|
198
|
-
|
199
198
|
# pagination if required
|
200
199
|
per_page = (@form['result_set']['per_page'] || 30).to_i
|
201
200
|
if per_page > 0
|
@@ -211,7 +210,7 @@ def index
|
|
211
210
|
if @form['result_set'].nil?
|
212
211
|
return process_return_to(params[:return_to] || 'reload')
|
213
212
|
end
|
214
|
-
# for now enable only filtering of
|
213
|
+
# for now enable only filtering of top level documents
|
215
214
|
if @tables.size == 1
|
216
215
|
check_filter_options()
|
217
216
|
check_sort_options()
|
@@ -225,8 +224,8 @@ def index
|
|
225
224
|
@records = []
|
226
225
|
return render(action: :index)
|
227
226
|
end
|
228
|
-
# pagination
|
229
|
-
unless @form['table'] == 'dc_dummy'
|
227
|
+
# pagination but only if not already set
|
228
|
+
unless (@form['table'] == 'dc_dummy' or @records.options[:limit])
|
230
229
|
per_page = (@form['result_set']['per_page'] || 30).to_i
|
231
230
|
@records = @records.page(params[:page]).per(per_page) if per_page > 0
|
232
231
|
end
|
@@ -302,14 +301,14 @@ end
|
|
302
301
|
# New action.
|
303
302
|
########################################################################
|
304
303
|
def new
|
304
|
+
# clear flash messages.
|
305
|
+
flash[:error] = flash[:warning] = flash[:info] = nil
|
306
|
+
create_new_empty_record
|
305
307
|
if (m = callback_method('before_new') )
|
306
308
|
ret = call_callback_method(m)
|
307
309
|
# Don't do anything if return is false
|
308
310
|
return index if ret.class == FalseClass
|
309
311
|
end
|
310
|
-
# clear flash messages.
|
311
|
-
flash[:error] = flash[:warning] = flash[:info] = nil
|
312
|
-
create_new_empty_record
|
313
312
|
table = @tables.last[1] + '.'
|
314
313
|
# initial values set on page
|
315
314
|
if cookies[:record] and cookies[:record].size > 0
|
@@ -763,7 +762,7 @@ end
|
|
763
762
|
########################################################################
|
764
763
|
def save_data
|
765
764
|
fields = fields_on_form()
|
766
|
-
return true
|
765
|
+
return true if fields.size == 0
|
767
766
|
#
|
768
767
|
fields.each do |v|
|
769
768
|
next if v['type'].nil?
|
File without changes
|
@@ -40,7 +40,7 @@ def dc_actions_for_index()
|
|
40
40
|
return '' if actions.nil? or actions.size == 0
|
41
41
|
# Simulate standard actions
|
42
42
|
actions = {'standard' => true} if actions.class == String && actions == 'standard'
|
43
|
-
std_actions = {
|
43
|
+
std_actions = {2 => 'new', 3 => 'sort', 4 => 'filter' }
|
44
44
|
if actions['standard']
|
45
45
|
actions.merge!(std_actions)
|
46
46
|
actions['standard'] = nil
|
@@ -51,8 +51,12 @@ def dc_actions_for_index()
|
|
51
51
|
<span id="dc-spinner" class="div-hidden">#{fa_icon('spinner lg spin')}</span>
|
52
52
|
<ul class="dc-action-menu">
|
53
53
|
EOT
|
54
|
-
#
|
55
|
-
|
54
|
+
# Remove actions settings and sort
|
55
|
+
only_actions = []
|
56
|
+
actions.each { |key, value| only_actions << [key, value] if key.class == Fixnum }
|
57
|
+
only_actions.sort_by!(&:first)
|
58
|
+
only_actions.each do |element|
|
59
|
+
k,v = element
|
56
60
|
session[:form_processing] = "index:actions: #{k}=#{v}"
|
57
61
|
next if v.nil? # must be
|
58
62
|
url = @parms.clone
|
@@ -96,8 +100,8 @@ EOT
|
|
96
100
|
# add filter OFF link
|
97
101
|
s = session[@form['table']]
|
98
102
|
if s and s[:filter]
|
99
|
-
caption << ' ' + dc_link_to(nil,'remove lg', controller: 'cmsedit',
|
100
|
-
filter: 'off', table: @form['table'], title: 'drgcms.filter_off')
|
103
|
+
caption << ' ' + dc_link_to(nil,'remove lg', {controller: 'cmsedit',
|
104
|
+
filter: 'off', table: @form['table']}, { title: t('drgcms.filter_off')+s[:filter]})
|
101
105
|
end
|
102
106
|
caption
|
103
107
|
# new
|
@@ -131,6 +135,12 @@ def dc_div_filter()
|
|
131
135
|
filter.split(',').each do |f|
|
132
136
|
f.strip!
|
133
137
|
name = f.match(' as ') ? f.split(' ').first : f
|
138
|
+
# like another field on the form
|
139
|
+
if f.match(' like ')
|
140
|
+
a = f.split(' ')
|
141
|
+
name = a.first
|
142
|
+
f = a.last
|
143
|
+
end
|
134
144
|
choices << [ t("helpers.label.#{@form['table']}.#{name}", name), f ]
|
135
145
|
end
|
136
146
|
choices4_operators = t('drgcms.choices4_filter_operators').chomp.split(',').inject([]) {|r,v| r << (v.match(':') ? v.split(':') : v )}
|
@@ -178,14 +188,16 @@ def dc_link_or_ajax(yaml, parms) #:nodoc:
|
|
178
188
|
rest = {}
|
179
189
|
rest['method'] = yaml['method'] || yaml['request'] || 'get'
|
180
190
|
rest['caption'] = yaml['caption'] || yaml['text']
|
181
|
-
rest['class'] =
|
191
|
+
rest['class'] = (yaml['type'] == 'link' ? 'dc-link' : 'dc-link-ajax') + ' dc-animate'
|
182
192
|
rest['title'] = yaml['title']
|
183
193
|
|
184
194
|
dc_deprecate "Form: result_set:action:text directive will be deprecated. Use caption instead of text." if yaml['text']
|
185
195
|
if yaml['type'] == 'link'
|
186
196
|
dc_link_to(yaml['caption'], yaml['icon'], parms, rest )
|
187
197
|
else
|
188
|
-
''
|
198
|
+
rest['data-url'] = url_for(parms)
|
199
|
+
rest['class'] << " fa fa-#{yaml['icon']}"
|
200
|
+
fa_icon(yaml['icon'], rest )
|
189
201
|
end
|
190
202
|
end
|
191
203
|
|
@@ -269,13 +281,15 @@ def dc_header_for_result()
|
|
269
281
|
th = '<th '
|
270
282
|
v = {'name' => v} if v.class == String
|
271
283
|
caption = v['caption'] || t("helpers.label.#{@form['table']}.#{v['name']}")
|
272
|
-
# no sorting when embedded
|
273
|
-
|
284
|
+
# no sorting when embedded documents or custom filter is active
|
285
|
+
sort_ok = @form['result_set'].nil? || (@form['result_set'] && @form['result_set']['filter'].nil?)
|
286
|
+
sort_ok = sort_ok || (@form['index'] && @form['index']['sort'])
|
287
|
+
if @tables.size == 1 and sort_ok
|
274
288
|
icon = 'sort lg'
|
275
289
|
if v['name'] == sort_field
|
276
290
|
icon = sort_direction == '1' ? 'sort-alpha-asc lg' : 'sort-alpha-desc lg'
|
277
291
|
end
|
278
|
-
th << ">#{dc_link_to(caption, icon, sort: v['name'], table:
|
292
|
+
th << ">#{dc_link_to(caption, icon, sort: v['name'], table: params[:table], formname: params[:formname], action: :index )}</th>"
|
279
293
|
else
|
280
294
|
th << ">#{caption}</th>"
|
281
295
|
end
|
@@ -286,7 +300,7 @@ def dc_header_for_result()
|
|
286
300
|
end
|
287
301
|
|
288
302
|
############################################################################
|
289
|
-
# Creates
|
303
|
+
# Creates link for single or double click on result column
|
290
304
|
############################################################################
|
291
305
|
def dc_clicks_for_result(document)
|
292
306
|
html = ''
|
@@ -21,7 +21,7 @@
|
|
21
21
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
23
|
#++
|
24
|
-
|
24
|
+
require 'sort_alphabetical'
|
25
25
|
|
26
26
|
###########################################################################
|
27
27
|
#
|
@@ -147,7 +147,7 @@ end
|
|
147
147
|
# String. HTML code for title.
|
148
148
|
############################################################################
|
149
149
|
def dc_table_title(text, result_set=nil)
|
150
|
-
c = "<table width='100%'
|
150
|
+
c = "<table width='100%' class='dc-title'><tr><td>#{text}</td>"
|
151
151
|
if result_set and result_set.respond_to?(:current_page)
|
152
152
|
c << "<td align='right' style='font-size: 0.8em;'> #{paginate(result_set, :params => {:action => 'index'})}</td>"
|
153
153
|
end
|
@@ -813,11 +813,11 @@ def dc_choices4(model, name, id='_id', options = {})
|
|
813
813
|
qry = model.only(id, name)
|
814
814
|
qry = qry.and(dc_site_id: dc_get_site()) if options[:site_only]
|
815
815
|
qry = qry.and(active: true) if model.method_defined?(:active)
|
816
|
-
qry = qry.sort(name
|
817
|
-
#
|
818
|
-
choices
|
819
|
-
qry.
|
820
|
-
choices
|
816
|
+
# qry = qry.sort(name => 1)
|
817
|
+
# choices = []
|
818
|
+
# qry.each {|v| choices << [ v[name], v[id] ] }
|
819
|
+
choices = qry.inject([]) {|result,e| result << [ e[name], e[id] ]}
|
820
|
+
choices.sort_alphabetical_by(&:first) # use UTF-8 sort
|
821
821
|
end
|
822
822
|
|
823
823
|
############################################################################
|
data/app/models/dc_filter.rb
CHANGED
@@ -138,7 +138,7 @@ def self.get_filter_field(parent)
|
|
138
138
|
object = klas.new(parent, nil, field).render
|
139
139
|
js = object.js
|
140
140
|
"<span class=\"filter_field\" data-url=\"#{url}\">#{object.html} " <<
|
141
|
-
parent.fa_icon('filter lg
|
141
|
+
parent.fa_icon('filter lg', class: 'record_filter_field_icon dc-link-icon dc-animate') <<
|
142
142
|
(js.size > 2 ? parent.javascript_tag(js) : '') << '</span>'
|
143
143
|
end
|
144
144
|
|
@@ -957,7 +957,7 @@ class DatePicker < DrgcmsField
|
|
957
957
|
# Render date_picker field html code
|
958
958
|
###########################################################################
|
959
959
|
def render
|
960
|
-
value = @record[@yaml['name']] ? I18n.localize(@record[@yaml['name']].localtime.to_date) : nil
|
960
|
+
value = (@record and @record[@yaml['name']]) ? I18n.localize(@record[@yaml['name']].localtime.to_date) : nil
|
961
961
|
return ro_standard( @parent.dc_format_value(value)) if @readonly
|
962
962
|
#
|
963
963
|
@yaml['options'] ||= {}
|
@@ -1020,7 +1020,7 @@ class DatetimePicker < DrgcmsField
|
|
1020
1020
|
# Render date_time_picker field html code
|
1021
1021
|
###########################################################################
|
1022
1022
|
def render
|
1023
|
-
value = @record[@yaml['name']] ? I18n.localize(@record[@yaml['name']].localtime) : nil
|
1023
|
+
value = (@record and @record[@yaml['name']]) ? I18n.localize(@record[@yaml['name']].localtime) : nil
|
1024
1024
|
return ro_standard( @parent.dc_format_value(value)) if @readonly
|
1025
1025
|
#
|
1026
1026
|
@yaml['options'] ||= {}
|
@@ -1125,12 +1125,14 @@ def render
|
|
1125
1125
|
ret_name = "#{ret_name}.#{method}" if method
|
1126
1126
|
@yaml['html'] ||= {}
|
1127
1127
|
@yaml['html']['value'] = value_displayed
|
1128
|
+
@yaml['html']['placeholder'] ||= t('drgcms.two_chars') || nil
|
1128
1129
|
#
|
1129
1130
|
_name = '_' + @yaml['name']
|
1130
1131
|
record = record_text_for(@yaml['name'])
|
1131
1132
|
@html << @parent.text_field(record, _name, @yaml['html'])
|
1132
1133
|
if @yaml['with_new']
|
1133
|
-
@html <<
|
1134
|
+
@html << ' ' +
|
1135
|
+
@parent.fa_icon('plus-square lg', class: 'in-edit-add', title: t('drgcms.new'),
|
1134
1136
|
style: "vertical-align: top;", 'data-table' => @yaml['with_new'] )
|
1135
1137
|
end
|
1136
1138
|
@html << @parent.hidden_field(record, @yaml['name'], value: value) # actual value will be in hidden field
|
data/config/locales/en.yml
CHANGED
data/drg_cms.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# Copyright 2012-2016 Damjan Rems
|
2
|
+
|
1
3
|
$:.push File.expand_path("../lib", __FILE__)
|
2
4
|
|
3
5
|
# Maintain your gem's version:
|
@@ -25,4 +27,5 @@ Gem::Specification.new do |s|
|
|
25
27
|
s.add_dependency 'mongoid'
|
26
28
|
s.add_dependency 'kaminari'
|
27
29
|
s.add_dependency 'font-awesome-rails'
|
30
|
+
s.add_dependency 'sort_alphabetical'
|
28
31
|
end
|
data/lib/drg_cms/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drg_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damjan Rems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: sort_alphabetical
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: DRG CMS can be used for rapid building of complex, data-entry intensive
|
126
140
|
web sites as well as building your in-house private cloud applications.
|
127
141
|
email:
|