rbbt-views 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rbbt/workflow/rest.rb +150 -7
- data/lib/rbbt/workflow/rest/auth.rb +4 -4
- data/lib/rbbt/workflow/rest/entity.rb +115 -17
- data/lib/rbbt/workflow/rest/helpers.rb +49 -0
- data/lib/rbbt/workflow/rest/render.rb +64 -73
- data/lib/rbbt/workflow/rest/util.rb +124 -11
- data/share/views/compass/form.sass +0 -1
- data/share/views/compass/layout.sass +93 -2
- data/share/views/edit_list.haml +39 -0
- data/share/views/entity/GenomicMutation.haml +11 -1
- data/share/views/entity/KeggPathway.haml +4 -2
- data/share/views/entity/MutatedIsoform.haml +5 -33
- data/share/views/entity/MutatedIsoform/marked_svg.haml +3 -0
- data/share/views/entity/MutatedIsoform/pdbs.haml +33 -0
- data/share/views/entity/NCIBioCartaPathway.haml +11 -0
- data/share/views/entity/NCINaturePathway.haml +11 -0
- data/share/views/entity/NCIReactomePathway.haml +11 -0
- data/share/views/entity/Protein.haml +5 -0
- data/share/views/entity_list/Default.haml +1 -10
- data/share/views/js/app.js +336 -39
- data/share/views/layout.haml +20 -1
- data/share/views/partials/_form.haml +3 -1
- data/share/views/partials/_result_table.haml +4 -1
- data/share/views/public/plugins/jquery/js/jquery.cookie.js +47 -0
- data/share/views/user_lists.haml +10 -0
- metadata +14 -10
- data/share/views/entity/NCIBioCartaPathways.haml +0 -9
- data/share/views/entity/NCINaturePathways.haml +0 -9
- data/share/views/entity/NCIReactomePathways.haml +0 -9
@@ -0,0 +1,39 @@
|
|
1
|
+
%a(href="/entity_list/#{ type }/#{ id }") View
|
2
|
+
|
3
|
+
%form(action="#{File.join('/entity_list', type, 'copy', id)}" method='post')
|
4
|
+
%label Copy as:
|
5
|
+
%input(name='new_id')
|
6
|
+
%input(type='submit')
|
7
|
+
|
8
|
+
%form(action="#{File.join('/entity_list', type, 'add', id)}" method='post')
|
9
|
+
%label Add other list:
|
10
|
+
%select.loaded_lists(name="other_list" type=type)
|
11
|
+
%input(type='submit')
|
12
|
+
|
13
|
+
%form(action="#{File.join('/entity_list', type, 'subset', id)}" method='post')
|
14
|
+
%label Subset other list:
|
15
|
+
%select.loaded_lists(name="other_list" type=type)
|
16
|
+
%input(type='submit')
|
17
|
+
|
18
|
+
%form(action="#{File.join('/entity_list', type, 'remove', id)}" method='post')
|
19
|
+
%label Remove other list:
|
20
|
+
%select.loaded_lists(name="other_list" type=type)
|
21
|
+
%input(type='submit')
|
22
|
+
|
23
|
+
|
24
|
+
%ul.entity_list
|
25
|
+
- list.each do |entity|
|
26
|
+
- values = {}
|
27
|
+
- types = {}
|
28
|
+
- entity.info.each{|k,v| values[k] = String === v ? v : v.to_json; types[k] = :string }
|
29
|
+
|
30
|
+
%li(id="#{entity.id}")
|
31
|
+
= entity.respond_to?(:link) ? entity.link : entity
|
32
|
+
\.
|
33
|
+
%a.DELETE.remove_entity_from_list(rel="#{entity.id}" href="/entity_list/#{ type }/#{ entity }/#{ id }") remove
|
34
|
+
-#- form_id = "edit_entity_#{id}_#{entity.to_s}".gsub(/\s/, '_')
|
35
|
+
-#%a.open_edit_controls(href="#edit_controls" ref=form_id) edit
|
36
|
+
-#.edit_controls
|
37
|
+
-# - action = File.join("/entity_list", type, entity, id)
|
38
|
+
-# = workflow_partial('partials/_form', workflow, :values => values, :inputs => values.keys, :input_types => types, :action => action, :method => "post", :id => form_id)
|
39
|
+
|
@@ -3,8 +3,18 @@
|
|
3
3
|
%p== reference base: #{entity.reference}
|
4
4
|
%p== Genes: #{entity.genes.nil? ? "none" : entity.genes.link * ", "}
|
5
5
|
|
6
|
+
- if entity.in_exon_junction?
|
7
|
+
%p In Exon Junction
|
8
|
+
|
6
9
|
%a(href="#{entity.ensembl_browser}") Ensembl Browser
|
7
10
|
|
8
11
|
%ul
|
9
12
|
- (entity.mutated_isoforms || []).select{|mi| mi.consequence != "SYNONYMOUS"}.each do |mi|
|
10
|
-
%li
|
13
|
+
%li
|
14
|
+
= mi.link
|
15
|
+
%span.note
|
16
|
+
- pdbs = mi.pdbs
|
17
|
+
- if pdbs.nil? or pdbs.empty?
|
18
|
+
[No PDBs]
|
19
|
+
- else
|
20
|
+
== [#{pdbs.length} PDBs]
|
@@ -1,12 +1,14 @@
|
|
1
1
|
%h3= entity.name
|
2
2
|
|
3
|
-
- genes_in_pathway = Gene.setup(KEGG.index2genes[entity], "KEGG Gene ID",
|
3
|
+
- genes_in_pathway = Gene.setup(KEGG.index2genes[entity], "KEGG Gene ID", entity.organism).from_kegg
|
4
4
|
|
5
5
|
%dl
|
6
6
|
%dt Description
|
7
7
|
%dd= entity.description
|
8
8
|
|
9
|
-
%dt
|
9
|
+
%dt
|
10
|
+
All Genes in pathway
|
11
|
+
== (#{ genes_in_pathway.ensembl.list_link :length, "Genes in pathway #{entity.name}"})
|
10
12
|
%dd= genes_in_pathway.from_kegg.link * ", "
|
11
13
|
|
12
14
|
%img(src='http://www.genome.jp/kegg/pathway/hsa/#{entity}.png' style='width:100%;float:left;margin-right:10px;margin-botton:10px;' title='Click to see KEGG entry')
|
@@ -1,8 +1,5 @@
|
|
1
1
|
%h1= entity
|
2
|
-
= entity.
|
3
|
-
|
4
|
-
.svg(style="width:100%")
|
5
|
-
= entity.marked_svg
|
2
|
+
= entity.action_link 'marked_svg', "Protein overview", :link_options => {:extra_classes => "replace"}
|
6
3
|
|
7
4
|
%dl
|
8
5
|
%dt MutationAssesor prediction
|
@@ -12,32 +9,7 @@
|
|
12
9
|
%dd= entity.damage_scores([:sift])
|
13
10
|
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
-
|
18
|
-
|
19
|
-
%hr
|
20
|
-
%select.pdb
|
21
|
-
%option(selected="selected") Select a pdb
|
22
|
-
- pdbs.each do |pdb, info|
|
23
|
-
- pdb_chain = info[:chains].split("/").first
|
24
|
-
- pdb_position = entity.position - info[:region].begin + 1
|
25
|
-
%option(attr-chain=pdb_chain attr-position=pdb_position attr-pdb=pdb)= "#{ pdb} (#{[pdb_position, pdb_chain] * "/"})"
|
26
|
-
|
27
|
-
#jmol_image
|
28
|
-
|
29
|
-
:javascript
|
30
|
-
|
31
|
-
jmolSetXHTML('jmol_image')
|
32
|
-
|
33
|
-
jmolApplet(500, "", "PIZARRA");
|
34
|
-
$('select.pdb').change(function(){
|
35
|
-
var option = $(this).find('option:selected');
|
36
|
-
var pdb = option.attr('attr-pdb');
|
37
|
-
if (pdb == "Select a pdb") return false
|
38
|
-
var pdb_position = option.attr('attr-position');
|
39
|
-
var pdb_chain = option.attr('attr-chain');
|
40
|
-
jmolScript("load =" + pdb + "; wireframe off; restrict water; select protein; backbone off; color pink;cartoons on;color structure; select protein and *.CA and " + pdb_position + ":" + pdb_chain + "; spacefill; color blue;", "PIZARRA");
|
41
|
-
})
|
42
|
-
|
43
|
-
|
12
|
+
- if entity.pdbs and entity.pdbs.any?
|
13
|
+
= entity.action_link 'pdbs', "Mutation over pdbs", :link_options => {:extra_classes => "replace"}
|
14
|
+
- else
|
15
|
+
No pdbs found
|
@@ -0,0 +1,33 @@
|
|
1
|
+
- pdbs = entity.pdbs_and_positions
|
2
|
+
- if pdbs and pdbs.any?
|
3
|
+
#jmol
|
4
|
+
%select.pdb
|
5
|
+
%option(selected="selected") Select a pdb
|
6
|
+
- found = 0
|
7
|
+
- pdbs.each do |pdb, chains|
|
8
|
+
- chains.each do |pdb_chain, pdb_position|
|
9
|
+
- next if pdb_position.nil?
|
10
|
+
- pdb_position -= 1
|
11
|
+
%option(attr-chain=pdb_chain attr-position=pdb_position attr-pdb=pdb)= "#{ pdb} (#{[pdb_position, pdb_chain] * "/"})"
|
12
|
+
- found += 1
|
13
|
+
|
14
|
+
- if found == 0
|
15
|
+
No pdbs cover that position
|
16
|
+
- else
|
17
|
+
#jmol_image
|
18
|
+
|
19
|
+
:javascript
|
20
|
+
|
21
|
+
jmolSetXHTML('jmol_image')
|
22
|
+
|
23
|
+
jmolApplet(500, "", "PIZARRA");
|
24
|
+
$('select.pdb').change(function(){
|
25
|
+
var option = $(this).find('option:selected');
|
26
|
+
var pdb = option.attr('attr-pdb');
|
27
|
+
if (pdb == "Select a pdb") return false
|
28
|
+
var pdb_position = option.attr('attr-position');
|
29
|
+
var pdb_chain = option.attr('attr-chain');
|
30
|
+
jmolScript("load =" + pdb + "; wireframe off; restrict water; select protein; backbone off; color pink;cartoons on;color structure; select protein and *.CA and " + pdb_position + ":" + pdb_chain + "; spacefill; color blue;", "PIZARRA");
|
31
|
+
})
|
32
|
+
|
33
|
+
|
data/share/views/js/app.js
CHANGED
@@ -60,7 +60,8 @@ function expand_details(){
|
|
60
60
|
var url = $('#details').attr('url');
|
61
61
|
if (url == null) return false;
|
62
62
|
|
63
|
-
$.ajax(add_parameters(url, '_size=normal'), {
|
63
|
+
$.ajax(add_parameters(url, '_size=normal&_cache_type=memory'), {
|
64
|
+
cache: false,
|
64
65
|
success: function(data){
|
65
66
|
$('#details').html(data).attr('url', url);
|
66
67
|
$('#main').hide()
|
@@ -80,7 +81,8 @@ function contract_details(){
|
|
80
81
|
var url = $('#details').attr('url');
|
81
82
|
if (url == null) return false;
|
82
83
|
|
83
|
-
$.ajax(add_parameters(url, '_size=small'), {
|
84
|
+
$.ajax(add_parameters(url, '_size=small&_cache_type=memory'), {
|
85
|
+
cache: false,
|
84
86
|
success: function(data){
|
85
87
|
$('#details').html(data).attr('url', url);
|
86
88
|
$('#main').show()
|
@@ -106,7 +108,8 @@ function back_details(){
|
|
106
108
|
size = "small";
|
107
109
|
}
|
108
110
|
|
109
|
-
$.ajax(add_parameters(url, '_size=' + size), {
|
111
|
+
$.ajax(add_parameters(url, '_size=' + size + "&_cache_type=memory"), {
|
112
|
+
cache: false,
|
110
113
|
success: function(data){
|
111
114
|
$('#details').html(data).attr('url', url);
|
112
115
|
rbbt_action_setup();
|
@@ -121,31 +124,216 @@ function back_details(){
|
|
121
124
|
|
122
125
|
// REPLACE OBJECTS
|
123
126
|
|
124
|
-
function replace_object(obj){
|
127
|
+
function replace_object(obj, update){
|
125
128
|
var href = obj.attr('href');
|
126
129
|
|
130
|
+
|
127
131
|
if (href == null || href == undefined || href == ""){href = obj.attr('target');}
|
128
132
|
if (href == null || href == undefined || href == ""){href = obj.attr('url');}
|
129
133
|
|
134
|
+
if (update == 'reload'){
|
135
|
+
href = add_parameters(href, "_update=reload")
|
136
|
+
}
|
137
|
+
|
138
|
+
if (update == 'check'){
|
139
|
+
href = add_parameters(href, "_update=check")
|
140
|
+
}
|
141
|
+
|
130
142
|
$.ajax(href,{
|
143
|
+
cache: false,
|
131
144
|
beforeSend: function(){obj.addClass("reloading")},
|
132
145
|
complete: function(){obj.removeClass("reloading")},
|
146
|
+
error: function( req, text, error ) {
|
147
|
+
obj.removeClass("reloading");
|
148
|
+
obj.addClass("error");
|
149
|
+
if (obj.find('span[class*=cache_status]').length == 0){
|
150
|
+
obj.html(obj.html() + "<span class='cache_status'>error</status>").after($("<a class='retry_error'>retry</a>"))
|
151
|
+
}else{
|
152
|
+
obj.after($("<a class='retry_error'>retry</a>")).find('span[class*=cache_status]').first().html("error")
|
153
|
+
}
|
154
|
+
rbbt_action_setup();
|
155
|
+
},
|
133
156
|
success: function( data, stat, req ) {
|
134
|
-
var html = '<div class="embedded" target="' + req.getResponseHeader("AJAX-URL") + '">' + data + '</div>';
|
135
|
-
var embedded = $(html);
|
136
|
-
embedded.addClass(obj.attr('class'));
|
137
|
-
embedded.removeClass('replace');
|
138
|
-
embedded.removeClass('rbbt_action_setup');
|
139
|
-
obj.replaceWith(embedded);
|
140
157
|
if (req.status == 202){
|
141
|
-
|
142
|
-
|
158
|
+
obj.addClass("reloading");
|
159
|
+
|
160
|
+
if (obj.find('span[class*=cache_status]').length == 0){
|
161
|
+
obj.html(obj.html() + data)
|
162
|
+
}else{
|
163
|
+
obj.find('span[class*=cache_status]').first().replaceWith($(data))
|
164
|
+
}
|
165
|
+
|
166
|
+
if (update == 'check'){
|
167
|
+
obj.removeClass("reloading");
|
168
|
+
obj.addClass("check");
|
169
|
+
if (obj.find('span[class*=cache_status]').length == 0){
|
170
|
+
obj.after($("<a class='start_checked'>start</a>"));
|
171
|
+
}else{
|
172
|
+
obj.after($("<a class='start_checked'>start</a>"));
|
173
|
+
}
|
174
|
+
rbbt_action_setup();
|
175
|
+
}else{
|
176
|
+
window.setTimeout(function(){replace_object(obj)}, 7000)
|
177
|
+
}
|
143
178
|
}else{
|
179
|
+
var html = '<div class="embedded" target="' + req.getResponseHeader("AJAX-URL") + '">' + data + '</div>';
|
180
|
+
var embedded = $(html);
|
181
|
+
embedded.addClass(obj.attr('class'));
|
182
|
+
embedded.removeClass('replace');
|
183
|
+
embedded.removeClass('rbbt_action_setup');
|
144
184
|
embedded.removeClass("reloading");
|
185
|
+
obj.replaceWith(embedded);
|
145
186
|
rbbt_action_setup();
|
146
187
|
}
|
188
|
+
|
189
|
+
},
|
190
|
+
});
|
191
|
+
}
|
192
|
+
|
193
|
+
function expand_embedded(embedded){
|
194
|
+
var header = embedded.find('header').first();
|
195
|
+
embedded.html(embedded.attr('attr-save'));
|
196
|
+
embedded.attr('attr-save',null);
|
197
|
+
embedded.removeClass('contracted_embedded');
|
198
|
+
embedded.removeClass('rbbt_action_setup').find('.rbbt_action_setup').removeClass('rbbt_action_setup');
|
199
|
+
rbbt_action_setup();
|
200
|
+
}
|
201
|
+
|
202
|
+
function contract_embedded(embedded){
|
203
|
+
var header = embedded.find('header').first();
|
204
|
+
embedded.attr('attr-save', embedded.html());
|
205
|
+
embedded.html(header.html());
|
206
|
+
embedded.addClass('contracted_embedded');
|
207
|
+
embedded.removeClass('rbbt_action_setup').find('.rbbt_action_setup').removeClass('rbbt_action_setup');
|
208
|
+
rbbt_action_setup();
|
209
|
+
}
|
210
|
+
|
211
|
+
//-- LIST MANAGEMENT
|
212
|
+
|
213
|
+
var entity_lists = {}
|
214
|
+
|
215
|
+
function saved_lists(){
|
216
|
+
return JSON.parse($.cookie('saved_lists'))
|
217
|
+
}
|
218
|
+
|
219
|
+
function remove_list(type, list){
|
220
|
+
var lists = saved_lists();
|
221
|
+
if (lists == null) { lists = {}; };
|
222
|
+
if (lists[type] == null) { lists[type] = [] };
|
223
|
+
|
224
|
+
var elems = lists[type]
|
225
|
+
if (elems != null){
|
226
|
+
var index = elems.indexOf(list);
|
227
|
+
|
228
|
+
if (index != -1){ elems.splice(index, 1);}
|
229
|
+
|
230
|
+
if (elems.length > 0){
|
231
|
+
lists[type] = elems;
|
232
|
+
}else{
|
233
|
+
delete lists[type]
|
234
|
+
}
|
235
|
+
|
236
|
+
delete entity_lists[type][list]
|
237
|
+
if (entity_lists[type].length == 0){
|
238
|
+
delete entity_lists[type]
|
147
239
|
}
|
148
|
-
|
240
|
+
}
|
241
|
+
|
242
|
+
$.cookie('saved_lists', JSON.stringify(lists), {path: "/"})
|
243
|
+
|
244
|
+
update_list_viewer()
|
245
|
+
}
|
246
|
+
|
247
|
+
function load_list(type, list){
|
248
|
+
var lists = saved_lists();
|
249
|
+
if (lists == null) { lists = {}; };
|
250
|
+
if (lists[type] == null) { lists[type] = [] };
|
251
|
+
lists[type].push(list);
|
252
|
+
$.cookie('saved_lists', JSON.stringify(lists), {path: "/"})
|
253
|
+
add_entity_list(type, list);
|
254
|
+
}
|
255
|
+
|
256
|
+
function record_list(type, list_id, list){
|
257
|
+
if (entity_lists[type] == null){
|
258
|
+
entity_lists[type] = {}
|
259
|
+
}
|
260
|
+
entity_lists[type][list_id] = list;
|
261
|
+
}
|
262
|
+
|
263
|
+
function update_list_viewer(){
|
264
|
+
var list_html = ""
|
265
|
+
list_html += "<a href='/entity_list/user'>your lists</a>\n"
|
266
|
+
list_html += "<a href='/entity_list/public'>public lists</a>\n"
|
267
|
+
list_html += "<a class='clear_selected' href='#clear_selected'>clear selected</a>\n"
|
268
|
+
list_html += "<h5 class='loaded_lists'>Loaded lists</h5>\n"
|
269
|
+
list_html += "<dl class='entity_list_types'>\n"
|
270
|
+
$.each(entity_lists, function(type, lists){
|
271
|
+
list_html += "<dt>" + type + "</dt>\n"
|
272
|
+
list_html += "<dd>\n"
|
273
|
+
list_html += "<ul class='entity_list'>"
|
274
|
+
$.each(lists, function(name, elems){
|
275
|
+
list_html += "<li>"
|
276
|
+
|
277
|
+
list_html += "<a href='#select_list' class='select_list' attr-list-type='" + type + "' attr-list='" + name + "'>"
|
278
|
+
list_html += 'select'
|
279
|
+
list_html += "</a>" + "\n"
|
280
|
+
|
281
|
+
list_html += "<a href='#remove_list' class='remove_list' attr-list-type='" + type + "' attr-list='" + name + "'>"
|
282
|
+
list_html += "remove"
|
283
|
+
list_html += "</a>" + "\n"
|
284
|
+
|
285
|
+
list_html += "<a href='/entity_list/" + type + "/" + name + "' class='view_list' attr-list-type='" + type + "'>"
|
286
|
+
list_html += name
|
287
|
+
list_html += "</a>" + "\n"
|
288
|
+
|
289
|
+
list_html += "</li>"
|
290
|
+
})
|
291
|
+
list_html += "</ul>"
|
292
|
+
list_html += "</dd>\n"
|
293
|
+
})
|
294
|
+
$('#lists').html(list_html);
|
295
|
+
rbbt_action_setup();
|
296
|
+
}
|
297
|
+
|
298
|
+
function update_list_selectors(){
|
299
|
+
$.each(entity_lists, function(type, lists){
|
300
|
+
$('select.loaded_lists[type=' + type + ']').each(function(){
|
301
|
+
var select = $(this);
|
302
|
+
select.find('option').remove();
|
303
|
+
$.each(lists, function(name, elems){
|
304
|
+
var option = $('<option value="' + name + '">' + name + '</option>')
|
305
|
+
select.append(option);
|
306
|
+
return true
|
307
|
+
})
|
308
|
+
})
|
309
|
+
});
|
310
|
+
}
|
311
|
+
|
312
|
+
function add_entity_list(type, list_id){
|
313
|
+
$.getJSON(
|
314
|
+
"/entity_list/" + type + "/" + list_id + '?_format=json',
|
315
|
+
function(data){
|
316
|
+
record_list(type, list_id, data);
|
317
|
+
update_list_viewer();
|
318
|
+
update_list_selectors();
|
319
|
+
})
|
320
|
+
}
|
321
|
+
|
322
|
+
function id_for_entity(entity_format, entity){
|
323
|
+
return((entity_format.toLowerCase().replace(/[^\w]/g, "_") + "=" + entity));
|
324
|
+
}
|
325
|
+
|
326
|
+
function select_list(type, list_id){
|
327
|
+
var list = entity_lists[type][list_id];
|
328
|
+
var entity;
|
329
|
+
|
330
|
+
$.each(list, function(id, data){
|
331
|
+
var id = data[0];
|
332
|
+
var info = data[1];
|
333
|
+
var format = info["format"];
|
334
|
+
var entity_id = id_for_entity(format, id);
|
335
|
+
$('.entity[' + entity_id + ']').addClass("selected_entity");
|
336
|
+
})
|
149
337
|
}
|
150
338
|
|
151
339
|
//-- SETUP FUNCTIOS
|
@@ -163,6 +351,7 @@ function rbbt_table_setup(){
|
|
163
351
|
var psize = form.find(".psize").first().val();
|
164
352
|
var change = $(this).val();
|
165
353
|
$.ajax({
|
354
|
+
cache: false,
|
166
355
|
url: add_parameters(href, "_pfield=" + pfield + "&_pnum=" + pnum + "&_psize=" + psize + "&_paginate=" + change),
|
167
356
|
success: function(data){
|
168
357
|
embedded_div.html(data);
|
@@ -197,6 +386,11 @@ function rbbt_action_setup(){
|
|
197
386
|
replace_object($(this));
|
198
387
|
}).addClass('rbbt_action_setup');
|
199
388
|
|
389
|
+
$('a.check_replace').not('[class*=rbbt_action_setup]').each(function(){
|
390
|
+
replace_object($(this), 'check');
|
391
|
+
}).addClass('rbbt_action_setup');
|
392
|
+
|
393
|
+
|
200
394
|
$('a.entity').not('[class*=rbbt_action_setup]').click(function(){
|
201
395
|
var link = $(this);
|
202
396
|
var href = link.attr('href')
|
@@ -210,7 +404,8 @@ function rbbt_action_setup(){
|
|
210
404
|
show_details();
|
211
405
|
$('#details').html("<span class='details_loading'>Loading " + href + "</span>").addClass("loading").removeClass("error");
|
212
406
|
|
213
|
-
$.ajax(add_parameters(href, '_size=' + size), {
|
407
|
+
$.ajax(add_parameters(href, '_size=' + size + '&_cache_type=memory'), {
|
408
|
+
cache: false,
|
214
409
|
success: function(data){
|
215
410
|
var old_url = $('#details').attr('url');
|
216
411
|
if (old_url != null && old_url != undefined ){
|
@@ -230,46 +425,148 @@ function rbbt_action_setup(){
|
|
230
425
|
}).addClass('rbbt_action_setup');
|
231
426
|
|
232
427
|
$('.DELETE,.POST').not('[class*=rbbt_action_setup]').click(function() {
|
233
|
-
if(confirm('Are you sure?')) {
|
428
|
+
//if(confirm('Are you sure?')) {
|
429
|
+
if(true) {
|
234
430
|
var link = $(this);
|
235
|
-
var
|
431
|
+
var target_id = link.attr('rel')
|
432
|
+
var href = link.attr('href');
|
236
433
|
|
237
|
-
$.ajax({url:href, data:{ _method: $(this).getClassInList(['POST', 'DELETE'])}, type:"post", asyn:false})
|
434
|
+
$.ajax({cache: false, url:href, data:{ _method: $(this).getClassInList(['POST', 'DELETE'])}, type:"post", asyn:false, success: function(){if (target_id != null){ link.remove(); $("#" + target_id).remove();}}})
|
238
435
|
}
|
239
436
|
return false;
|
240
437
|
}).addClass('rbbt_action_setup');
|
241
438
|
|
242
|
-
//$('form.replace').not('[class*=rbbt_action_setup]').each(function(){
|
243
|
-
// var link = $(this);
|
244
|
-
// var href = link.attr('href')
|
245
|
-
// $.ajax(href,{
|
246
|
-
// success: function( data, stat, req ) {
|
247
|
-
// link.replaceWith('<div class="embedded" target="' + req.getResponseHeader("AJAX-URL") + '">' + data + '</div>');
|
248
|
-
// rbbt_action_setup();
|
249
|
-
// }
|
250
|
-
// });
|
251
|
-
//}).addClass('rbbt_action_setup');
|
252
|
-
|
253
439
|
$('div.embedded form').not('[class*=rbbt_action_setup]').submit(function(){
|
254
440
|
var form = $(this);
|
255
441
|
var embedded = form.parents('div.embedded').first();
|
256
442
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
}
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
443
|
+
var params = "";
|
444
|
+
|
445
|
+
form.find('input').not('[type=submit]').each(function(){
|
446
|
+
var input = $(this)
|
447
|
+
if (params.length > 0){ params += '&'}
|
448
|
+
params += input.attr('name') + "=" + input.val();
|
449
|
+
})
|
450
|
+
|
451
|
+
form.find('select').not('[type=submit]').each(function(){
|
452
|
+
var select = $(this)
|
453
|
+
var option = select.find('option:selected');
|
454
|
+
if (params.length > 0){ params += '&'}
|
455
|
+
params += select.attr('name') + "=" + option.val();
|
456
|
+
})
|
457
|
+
|
458
|
+
|
459
|
+
params = params
|
460
|
+
|
461
|
+
var url = embedded.attr('target');
|
462
|
+
url = url.replace(/\?.*/, '?' + params)
|
463
|
+
|
464
|
+
embedded.attr('target', url)
|
465
|
+
|
466
|
+
replace_object(embedded);
|
467
|
+
|
468
|
+
return false;
|
469
|
+
}).addClass('rbbt_action_setup');
|
470
|
+
|
471
|
+
$('.embedded > header').not('[class*=rbbt_action_setup]').each(function(){
|
472
|
+
var header = $(this);
|
473
|
+
var embedded = header.parent('.embedded');
|
474
|
+
var href = embedded.attr('target');
|
475
|
+
|
476
|
+
if (header.find('ul.embedded_control').length == 0){
|
477
|
+
var html = header.html();
|
478
|
+
html = html + '<ul class="embedded_control"><li><a class="toggle_embedded">toggle</a></li><li><a class="reload_embedded">reload</a></li><li><a class="link_embedded" href="'+ href + '">link</a></li></ul>'
|
479
|
+
header.html(html);
|
480
|
+
}
|
481
|
+
|
482
|
+
header.addClass('rbbt_action_setup')
|
483
|
+
|
484
|
+
rbbt_action_setup();
|
485
|
+
}).addClass('rbbt_action_setup');
|
486
|
+
|
487
|
+
$('a.reload_embedded').not('[class*=rbbt_action_setup]').click(function(){
|
488
|
+
var link = $(this);
|
489
|
+
var embedded = link.parents('.embedded').first();
|
490
|
+
if (embedded.hasClass('contracted_embedded')){
|
491
|
+
expand_embedded(embedded)
|
492
|
+
}
|
493
|
+
replace_object(embedded, 'reload');
|
494
|
+
return false;
|
495
|
+
}).addClass('rbbt_action_setup');
|
496
|
+
|
497
|
+
$('a.toggle_embedded').not('[class*=rbbt_action_setup]').click(function(){
|
498
|
+
var link = $(this);
|
499
|
+
var embedded = link.parents('.embedded').first();
|
500
|
+
var header = embedded.find('header').first();
|
501
|
+
|
502
|
+
if (embedded.attr('attr-save') == null){
|
503
|
+
contract_embedded(embedded)
|
504
|
+
}else{
|
505
|
+
expand_embedded(embedded)
|
267
506
|
}
|
268
|
-
|
507
|
+
return false;
|
508
|
+
}).addClass('rbbt_action_setup');
|
509
|
+
|
510
|
+
$('a.retry_error').not('[class*=rbbt_action_setup]').click(function(e){
|
511
|
+
var retry_link = $(this);
|
512
|
+
var link = retry_link.prev('a');
|
513
|
+
if (link.length == 0){ link = retry_link.prev('.embedded')};
|
514
|
+
replace_object(link, 'reload');
|
515
|
+
retry_link.remove();
|
516
|
+
return false;
|
517
|
+
}).addClass('rbbt_action_setup');
|
518
|
+
|
519
|
+
|
520
|
+
$('a.start_checked').not('[class*=rbbt_action_setup]').click(function(e){
|
521
|
+
var retry_link = $(this);
|
522
|
+
var link = retry_link.prev('a');
|
523
|
+
replace_object(link);
|
524
|
+
retry_link.remove();
|
525
|
+
return false;
|
526
|
+
}).addClass('rbbt_action_setup');
|
527
|
+
|
528
|
+
$('a.select_list').not('[class*=rbbt_action_setup]').click(function(){
|
529
|
+
var link = $(this);
|
530
|
+
var list_id = link.attr('attr-list')
|
531
|
+
var type = link.attr('attr-list-type')
|
532
|
+
|
533
|
+
select_list(type, list_id)
|
534
|
+
return false;
|
535
|
+
}).addClass('rbbt_action_setup');
|
269
536
|
|
537
|
+
$('a.remove_list').not('[class*=rbbt_action_setup]').click(function(){
|
538
|
+
var link = $(this);
|
539
|
+
var list_id = link.attr('attr-list');
|
540
|
+
var type = link.attr('attr-list-type')
|
541
|
+
|
542
|
+
remove_list(type, list_id);
|
543
|
+
|
544
|
+
return false;
|
545
|
+
}).addClass('rbbt_action_setup');
|
546
|
+
|
547
|
+
|
548
|
+
$('a.load_entity_list').not('[class*=rbbt_action_setup]').click(function(){
|
549
|
+
var link = $(this);
|
550
|
+
var list_id = link.attr('attr-list');
|
551
|
+
var type = link.attr('attr-list-type');
|
552
|
+
|
553
|
+
load_list(type, list_id);
|
270
554
|
return false;
|
271
555
|
}).addClass('rbbt_action_setup');
|
272
556
|
|
557
|
+
$('a.open_edit_controls').not('[class*=rbbt_action_setup]').click(function(){
|
558
|
+
var link = $(this);
|
559
|
+
|
560
|
+
var edit_controls = link.next('.edit_controls')
|
561
|
+
edit_controls.toggle();
|
562
|
+
|
563
|
+
return false;
|
564
|
+
}).addClass('rbbt_action_setup');
|
565
|
+
|
566
|
+
$('a.clear_selected').not('[class*=rbbt_action_setup]').click(function(){
|
567
|
+
$('a.selected_entity').removeClass('selected_entity')
|
568
|
+
}).addClass('rbbt_action_setup');
|
273
569
|
|
570
|
+
update_list_selectors();
|
274
571
|
}
|
275
572
|
|