diff options
Diffstat (limited to 'view/js/acl.js')
-rw-r--r-- | view/js/acl.js | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/view/js/acl.js b/view/js/acl.js index 6c3d9b462..c129634a0 100644 --- a/view/js/acl.js +++ b/view/js/acl.js @@ -17,7 +17,7 @@ function ACL(backend_url, preset){ that.item_tpl = unescape($(".acl-list-item[rel=acl-template]").html()); that.showall = $("#acl-showall"); - if (preset.length==0) that.showall.addClass("selected"); + if (preset.length==0) that.showall.removeClass("btn-default").addClass("btn-warning"); /*events*/ @@ -70,10 +70,10 @@ ACL.prototype.on_showall = function(event){ event.preventDefault() event.stopPropagation(); - if (that.showall.hasClass("selected")){ + if (that.showall.hasClass("btn-warning")){ return false; } - that.showall.addClass("selected"); + that.showall.removeClass("btn-default").addClass("btn-warning"); that.allow_cid = []; that.allow_gid = []; @@ -162,23 +162,11 @@ ACL.prototype.set_deny = function(itemid){ } ACL.prototype.update_view = function(){ - var jotpermslock; - var jotpermsunlock; - if (document.jotpermslock == null) { - jotpermslock = 'lock'; - } else { - jotpermslock = document.jotpermslock; - } - if (document.jotpermsunlock == null) { - jotpermsunlock = 'unlock'; - } else { - jotpermsunlock = document.jotpermsunlock; - } if (that.allow_gid.length==0 && that.allow_cid.length==0 && that.deny_gid.length==0 && that.deny_cid.length==0){ - that.showall.addClass("selected"); + that.showall.removeClass("btn-default").addClass("btn-warning"); /* jot acl */ - $('#jot-perms-icon').removeClass(jotpermslock).addClass(jotpermsunlock); + $('#jot-perms-icon').removeClass('icon-lock').addClass('icon-unlock'); $('#jot-public').show(); $('.profile-jot-net input').attr('disabled', false); if(typeof editor != 'undefined' && editor != false) { @@ -186,9 +174,9 @@ ACL.prototype.update_view = function(){ } } else { - that.showall.removeClass("selected"); + that.showall.removeClass("btn-warning").addClass("btn-default"); /* jot acl */ - $('#jot-perms-icon').removeClass(jotpermsunlock).addClass(jotpermslock); + $('#jot-perms-icon').removeClass('icon-unlock').addClass('icon-lock'); $('#jot-public').hide(); $('.profile-jot-net input').attr('disabled', 'disabled'); $('#profile-jot-desc').html(' '); @@ -202,20 +190,20 @@ ACL.prototype.update_view = function(){ type = itemid[0]; id = itemid.substr(1); - btshow = $(this).children(".acl-button-show").removeClass("selected"); - bthide = $(this).children(".acl-button-hide").removeClass("selected"); + btshow = $(this).children(".acl-button-show").removeClass("btn-success").addClass("btn-default"); + bthide = $(this).children(".acl-button-hide").removeClass("btn-danger").addClass("btn-default"); switch(type){ case "g": var uclass = ""; if (that.allow_gid.indexOf(id)>=0){ - btshow.addClass("selected"); - bthide.removeClass("selected"); + btshow.removeClass("btn-default").addClass("btn-success"); + bthide.removeClass("btn-danger").addClass("btn-default"); uclass="groupshow"; } if (that.deny_gid.indexOf(id)>=0){ - btshow.removeClass("selected"); - bthide.addClass("selected"); + btshow.removeClass("btn-success").addClass("btn-default"); + bthide.removeClass("btn-default").addClass("btn-danger"); uclass="grouphide"; } @@ -235,12 +223,12 @@ ACL.prototype.update_view = function(){ break; case "c": if (that.allow_cid.indexOf(id)>=0){ - btshow.addClass("selected"); - bthide.removeClass("selected"); + btshow.removeClass("btn-default").addClass("btn-success"); + bthide.removeClass("btn-danger").addClass("btn-default"); } if (that.deny_cid.indexOf(id)>=0){ - btshow.removeClass("selected"); - bthide.addClass("selected"); + btshow.removeClass("btn-success").addClass("btn-default"); + bthide.removeClass("btn-default").addClass("btn-danger"); } } @@ -270,11 +258,16 @@ ACL.prototype.populate = function(data){ that.list_content.height(height); $(data.items).each(function(){ html = "<div class='acl-list-item {4} {7} {5}' title='{6}' id='{2}{3}'>"+that.item_tpl+"</div>"; - html = html.format( this.photo, this.name, this.type, this.xid, '', this.self, this.link, this.taggable ); + html = html.format(this.photo, this.name, this.type, this.xid, '', this.self, this.link, this.taggable); if (this.uids!=undefined) that.group_uids[this.id] = this.uids; //console.log(html); that.list_content.append(html); }); + $("#acl-list-content .acl-list-item img[data-src]").each(function(i, el){ + // Replace data-src attribute with src attribute for every image + $(el).attr('src', $(el).data("src")); + $(el).removeAttr("data-src"); + }); that.update_view(); } |