[update] Improve versions infos + [update] Active file

This commit is contained in:
brunosimon
2016-08-13 01:27:47 +02:00
parent f1342c8dc0
commit 03c0629650
4 changed files with 80 additions and 48 deletions
+40 -15
View File
@@ -9,32 +9,57 @@ application.controller(
// Every 5 seconds
$interval( function()
{
// // Each version
// project.each_version( function( version )
// {
// // Date
// version.time_from_now = version.moment_date.fromNow();
// } );
// Each file
for( var _file_key in project.files )
{
var _file = project.files[ _file_key ];
// Each version
for( var _version_key in _file.versions )
{
var _version = _file.versions[ _version_key ];
// Date
_version.time_from_now = _version.moment_date.fromNow();
}
}
}, 5000 );
$scope.always_last_version_toggle_click = function()
{
$scope.always_last_version = !$scope.always_last_version;
};
$scope.folder_click = function( folder )
{
console.log('folder click');
// console.log('folder click');
// folder.active = !folder.active;
};
$scope.file_click = function( file )
{
file = file.data;
file.notif = 0;
// File
if( $scope.file )
$scope.file.active = false;
file = file.data;
file.notif = 0;
file.active = true;
$scope.file = file;
// Version
if( $scope.version )
$scope.version.active = false;
// file.active = true;
$scope.file = file;
$scope.version = file.versions[ file.versions.length - 1 ];
$scope.version.active = true
};
$scope.version_click = function( version )
{
if( $scope.version )
$scope.version.active = false;
version.active = true;
$scope.version = version;
};
@@ -47,13 +72,13 @@ application.controller(
{
$scope.$apply( function()
{
$scope.project = project;
} );
} );
$scope.project = project.data;
$scope.file = null;
$scope.version = null;
$scope.project = project;
$scope.file = null;
$scope.always_last_version = true;
$scope.version = null;
}
]
);
+1 -11
View File
@@ -75,9 +75,6 @@ application.factory(
socket.on( 'create_file', function( data )
{
// console.log('create_file');
// console.log(data);
var file = result.files[ data.path.full ];
// Doesn't exist yet
@@ -105,9 +102,6 @@ application.factory(
socket.on( 'create_version', function( data )
{
// console.log('create_version');
// console.log(data);
var file = result.files[ data.file ];
// Doesn't exist yet
@@ -125,9 +119,6 @@ application.factory(
socket.on( 'delete_file', function( data )
{
// console.log('delete_file');
// console.log(data);
var file = result.files[ data.path.full ];
// Doesn't exist yet
@@ -146,8 +137,7 @@ application.factory(
// Update project event
socket.on( 'update_project', function( data )
{
// console.log('update_project');
// console.log(data);
result.name = data.name;
// Duplicate files
for( var _file_key in data.files )