rbbt-rest 1.3.32 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/common/forms.rb +1 -1
- data/lib/rbbt/rest/entity/action_controller.rb +2 -2
- data/lib/rbbt/rest/entity/favourites.rb +3 -3
- data/lib/rbbt/rest/main.rb +2 -1
- data/share/views/compass/_rbbt.sass +5 -1
- data/share/views/compass/actions.sass +2 -0
- data/share/views/compass/app.sass +3 -68
- data/share/views/compass/fonts.sass +54 -0
- data/share/views/compass/functions.sass +2 -1
- data/share/views/compass/grid_system.sass +51 -0
- data/share/views/compass/layout.sass +74 -8
- data/share/views/compass/rbbt/form.sass +2 -2
- data/share/views/compass/rbbt/menu.sass +6 -5
- data/share/views/compass/rbbt/reveal.sass +8 -9
- data/share/views/compass/style.sass +44 -2
- data/share/views/compass/theme.sass +14 -9
- data/share/views/compass/top_menu.sass +4 -5
- data/share/views/compass/workflow.sass +7 -5
- data/share/views/layout.haml +2 -2
- data/share/views/public/js/_ajax_replace.js +3 -0
- data/share/views/public/js/helpers.js +71 -60
- data/share/views/public/js/rbbt/favourites.js +398 -398
- data/share/views/public/js/rbbt/reveal.js +6 -0
- data/share/views/public/plugins/jquery/js/jquery-2.1.1.js +9190 -0
- metadata +5 -3
- data/config.ru +0 -102
@@ -4,19 +4,18 @@
|
|
4
4
|
=modal
|
5
5
|
+rbbt_panel(#fff, #000)
|
6
6
|
position: fixed
|
7
|
-
|
7
|
+
top: 0
|
8
8
|
z-index: 20
|
9
9
|
|
10
10
|
@media #{$not-large}
|
11
|
-
|
12
|
-
border: 10px solid rgba(0,0,0,0.3)
|
11
|
+
border: 5px solid rgba(0,0,0,0.3)
|
13
12
|
@media #{$only-large}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
height:
|
13
|
+
border: 5px solid rgba(0,0,0,0.3)
|
14
|
+
|
15
|
+
min-width: 70%
|
16
|
+
max-height: 90%
|
17
|
+
margin: 50px
|
18
18
|
overflow: auto
|
19
|
-
width: 100%
|
20
19
|
& > .header
|
21
20
|
font-size: 1.5em
|
22
21
|
.controls
|
@@ -27,7 +26,7 @@
|
|
27
26
|
float: left
|
28
27
|
|
29
28
|
width: 100%
|
30
|
-
+
|
29
|
+
+clear_fix
|
31
30
|
border-bottom: 1px solid grey
|
32
31
|
margin-bottom: $vindent
|
33
32
|
|
@@ -1,3 +1,45 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
@import "compass/reset"
|
2
|
+
@import "compass/utilities"
|
3
|
+
@import "compass/typography/vertical_rhythm"
|
4
|
+
@import "compass/css3"
|
3
5
|
|
6
|
+
@import "fonts"
|
7
|
+
|
8
|
+
ul
|
9
|
+
margin: 0px
|
10
|
+
padding-left: 0
|
11
|
+
|
12
|
+
a
|
13
|
+
text-decoration: none
|
14
|
+
&[href]
|
15
|
+
&:not([href^=\/])
|
16
|
+
&:not([href^='#'])
|
17
|
+
&:after
|
18
|
+
content: '\2192'
|
19
|
+
|
20
|
+
body
|
21
|
+
+establish-baseline
|
22
|
+
+typeSize("base")
|
23
|
+
width: 99%
|
24
|
+
|
25
|
+
p
|
26
|
+
padding: 0.5em 0
|
27
|
+
h5, h6
|
28
|
+
+typeSize("large")
|
29
|
+
|
30
|
+
h3, h4
|
31
|
+
+typeSize("large")
|
32
|
+
|
33
|
+
h1, h2
|
34
|
+
+typeSize("xlarge")
|
35
|
+
|
36
|
+
h2, h3
|
37
|
+
+typeWeight("strong")
|
38
|
+
|
39
|
+
h1
|
40
|
+
+typeWeight("ultrastrong")
|
41
|
+
|
42
|
+
code
|
43
|
+
font-family: console
|
44
|
+
+typeWeight("strong")
|
45
|
+
|
@@ -14,15 +14,20 @@ $color_panel_bg: $color_main
|
|
14
14
|
$color_menu_border: #494949
|
15
15
|
$color_menu_text: #020202
|
16
16
|
|
17
|
+
=dark()
|
18
|
+
+rebase($base3,$base2,$base1,$base0,$base00,$base01,$base02,$base03)
|
19
|
+
|
20
|
+
=light()
|
21
|
+
+rebase($base03,$base02,$base01,$base00,$base0,$base1,$base2,$base3)
|
17
22
|
|
18
23
|
.dark
|
19
|
-
+
|
24
|
+
+dark()
|
20
25
|
|
21
26
|
.light
|
22
|
-
+
|
27
|
+
+light()
|
23
28
|
|
24
29
|
body
|
25
|
-
background-color: $
|
30
|
+
background-color: $color3
|
26
31
|
|
27
32
|
html
|
28
33
|
*
|
@@ -34,19 +39,19 @@ html
|
|
34
39
|
|
35
40
|
//{{{ RBBT MENUS
|
36
41
|
|
37
|
-
$color_top_menu: $
|
42
|
+
$color_top_menu: $color2
|
38
43
|
|
39
|
-
$color_menu_bg: $
|
44
|
+
$color_menu_bg: $color1
|
40
45
|
$color_menu_text: $base0
|
41
|
-
$color_menu_item_bg: $
|
46
|
+
$color_menu_item_bg: $color1
|
42
47
|
$color_menu_item_text: $base0
|
43
|
-
$color_menu_content_bg: $
|
48
|
+
$color_menu_content_bg: $color3
|
44
49
|
$color_menu_content_text: $base0
|
45
50
|
|
46
|
-
$color_list_management_bg: $
|
51
|
+
$color_list_management_bg: $color2
|
47
52
|
//{{{ RBBT PANEL
|
48
53
|
|
49
|
-
$color_panel_bg: $
|
54
|
+
$color_panel_bg: $color2
|
50
55
|
$color_panel_border: $base1
|
51
56
|
$color_panel_text: $base0
|
52
57
|
|
@@ -8,10 +8,8 @@ $padding_top_menu: 5px
|
|
8
8
|
@media print
|
9
9
|
display: none
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
@media #{$only-large}
|
14
|
-
position: fixed
|
11
|
+
position: fixed
|
12
|
+
|
15
13
|
top: 0
|
16
14
|
width: 100%
|
17
15
|
z-index: 30
|
@@ -25,7 +23,8 @@ $padding_top_menu: 5px
|
|
25
23
|
& > ul
|
26
24
|
+grid_row()
|
27
25
|
+clean_list
|
28
|
-
+
|
26
|
+
+clear_fix
|
27
|
+
overflow: show
|
29
28
|
|
30
29
|
@media #{$only-large}
|
31
30
|
& > li
|
@@ -1,5 +1,7 @@
|
|
1
|
-
ul.tasks
|
2
|
-
|
1
|
+
ul.tasks
|
2
|
+
margin-top: 2em
|
3
|
+
li
|
4
|
+
display: block !important
|
3
5
|
|
4
6
|
.workflow_task
|
5
7
|
+card
|
@@ -9,7 +11,7 @@ ul.tasks > li
|
|
9
11
|
|
10
12
|
.description
|
11
13
|
+grid_row
|
12
|
-
+
|
14
|
+
+clear_fix
|
13
15
|
.task_description
|
14
16
|
|
15
17
|
|
@@ -38,10 +40,10 @@ ul.tasks > li
|
|
38
40
|
+rbbt_menu_item($color_bg: $base3, $color_menu_border: $base3)
|
39
41
|
|
40
42
|
dd.job_control, dd.job_files
|
41
|
-
+
|
43
|
+
+clear_fix
|
42
44
|
ul
|
43
45
|
+rbbt_button_list($color_bg: $color_menu_bg)
|
44
|
-
+
|
46
|
+
+clear_fix
|
45
47
|
background-color: $color_top_menu
|
46
48
|
width: auto
|
47
49
|
float: left
|
data/share/views/layout.haml
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
|
32
32
|
= serve_js
|
33
33
|
|
34
|
-
- %w(jquery-2.
|
34
|
+
- %w(jquery-2.1.1 jquery.cookie jquery.form).each do |jquery_file|
|
35
35
|
- record_js File.join('/plugins/jquery/js/', jquery_file)
|
36
36
|
|
37
37
|
- record_js '/plugins/jquery-ui/js/jquery-ui-1.8.14.custom.min.js'
|
@@ -46,7 +46,7 @@
|
|
46
46
|
- %w(helpers _md5 _ajax_replace _ellipsis).each do |file|
|
47
47
|
- record_js "/js-find/#{ file }"
|
48
48
|
|
49
|
-
- %w(dom_update workflow menu
|
49
|
+
- %w(dom_update workflow fragment menu favourites page_type modal reveal actions table list map hide).each do |file|
|
50
50
|
- record_js "/js-find/rbbt/#{ file }"
|
51
51
|
|
52
52
|
- record_js "/js-find/app"
|
@@ -1,106 +1,117 @@
|
|
1
1
|
//{{{ URL PARAMETER CONTROL
|
2
2
|
|
3
3
|
function add_parameters(url, parameters){
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
13
|
-
string = pairs.join("&");
|
4
|
+
var string;
|
5
|
+
|
6
|
+
if ( typeof(parameters) == 'string' || typeof(parameters) == 'String'){
|
7
|
+
string = parameters;
|
8
|
+
}else{
|
9
|
+
var pairs = [];
|
10
|
+
for (parameter in parameters){
|
11
|
+
pairs.push(parameter + "=" + parameters[parameter]);
|
14
12
|
}
|
13
|
+
string = pairs.join("&");
|
14
|
+
}
|
15
15
|
|
16
|
-
|
16
|
+
if (string.length == 0){return(url)}
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
if (url.indexOf('?') == -1){
|
19
|
+
return url + '?' + string;
|
20
|
+
}else{
|
21
|
+
return url + '&' + string;
|
22
|
+
}
|
23
23
|
}
|
24
24
|
|
25
25
|
function add_parameter(url, parameter, value){
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
var url = remove_parameter(url, parameter)
|
27
|
+
url = add_parameters(url, parameter + "=" + value)
|
28
|
+
return url;
|
29
29
|
}
|
30
30
|
|
31
31
|
function remove_parameter(url, parameter){
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
if (url.match("&" + parameter + "=")){
|
33
|
+
return url.replace("&" + parameter + "=", '&REMOVE=').replace(/REMOVE=[^&]+/, '').replace(/\?&/, '?').replace(/&&/, '&').replace(/[?&]$/, '');
|
34
|
+
}else{
|
35
|
+
return url.replace("?" + parameter + "=", '?REMOVE=').replace(/REMOVE=[^&]+/, '').replace(/\?&/, '?').replace(/&&/, '&').replace(/[?&]$/, '');
|
36
|
+
}
|
37
37
|
}
|
38
38
|
|
39
39
|
function clean_element(elem){
|
40
|
-
|
40
|
+
return elem.replace(/\//g, '--').replace(/%/g,'o-o')
|
41
41
|
}
|
42
42
|
|
43
43
|
function restore_element(elem){
|
44
|
-
|
44
|
+
return unescape(elem.replace(/--/g, '/').replace(/o-o/g,'%'));
|
45
45
|
}
|
46
46
|
|
47
47
|
function parse_parameters(params){
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
var ret = {},
|
49
|
+
seg = params.replace(/^\?/,'').split('&'),
|
50
|
+
len = seg.length, i = 0, s;
|
51
|
+
for (;i<len;i++) {
|
52
|
+
if (!seg[i]) { continue; }
|
53
|
+
s = seg[i].split('=');
|
54
|
+
ret[s[0]] = restore_element(s[1]);
|
55
|
+
}
|
56
|
+
return ret
|
57
57
|
}
|
58
58
|
|
59
59
|
function require_js(url, success){
|
60
|
-
|
60
|
+
if (typeof url == 'object'){
|
61
|
+
if (url.length > 1){
|
62
|
+
var u = url.shift()
|
63
|
+
require_js(u, function(){
|
64
|
+
require_js(url, success);
|
65
|
+
})
|
66
|
+
return true
|
67
|
+
}else{
|
68
|
+
return require_js(url.shift(), success);
|
69
|
+
}
|
70
|
+
}else{
|
71
|
+
var async = true;
|
61
72
|
var cache = production;
|
73
|
+
|
62
74
|
if (undefined === success){
|
63
|
-
|
75
|
+
async = false;
|
64
76
|
}else{
|
65
|
-
|
77
|
+
async = true;
|
66
78
|
}
|
67
79
|
|
68
80
|
url = url.replace('/js/', '/js-find/')
|
69
|
-
$.ajax({url: url, cache:cache, dataType:'script', async: async, success: success} ).fail(function(jqxhr, settings, exception){
|
70
|
-
|
81
|
+
$.ajax({url: url, cache:cache, dataType:'script', async: async, success: success} ).fail(function(jqxhr, settings, exception){ })
|
82
|
+
}
|
71
83
|
}
|
72
84
|
|
73
85
|
function remove_from_array(array, elem){
|
74
|
-
|
75
|
-
|
76
|
-
|
86
|
+
return jQuery.grep(array, function(value) {
|
87
|
+
return value != elem;
|
88
|
+
});
|
77
89
|
}
|
78
90
|
|
79
91
|
function array_values(hash){
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
92
|
+
var tmp_arr = [], key = '';
|
93
|
+
for (key in hash) {
|
94
|
+
tmp_arr[tmp_arr.length] = hash[key];
|
95
|
+
}
|
84
96
|
|
85
|
-
|
97
|
+
return tmp_arr;
|
86
98
|
}
|
87
99
|
|
88
100
|
function clean_attr(text){
|
89
|
-
|
90
|
-
return encodeURIComponent(text)//.replace(/[^\w-_]/g, function(s){return '\\' + s})
|
101
|
+
return encodeURIComponent(text)
|
91
102
|
}
|
92
103
|
|
93
104
|
function uniq(ary) {
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
105
|
+
var seen = {};
|
106
|
+
return ary.filter(function(elem) {
|
107
|
+
var k = elem;
|
108
|
+
return (seen[k] === 1) ? 0 : seen[k] = 1;
|
109
|
+
})
|
99
110
|
}
|
100
111
|
function uniqBy(ary, key) {
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
112
|
+
var seen = {};
|
113
|
+
return ary.filter(function(elem) {
|
114
|
+
var k = key(elem);
|
115
|
+
return (seen[k] === 1) ? 0 : seen[k] = 1;
|
116
|
+
})
|
106
117
|
}
|
@@ -1,424 +1,424 @@
|
|
1
1
|
|
2
2
|
function get_favourite_entities(complete){
|
3
|
-
|
3
|
+
return get_ajax({url: '/favourite_entities', async: true, cache: false}, complete)
|
4
4
|
}
|
5
5
|
|
6
6
|
function get_favourite_entity_lists(complete){
|
7
|
-
|
7
|
+
return get_ajax({url: '/favourite_entity_lists', async: true, cache: false}, complete)
|
8
8
|
}
|
9
9
|
|
10
10
|
function get_favourite_entity_maps(complete){
|
11
|
-
|
11
|
+
return get_ajax({url: '/favourite_entity_maps', async: true, cache: false}, complete)
|
12
12
|
}
|
13
13
|
|
14
14
|
//{{{{ FAVOURITE MENUS
|
15
15
|
|
16
16
|
function favourite_type_ul(entities){
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
var type_ul = $('<ul>').addClass('entities')
|
18
|
+
for (var entity in entities){
|
19
|
+
var entity_hash = entities[entity];
|
20
|
+
var link = entity_hash["link"];
|
21
|
+
var entity_li = $('<li>');
|
22
|
+
entity_li.append(link);
|
23
|
+
type_ul.append(entity_li);
|
24
|
+
}
|
25
|
+
return type_ul
|
26
26
|
}
|
27
27
|
|
28
28
|
function favourite_list_type_ul(type, lists){
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
var type_ul = $('<ul>').addClass('lists')
|
30
|
+
for (var list in lists){
|
31
|
+
var list = lists[list];
|
32
|
+
var link = list_link(type, list)
|
33
|
+
var entity_li = $('<li>');
|
34
|
+
entity_li.html(link);
|
35
|
+
type_ul.append(entity_li);
|
36
|
+
}
|
37
|
+
return type_ul
|
38
38
|
}
|
39
39
|
|
40
40
|
function favourite_map_type_ul(type, column, maps){
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
var type_ul = $('<ul>').addClass('maps')
|
42
|
+
for (var map in maps){
|
43
|
+
var map = maps[map];
|
44
|
+
var link = map_link(type, column, map)
|
45
|
+
var entity_li = $('<li>');
|
46
|
+
entity_li.html(link);
|
47
|
+
type_ul.append(entity_li);
|
48
|
+
}
|
49
|
+
return type_ul
|
50
50
|
}
|
51
51
|
|
52
52
|
$.widget("rbbt.favourites", {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
53
|
+
options: {
|
54
|
+
entities: {},
|
55
|
+
lists: {},
|
56
|
+
maps: {}
|
57
|
+
},
|
58
|
+
|
59
|
+
_create: function() {
|
60
|
+
this.update();
|
61
|
+
var tool = this;
|
62
|
+
this.element.on('click', 'dt.star', function(){
|
63
|
+
tool.toggle()
|
64
|
+
return false
|
65
|
+
})
|
66
|
+
this.element.on('click', 'a.remove_element', function(){
|
67
|
+
tool._remove_element($(this).siblings('a.entity, a.entity_list, a.entity_map'))
|
68
|
+
})
|
69
|
+
},
|
70
|
+
|
71
|
+
_menu: function(){
|
72
|
+
return(this.element)
|
73
|
+
},
|
74
|
+
|
75
|
+
_sync: function(){
|
76
|
+
var tool = this
|
77
|
+
|
78
|
+
get_favourite_entities(function(entities){
|
79
|
+
tool.options.entities = entities;
|
80
|
+
tool._update_entities()
|
81
|
+
tool._update_star()
|
82
|
+
})
|
83
|
+
|
84
|
+
get_favourite_entity_lists(function(lists){
|
85
|
+
tool.options.lists = lists;
|
86
|
+
tool._update_lists()
|
87
|
+
tool._update_star()
|
88
|
+
})
|
89
|
+
|
90
|
+
|
91
|
+
get_favourite_entity_maps(function(maps){
|
92
|
+
tool.options.maps = maps;
|
93
|
+
tool._update_maps()
|
94
|
+
tool._update_star()
|
95
|
+
})
|
96
|
+
},
|
97
|
+
|
98
|
+
//{{{ REMOVE ELEMENT
|
99
|
+
//----------
|
100
|
+
|
101
|
+
_remove_element: function(link){
|
102
|
+
var item = link.parent('li');
|
103
|
+
var ul = item.parent('ul');
|
104
|
+
var type = ul.attr('class');
|
105
|
+
var dt = ul.parent('dd').prev('dt');
|
106
|
+
var element = link.attr('title');
|
107
|
+
var entity_type = dt.attr('entity_type');
|
108
|
+
var entity_column = dt.attr('entity_column');
|
109
|
+
var url;
|
110
|
+
var tool = this;
|
111
|
+
|
112
|
+
switch(type){
|
113
|
+
case "entities":
|
114
|
+
method = "/remove_favourite_entity/";
|
115
|
+
element = link.attr('attr-entity_id')
|
116
|
+
url = method + clean_element(entity_type) + "/" + element;
|
117
|
+
break;
|
118
|
+
|
119
|
+
case "lists":
|
120
|
+
method = "/remove_favourite_entity_list/";
|
121
|
+
url = method + clean_element(entity_type) + "/" + clean_element(element);
|
122
|
+
break;
|
123
|
+
|
124
|
+
case "maps":
|
125
|
+
method = "/remove_favourite_entity_map/";
|
126
|
+
url = method + clean_element(entity_type) + "/" + clean_element(entity_column) + "/" + clean_element(element);
|
127
|
+
break;
|
128
|
+
};
|
129
|
+
|
130
|
+
$.ajax({url: url, type: 'POST', success: function (){ tool.update()}})
|
131
|
+
},
|
132
|
+
|
133
|
+
_add_destructors: function(list){
|
134
|
+
var icon = $('<i class="general fi-minus">')
|
135
|
+
var remove = $('<a class=remove_element></a>').append(icon)
|
136
|
+
list.find('li').prepend(remove)
|
137
|
+
},
|
138
|
+
|
139
|
+
|
140
|
+
//{{{ TOGGLE PAGE STAR
|
141
|
+
//----------
|
142
|
+
|
143
|
+
_update_star: function(){
|
144
|
+
if (this.is_favourite() == true){
|
145
|
+
this.element.find('dt.star').addClass('active');
|
146
|
+
}else{
|
147
|
+
this.element.find('dt.star').removeClass('active');
|
148
|
+
}
|
149
|
+
},
|
150
|
+
_toggle_page: function(){
|
151
|
+
this.toggle_page(undefined)
|
152
|
+
},
|
153
|
+
|
154
|
+
toggle: function(){
|
155
|
+
this._toggle_page();
|
156
|
+
},
|
157
|
+
|
158
|
+
//{{{ UPDATE
|
159
|
+
//----------
|
160
|
+
|
161
|
+
_update_entities: function(){
|
162
|
+
var menu = this._menu()
|
163
|
+
menu.find('ul.entities').addClass('remove');
|
164
|
+
|
165
|
+
var entities = menu.find('dt.entities').next('dd').find('> dl')
|
166
|
+
for(type in this.options.entities){
|
167
|
+
var ul = favourite_type_ul(this.options.entities[type]);
|
168
|
+
this._add_destructors(ul)
|
169
|
+
var dt = entities.find('dt[entity_type=' + clean_attr(type) + ']')
|
170
|
+
|
171
|
+
if (dt.length == 0){
|
172
|
+
var dt = $('<dt>').html(type).addClass('next').addClass('type').attr('entity_type', type);
|
173
|
+
var dd = $('<dd>').append(ul);
|
174
|
+
entities.append(dt).append(dd);
|
175
|
+
update_rbbt();
|
176
|
+
}else{
|
177
|
+
if (dt.next('dd').find('ul.entities').length == 0){
|
178
|
+
dt.next('dd').append(ul);
|
179
|
+
}else{
|
180
|
+
dt.next('dd').find('ul.entities').replaceWith(ul);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
menu.find('dt[entity_type=' + clean_attr(type) + ']').next('dd').find('ul.entities').replaceWith(ul);
|
185
|
+
}
|
186
|
+
menu.find('ul.entities.remove').remove()
|
187
|
+
},
|
188
|
+
|
189
|
+
_update_lists: function(){
|
190
|
+
var menu = this._menu()
|
191
|
+
menu.find('ul.lists').addClass('remove');
|
192
|
+
|
193
|
+
var lists = menu.find('dt.lists').next('dd').find('> dl')
|
194
|
+
for(type in this.options.lists){
|
195
|
+
var ul = favourite_list_type_ul(type, this.options.lists[type])
|
196
|
+
this._add_destructors(ul)
|
197
|
+
var dt = lists.find('dt[entity_type=' + clean_attr(type) + ']');
|
198
|
+
|
199
|
+
if (dt.length == 0){
|
200
|
+
var dt = $('<dt>').html(type).addClass('next').addClass('type').attr('entity_type', type);
|
201
|
+
var dd = $('<dd>').append(ul);
|
202
|
+
lists.append(dt).append(dd);
|
203
|
+
update_rbbt();
|
204
|
+
}else{
|
205
|
+
if (dt.next('dd').find('ul.lists').length == 0){
|
206
|
+
dt.next('dd').append(ul);
|
207
|
+
}else{
|
208
|
+
dt.next('dd').find('ul.lists').replaceWith(ul);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
}
|
212
|
+
menu.find('ul.lists.remove').remove();
|
213
|
+
},
|
214
|
+
|
215
|
+
_update_maps: function(){
|
216
|
+
var menu = this._menu()
|
217
|
+
menu.find('ul.maps').addClass('remove')
|
218
|
+
|
219
|
+
var maps = menu.find('dt.maps').next('dd').find('> dl')
|
220
|
+
for(type in this.options.maps){
|
221
|
+
for(column in this.options.maps[type]){
|
222
|
+
var ul = favourite_map_type_ul(type, column, this.options.maps[type][column]);
|
223
|
+
this._add_destructors(ul)
|
224
|
+
var dt = maps.find('dt[entity_type=\'' + clean_attr(type) + '\'][entity_column=\'' + clean_attr(column) + '\']');
|
225
|
+
|
226
|
+
if (dt.length == 0){
|
227
|
+
var dt = $('<dt>').html(type + ' - ' + column).addClass('next').addClass('type').attr('entity_type', clean_attr(type)).attr('entity_column', clean_attr(column));
|
228
|
+
var dd = $('<dd>').append(ul);
|
229
|
+
maps.append(dt).append(dd);
|
230
|
+
update_rbbt();
|
231
|
+
}else{
|
232
|
+
if (dt.next('dd').find('ul.maps').length == 0){
|
233
|
+
dt.next('dd').append(ul);
|
234
|
+
}else{
|
235
|
+
dt.next('dd').find('ul.maps').replaceWith(ul);
|
236
|
+
}
|
237
|
+
}
|
238
|
+
}
|
239
|
+
}
|
240
|
+
menu.find('ul.maps.remove').remove()
|
241
|
+
},
|
242
|
+
|
243
|
+
|
244
|
+
//{{{ SELECTS
|
245
|
+
//
|
246
|
+
_update_list_select: function(select, type, lists){
|
247
|
+
if (select.attr('attr-allow-empty') == 'true'){
|
248
|
+
var option = $('<option value="none" class="loaded">none</option>')
|
249
|
+
select.append(option);
|
250
|
+
}
|
251
|
+
|
252
|
+
var selected = null;
|
253
|
+
|
254
|
+
if (select.attr('attr-selected') != undefined ){
|
255
|
+
selected = select.attr('attr-selected');
|
256
|
+
}
|
257
|
+
|
258
|
+
$.each(lists, function(name, elems){
|
259
|
+
var option = null;
|
260
|
+
var name = elems
|
261
|
+
if (selected == null || name != selected){
|
262
|
+
option = $('<option attr-entity_type="' + type + '" class="automatic_load" value="' + name + '">' + name + '</option>');
|
263
|
+
}else{
|
264
|
+
option = $('<option attr-entity_type="' + type + '" class="automatic_load" selected=selected value="' + name + '">' + name + '</option>');
|
265
|
+
}
|
266
|
+
select.append(option);
|
267
|
+
return true
|
268
|
+
})
|
269
|
+
},
|
270
|
+
|
271
|
+
_update_map_select: function(select, type, map_lists){
|
272
|
+
if (select.attr('attr-allow-empty') == 'true'){
|
273
|
+
var option = $('<option value="none" class="loaded">none</option>');
|
274
|
+
select.append(option);
|
275
|
+
}
|
276
|
+
|
277
|
+
var selected = null;
|
278
|
+
|
279
|
+
if (select.attr('attr-selected') != undefined ){
|
280
|
+
selected = select.attr('attr-selected');
|
281
|
+
}
|
282
|
+
|
283
|
+
for (column in map_lists){
|
284
|
+
var maps = map_lists[column];
|
285
|
+
if (undefined === select.attr('column') || select.attr('column') == column){
|
286
|
+
$.each(maps, function(name, elems){
|
287
|
+
var option = null;
|
288
|
+
var name = elems
|
289
|
+
if (selected == null || name != selected){
|
290
|
+
option = $('<option class="automatic_load" attr-entity_type="' + clean_attr(type) + '" attr-column="'+ clean_attr(column) + '" value="' + name + '">' + name + '</option>');
|
291
|
+
}else{
|
292
|
+
option = $('<option class="automatic_load" attr-entity_type="' + clean_attr(type) + '" attr-column="'+ clean_attr(column) + '" selected=selected value="' + name + '">' + name + '</option>');
|
293
|
+
}
|
294
|
+
select.append(option);
|
295
|
+
return true
|
296
|
+
})
|
297
|
+
}
|
298
|
+
}
|
299
|
+
},
|
300
|
+
|
301
|
+
//{{{ UPDATES
|
302
|
+
//
|
303
|
+
update_list_selects: function(){
|
304
|
+
var tool = this;
|
305
|
+
$('select.favourite_lists').find('option.automatic_load').remove()
|
306
|
+
|
307
|
+
$.each(this.options.lists, function(type, lists){
|
308
|
+
$('select.favourite_lists[type=' + type + ']').each(function(){
|
309
|
+
var select = $(this);
|
310
|
+
tool._update_list_select(select, type, lists);
|
311
|
+
})
|
312
|
+
$('select.favourite_lists[type=All]').each(function(){
|
313
|
+
var select = $(this);
|
314
|
+
select.append($('<option class="automatic_load" disabled>'+ type +'</option>'));
|
315
|
+
tool._update_list_select(select, type, lists);
|
316
|
+
})
|
317
|
+
});
|
318
|
+
},
|
319
|
+
|
320
|
+
update_map_selects: function(){
|
321
|
+
var tool = this;
|
322
|
+
$('select.favourite_maps').find('option.automatic_load').remove()
|
323
|
+
|
324
|
+
$.each(this.options.maps, function(type, maps){
|
325
|
+
$('select.favourite_maps[type=' + type + ']').each(function(){
|
326
|
+
var select = $(this);
|
327
|
+
tool._update_map_select(select, type, maps);
|
328
|
+
})
|
329
|
+
$('select.favourite_maps[type=All]').each(function(){
|
330
|
+
var select = $(this);
|
331
|
+
select.append($('<option class="automatic_load" disabled>'+ type +'</option>'));
|
332
|
+
tool._update_map_select(select, type, maps);
|
333
|
+
})
|
334
|
+
});
|
335
|
+
},
|
336
|
+
|
337
|
+
close: function(){
|
338
|
+
this.element.find('.show').removeClass('show')
|
339
|
+
},
|
340
|
+
|
341
|
+
is_favourite: function(path){
|
342
|
+
var type = page_type(path);
|
343
|
+
|
344
|
+
switch(type){
|
345
|
+
|
346
|
+
case "entity":
|
347
|
+
var entity = page_entity(path);
|
348
|
+
var entity_type = page_entity_base_type(path);
|
349
|
+
return this.options.entities[entity_type] !== undefined && this.options.entities[entity_type][entity] !== undefined
|
350
|
+
|
351
|
+
case "entity_list":
|
352
|
+
var list = page_entity_list(path);
|
353
|
+
var entity_type = page_entity_base_type(path);
|
354
|
+
return this.options.lists[entity_type] !== undefined && _.indexOf(this.options.lists[entity_type], list) !== -1
|
355
|
+
|
356
|
+
case "entity_map":
|
357
|
+
var map = page_entity_map(path);
|
358
|
+
var entity_type = page_entity_base_type(path);
|
359
|
+
var entity_column = page_entity_map_column(path);
|
360
|
+
return this.options.maps[entity_type] !== undefined && this.options.maps[entity_type][entity_column] !== undefined && _.indexOf(this.options.maps[entity_type][entity_column], map) !== -1
|
361
|
+
}
|
362
|
+
|
363
|
+
return false
|
364
|
+
},
|
365
|
+
|
366
|
+
toggle_page: function(path){
|
367
|
+
var type = page_type(path);
|
368
|
+
var tool = this
|
369
|
+
switch(type){
|
370
|
+
|
371
|
+
case "entity":
|
372
|
+
var entity = page_entity(path);
|
373
|
+
var entity_type = page_entity_type(path);
|
374
|
+
var entity_info = page_entity_info(path);
|
375
|
+
|
376
|
+
if (this.is_favourite(path)){
|
377
|
+
method = "/remove_favourite_entity/";
|
378
|
+
}else{
|
379
|
+
method = "/add_favourite_entity/";
|
380
|
+
}
|
381
|
+
var url = method + clean_element(entity_type) + "/" + entity;
|
382
|
+
$.ajax({url: url, type: 'POST', data: entity_info, success: function (){ tool.update()}})
|
383
|
+
break;
|
384
|
+
|
385
|
+
case "entity_list":
|
386
|
+
var list = page_entity_list(path);
|
387
|
+
var entity_type = page_entity_type(path);
|
388
|
+
if (this.is_favourite(path)){
|
389
|
+
method = "/remove_favourite_entity_list/";
|
390
|
+
}else{
|
391
|
+
method = "/add_favourite_entity_list/";
|
392
|
+
}
|
393
|
+
var url = method + clean_element(entity_type) + "/" + clean_element(list);
|
394
|
+
$.ajax({url: url, type: 'POST', success: function (){ tool.update() }})
|
395
|
+
break;
|
396
|
+
|
397
|
+
case "entity_map":
|
398
|
+
var map = page_entity_map(path);
|
399
|
+
var entity_type = page_entity_type(path);
|
400
|
+
var entity_column = page_entity_map_column(path);
|
401
|
+
if (this.is_favourite(path)){
|
402
|
+
method = "/remove_favourite_entity_map/";
|
403
|
+
}else{
|
404
|
+
method = "/add_favourite_entity_map/";
|
405
|
+
}
|
406
|
+
var url = method + clean_element(entity_type) + "/" + clean_element(entity_column) + "/" + clean_element(map);
|
407
|
+
$.ajax({url: url, type: 'POST', success: function (){ tool.update()}})
|
408
|
+
break;
|
409
|
+
}
|
410
|
+
},
|
411
|
+
|
412
|
+
|
413
|
+
update: function(){
|
414
|
+
this._sync()
|
415
|
+
//this._update_entities()
|
416
|
+
//this._update_lists()
|
417
|
+
//this._update_maps()
|
418
|
+
//this._update_star()
|
419
|
+
//this._add_destructors()
|
420
|
+
$('#modal.url.entity').modal('update_star')
|
265
421
|
}
|
266
|
-
select.append(option);
|
267
|
-
return true
|
268
|
-
})
|
269
|
-
},
|
270
|
-
|
271
|
-
_update_map_select: function(select, type, map_lists){
|
272
|
-
if (select.attr('attr-allow-empty') == 'true'){
|
273
|
-
var option = $('<option value="none" class="loaded">none</option>');
|
274
|
-
select.append(option);
|
275
|
-
}
|
276
|
-
|
277
|
-
var selected = null;
|
278
|
-
|
279
|
-
if (select.attr('attr-selected') != undefined ){
|
280
|
-
selected = select.attr('attr-selected');
|
281
|
-
}
|
282
|
-
|
283
|
-
for (column in map_lists){
|
284
|
-
var maps = map_lists[column];
|
285
|
-
if (undefined === select.attr('column') || select.attr('column') == column){
|
286
|
-
$.each(maps, function(name, elems){
|
287
|
-
var option = null;
|
288
|
-
var name = elems
|
289
|
-
if (selected == null || name != selected){
|
290
|
-
option = $('<option class="automatic_load" attr-entity_type="' + clean_attr(type) + '" attr-column="'+ clean_attr(column) + '" value="' + name + '">' + name + '</option>');
|
291
|
-
}else{
|
292
|
-
option = $('<option class="automatic_load" attr-entity_type="' + clean_attr(type) + '" attr-column="'+ clean_attr(column) + '" selected=selected value="' + name + '">' + name + '</option>');
|
293
|
-
}
|
294
|
-
select.append(option);
|
295
|
-
return true
|
296
|
-
})
|
297
|
-
}
|
298
|
-
}
|
299
|
-
},
|
300
|
-
|
301
|
-
//{{{ UPDATES
|
302
|
-
//
|
303
|
-
update_list_selects: function(){
|
304
|
-
var tool = this;
|
305
|
-
$('select.favourite_lists').find('option.automatic_load').remove()
|
306
|
-
|
307
|
-
$.each(this.options.lists, function(type, lists){
|
308
|
-
$('select.favourite_lists[type=' + type + ']').each(function(){
|
309
|
-
var select = $(this);
|
310
|
-
tool._update_list_select(select, type, lists);
|
311
|
-
})
|
312
|
-
$('select.favourite_lists[type=All]').each(function(){
|
313
|
-
var select = $(this);
|
314
|
-
select.append($('<option class="automatic_load" disabled>'+ type +'</option>'));
|
315
|
-
tool._update_list_select(select, type, lists);
|
316
|
-
})
|
317
|
-
});
|
318
|
-
},
|
319
|
-
|
320
|
-
update_map_selects: function(){
|
321
|
-
var tool = this;
|
322
|
-
$('select.favourite_maps').find('option.automatic_load').remove()
|
323
|
-
|
324
|
-
$.each(this.options.maps, function(type, maps){
|
325
|
-
$('select.favourite_maps[type=' + type + ']').each(function(){
|
326
|
-
var select = $(this);
|
327
|
-
tool._update_map_select(select, type, maps);
|
328
|
-
})
|
329
|
-
$('select.favourite_maps[type=All]').each(function(){
|
330
|
-
var select = $(this);
|
331
|
-
select.append($('<option class="automatic_load" disabled>'+ type +'</option>'));
|
332
|
-
tool._update_map_select(select, type, maps);
|
333
|
-
})
|
334
|
-
});
|
335
|
-
},
|
336
|
-
|
337
|
-
close: function(){
|
338
|
-
this.element.find('.show').removeClass('show')
|
339
|
-
},
|
340
|
-
|
341
|
-
is_favourite: function(path){
|
342
|
-
var type = page_type(path);
|
343
|
-
|
344
|
-
switch(type){
|
345
|
-
|
346
|
-
case "entity":
|
347
|
-
var entity = page_entity(path);
|
348
|
-
var entity_type = page_entity_base_type(path);
|
349
|
-
return this.options.entities[entity_type] !== undefined && this.options.entities[entity_type][entity] !== undefined
|
350
|
-
|
351
|
-
case "entity_list":
|
352
|
-
var list = page_entity_list(path);
|
353
|
-
var entity_type = page_entity_base_type(path);
|
354
|
-
return this.options.lists[entity_type] !== undefined && _.indexOf(this.options.lists[entity_type], list) !== -1
|
355
|
-
|
356
|
-
case "entity_map":
|
357
|
-
var map = page_entity_map(path);
|
358
|
-
var entity_type = page_entity_base_type(path);
|
359
|
-
var entity_column = page_entity_map_column(path);
|
360
|
-
return this.options.maps[entity_type] !== undefined && this.options.maps[entity_type][entity_column] !== undefined && _.indexOf(this.options.maps[entity_type][entity_column], map) !== -1
|
361
|
-
}
|
362
|
-
|
363
|
-
return false
|
364
|
-
},
|
365
|
-
|
366
|
-
toggle_page: function(path){
|
367
|
-
var type = page_type(path);
|
368
|
-
var tool = this
|
369
|
-
switch(type){
|
370
|
-
|
371
|
-
case "entity":
|
372
|
-
var entity = page_entity(path);
|
373
|
-
var entity_type = page_entity_type(path);
|
374
|
-
var entity_info = page_entity_info(path);
|
375
|
-
|
376
|
-
if (this.is_favourite(path)){
|
377
|
-
method = "/remove_favourite_entity/";
|
378
|
-
}else{
|
379
|
-
method = "/add_favourite_entity/";
|
380
|
-
}
|
381
|
-
var url = method + clean_element(entity_type) + "/" + entity;
|
382
|
-
$.ajax({url: url, type: 'POST', data: entity_info, success: function (){ tool.update()}})
|
383
|
-
break;
|
384
|
-
|
385
|
-
case "entity_list":
|
386
|
-
var list = page_entity_list(path);
|
387
|
-
var entity_type = page_entity_type(path);
|
388
|
-
if (this.is_favourite(path)){
|
389
|
-
method = "/remove_favourite_entity_list/";
|
390
|
-
}else{
|
391
|
-
method = "/add_favourite_entity_list/";
|
392
|
-
}
|
393
|
-
var url = method + clean_element(entity_type) + "/" + clean_element(list);
|
394
|
-
$.ajax({url: url, type: 'POST', success: function (){ tool.update() }})
|
395
|
-
break;
|
396
|
-
|
397
|
-
case "entity_map":
|
398
|
-
var map = page_entity_map(path);
|
399
|
-
var entity_type = page_entity_type(path);
|
400
|
-
var entity_column = page_entity_map_column(path);
|
401
|
-
if (this.is_favourite(path)){
|
402
|
-
method = "/remove_favourite_entity_map/";
|
403
|
-
}else{
|
404
|
-
method = "/add_favourite_entity_map/";
|
405
|
-
}
|
406
|
-
var url = method + clean_element(entity_type) + "/" + clean_element(entity_column) + "/" + clean_element(map);
|
407
|
-
$.ajax({url: url, type: 'POST', success: function (){ tool.update()}})
|
408
|
-
break;
|
409
|
-
}
|
410
|
-
},
|
411
|
-
|
412
|
-
|
413
|
-
update: function(){
|
414
|
-
this._sync()
|
415
|
-
//this._update_entities()
|
416
|
-
//this._update_lists()
|
417
|
-
//this._update_maps()
|
418
|
-
//this._update_star()
|
419
|
-
//this._add_destructors()
|
420
|
-
$('#modal.url.entity').modal('update_star')
|
421
|
-
}
|
422
422
|
|
423
423
|
})
|
424
424
|
|