From ee3f06c64cc6f02383811603cd3612677eed2fd9 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Fri, 11 Oct 2013 08:51:46 -0600 Subject: [PATCH] add/del author --- .../meta/pkg-index/official/dynamic.rkt | 22 +++++++- .../meta/pkg-index/official/static/index.html | 1 + .../meta/pkg-index/official/static/index.js | 52 +++++++++++++++---- 3 files changed, 63 insertions(+), 12 deletions(-) diff --git a/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt b/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt index 9a28a2b9a1..b02b52b3f0 100644 --- a/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt +++ b/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt @@ -180,7 +180,7 @@ (list email) empty empty (list "Someone tried to register your email address for an account on the Racket Package Catalog." - "If you want to proceed, use this email code:" + "If you want to proceed, use this code:" "" correct-email-code "" @@ -229,6 +229,20 @@ ['tag tag]) #f) +;; XXX +(define-jsonp/auth + (jsonp/package/author/add + ['pkg pkg] + ['author author]) + #f) + +;; XXX +(define-jsonp/auth + (jsonp/package/author/del + ['pkg pkg] + ['author author]) + #f) + ;; XXX (define-jsonp/auth (jsonp/package/curate @@ -250,6 +264,8 @@ [("jsonp" "package" "version" "del") jsonp/package/version/del] [("jsonp" "package" "tag" "add") jsonp/package/tag/add] [("jsonp" "package" "tag" "del") jsonp/package/tag/del] + [("jsonp" "package" "author" "add") jsonp/package/author/add] + [("jsonp" "package" "author" "del") jsonp/package/author/del] [("jsonp" "package" "curate") jsonp/package/curate] [("api" "upload") #:method "post" api/upload] [else redirect-to-static])) @@ -257,7 +273,9 @@ (define (go port) (printf "launching on port ~a\n" port) (serve/servlet - main-dispatch + (λ (req) + (displayln (url->string (request-uri req))) + (main-dispatch req)) #:command-line? #t #:listen-ip #f #:ssl? #t 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 38ed447f2b..9eeffff8b9 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static/index.html +++ b/pkgs/plt-services/meta/pkg-index/official/static/index.html @@ -34,6 +34,7 @@ Package Name: Ring: Authors: + Source: Checksum: Last Updated: 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 4cc5b8948c..54d269a3d2 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static/index.js +++ b/pkgs/plt-services/meta/pkg-index/official/static/index.js @@ -36,7 +36,7 @@ $( document ).ready(function() { var active_info = false; var target_pkg = false; function update_info( pkgi ) { - console.log( pkgi ); + // console.log( pkgi ); change_hash( "[" + pkgi['name'] + "]" ); var mypkg_p = ($.inArray(me(), pkgi['authors'] ) != -1); @@ -48,11 +48,18 @@ $( document ).ready(function() { $( "#pi_name_inst" ).text( pkgi['name'] ); $( "#pi_ring" ).text( pkgi['ring'] ); - // xxx show add/delete buttons $( "#pi_authors" ).html("") .append( $.map( pkgi['authors'], function ( author, i ) { - return [author, " "]; } ) ) + if ( mypkg_p && author != me() ) { + return [ author, jslink( "[x]", function () { submit_remove_author(author); }), + " "]; } + else { + return [author, " "]; }} ) ); + if ( mypkg_p ) { + $( "#pi_add_author_row" ).show(); } + else { + $( "#pi_add_author_row" ).hide(); } $( "#pi_source" ).html( $('', { text: pkgi['source'], href: pkgi['source_url'] } )); @@ -70,13 +77,12 @@ $( document ).ready(function() { // xxx make this button do something $( "#pi_description" ).append( $('