drg_cms 0.4.54 → 0.4.57

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4b763f10c4908f259ef1caac04ba0a9d3cb7259
4
- data.tar.gz: 1bdca5ace9741bb16c17c817cf81ca18953105ba
3
+ metadata.gz: 3d10b53c63a0f5d18e7c4ee0abf0d7d78c5245d9
4
+ data.tar.gz: b6f551fc08937f420940e728f011436b506e4cce
5
5
  SHA512:
6
- metadata.gz: 1d9a8383bb7328b1c0fc21c9d7939919ba9d716ecdfede5ebadb68bb65f1fa77ccd94060daf0159cc8e57438bd42a6934035486dec24a45305f27aee12afbe00
7
- data.tar.gz: 95ef2a4c9a674932ac80a8dc2dc79b2adeed17d4209c60587fbb95122e9d86b8889d8a9bdb9e0ff3553ce2c96d326b7aa784aaec1b8c83d42b2d7cf7e9427dac
6
+ metadata.gz: 8496a3fa343e395014a47881da429780d9d9c4a407719229685404594af2fdedabc86a59640897324387b58c42d697f97f71aad1c992fa3bd1c7871abfd99b11
7
+ data.tar.gz: d47a2697eff35587bd695d958233eca2b7df5592a9677b88042ed8411ff161209b8182bd0b1304f0edb8e7bafd309cccae3cf367178ed2e9525556e50d6a39ab
data/README.md CHANGED
@@ -1,17 +1,18 @@
1
1
  # DrgCms
2
2
 
3
- DRG CMS is cms build on strong foundations of Ruby on Rails and Mongo DB.
3
+ DRG CMS is content management system build on strong foundations of Ruby on Rails and Mongo DB. It uses single (cmsedit) controller for data entry and specialy crafted forms system for defining data entry fields. It has user friendly role based access system built-in and is highly extendable with help of Ruby on Rails plugin system.
4
+
5
+ DRG CMS can be used for rapid building of complex, data-entry intensive web sites or building your private Intranet sites.
4
6
 
5
7
  Project Tracking
6
8
  ----------------
7
9
 
8
10
  * [DrgCms Website and Documentation](http://www.drgcms.org)
9
- * [DrgCms Testing website](http://test.drgcms.org)
10
11
 
11
12
  Compatibility
12
13
  -------------
13
14
 
14
- DRG CMS is tested against MRI 1.9.3, 2.0.0, 2.1.0.
15
+ DRG CMS is tested against MRI 1.9.3 and 2.x, MongoDB 2.4, 2.6
15
16
 
16
17
  Documentation
17
18
  -------------
@@ -372,8 +372,8 @@ $(document).ready( function() {
372
372
  });
373
373
 
374
374
  /**********************************************************************
375
- *
376
- *
375
+ * When filter_field (field name) is selected on filter subform this routine finds
376
+ * and displays apropriate span with input field.
377
377
  **********************************************************************/
378
378
  $('#_filter_field').bind('change', function() {
379
379
  if (this.value.length > 0) {
@@ -384,7 +384,7 @@ element = $(this).find(':first').attr('id');
384
384
  sometimes it is the second element
385
385
  if (element == nil) { element = $(this).find(':first').next().attr('id');}
386
386
  */
387
- if ($(this).attr('id') == name) {
387
+ if ($(this).attr('id') === name) {
388
388
  if ( $(this).hasClass('div-hidden') ) { $(this).toggleClass('div-hidden'); }
389
389
  } else {
390
390
  if ( !$(this).hasClass('div-hidden') ) { $(this).toggleClass('div-hidden'); }
@@ -404,7 +404,7 @@ element = $(this).find(':first').attr('id');
404
404
  *******************************************************************/
405
405
  $('.dc-submit').bind('click', function() {
406
406
  $.each(this.attributes, function() {
407
- if (this.name.substring(0,5) == 'data-') {
407
+ if (this.name.substring(0,5) === 'data-') {
408
408
  $('<input>').attr({
409
409
  type: 'hidden',
410
410
  name: 'data[' + this.name.substring(5) + ']',
@@ -31,19 +31,25 @@ vertical-align: middle;
31
31
  }
32
32
 
33
33
  textarea, input, select {
34
- /*font-family: helvetica;
35
- font-size: 13px; */
34
+ color: #222;
36
35
  padding: 4px;
37
36
  border: solid 1px #888;
38
- box-shadow: rgba(0,0,0, 0.1) 0px 0px 4px;
39
37
  border-radius: 2px;
38
+ /*
40
39
  background: linear-gradient(#ffd 4%, #fff 100%);
41
- color: #222;
40
+ box-shadow: rgba(0,0,0, 0.1) 0px 0px 4px;
41
+ */
42
42
  }
43
43
 
44
44
  input { padding: 6px;}
45
-
46
- select#record_select { padding: 1px;}
45
+ /*
46
+ select#record_select {
47
+ padding: 1px;
48
+ max-width: 300px;
49
+ height: 26px;
50
+ background: #fff;
51
+ }
52
+ */
47
53
 
48
54
  hr {
49
55
  background-color: #ccc;
@@ -64,15 +70,24 @@ height: 2px;
64
70
  th {
65
71
  padding: 5px 1px;
66
72
  text-align: left;
67
- border-top:1px solid #ccc;
68
- border-bottom:1px solid #ccc;
69
- background: linear-gradient(#eee 5%, #fff 100%);
73
+ border-bottom:2px solid #ccc;
74
+ background: #fff;
75
+ /* border-top:1px solid #ccc;
76
+ background: linear-gradient(#eee 5%, #fff 100%); */
70
77
  }
71
78
 
79
+ th a:hover { color: #000;}
80
+
72
81
  img { vertical-align:bottom; }
73
82
 
74
- a:link, a:active, a:visited { color: #c43; text-decoration: none; background: transparent;}
75
- a:hover { text-decoration: none; color: #000; }
83
+ a:link, a:active, a:visited {
84
+ color: #888;
85
+ font-weight: bold;
86
+ text-decoration: none;
87
+ background: transparent;
88
+ }
89
+
90
+ a:hover { text-decoration: none; color: #fff; }
76
91
  a img { border: none; }
77
92
 
78
93
 
@@ -96,56 +111,68 @@ width: 24px;
96
111
  padding: 0px;
97
112
  border-spacing: 0px;
98
113
  border-radius: 1px;
114
+ /*
99
115
  border-right: 0px;
100
116
  border-left: 1px solid #fff;
101
117
  border-top: 1px solid #fff;
102
- background-color: #f8f8f8;
103
118
  border-bottom:1px solid #ccc;
119
+ */
120
+ background-color: #f8f8f8;
104
121
  }
105
122
 
123
+ .dc-result td { padding: 2px 0px; }
106
124
  .dc-menu {
107
125
  border-spacing: 3px;
108
126
  padding: 0px;
109
127
  }
110
128
 
111
129
  .dc-link {
112
- padding: 4px 8px;
130
+ padding: 6px 16px;
113
131
  text-align: center;
114
- border:1px solid #eee;
115
- border-radius: 2px;
116
- background: linear-gradient(#eee 5%, #fff 100%);
132
+ /* border: 1px solid #eee;*/
133
+ border-radius: 5px;
134
+ background-color: #eee;
135
+ /* background: linear-gradient(#eee 5%, #fff 100%); */
117
136
  }
118
137
 
119
138
  .dc-link:hover {
120
- background: linear-gradient(#fff 5%, #eee 100%);
139
+ /* background: linear-gradient(#fff 5%, #eee 100%); */
140
+ background-color: #888;
141
+ }
142
+
143
+ .dc-link:hover a {
144
+ color: #fff;
121
145
  }
122
146
 
123
147
  .dc-link-ajax {
124
148
  text-align: left;
125
- border:1px solid #eee;
126
- padding: 4px 8px;
127
- border-radius: 2px;
128
- color: #c43;
129
- background: linear-gradient(#eee 5%, #fff 100%);
149
+ font-weight: bold;
150
+ /* border:1px solid #eee; */
151
+ padding: 6px 16px;
152
+ border-radius: 5px;
153
+ color: #888;
154
+ background-color: #eee;
155
+ /* background: linear-gradient(#eee 5%, #fff 100%); */
130
156
  }
131
157
 
132
158
  .dc-link-ajax:hover {
133
- background: linear-gradient(#fff 5%, #eee 100%);
134
- color: black;
159
+ /* background: linear-gradient(#fff 5%, #eee 100%); */
160
+ color: fff;
135
161
  cursor: pointer;
136
162
  }
137
163
 
138
164
  .dc-link-img {
139
- padding: 2px;
165
+ padding: 3px;
140
166
  text-align: center;
141
- border:1px solid #eee;
167
+ /* border:1px solid #eee;*/
142
168
  margin: 0px;
143
- border-radius: 2px;
144
- background: linear-gradient(#eee 5%, #fff 100%);
169
+ /* border-radius: 2px;*/
170
+ /* background: linear-gradient(#eee 5%, #fff 100%); */
145
171
  }
146
172
 
147
173
  .dc-link-img:hover {
148
- background: linear-gradient(#fff 5%, #eee 100%);
174
+ /* background: linear-gradient(#fff 5%, #eee 100%); */
175
+ background-color: #eee;
149
176
  }
150
177
 
151
178
  .dc-link-selected {
@@ -176,43 +203,50 @@ width: 24px;
176
203
  .skip-next a:hover { text-decoration: none; color: #c43; }
177
204
 
178
205
  .dc-animate-button {
179
- background: #ccc;
180
- box-shadow: inset 0 0 20px #ccc;
206
+ background: #eee;
207
+ box-shadow: inset 0 0 10px #fff;
181
208
  }
182
209
 
183
210
  .dc-link-submit {
184
211
  text-align: left;
185
- border:1px solid #eee;
212
+ /* border:1px solid #eee; */
186
213
  padding: 0px;
187
214
  margin: 0px;
188
215
 
189
- border-radius: 2px;
190
- background: linear-gradient(#eee 5%, #fff 100%);
216
+ border-radius: 5px;
217
+ background-color: #eee;
218
+ /* background: linear-gradient(#eee 5%, #fff 100%); */
191
219
  }
192
220
 
193
221
  .dc-link-submit:hover {
194
- background: linear-gradient(#fff 5%, #eee 100%);
222
+ color: #000;
223
+ background-color: #888;
224
+ /* background: linear-gradient(#fff 5%, #eee 100%); */
225
+ }
226
+ .dc-link-submit:hover .dc-submit {
227
+ color: #fff;
195
228
  }
196
-
197
229
  .dc-submit {
198
230
  text-decoration: none;
199
231
  border: 0px;
200
- color: #c43;
232
+ color: #888;
233
+ font-weight: bold;
201
234
  box-shadow: none;
202
235
  background: none;
203
236
  /* background-color: none; */
204
- padding: 0px 4px;
237
+ padding: 0px 10px;
205
238
  border-radius: 0px;
206
239
  }
207
240
 
208
241
  .dc-submit:hover {
242
+ cursor: pointer;
209
243
  text-decoration: none;
210
- color: #000;
211
- border-bottom: 1px dotted #000;
212
- padding-top: 1px;
213
-
244
+ color: #fff;
245
+ /* border-bottom: 1px solid #888;
246
+ padding-top: 1px;*/
247
+ background-color: #888;
214
248
  }
215
-
249
+ /*
216
250
  .dc-img-link {
217
251
  border: 0px;
218
252
  padding-top: 1px
@@ -222,6 +256,7 @@ width: 24px;
222
256
  text-decoration: none;
223
257
  background-color: #c43;
224
258
  }
259
+ */
225
260
 
226
261
  .dc-title {
227
262
  font-weight: bold;
@@ -282,7 +317,7 @@ width: 24px;
282
317
  border: #a94442 2px solid;
283
318
  }
284
319
 
285
- /** VRZI VEN OB PRILIKI *******************/
320
+ /** VRZI VEN OB PRILIKI *******************
286
321
  .dc-form-label-odd {
287
322
  color: #555;
288
323
  text-align: right;
@@ -317,7 +352,7 @@ width: 24px;
317
352
  background-color: #f4f4f4;
318
353
  border-bottom: 1px solid #eee;
319
354
  }
320
- /************** *******************/
355
+ ************** *******************/
321
356
 
322
357
  .dc-form-label {
323
358
  color: #555;
@@ -370,6 +405,8 @@ width: 24px;
370
405
  margin-bottom: 3px;
371
406
  padding-right: 2px;
372
407
  padding-left: 2px;
408
+ padding-bottom: 2px;
409
+ border-bottom: 1px solid #eee;
373
410
  }
374
411
 
375
412
  .dc-spinner {
@@ -382,28 +419,35 @@ width: 24px;
382
419
  color: #888;
383
420
  text-decoration: none;
384
421
  text-align: center;
422
+ font-weight: bold;
423
+
424
+ /*
385
425
  border-bottom: none;
386
426
  border-top: 1px solid #ccc;
387
427
  border-left: 1px solid #ccc;
388
428
  border-right: 1px solid #fff;
389
- padding:4px 8px 4px 8px;
429
+ */
430
+ padding:3px 15px;
390
431
  border-radius: 4px 4px 0px 0px;
391
432
  background: #eee;
392
433
  margin-right: 4px;
393
- background: linear-gradient(#eee 2%, #fff 100%);
434
+ /* background: linear-gradient(#eee 2%, #fff 100%); */
394
435
  }
395
436
 
396
437
  .dc-form-li:hover, .dc-form-li-selected {
397
- color: #222;
398
- background: #f8f8f8;
438
+ cursor: pointer;
439
+ color: #fff;
440
+ background: #888;
441
+ /*
399
442
  box-shadow: 4px 0px 2px -2px #aaa ;
400
443
  box-shadow: 0px -2px 2px #ccc;
401
-
444
+ /*
402
445
  border-top: 1px solid #fff;
403
446
  border-left: 1px solid #fff;
404
447
  border-right: 1px solid #ddd;
405
448
  border-bottom: none;
406
- background: linear-gradient(#fff 2%, #f4f4f4 100%);
449
+ */
450
+ /*background: linear-gradient(#fff 2%, #f4f4f4 100%); */
407
451
  }
408
452
 
409
453
  .dc-odd {
@@ -430,6 +474,12 @@ width: 24px;
430
474
  margin-bottom: 10px;
431
475
  }
432
476
 
477
+ .cmsedit-menu select#record_select {
478
+ padding: 0px;
479
+ max-width: 300px;
480
+ height: 26px;
481
+ }
482
+
433
483
  #result {
434
484
  background-color: #eee;
435
485
  }
@@ -503,15 +553,18 @@ padding: 0px;
503
553
  }
504
554
 
505
555
  #drgcms_filter {
556
+ padding: 4px 0px;
557
+ margin: 0px;
558
+
559
+ /*
506
560
  display: none;
561
+
507
562
  border:1px solid #ccc;
508
- padding: 4px;
509
- margin: 0px;
510
-
511
563
  border-top: 1px solid #fff;
512
564
  border-left: 1px solid #fff;
513
565
  border-radius: 1px;
514
566
  background-color: #eee;
567
+ */
515
568
  }
516
569
 
517
570
  .iframe_embedded {
@@ -533,6 +586,8 @@ overflow-x:hidden;
533
586
  /******************* action-menu *********************/
534
587
  #dc-action-menu {
535
588
  padding: 2px 0px 2px 0px;
589
+ font-weight: bold;
590
+ color: #888;
536
591
  }
537
592
 
538
593
  #dc-action-menu ul {
@@ -543,32 +598,30 @@ margin: 5px 2px 4px 0px;
543
598
 
544
599
  .dc-action-menu {
545
600
  list-style:none;
546
- font-size: 12px;
547
- }
548
-
549
- .dc-action-menu a {
550
- color: #c43;
601
+ /*font-size: 12px;*/
551
602
  }
552
603
 
553
604
  .dc-action-menu li {
554
605
  display:inline;
555
606
  position:relative;
556
607
  list-style:none;
557
- padding: 4px 10px;
558
- border-radius: 2px;
559
- border: 1px solid #eee;
608
+ padding: 6px 15px;
560
609
  margin-right: 2px;
561
- background: linear-gradient(#eee 5%, #fff 100%);
562
610
  max-width: 200px;
611
+ background: #eee;
612
+ border-radius:5px;
613
+ /* border: 1px solid #eee;
614
+ background: linear-gradient(#eee 5%, #fff 100%); */
563
615
  }
564
616
 
565
617
  .dc-action-menu li:hover {
566
- color: #000;
567
- background: linear-gradient(#fff 5%, #eee 100%);
618
+ background: #888;
619
+ color: #fff;
620
+ /*background: linear-gradient(#fff 5%, #eee 100%); */
568
621
  }
569
622
 
570
623
  .dc-action-menu li:hover a {
571
- color: #c43;
624
+ color: #fff;
572
625
  }
573
626
 
574
627
  .dc-action-menu ul {
@@ -602,11 +655,11 @@ background-color: #fff;
602
655
  }
603
656
 
604
657
  .dc-action-menu li:hover ul li a {
605
- color: #c43;
658
+ color: #888;
606
659
  }
607
660
 
608
661
  .dc-action-menu li:hover ul li a:hover {
609
- color: black;
662
+ color: #fff;
610
663
  }
611
664
 
612
665
  /************************** info popup *************************/
@@ -77,6 +77,7 @@
77
77
  ########################################################################
78
78
  class CmseditController < DcApplicationController
79
79
  before_action :check_authorization, :except => [:show, :login]
80
+ layout 'cms'
80
81
 
81
82
  ########################################################################
82
83
  # Will check and set sorting options for current result set. Subroutine of index method.
@@ -463,7 +464,7 @@ end
463
464
  =end
464
465
 
465
466
  ########################################################################
466
- # Merges two forms when current form extends other form. Subroutine of read_yaml.
467
+ # Merges two forms when current form extends other form. Subroutine of read_drg_cms_form.
467
468
  # With a little help of https://www.ruby-forum.com/topic/142809
468
469
  ########################################################################
469
470
  def forms_merge(hash1, hash2)
@@ -482,7 +483,7 @@ end
482
483
  ########################################################################
483
484
  # Read drgcms form into yaml object. Subroutine of check_authorization.
484
485
  ########################################################################
485
- def read_yaml
486
+ def read_drg_cms_form
486
487
  table_name = decamelize_type(params[:table].strip)
487
488
  @tables = table_name.split(';').inject([]) { |r,v| r << [v.classify.constantize, v] }
488
489
  # split ids passed when embedded document
@@ -498,7 +499,6 @@ def read_yaml
498
499
  end
499
500
  # add readonly key to form if readonly parameter is passed in url
500
501
  @form['readonly'] = 1 if params['readonly'] and %w(1 yes true).include?(params['readonly'].to_s.downcase.strip)
501
- # p '2',@form
502
502
  # !!!!!! Always use strings for key names since @parms['table'] != @parms[:table]
503
503
  @parms = { 'table' => table_name, 'ids' => ids, 'formname' => formname,
504
504
  'return_to' => params['return_to'], 'edit_only' => params['edit_only'] }
@@ -510,25 +510,26 @@ end
510
510
  ############################################################################
511
511
  def check_authorization
512
512
  params[:table] ||= params[:formname]
513
- # Extend class with methods defined in drgcms_controls module. May include embedded forms therefor ; => _
514
- controls_string = params[:table].gsub(';','_') + '_control'
515
- controls = ("DrgcmsControls::#{controls_string.classify}".constantize rescue nil)
516
- extend controls if controls
517
513
  # Just show menu
518
514
  return show if params[:action] == 'show'
519
515
  # request shouldn't pass
520
- if session[:user_roles].nil? or params[:table].to_s.strip.downcase.size < 3
516
+ if session[:user_roles].nil? or params[:table].to_s.strip.downcase.size < 3 or
517
+ !dc_user_can(DcPermission::CAN_VIEW)
521
518
  return render(action: 'error', locals: { error: t('drgcms.not_authorized')} )
522
519
  end
523
520
 
524
- # If user has permission to view table (collection) load form
525
- if dc_user_can(DcPermission::CAN_VIEW)
526
- read_yaml
521
+ read_drg_cms_form
527
522
  # Permissions can be also defined on form
528
- return if @form['permissions'].nil? or @form['permissions']['can_view'].nil?
529
- return if dc_user_has_role(@form['permissions']['can_view'])
530
- end
531
- render(action: 'error', locals: {error: t('drgcms.not_authorized')} )
523
+ #TODO So far only can_view is used. Think about if using other permissions has sense
524
+ if @form['permissions'].nil? or @form['permissions']['can_view'].nil? or
525
+ dc_user_has_role(@form['permissions']['can_view'])
526
+ # Extend class with methods defined in drgcms_controls module. May include embedded forms therefor ; => _
527
+ controls_string = (@form['controls'] ? @form['controls'] : params[:table].gsub(';','_')) + '_control'
528
+ controls = "DrgcmsControls::#{controls_string.classify}".constantize rescue nil
529
+ extend controls if controls
530
+ else
531
+ render(action: 'error', locals: { error: t('drgcms.not_authorized')} )
532
+ end
532
533
  end
533
534
 
534
535
  ########################################################################