history panel: fix delete function to use show_deleted

This commit is contained in:
Carl Eberhard
2012-12-19 15:46:55 -05:00
parent 765eeea201
commit cc190d7449
4 changed files with 13 additions and 9 deletions
+2 -1
View File
@@ -44,7 +44,8 @@ var HDABaseView = BaseView.extend( LoggableMixin ).extend(
this.expanded = attributes.expanded || false;
// re-render the entire view on any model change
this.model.bind( 'change', this.render, this );
this.model.bind( 'change', this.render , this );
//this.bind( 'all', function( event ){
// this.log( event );
//}, this );
+3 -6
View File
@@ -118,9 +118,6 @@ var HDAEditView = HDABaseView.extend( LoggableMixin ).extend(
id : 'historyItemDeleter-' + this.model.get( 'id' ),
icon_class : 'delete',
on_click : function() {
// Provide feedback by hiding from view immediately.
self.$el.slideUp();
// Delete the dataset on the server and update HDA + view depending on success/failure.
// FIXME: when HDA-delete is implemented in the API, can call set(), then save directly
// on the model.
@@ -134,13 +131,13 @@ var HDAEditView = HDABaseView.extend( LoggableMixin ).extend(
},
success: function() {
// FIXME: setting model attribute causes re-rendering, which is unnecessary.
self.model.set( 'deleted', true );
self.$el.remove();
//self.$el.remove();
self.model.set({ deleted: true });
}
});
// Return false so that anchor action (page reload) does not happen.
return false;
//return false;
}
};
if( this.model.get( 'deleted' ) || this.model.get( 'purged' ) ){
@@ -163,6 +163,11 @@ var HistoryPanel = BaseView.extend( LoggableMixin ).extend(
this.model.hdas.bind( 'add', this.add, this );
this.model.hdas.bind( 'reset', this.addAll, this );
// when a hda model is (un)deleted or (un)hidden, re-render entirely
//TODO??: purged
//TODO??: could be more selective here
this.model.hdas.bind( 'change:deleted change:hidden', this.render, this );
// if an a hidden hda is created (gen. by a workflow), moves thru the updater to the ready state,
// then: remove it from the collection if the panel is set to NOT show hidden datasets
this.model.hdas.bind( 'change:state',
@@ -292,6 +297,7 @@ var HistoryPanel = BaseView.extend( LoggableMixin ).extend(
// fade out existing, swap with the new, fade in, set up behaviours
$( historyView ).queue( setUpQueueName, function( next ){
historyView.$el.fadeOut( 'fast', function(){ next(); });
//historyView.$el.show( function(){ next(); });
});
$( historyView ).queue( setUpQueueName, function( next ){
// swap over from temp div newRender
@@ -299,6 +305,7 @@ var HistoryPanel = BaseView.extend( LoggableMixin ).extend(
historyView.$el.append( newRender.children() );
historyView.$el.fadeIn( 'fast', function(){ next(); });
//historyView.$el.show( function(){ next(); });
});
$( historyView ).queue( setUpQueueName, function( next ){
this.log( historyView + ' rendered:', historyView.$el );