diff --git a/pkgs/plt-services/meta/pkg-index/official/.gitignore b/pkgs/plt-services/meta/pkg-index/official/.gitignore index ae6f4494c4..17a4d8234e 100644 --- a/pkgs/plt-services/meta/pkg-index/official/.gitignore +++ b/pkgs/plt-services/meta/pkg-index/official/.gitignore @@ -3,3 +3,4 @@ /static/pkg /static/pkgs-all *json +/static/atom.xml diff --git a/pkgs/plt-services/meta/pkg-index/official/static.rkt b/pkgs/plt-services/meta/pkg-index/official/static.rkt index dbfc9b7ecc..cb5f150a66 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static.rkt +++ b/pkgs/plt-services/meta/pkg-index/official/static.rkt @@ -119,32 +119,67 @@ (packages-conflict?/cache pkg other-pkg))) ring-01)) + (define (package-url->useful-url pkg-url-str) + (define pkg-url + (string->url pkg-url-str)) + (match (url-scheme pkg-url) + ["github" + (match (url-path pkg-url) + [(list* user repo branch path) + (url->string + (struct-copy + url pkg-url + [scheme "http"] + [path (list* user repo (path/param "tree" empty) branch path)]))] + [_ + pkg-url-str])] + ["git" + (match (url-path pkg-url) + ;; xxx make this more robust + [(list user repo) + (url->string + (struct-copy + url pkg-url + [scheme "http"] + [path (list user repo (path/param "tree" empty) + (path/param "master" empty))]))] + [_ + pkg-url-str])] + [_ + pkg-url-str])) + (for ([pkg (in-hash-keys pkg-ht)]) (hash-update! pkg-ht pkg (λ (ht) (define conflicts (package-conflicts? pkg)) - (hash-set* ht - 'conflicts conflicts - 'search-terms - (let* ([st (hasheq)] - [st (for/fold ([st st]) - ([t (in-list (hash-ref ht 'tags))]) - (hash-set st (string->symbol t) #t))] - [st (hash-set st (string->symbol (format "ring:~a" (hash-ref ht 'ring))) #t)] - [st (for/fold ([st st]) - ([a (in-list (author->list (hash-ref ht 'author)))]) - (hash-set st (string->symbol (format "author:~a" a)) #t))] - [st (if (empty? (hash-ref ht 'tags)) - (hash-set st ':no-tag: #t) - st)] - [st (if (hash-ref ht 'checksum-error) - (hash-set st ':error: #t) - st)] - [st (if (empty? conflicts) - st - (hash-set st ':conflicts: #t))]) - st))))) + (hash-set* + ht + 'conflicts conflicts + 'source_url (package-url->useful-url (hash-ref ht 'source)) + 'search-terms + (let* ([st (hasheq)] + [st (for/fold ([st st]) + ([t (in-list (hash-ref ht 'tags))]) + (hash-set st (string->symbol t) #t))] + [st (hash-set + st + (string->symbol + (format "ring:~a" (hash-ref ht 'ring))) #t)] + [st (for/fold ([st st]) + ([a (in-list (author->list (hash-ref ht 'author)))]) + (hash-set + st (string->symbol (format "author:~a" a)) #t))] + [st (if (empty? (hash-ref ht 'tags)) + (hash-set st ':no-tag: #t) + st)] + [st (if (hash-ref ht 'checksum-error) + (hash-set st ':error: #t) + st)] + [st (if (empty? conflicts) + st + (hash-set st ':conflicts: #t))]) + st))))) (define basic-dispatch 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 231e4adbc4..c4cbd8bf20 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static/index.html +++ b/pkgs/plt-services/meta/pkg-index/official/static/index.html @@ -17,21 +17,23 @@

-
- Package Name: XXX - Ring: XXX - Authors: XXX - Source: XXX - Checksum: XXX - Last Update: XXX - Last Checked: XXX - Last Edit: XXX - Description: XXX - Tags: XXX - XXX Add a tag - XXX Version exceptions +
+ + + + + + + + + + + + + +
Package Name:
Ring:
Authors:
Source:
Checksum:
Last Updated:
Last Checked:
Last Edit:
Description:
Tags:
XXXAdd a tag
XXXVersion exceptions
-
Install this package with:

raco pkg install XXX

or, with the 'File|Install Package...' menu option in DrRacket.
+
Install this package with:

raco pkg install

or, with the 'File|Install Package...' menu option in DrRacket.
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 2241d015e9..4293f9daf9 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static/index.js +++ b/pkgs/plt-services/meta/pkg-index/official/static/index.js @@ -3,19 +3,43 @@ // xxx what user am i // xxx upload // xxx update -// xxx show info about a package (make sure url is same as in atom feed) +// xxx show info about a package $( document ).ready(function() { $("#package_info").dialog({ autoOpen: false, + minWidth: 600, + minHeight: 600, position: { my: "center", at: "center", of: "#search_menu" }, modal: true }); + function format_time( t ) { + var d = new Date( t * 1000 ); + return d.toLocaleString(); } + var active_info = false; var target_pkg = false; function update_info( pkgi ) { console.log( pkgi ); change_hash( "[" + pkgi['name'] + "]" ); + $( "#pi_name" ).text( pkgi['name'] ); + $( "#pi_name_inst" ).text( pkgi['name'] ); + $( "#pi_ring" ).text( pkgi['ring'] ); + $( "#pi_authors" ).html("") + .append( $.map( pkgi['authors'], + function ( author, i ) { + return [author, " "]; } ) ) + + $( "#pi_source" ).html( $('', { text: pkgi['source'], + href: pkgi['source_url'] } )); + + $( "#pi_checksum" ).text( pkgi['checksum'] ); + $( "#pi_last_updated" ).text( format_time(pkgi['last-updated']) ); + $( "#pi_last_checked" ).text( format_time(pkgi['last-checked']) ); + $( "#pi_last_edit" ).text( format_time(pkgi['last-edit']) ); + $( "#pi_description" ).text( pkgi['description'] ); + $( "#pi_tags" ).html("").append( $.map( pkgi['tags'], function ( tag, i ) { + return [tag, " "]; } ) ) active_info = pkgi; }; var search_terms = { }; @@ -112,12 +136,7 @@ $( document ).ready(function() { var shown_terms_keys = object_keys(shown_terms); var shown_terms_skeys = shown_terms_keys.sort(function(a,b) { - var va = shown_terms[a]; - var vb = shown_terms[b]; - if ( va < 0 && vb < 0 ) { return ((a < b) ? -1 : ((a > b) ? 1 : 0)); } - else if ( va >= 0 && vb >= 0 ) { return ((va < vb) ? -1 : ((va > vb) ? 1 : 0)); } - else if ( va < 0 ) { return -1; } - else if ( vb < 0 ) { return 1; } }); + return ((a < b) ? -1 : ((a > b) ? 1 : 0)); }); change_hash( "" ); $("#search_menu").html("").append( $.map( shown_terms_skeys, function ( term, i ) { diff --git a/pkgs/plt-services/meta/pkg-index/official/static/style.css b/pkgs/plt-services/meta/pkg-index/official/static/style.css index 36b1b93fa2..58dcfaf5be 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static/style.css +++ b/pkgs/plt-services/meta/pkg-index/official/static/style.css @@ -72,20 +72,12 @@ table.packages tbody tr.even { } .package { - margin-top: 1em; - margin-bottom: 1em; - width: 100%; text-align: center; } .package table { - width: 70%; - margin-left: 15%; - margin-right: 15%; - border: 1px dotted; } .package table tr { - width: 100%; } .package table td { vertical-align: top; @@ -100,7 +92,7 @@ table.packages tbody tr.even { .package table td:nth-child(1) { text-align: right; font-weight: bold; - width: 15%; + width: 20%; } .package table td:nth-child(2) { text-align: left;