desktopapp: edit project added

This commit is contained in:
nau
2016-09-05 09:45:24 +02:00
parent 93f1bf48ff
commit a152fd84db
11 changed files with 43 additions and 6 deletions

View File

@@ -32,16 +32,31 @@ angular.module('workApp', [])
id: $scope.projects[$scope.projects.length-1].id+1 id: $scope.projects[$scope.projects.length-1].id+1
}; };
}; };
$scope.editingIndex="";
$scope.editProject = function(index){
$scope.editingIndex=index;
$scope.editingProject=angular.copy($scope.projects[index]);
};
$scope.cancelEditProject = function(){
$scope.editingProject=false;
};
$scope.updateProject = function(){
$scope.projects[$scope.editingIndex]=angular.copy($scope.editingProject);
$scope.currentproject=angular.copy($scope.editingProject);
$scope.editingProject=false;
};
$scope.removeProject = function(index){ $scope.removeProject = function(index){
$scope.projects.splice(index, 1); $scope.projects.splice(index, 1);
localStorage.setItem("w_l_projects", angular.toJson($scope.projects)); localStorage.setItem("w_l_projects", angular.toJson($scope.projects));
}; };
$scope.projectSelect = function(index){ $scope.projectSelect = function(index){
$scope.btnStop();
$scope.currentproject=$scope.projects[index]; $scope.currentproject=$scope.projects[index];
}; };
var interval; var interval;
$scope.currentStrike=0; $scope.currentStrike=0;
$scope.btnWork = function(){ $scope.btnWork = function(){
$scope.editingProject=false;
$scope.working=true; $scope.working=true;
$scope.currentStrike=0; $scope.currentStrike=0;
interval = $interval(function(){ interval = $interval(function(){

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
desktopapp/img/browser.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
desktopapp/img/codetags.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
desktopapp/img/diagram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
desktopapp/img/edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

BIN
desktopapp/img/monitor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
desktopapp/img/tablet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -51,16 +51,21 @@
<span class="card-title">Projects</span> <span class="card-title">Projects</span>
<div class="collection"> <div class="collection">
<a href="#!" ng-click="projectSelect($index)" ng-repeat="project in projects" class="collection-item avatar blue-grey lighten-4"> <a href="#!" ng-click="projectSelect($index)" ng-repeat="project in projects" class="collection-item avatar blue-grey lighten-4">
<div class="waves-effect waves-light btn-floating blue-grey lighten-2 right" ng-click="removeProject($index)"> <div class="right">
<div class="waves-effect waves-light btn-floating blue-grey lighten-2" ng-click="editProject($index)">
<i class="material-icons"><img src="img/edit.png" class="o_trash_icon" /></i>
</div>
<div class="waves-effect waves-light btn-floating blue-grey lighten-2" ng-click="removeProject($index)">
<i class="material-icons"><img src="img/trash.png" class="o_trash_icon" /></i> <i class="material-icons"><img src="img/trash.png" class="o_trash_icon" /></i>
</div> </div>
<img ng-src="img/coding/{{project.icon}}.png" class="circle"/> </div>
<img ng-src="img/{{project.icon}}.png" class="circle"/>
<span class="title">{{project.title}}</span> <span class="title">{{project.title}}</span>
<p class="grey-text">{{project.totaltime | secondsToDateTime | date:'HH:mm:ss'}}</p> <p class="grey-text">{{project.totaltime | secondsToDateTime | date:'HH:mm:ss'}}</p>
</a> </a>
</div> </div>
</div> </div>
<div class="card-action"> <div class="card-action" ng-show="!editingProject">
<div class="input-field col s6"> <div class="input-field col s6">
<input ng-model="newproject.title" id="newprojectname" type="text" class="validate"> <input ng-model="newproject.title" id="newprojectname" type="text" class="validate">
<label for="newprojectname">New project name</label> <label for="newprojectname">New project name</label>
@@ -71,12 +76,24 @@
</div> </div>
<a ng-click="addNewProject()" class="waves-effect waves-light btn blue-grey lighten-1 right">Add new project</a> <a ng-click="addNewProject()" class="waves-effect waves-light btn blue-grey lighten-1 right">Add new project</a>
</div> </div>
<div class="card-action" ng-show="editingProject">
<div class="input-field col s6">
<input ng-model="editingProject.title" id="newprojectname" value=" " type="text" class="validate">
<label for="newprojectname">New project name</label>
</div>
<div class="input-field col s6">
<input ng-model="editingProject.icon" id="icon" value=" " type="text" class="validate">
<label for="icon">icon</label>
</div>
<a ng-click="cancelEditProject()" class="waves-effect waves-light btn red lighten-2">Cancel</a>
<a ng-click="updateProject()" class="waves-effect waves-light btn blue lighten-2 right">Update project</a>
</div>
</div> </div>
<div ng-show="currentproject.title" class="card blue-grey lighten-4 col s12 m7 l7"> <div ng-show="currentproject.title" class="card blue-grey lighten-4 col s12 m7 l7">
<div class="card-content"> <div class="card-content">
<span class="card-title"> <span class="card-title">
<img ng-src="img/coding/{{currentproject.icon}}.png" class="o_project_title_img"/> <img ng-src="img/{{currentproject.icon}}.png" class="o_project_title_img"/>
{{currentproject.title}} {{currentproject.title}}
</span> </span>
<p> <p>
@@ -94,6 +111,11 @@
<!--<a class="waves-effect waves-light btn deep-orange lighten-2">Stop working!</a>--> <!--<a class="waves-effect waves-light btn deep-orange lighten-2">Stop working!</a>-->
</div> </div>
</div> </div>
<div ng-show="!currentproject.title" class="card blue-grey lighten-4 col s12 m7 l7" style="height: 200px;">
<span class="card-title">
Select a project
</span>
</div>
</div> </div>