From 60ae164d05f3cbf1c971154335cc8feea6433a8e Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Wed, 27 Nov 2013 15:39:36 -0700 Subject: [PATCH] Removing add tag button when not logged in re mflatt --- .../meta/pkg-index/official/static/index.html | 2 +- .../meta/pkg-index/official/static/index.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/plt-services/meta/pkg-index/official/static/index.html b/pkgs/plt-services/meta/pkg-index/official/static/index.html index 75adccc961..a95681054d 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static/index.html +++ b/pkgs/plt-services/meta/pkg-index/official/static/index.html @@ -54,7 +54,7 @@ Last Edit: Description: Tags: - + Versions Exceptions

Dependencies diff --git a/pkgs/plt-services/meta/pkg-index/official/static/index.js b/pkgs/plt-services/meta/pkg-index/official/static/index.js index 2e2118fff3..b8ba7e1837 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static/index.js +++ b/pkgs/plt-services/meta/pkg-index/official/static/index.js @@ -8,6 +8,8 @@ function me () { return localStorage['email']; } $( document ).ready(function() { + var logged_in = false; + function jslink ( texts, clickf) { return $('', { href: "javascript:void(0)", click: clickf } ).html(texts); } @@ -43,7 +45,7 @@ $( document ).ready(function() { update_package_on_list ( pkgi ); // console.log( pkgi ); change_hash( "[" + pkgi['name'] + "]" ); - + var mypkg_p = ($.inArray(me(), pkgi['authors'] ) != -1); function make_editbutton ( spot, initv, fun ) { @@ -71,7 +73,6 @@ $( document ).ready(function() { else { $( "#pi_delete_row" ).hide(); } - $( "#pi_name_inst" ).text( pkgi['name'] ); $( "#pi_ring" ).text( pkgi['ring'] ); $( "#pi_authors" ).html("") @@ -108,6 +109,10 @@ $( document ).ready(function() { " "]; } else { return [tag, " "]; } } ) )); + if ( logged_in ) { + $( "#pi_add_tag_row" ).show(); } + else { + $( "#pi_add_tag_row" ).hide(); } $( "#pi_versions" ).html("").append( $.map( Object.keys(pkgi['versions']).sort(), function ( v, vi ) { var vo = pkgi['versions'][v]; @@ -498,8 +503,10 @@ $( document ).ready(function() { $( "#login_code_row" ).hide(); function menu_logout () { + logged_in = false; $("#logout").html( jslink( "login", function () { $( "#login" ).dialog( "open" ); } ) ); } function menu_loggedin ( curate_p ) { + logged_in = true; $("#logout").html("") .append( me(), ( curate_p ? [ " (", jslink( "curator", function () {