-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_pub.admin.js
34 lines (34 loc) · 1.26 KB
/
custom_pub.admin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(function ($) {
"use strict";
Backdrop.behaviors.custom_pub_admin = {
attach: function () {
var toggleButtonLabels = {
edit: Backdrop.t('Edit'),
close: Backdrop.t('Close')
};
$("td.custom_pub-option-edit-cell").html('<a href="#">' + toggleButtonLabels.edit + '</a>').css("text-align", "right");
$("tr.custom_pub-form-edit").hide();
$("td.custom_pub-option-edit-cell > a").bind('click', function () {
var $this = $(this);
var opt = [];
var txt = $this.text();
opt[toggleButtonLabels.edit] = toggleButtonLabels.close;
opt[toggleButtonLabels.close] = toggleButtonLabels.edit;
$this.parents('tr.custom_pub-option-row').next("tr.custom_pub-form-edit").toggle();
$this.text(opt[txt]);
return false;
});
$("th.close-custom-pub-table").html('<a>X</a>')
.css('text-align', 'right');
$("th.close-custom-pub-table > a")
.css('cursor', 'pointer')
.live('click', function () {
var $this = $(this);
var $row = $this.parents("tr.custom_pub-form-edit");
var $link = $row.prev('tr.custom_pub-option-row').find("td.custom_pub-option-edit-cell > a");
$link.click();
return false;
});
}
};
})(jQuery);