rad_bag 0.0.1 → 0.0.2

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.
data/Rakefile CHANGED
@@ -4,6 +4,7 @@ project(
4
4
  name: "bag",
5
5
  official_name: "rad_bag",
6
6
  summary: "Simple and handy Organizer",
7
+ dirs: ['app', 'config'],
7
8
  gem: true,
8
9
 
9
10
  author: "Alexey Petrushin",
@@ -0,0 +1,3 @@
1
+ class Notes < Items
2
+ layout '/bag/layout'
3
+ end
@@ -0,0 +1,52 @@
1
+ class Selectors < Items
2
+ layout '/bag/layout'
3
+
4
+ partials.hide :comments
5
+
6
+ def show
7
+ partials do
8
+ show :search
9
+ show :tags
10
+ end
11
+
12
+ respond_to do |f|
13
+ if @model
14
+ require_permission :view, @model
15
+
16
+ @page, @per_page = (params.page || 1).to_i, Models::Item::PER_PAGE
17
+
18
+ query = Models::Item.where(
19
+ viewers: {_in: rad.user.major_roles},
20
+ dependent: {_exists: false}
21
+ ).sort([:created_at, -1]).paginate(@page, @per_page)
22
+
23
+ tags = (@model.query + selected_tags).uniq
24
+ query = query.where tags: {_all: tags} unless tags.empty?
25
+
26
+ @model.items = query.all
27
+
28
+ f.html{@html_title = @model.name}
29
+ f.json{render json: @model}
30
+ else
31
+ f.html{render :not_found}
32
+ f.json{render :not_found}
33
+ end
34
+ end
35
+ end
36
+
37
+ def update
38
+ require_permission :update, @model
39
+
40
+ respond_to do |f|
41
+ if @model.set(params.model).save
42
+ flash.info = t :selector_updated
43
+
44
+ f.js{reload_page}
45
+ f.json{render :ok}
46
+ else
47
+ f.js{render action: :edit}
48
+ f.json{render json: {errors: @model.errors}, status: :failed}
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,10 @@
1
+ class Note < Item
2
+ available_as_markup :text
3
+ assign :original_text, String, true
4
+ validates_presence_of :text
5
+
6
+ # TODO2 search
7
+ # searchable do
8
+ # text :text, using: :text_as_text, stored: true
9
+ # end
10
+ end
@@ -0,0 +1,32 @@
1
+ class Selector < Item
2
+ VIEWS = %w{line thumb}
3
+
4
+ attr_writer :query
5
+ def query; @query ||= [] end
6
+ available_as_string :query, :line
7
+ assign :query_as_string, String, true
8
+
9
+
10
+ attr_writer :view
11
+ def view; @view ||= 'line' end
12
+ assign :view, String, true
13
+ validates_presence_of :view
14
+ validates_inclusion_of :view, in: VIEWS
15
+
16
+
17
+ available_as_markup :text
18
+ assign :original_text, String, true
19
+
20
+ def items; @_items ||= [] end
21
+ def items= items; @_items = items end
22
+
23
+ # TODO1 update this
24
+ def to_json options = {}
25
+ super options.merge(methods: [:items])
26
+ end
27
+
28
+ # TODO2 search
29
+ # searchable do
30
+ # text :text, using: :text_as_text
31
+ # end
32
+ end
@@ -0,0 +1,963 @@
1
+ /*
2
+ Naming convention:
3
+ - global styles have 'the' prefix
4
+ - local styles have 'l' (local) prefix
5
+ - mixins have 'm' (mixin) prefix
6
+
7
+ - internal structural mixins have 't' (template) prefix
8
+ - internal style mixins have 's' (style) prefix
9
+ */
10
+ /*@small: 5px;
11
+ @normal: 10px;
12
+ @big: 20px;*/
13
+ .m_tiny {
14
+ color: #cccccc !important;
15
+ }
16
+ .m_tiny a {
17
+ color: #cccccc !important;
18
+ }
19
+ .m_bold {
20
+ font-weight: bold;
21
+ }
22
+ .m_hidden {
23
+ display: none !important;
24
+ }
25
+ /*.s_width () {max-width: @max_width; margin-left: auto; margin-right: auto;}*/
26
+ a {
27
+ color: black;
28
+ text-decoration: none;
29
+ }
30
+ a:visited {
31
+ color: black;
32
+ }
33
+ .css_clear {
34
+ display: block !important;
35
+ clear: both !important;
36
+ width: 0px !important;
37
+ height: 0px !important;
38
+ min-width: 0px !important;
39
+ min-height: 0px !important;
40
+ margin: 0px !important;
41
+ padding: 0px !important;
42
+ border: 0px !important;
43
+ }
44
+ table.css_table {
45
+ margin: 0;
46
+ padding: 0;
47
+ border: 0;
48
+ width: 100%;
49
+ }
50
+ table.css_table > tbody {
51
+ margin: 0;
52
+ padding: 0;
53
+ border: 0;
54
+ }
55
+ table.css_table > tbody > tr {
56
+ margin: 0;
57
+ padding: 0;
58
+ border: 0;
59
+ }
60
+ table.css_table > tbody > tr > td {
61
+ margin: 0;
62
+ padding: 0;
63
+ border: 0;
64
+ vertical-align: top;
65
+ }
66
+ .m_title {
67
+ font-size: 180%;
68
+ font-weight: bold;
69
+ padding-top: 5px;
70
+ padding-bottom: 5px;
71
+ margin-top: 0px;
72
+ margin-bottom: 0px;
73
+ margin-top: 0px;
74
+ padding-top: 0px;
75
+ }
76
+ .m_details {
77
+ float: right;
78
+ color: #cccccc;
79
+ }
80
+ .m_details > *, .m_details > a {
81
+ float: left;
82
+ }
83
+ .m_details a {
84
+ color: #2a5db0;
85
+ text-decoration: underline;
86
+ }
87
+ .m_details a:visited {
88
+ color: #2a5db0;
89
+ }
90
+ .m_details > * {
91
+ padding-right: 5px;
92
+ }
93
+ .m_details a {
94
+ color: #cccccc !important;
95
+ }
96
+ .m_tags {
97
+ float: left;
98
+ margin-top: 5px;
99
+ margin-bottom: 5px;
100
+ }
101
+ .m_tags > *, .m_tags > a {
102
+ float: left;
103
+ }
104
+ .m_tags > *, .m_tags > a {
105
+ -moz-border-radius: 3px;
106
+ -webkit-border-radius: 3px;
107
+ border-radius: 3px;
108
+ font-size: 90%;
109
+ padding-left: 5px;
110
+ padding-right: 5px;
111
+ background: #efefef;
112
+ margin-right: 5px;
113
+ }
114
+ .m_tags .m_owner_visibility,
115
+ .m_tags .m_member_visibility,
116
+ .m_tags .m_custom_visibility,
117
+ .m_tags .m_item_type {
118
+ background: white;
119
+ }
120
+ .m_tags .m_owner_visibility {
121
+ color: #dd0000;
122
+ }
123
+ .m_tags .m_member_visibility, .m_tags .m_custom_visibility {
124
+ color: #dddd00;
125
+ }
126
+ .m_tags .m_item_type {
127
+ color: #cccccc !important;
128
+ }
129
+ .m_tags .m_item_type a {
130
+ color: #cccccc !important;
131
+ }
132
+ .m_attachments {
133
+ float: left;
134
+ margin-top: 5px;
135
+ margin-bottom: 5px;
136
+ }
137
+ .m_attachments > *, .m_attachments > a {
138
+ float: left;
139
+ }
140
+ .m_attachments a {
141
+ color: #2a5db0;
142
+ text-decoration: underline;
143
+ }
144
+ .m_attachments a:visited {
145
+ color: #2a5db0;
146
+ }
147
+ .m_attachments > *, .m_attachments > a {
148
+ padding-right: 5px;
149
+ }
150
+ .m_hover_controls {
151
+ position: absolute;
152
+ right: 0px;
153
+ top: 0px;
154
+ z-index: 1;
155
+ display: none;
156
+ font-size: 100%;
157
+ text-align: right;
158
+ }
159
+ .m_hover_controls a {
160
+ color: #2a5db0;
161
+ text-decoration: underline;
162
+ }
163
+ .m_hover_controls a:visited {
164
+ color: #2a5db0;
165
+ }
166
+ .m_selectable > .m_hover_controls {
167
+ background: white;
168
+ border: solid 1px white;
169
+ padding: 5px;
170
+ margin: 5px;
171
+ border-color: #cccccc;
172
+ -moz-border-radius-bottomleft: 3px;
173
+ -webkit-border-bottom-left-radius: 3px;
174
+ border-bottom-left-radius: 3px;
175
+ border-right: 0px;
176
+ border-top: 0px;
177
+ margin: 0px;
178
+ }
179
+ .m_selectable_hover {
180
+ border-color: #cccccc !important;
181
+ }
182
+ /*.t_left () {float: left;}
183
+ .t_right () {float: right;}
184
+ */.m_markup a {
185
+ color: #2a5db0;
186
+ text-decoration: underline;
187
+ }
188
+ .m_markup a:visited {
189
+ color: #2a5db0;
190
+ }
191
+ .m_markup .left {
192
+ float: left;
193
+ margin-top: 2.5px;
194
+ margin-right: 5px;
195
+ }
196
+ .m_markup .right {
197
+ float: right;
198
+ margin-top: 2.5px;
199
+ margin-left: 5px;
200
+ }
201
+ .m_markup .clear {
202
+ clear: both;
203
+ }
204
+ .m_markup .space {
205
+ height: 10px;
206
+ clear: both;
207
+ }
208
+ .m_markup .tiny {
209
+ color: #cccccc !important;
210
+ }
211
+ .m_markup .tiny a {
212
+ color: #cccccc !important;
213
+ }
214
+ .m_markup table tr td {
215
+ vertical-align: top;
216
+ }
217
+ .m_markup p {
218
+ margin-bottom: 10px;
219
+ }
220
+ .m_markup h1,
221
+ .m_markup h2,
222
+ .m_markup h3,
223
+ .m_markup h4,
224
+ .m_markup h5,
225
+ .m_markup h6 {
226
+ clear: both;
227
+ }
228
+ .m_markup object {
229
+ clear: both;
230
+ display: block;
231
+ margin-bottom: 5px;
232
+ }
233
+ .m_markup pre {
234
+ padding: 5px;
235
+ margin-bottom: 5px;
236
+ -moz-border-radius: 5px;
237
+ -webkit-border-radius: 5px;
238
+ border-radius: 5px;
239
+ background-color: #efefef;
240
+ max-width: 807.2px;
241
+ }
242
+ .m_markup .left pre, .m_markup .right pre {
243
+ width: 450px;
244
+ margin-left: 5px;
245
+ }
246
+ body > .css_box {
247
+ max-width: 1024px;
248
+ margin-left: auto;
249
+ margin-right: auto;
250
+ }
251
+ body > .css_box > table.css_table > tbody > tr > td.css_td2 {
252
+ width: 20%;
253
+ }
254
+ .the_tools {
255
+ background: white;
256
+ border: solid 1px white;
257
+ padding: 5px;
258
+ margin: 5px;
259
+ border-color: #cccccc;
260
+ -moz-border-radius: 5px;
261
+ -webkit-border-radius: 5px;
262
+ border-radius: 5px;
263
+ }
264
+ .panel_s {
265
+ font-size: 90%;
266
+ }
267
+ .panel_s .l_left {
268
+ padding-left: 5px;
269
+ }
270
+ .panel_s .l_left .l_item {
271
+ padding-left: 5px;
272
+ padding-right: 5px;
273
+ padding-top: 1px;
274
+ padding-bottom: 1px;
275
+ }
276
+ .panel_s .l_right {
277
+ padding-right: 5px;
278
+ }
279
+ .panel_s .l_right .l_item {
280
+ padding-left: 5px;
281
+ padding-right: 5px;
282
+ padding-top: 1px;
283
+ padding-bottom: 1px;
284
+ }
285
+ .panel_s .css_box .l_left .l_logo {
286
+ font-weight: bold;
287
+ }
288
+ .the_top_panel {
289
+ font-size: 90%;
290
+ background: #cccccc;
291
+ }
292
+ .the_top_panel .l_left {
293
+ float: left;
294
+ }
295
+ .the_top_panel .l_left .l_item {
296
+ float: left;
297
+ }
298
+ .the_top_panel .l_right {
299
+ float: right;
300
+ }
301
+ .the_top_panel .l_right .l_item {
302
+ float: right;
303
+ }
304
+ .the_top_panel .css_box {
305
+ max-width: 1024px;
306
+ margin-left: auto;
307
+ margin-right: auto;
308
+ }
309
+ .the_top_panel .l_left {
310
+ padding-left: 5px;
311
+ }
312
+ .the_top_panel .l_left .l_item {
313
+ padding-left: 5px;
314
+ padding-right: 5px;
315
+ padding-top: 1px;
316
+ padding-bottom: 1px;
317
+ }
318
+ .the_top_panel .l_right {
319
+ padding-right: 5px;
320
+ }
321
+ .the_top_panel .l_right .l_item {
322
+ padding-left: 5px;
323
+ padding-right: 5px;
324
+ padding-top: 1px;
325
+ padding-bottom: 1px;
326
+ }
327
+ .the_top_panel .css_box .l_left .l_logo {
328
+ font-weight: bold;
329
+ }
330
+ .the_top_panel .css_box .l_left .l_logo {
331
+ font-weight: bold;
332
+ }
333
+ .the_bottom_panel {
334
+ font-size: 90%;
335
+ background-color: #cccccc;
336
+ padding-top: 10px;
337
+ padding-bottom: 10px;
338
+ }
339
+ .the_bottom_panel .l_left {
340
+ float: left;
341
+ }
342
+ .the_bottom_panel .l_left .l_item {
343
+ float: left;
344
+ }
345
+ .the_bottom_panel .l_right {
346
+ float: right;
347
+ }
348
+ .the_bottom_panel .l_right .l_item {
349
+ float: right;
350
+ }
351
+ .the_bottom_panel .css_box {
352
+ max-width: 1024px;
353
+ margin-left: auto;
354
+ margin-right: auto;
355
+ }
356
+ .the_bottom_panel .l_left {
357
+ padding-left: 5px;
358
+ }
359
+ .the_bottom_panel .l_left .l_item {
360
+ padding-left: 5px;
361
+ padding-right: 5px;
362
+ padding-top: 1px;
363
+ padding-bottom: 1px;
364
+ }
365
+ .the_bottom_panel .l_right {
366
+ padding-right: 5px;
367
+ }
368
+ .the_bottom_panel .l_right .l_item {
369
+ padding-left: 5px;
370
+ padding-right: 5px;
371
+ padding-top: 1px;
372
+ padding-bottom: 1px;
373
+ }
374
+ .the_bottom_panel .css_box .l_left .l_logo {
375
+ font-weight: bold;
376
+ }
377
+ .the_navigation {
378
+ font-size: 90%;
379
+ }
380
+ .the_navigation .l_left {
381
+ float: left;
382
+ }
383
+ .the_navigation .l_left .l_item {
384
+ float: left;
385
+ }
386
+ .the_navigation .l_right {
387
+ float: right;
388
+ }
389
+ .the_navigation .l_right .l_item {
390
+ float: right;
391
+ }
392
+ .the_navigation .css_box {
393
+ max-width: 1024px;
394
+ margin-left: auto;
395
+ margin-right: auto;
396
+ }
397
+ .the_navigation .l_left {
398
+ padding-left: 5px;
399
+ }
400
+ .the_navigation .l_left .l_item {
401
+ padding-left: 5px;
402
+ padding-right: 5px;
403
+ padding-top: 1px;
404
+ padding-bottom: 1px;
405
+ }
406
+ .the_navigation .l_right {
407
+ padding-right: 5px;
408
+ }
409
+ .the_navigation .l_right .l_item {
410
+ padding-left: 5px;
411
+ padding-right: 5px;
412
+ padding-top: 1px;
413
+ padding-bottom: 1px;
414
+ }
415
+ .the_navigation .css_box .l_left .l_logo {
416
+ font-weight: bold;
417
+ }
418
+ .the_navigation .css_box .l_active {
419
+ font-weight: bold;
420
+ background-color: #cccccc;
421
+ -moz-border-radius-bottomleft: 3px;
422
+ -webkit-border-bottom-left-radius: 3px;
423
+ border-bottom-left-radius: 3px;
424
+ -moz-border-radius-bottomright: 3px;
425
+ -webkit-border-bottom-right-radius: 3px;
426
+ border-bottom-right-radius: 3px;
427
+ }
428
+ /*.the_navigation_t {.t_tabs;
429
+ > .css_box {.t_max_width;}}
430
+ .the_navigation {.the_navigation_t; .s_tabs; .s_small_text; padding-left: 0; padding-right: 0;
431
+ > .css_box {
432
+ .l_item:first-child {margin-left: @normal + @small;}
433
+ .l_active {.s_round_bl(@small_radius); .s_round_br(@small_radius);}}}*/.the_controls {
434
+ font-size: 100%;
435
+ }
436
+ .the_controls a {
437
+ color: #2a5db0;
438
+ text-decoration: underline;
439
+ }
440
+ .the_controls a:visited {
441
+ color: #2a5db0;
442
+ }
443
+ .the_discussion > .l_controls {
444
+ float: right;
445
+ }
446
+ .the_discussion > .l_controls {
447
+ background: white;
448
+ border: solid 1px white;
449
+ padding: 5px;
450
+ margin: 5px;
451
+ font-size: 100%;
452
+ }
453
+ .the_discussion > .l_controls a {
454
+ color: #2a5db0;
455
+ text-decoration: underline;
456
+ }
457
+ .the_discussion > .l_controls a:visited {
458
+ color: #2a5db0;
459
+ }
460
+ .the_paginator {
461
+ background: white;
462
+ border: solid 1px white;
463
+ padding: 5px;
464
+ margin: 5px;
465
+ }
466
+ .the_paginator a {
467
+ color: #2a5db0;
468
+ text-decoration: underline;
469
+ }
470
+ .the_paginator a:visited {
471
+ color: #2a5db0;
472
+ }
473
+ .the_paginator > * {
474
+ margin-right: 5px;
475
+ }
476
+ .the_paginator .l_active {
477
+ font-weight: bold;
478
+ }
479
+ .the_more {
480
+ color: #cccccc !important;
481
+ color: #2a5db0;
482
+ text-decoration: underline;
483
+ }
484
+ .the_more a {
485
+ color: #cccccc !important;
486
+ }
487
+ .the_more:visited {
488
+ color: #2a5db0;
489
+ }
490
+ .the_narrow {
491
+ margin-left: 20%;
492
+ margin-right: 20%;
493
+ }
494
+ .the_tabs > .l_panel {
495
+ padding-left: 5px;
496
+ padding-right: 5px;
497
+ background: white;
498
+ border-bottom: 1px solid #cccccc;
499
+ }
500
+ .the_tabs > .l_panel .l_item {
501
+ float: left;
502
+ }
503
+ .the_tabs > .l_panel .l_item {
504
+ padding-left: 5px;
505
+ padding-right: 5px;
506
+ padding-top: 1px;
507
+ padding-bottom: 1px;
508
+ }
509
+ .the_tabs > .l_panel .l_active {
510
+ background: #cccccc;
511
+ font-weight: bold;
512
+ }
513
+ .the_tabs > .l_panel .l_active {
514
+ -moz-border-radius-topleft: 3px;
515
+ -webkit-border-top-left-radius: 3px;
516
+ border-top-left-radius: 3px;
517
+ -moz-border-radius-topright: 3px;
518
+ -webkit-border-top-right-radius: 3px;
519
+ border-top-right-radius: 3px;
520
+ cursor: text;
521
+ }
522
+ .the_tabs > .l_panel .l_active a {
523
+ cursor: text;
524
+ }
525
+ .the_tabs > .l_panel a {
526
+ outline: none;
527
+ }
528
+ .the_basic_list .l_item .l_check_box {
529
+ display: inline;
530
+ }
531
+ .the_basic_list .l_item .l_content {
532
+ display: inline;
533
+ }
534
+ .the_basic_list .l_item .l_content > div {
535
+ display: inline;
536
+ }
537
+ .the_basic_list .l_item a {
538
+ color: #2a5db0;
539
+ text-decoration: underline;
540
+ }
541
+ .the_basic_list .l_item a:visited {
542
+ color: #2a5db0;
543
+ }
544
+ .the_info_message {
545
+ background: white;
546
+ border: solid 1px white;
547
+ padding: 5px;
548
+ margin: 5px;
549
+ -moz-border-radius: 5px;
550
+ -webkit-border-radius: 5px;
551
+ border-radius: 5px;
552
+ margin-left: 20%;
553
+ margin-right: 20%;
554
+ background: #eeeebb;
555
+ }
556
+ .the_info_message a {
557
+ color: #2a5db0;
558
+ text-decoration: underline;
559
+ }
560
+ .the_info_message a:visited {
561
+ color: #2a5db0;
562
+ }
563
+ .the_error_message {
564
+ background: white;
565
+ border: solid 1px white;
566
+ padding: 5px;
567
+ margin: 5px;
568
+ -moz-border-radius: 5px;
569
+ -webkit-border-radius: 5px;
570
+ border-radius: 5px;
571
+ margin-left: 20%;
572
+ margin-right: 20%;
573
+ background: #eebbbb;
574
+ }
575
+ .the_error_message a {
576
+ color: #2a5db0;
577
+ text-decoration: underline;
578
+ }
579
+ .the_error_message a:visited {
580
+ color: #2a5db0;
581
+ }
582
+ .the_divider {
583
+ background: white;
584
+ border: solid 1px white;
585
+ padding: 5px;
586
+ margin: 5px;
587
+ clear: both;
588
+ font-size: 110%;
589
+ font-weight: bold;
590
+ text-align: right;
591
+ border-bottom: 1px solid black;
592
+ }
593
+ .the_table {
594
+ width: 100%;
595
+ }
596
+ .the_table a {
597
+ color: #2a5db0;
598
+ text-decoration: underline;
599
+ }
600
+ .the_table a:visited {
601
+ color: #2a5db0;
602
+ }
603
+ .the_table thead tr th {
604
+ background: #cccccc;
605
+ font-size: 110%;
606
+ font-weight: bold;
607
+ text-align: left;
608
+ padding: 5px;
609
+ }
610
+ .the_table thead tr th:first-child {
611
+ -moz-border-radius-topleft: 5px;
612
+ -webkit-border-top-left-radius: 5px;
613
+ border-top-left-radius: 5px;
614
+ }
615
+ .the_table thead tr th:last-child {
616
+ -moz-border-radius-topright: 5px;
617
+ -webkit-border-top-right-radius: 5px;
618
+ border-top-right-radius: 5px;
619
+ }
620
+ .the_table tbody tr td {
621
+ padding: 5px;
622
+ }
623
+ .the_table tbody .l_even {
624
+ background: #efefef;
625
+ }
626
+ .the_toolbar .l_left {
627
+ float: left;
628
+ }
629
+ .the_toolbar .l_left .l_item {
630
+ float: left;
631
+ }
632
+ .the_toolbar .l_right {
633
+ float: right;
634
+ }
635
+ .the_toolbar .l_right .l_item {
636
+ float: right;
637
+ }
638
+ .the_toolbar .l_left {
639
+ padding-left: 5px;
640
+ }
641
+ .the_toolbar .l_left .l_item {
642
+ padding-left: 5px;
643
+ padding-right: 5px;
644
+ padding-top: 1px;
645
+ padding-bottom: 1px;
646
+ }
647
+ .the_toolbar .l_right {
648
+ padding-right: 5px;
649
+ }
650
+ .the_toolbar .l_right .l_item {
651
+ padding-left: 5px;
652
+ padding-right: 5px;
653
+ padding-top: 1px;
654
+ padding-bottom: 1px;
655
+ }
656
+ .the_toolbar a {
657
+ color: #2a5db0;
658
+ text-decoration: underline;
659
+ }
660
+ .the_toolbar a:visited {
661
+ color: #2a5db0;
662
+ }
663
+ .the_dialog {
664
+ background: white;
665
+ border: solid 1px white;
666
+ padding: 5px;
667
+ margin: 5px;
668
+ border-width: 5px;
669
+ border-color: #cccccc;
670
+ -moz-border-radius: 5px;
671
+ -webkit-border-radius: 5px;
672
+ border-radius: 5px;
673
+ width: 60%;
674
+ }
675
+ .the_image_dialog {
676
+ background: white;
677
+ border: solid 1px white;
678
+ padding: 5px;
679
+ margin: 5px;
680
+ border-color: #cccccc;
681
+ -moz-border-radius: 5px;
682
+ -webkit-border-radius: 5px;
683
+ border-radius: 5px;
684
+ }
685
+ .the_context_menu {
686
+ background: white;
687
+ border: solid 1px white;
688
+ padding: 5px;
689
+ margin: 5px;
690
+ border-color: #cccccc;
691
+ -moz-border-radius: 3px;
692
+ -webkit-border-radius: 3px;
693
+ border-radius: 3px;
694
+ max-width: 100px;
695
+ }
696
+ .the_context_menu a {
697
+ color: #2a5db0;
698
+ text-decoration: underline;
699
+ }
700
+ .the_context_menu a:visited {
701
+ color: #2a5db0;
702
+ }
703
+ .the_inplace_editor {
704
+ background: white;
705
+ border: solid 1px white;
706
+ padding: 5px;
707
+ margin: 5px;
708
+ border-color: #cccccc;
709
+ -moz-border-radius: 5px;
710
+ -webkit-border-radius: 5px;
711
+ border-radius: 5px;
712
+ }
713
+ .the_form .l_field > table.css_table > tbody > tr > td.css_td1 {
714
+ width: 30%;
715
+ }
716
+ .the_form .l_line .l_item {
717
+ float: left;
718
+ }
719
+ .the_form .l_errors .l_error {
720
+ font-size: 90%;
721
+ color: #dd0000;
722
+ }
723
+ .the_form .l_field {
724
+ background: white;
725
+ border: solid 1px white;
726
+ padding-top: 1px;
727
+ padding-bottom: 1px;
728
+ margin-top: 1px;
729
+ margin-bottom: 1px;
730
+ }
731
+ .the_form .l_field a {
732
+ color: #2a5db0;
733
+ text-decoration: underline;
734
+ }
735
+ .the_form .l_field a:visited {
736
+ color: #2a5db0;
737
+ }
738
+ .the_form .l_field .l_required {
739
+ font-weight: bold;
740
+ }
741
+ .the_form .l_field .l_input select {
742
+ min-width: 30%;
743
+ }
744
+ .the_form .l_field .l_input input, .the_form .l_field .l_input textarea {
745
+ width: 100%;
746
+ }
747
+ .the_form .l_field .l_input textarea {
748
+ min-height: 60px !important;
749
+ }
750
+ .the_form .l_field .l_input input[type=checkbox] {
751
+ width: auto;
752
+ }
753
+ .the_form .l_field .l_input input[type=radio] {
754
+ width: auto;
755
+ }
756
+ .the_form .l_field .l_input label {
757
+ margin-left: 5px;
758
+ margin-right: 10px;
759
+ }
760
+ .the_form .l_field .l_description {
761
+ font-size: 90%;
762
+ color: #cccccc;
763
+ }
764
+ .the_form .l_line {
765
+ padding-left: 5px;
766
+ padding-right: 5px;
767
+ background: white;
768
+ background: white;
769
+ border: solid 1px white;
770
+ padding-top: 5px;
771
+ padding-bottom: 5px;
772
+ margin-top: 5px;
773
+ margin-bottom: 5px;
774
+ }
775
+ .the_form .l_line .l_item {
776
+ padding-left: 5px;
777
+ padding-right: 5px;
778
+ padding-top: 1px;
779
+ padding-bottom: 1px;
780
+ }
781
+ .the_form .l_line .l_active {
782
+ background: #cccccc;
783
+ font-weight: bold;
784
+ }
785
+ .the_form .l_line a {
786
+ color: #2a5db0;
787
+ text-decoration: underline;
788
+ }
789
+ .the_form .l_line a:visited {
790
+ color: #2a5db0;
791
+ }
792
+ .the_form .l_line .l_item a {
793
+ padding: 3px 0px 4px;
794
+ display: block;
795
+ }
796
+ .the_form .the_more {
797
+ float: right;
798
+ }
799
+ .the_attachments .l_item {
800
+ float: left;
801
+ }
802
+ .the_attachments .l_item > a, .the_attachments .l_item div {
803
+ float: left;
804
+ }
805
+ .the_attachments .l_item > a, .the_attachments .l_item div {
806
+ margin-right: 5px;
807
+ }
808
+ .the_attachments .l_item_style {
809
+ background: white;
810
+ border: solid 1px white;
811
+ padding: 5px;
812
+ margin: 5px;
813
+ -moz-border-radius: 5px;
814
+ -webkit-border-radius: 5px;
815
+ border-radius: 5px;
816
+ border-color: #cccccc;
817
+ margin-left: 0;
818
+ margin-right: 10px;
819
+ }
820
+ .the_attachments .l_empty_item_style {
821
+ background: white;
822
+ border: solid 1px white;
823
+ padding: 5px;
824
+ margin: 5px;
825
+ margin-left: 0;
826
+ margin-right: 10px;
827
+ }
828
+ .the_comment {
829
+ background: white;
830
+ border: solid 1px white;
831
+ padding: 5px;
832
+ margin: 5px;
833
+ -moz-border-radius: 5px;
834
+ -webkit-border-radius: 5px;
835
+ border-radius: 5px;
836
+ }
837
+ .the_comment > table.css_table > tbody > tr > td.css_td1 {
838
+ width: 50px;
839
+ }
840
+ .the_comment .l_image {
841
+ margin-right: 5px;
842
+ }
843
+ .the_thumb {
844
+ float: left;
845
+ background: white;
846
+ border: solid 1px white;
847
+ padding: 5px;
848
+ margin: 5px;
849
+ -moz-border-radius: 5px;
850
+ -webkit-border-radius: 5px;
851
+ border-radius: 5px;
852
+ min-width: 150px;
853
+ min-height: 150px;
854
+ margin: 0px;
855
+ }
856
+ .the_thumb .l_title {
857
+ display: block;
858
+ }
859
+ .the_thumb .m_hover_controls {
860
+ font-size: 90%;
861
+ }
862
+ .the_thumb .l_title {
863
+ font-size: 90%;
864
+ max-width: 150px;
865
+ }
866
+ .the_line {
867
+ background: white;
868
+ border: solid 1px white;
869
+ padding: 5px;
870
+ margin: 5px;
871
+ -moz-border-radius: 5px;
872
+ -webkit-border-radius: 5px;
873
+ border-radius: 5px;
874
+ }
875
+ .the_line > table.css_table > tbody > tr > td.css_td1 {
876
+ width: 50px;
877
+ }
878
+ .the_line .l_image {
879
+ width: 50px;
880
+ margin-right: 5px;
881
+ }
882
+ .the_line .l_title {
883
+ font-size: 110%;
884
+ font-weight: bold;
885
+ color: #2a5db0;
886
+ }
887
+ .the_line .l_title:visited {
888
+ color: #2a5db0;
889
+ }
890
+ .the_item {
891
+ background: white;
892
+ border: solid 1px white;
893
+ padding: 5px;
894
+ margin: 5px;
895
+ -moz-border-radius: 5px;
896
+ -webkit-border-radius: 5px;
897
+ border-radius: 5px;
898
+ }
899
+ .the_tool {
900
+ padding-bottom: 10px;
901
+ }
902
+ .the_tool > .l_title {
903
+ color: #cccccc;
904
+ font-weight: bold;
905
+ }
906
+ .the_tag_selector {
907
+ text-align: center;
908
+ }
909
+ .the_tag_selector .l_tag {
910
+ display: inline-block;
911
+ }
912
+ .the_tag_selector .l_selected {
913
+ -moz-border-radius: 3px;
914
+ -webkit-border-radius: 3px;
915
+ border-radius: 3px;
916
+ color: white;
917
+ padding-left: 5px;
918
+ padding-right: 5px;
919
+ background: #2a5db0;
920
+ }
921
+ .the_tag_selector .l_selected a {
922
+ color: white;
923
+ }
924
+ .the_tag_selector .l_tag {
925
+ margin: 1px;
926
+ }
927
+ .the_tag_selector .l_size_1 {
928
+ font-size: 90%;
929
+ }
930
+ .the_tag_selector .l_size_2 {
931
+ font-size: 120%;
932
+ }
933
+ .the_tag_selector .l_size_3 {
934
+ font-size: 130%;
935
+ }
936
+ .the_tag_selector .l_size_4 {
937
+ font-size: 140%;
938
+ }
939
+ .the_selector {
940
+ background: white;
941
+ border: solid 1px white;
942
+ padding: 5px;
943
+ margin: 5px;
944
+ -moz-border-radius: 5px;
945
+ -webkit-border-radius: 5px;
946
+ border-radius: 5px;
947
+ }
948
+ .the_selector > .l_text a {
949
+ color: #2a5db0;
950
+ text-decoration: underline;
951
+ }
952
+ .the_selector > .l_text a:visited {
953
+ color: #2a5db0;
954
+ }
955
+ .the_note {
956
+ background: white;
957
+ border: solid 1px white;
958
+ padding: 5px;
959
+ margin: 5px;
960
+ -moz-border-radius: 5px;
961
+ -webkit-border-radius: 5px;
962
+ border-radius: 5px;
963
+ }
@@ -0,0 +1,7 @@
1
+ @import "../../../../../common_interface/app/static/themes/default/style";
2
+
3
+ .the_selector {.s_box; .s_round;
4
+ > .l_text {.s_link;}}
5
+
6
+ .the_note {.s_box; .s_round;
7
+ .l_text {}}
@@ -0,0 +1,4 @@
1
+ - content_for :nothing do
2
+ - content_for :css do
3
+ = stylesheet_link_tag '/themes/default/bag.css'
4
+ = render '/kit/layout'
@@ -0,0 +1 @@
1
+ = render '/kit/layout'
@@ -0,0 +1,13 @@
1
+ = b.title form_title_for(@model)
2
+ - b.form_for :model, @model, action: form_action, enctype: "multipart/form-data" do |f|
3
+ = f.error_messages
4
+
5
+ = f.text_field :name
6
+ = f.text_area :original_text, label: false, required: true
7
+
8
+ - common_fields_for_item f do
9
+ = f.attachments :attachments_as_attachments, label: t(:attachments) unless rad.user.anonymous?
10
+
11
+ = f.line
12
+
13
+ = f.line ok_button, cancel_button
@@ -0,0 +1,11 @@
1
+ - b.note id: @model.dom_id do |o|
2
+ - o.name h(@model.name)
3
+ - o.text @model.text
4
+
5
+ - o.controls do |a|
6
+ - a.add link_to(t(:edit), edit_path(@model, format: :js)) if can? :update, @model
7
+ - a.add link_to(t(:delete), destroy_path(@model, format: :js), method: :post, confirm: t(:are_you_shure)) if can? :destroy, @model
8
+
9
+ - o.attachments @model.attachments_as_attachments
10
+ - o.tags render_item_tags(@model)
11
+ - o.details render_item_details(@model)
@@ -0,0 +1,17 @@
1
+ = b.title form_title_for(@model)
2
+ - b.form_for :model, @model, action: form_action, enctype: "multipart/form-data" do |f|
3
+ = f.error_messages
4
+
5
+ = f.text_field :name, required: true
6
+ = f.text_field :query_as_string, required: true, label: t(:query), description: t(:query_description)
7
+
8
+ - values = Models::Selector::VIEWS.collect{|view| [t(view), view]}
9
+ = f.select :view, values, required: true
10
+
11
+ - common_fields_for_item f do
12
+ = f.text_area :original_text, label: t(:selector_description)
13
+ = f.attachments :attachments_as_attachments, label: t(:attachments) unless rad.user.anonymous?
14
+
15
+ = f.line
16
+
17
+ = f.line ok_button, cancel_button
@@ -0,0 +1,13 @@
1
+ - b.selector id: @model.dom_id do |o|
2
+ - o.name h(@model.name)
3
+ - o.text @model.text if selected_tags.blank?
4
+ - o.controls do |a|
5
+ - a.add link_to(t(:edit), edit_path(@model, format: :js)) if can? :update, @model
6
+ - a.add link_to(t(:delete), destroy_path(@model, format: :js), method: :post, confirm: t(:are_you_shure)) if can? :destroy, @model
7
+
8
+ - @model.items.each do |item|
9
+ = render "/previews/#{@model.view}", object: item
10
+ .css_clear
11
+
12
+ - html = paginator_for(@page, @model.items.size, @per_page){|t, n| link_to t, url_for(Controllers::Items, action_name, page: n, id: @model.to_param)}
13
+ - content_for :aspects, html unless html.blank?
@@ -0,0 +1,12 @@
1
+ - tag :div, object.merge_html_attributes(class: " the_note m_selectable") do
2
+ - if object.controls?
3
+ .m_hover_controls= object.controls.join(' ')
4
+
5
+ - if object.name?
6
+ %h1.m_title= object.name
7
+
8
+ .l_text.m_markup
9
+ = object.text
10
+ .css_clear
11
+
12
+ = render themed_partial('/shared/details'), object: object
@@ -0,0 +1,10 @@
1
+ - tag :div, object.merge_html_attributes(class: " the_selector") do
2
+ - if object.controls?
3
+ .m_hover_controls= object.controls.join(' ')
4
+ - if object.name?
5
+ %h1.m_title= object.name
6
+ - if object.text?
7
+ .l_text.m_markup
8
+ = object.text
9
+ .css_clear
10
+ .css_clear
@@ -0,0 +1,45 @@
1
+ en:
2
+ # Selectors
3
+ create_selector: "Create Selector"
4
+ invalid_selectors: "Invalid selector name"
5
+ query: "Query"
6
+ query_description: |
7
+ Select tags to display, for example - "News, Public".
8
+ You can also use special _class tag, for example to select only products type "Featured, _class:Models::Product".
9
+ query_errors: "There are errors in query"
10
+ query_too_long: "Query is too long"
11
+ selector_created: "Selector created"
12
+ selector_destroyed: "Selector deleted"
13
+ selector_description: "Description"
14
+ selector_updated: "Selector updated"
15
+
16
+ # Note
17
+ create_note: "Create note"
18
+ ether_name_or_text_should_be_filled: "Ether name or text should be filled"
19
+ note_created: "Note created"
20
+ note_destroyed: "Note deleted"
21
+ note_updated: "Note updated"
22
+
23
+ # Page
24
+ add_embedded_item: "Add"
25
+ create_page: "Create Page"
26
+ page_created: "Page created"
27
+ page_destroyed: "Page deleted"
28
+ page_updated: "Page updated"
29
+
30
+ # Container
31
+ order_updated: "Order updated"
32
+
33
+ # List
34
+ add_task: "Add Task"
35
+ create_list: "Create List"
36
+ list_created: "List created"
37
+ list_destroyed: "List deleted"
38
+ list_updated: "List updated"
39
+
40
+ # Task
41
+ create_task: "Create Task"
42
+ state_updated: "State updated"
43
+ task_created: "Task created"
44
+ task_destroyed: "Task deleted"
45
+ task_updated: "Task updated"
@@ -0,0 +1,45 @@
1
+ ru:
2
+ # Selectors
3
+ create_selector: "Создать селектор"
4
+ invalid_selectors: "Неверное имя селектора"
5
+ query: "Запрос"
6
+ query_description: |
7
+ Выберети теги для фильтрации результатов, например - "Новости, Публичный".
8
+ Вы также можете использовать спецаильный тег _class, например чтобы выбрать только продукты напишите "Игрушки, _class:Models::Product".
9
+ query_errors: "В запросе есть ошибки"
10
+ query_too_long: "Слишком длинный запрос"
11
+ selector_created: "Селектор создан"
12
+ selector_destroyed: "Селектор удален"
13
+ selector_description: "Описание"
14
+ selector_updated: "Селектор обновлен"
15
+
16
+ # Note
17
+ create_note: "Создать заметку"
18
+ ether_name_or_text_should_be_filled: "Имя или Текст должны быть заполнены"
19
+ note_created: "Заметка создана"
20
+ note_destroyed: "Заметка удалена"
21
+ note_updated: "Заметка обновлена"
22
+
23
+ # Page
24
+ add_embedded_item: "Добавить"
25
+ create_page: "Создать страницу"
26
+ page_created: "Страница содана"
27
+ page_destroyed: "Страница удалена"
28
+ page_updated: "Страница обновлена"
29
+
30
+ # Container
31
+ order_updated: "Порядок обновлен"
32
+
33
+ # List
34
+ add_task: "Добавить задачу"
35
+ create_list: "Создать список"
36
+ list_created: "Список создан"
37
+ list_destroyed: "Список удален"
38
+ list_updated: "Список обновлен"
39
+
40
+ # Task
41
+ create_task: "Создать задачу"
42
+ state_updated: "Статус изменен"
43
+ task_created: "Задача создана"
44
+ task_destroyed: "Задача удалена"
45
+ task_updated: "Задача обновлена"
data/config/routes.rb ADDED
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rad_bag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rad_kit
16
- requirement: &2773910 !ruby/object:Gem::Requirement
16
+ requirement: &2772670 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2773910
24
+ version_requirements: *2772670
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rad_users
27
- requirement: &2773670 !ruby/object:Gem::Requirement
27
+ requirement: &2772430 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2773670
35
+ version_requirements: *2772430
36
36
  description:
37
37
  email:
38
38
  executables: []
@@ -50,6 +50,23 @@ files:
50
50
  - spec/models/general_spec.rb
51
51
  - spec/models/selector_spec.rb
52
52
  - spec/spec_helper.rb
53
+ - app/controllers/notes.rb
54
+ - app/controllers/selectors.rb
55
+ - app/models/note.rb
56
+ - app/models/selector.rb
57
+ - app/static/themes/default/bag.css
58
+ - app/static/themes/default/bag.less
59
+ - app/views/bag/layout.html.haml
60
+ - app/views/bag/layout.js.haml
61
+ - app/views/controllers/notes/_form.html.haml
62
+ - app/views/controllers/notes/show.html.haml
63
+ - app/views/controllers/selectors/_form.html.haml
64
+ - app/views/controllers/selectors/show.html.haml
65
+ - app/views/themes/default/note.html.haml
66
+ - app/views/themes/default/selector.html.haml
67
+ - config/locales/en.yml
68
+ - config/locales/ru.yml
69
+ - config/routes.rb
53
70
  homepage: http://github.com/alexeypetrushin/rad_bag
54
71
  licenses: []
55
72
  post_install_message: