[update] Last version toggle
This commit is contained in:
@@ -76,6 +76,26 @@ application.controller(
|
||||
} );
|
||||
};
|
||||
|
||||
project.on_new_version = function( data )
|
||||
{
|
||||
// Should open last version
|
||||
if( $scope.always_last_version )
|
||||
{
|
||||
// Same file
|
||||
if( $scope.file && $scope.file.path.full === data.file )
|
||||
{
|
||||
$scope.$apply( function()
|
||||
{
|
||||
if( $scope.version )
|
||||
$scope.version.active = false;
|
||||
|
||||
$scope.version = data.version;
|
||||
$scope.version.active = true;
|
||||
} );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$scope.project = project;
|
||||
$scope.file = null;
|
||||
$scope.always_last_version = true;
|
||||
|
||||
@@ -106,6 +106,7 @@ application.factory(
|
||||
result.files = {};
|
||||
result.tree = new Tree( { auto_wash: false } );
|
||||
result.on_update = null;
|
||||
result.on_new_version = null;
|
||||
|
||||
// Connect
|
||||
result.connect = function( project_name )
|
||||
@@ -153,6 +154,9 @@ application.factory(
|
||||
// Apply callback
|
||||
if( typeof result.on_update === 'function' )
|
||||
result.on_update.apply( this, [ data ] );
|
||||
|
||||
if( typeof result.on_new_version === 'function' )
|
||||
result.on_new_version.apply( this, [ data ] );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user