add/del version

This commit is contained in:
Jay McCarthy 2013-10-11 09:01:55 -06:00
parent ee3f06c64c
commit e5af132acf
2 changed files with 33 additions and 4 deletions

View File

@ -44,6 +44,7 @@
<tr><td>Tags:</td><td><span id="pi_tags"></span></td></tr>
<tr><td></td><td><input type="text" id="pi_add_tag_text" class="text ui-widget-content ui-corner-all" /><button id="pi_add_tag_button">Add Tag</button></td></tr>
<tr><td>Versions Exceptions</td><td><table id="pi_versions"></table></td></tr>
<tr id="pi_add_version_row"><td></td><td><label>Version:</label> <input type="text" id="pi_add_version_text" class="text ui-widget-content ui-corner-all" /><br /><label>Source:</label> <input type="text" id="pi_add_version_source_text" class="text ui-widget-content ui-corner-all" /><button id="pi_add_version_button">Add Version Exception</button></td></tr>
</table>
<div class="install">Install this package with:<br><br><tt>raco pkg install <span id="pi_name_inst"></span></tt><br><br>or, with the 'File|Install Package...' menu option in DrRacket.</div>

View File

@ -84,13 +84,18 @@ $( document ).ready(function() {
else {
return [tag, " "]; } } ) ));
// xxx show add and delete buttons
$( "#pi_versions" ).html("").append( $.map( pkgi['versions'], function ( vo, v ) {
return [ $('<tr>').append( $('<td>').html(v),
return [ $('<tr>').append( $('<td>').html("").append(
v, (mypkg_p ? ["&nbsp;", jslink( "[x]", function () { submit_remove_version(v); }) ] : "") ),
$('<td>').html(vo['source']) ),
$('<tr>').append( $('<td>').html(""),
$('<td>').html(vo['checksum']) ),
" "]; } ) )
" "]; } ) );
if ( mypkg_p ) {
$( "#pi_add_version_row" ).show(); }
else {
$( "#pi_add_version_row" ).hide(); }
active_info = pkgi; };
function submit_remove_tag ( tag ) {
@ -143,6 +148,29 @@ $( document ).ready(function() {
if (e.which == 13) { submit_add_author (); } } );
$( "#pi_add_author_button" ).click( function (e) { submit_add_author (); } );
function submit_remove_version ( version ) {
dynamic_pkgsend( "/jsonp/package/version/del", { version: version } );
delete active_info['versions'][version];
update_info( active_info ); }
function submit_add_version () {
var it = $( "#pi_add_version_text" );
var version = it.val();
it.val("");
it = $( "#pi_add_version_source_text" );
var source = it.val();
it.val("");
dynamic_pkgsend( "/jsonp/package/version/add", { version: version, source: source } );
active_info['versions'][version] = { source: source, checksum: "" };
update_info( active_info ); }
$( "#pi_add_version_source_text" ).keypress( function (e) {
if (e.which == 13) { submit_add_version (); } } );
$( "#pi_add_version_button" ).click( function (e) { submit_add_version (); } );
var search_terms = { };
function clear_terms () {
@ -185,7 +213,7 @@ $( document ).ready(function() {
// thing, particularly with the Back button because we
// don't add the tags in the same order the user add them
// in. We could do that though.
// console.log("hash changed beneath me!");
// console.log("hash changed beneath me!");
return 42; } });
function filterlink ( text, tclass, f ) {