Convert JS click event to <a/> links

This commit is contained in:
jendib 2015-05-02 17:15:37 +02:00
parent a1af1f369f
commit 9b4b13a721
3 changed files with 7 additions and 17 deletions

View File

@ -95,20 +95,6 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
$scope.loadDocuments(); $scope.loadDocuments();
}); });
/**
* Go to add document form.
*/
$scope.addDocument = function() {
$state.transitionTo('document.add');
};
/**
* Go to edit document form.
*/
$scope.editDocument = function(id) {
$state.transitionTo('document.edit', { id: id });
};
/** /**
* Display a document. * Display a document.
*/ */

View File

@ -2,7 +2,7 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="well"> <div class="well">
<p class="text-center"> <p class="text-center">
<button class="btn btn-primary" type="button" ng-click="addDocument()"><span class="glyphicon glyphicon-plus"></span> Add a document</button> <a href="#/document/add" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> Add a document</a>
</p> </p>
<div class="input-group"> <div class="input-group">
@ -34,7 +34,11 @@
</thead> </thead>
<tbody> <tbody>
<tr ng-click="viewDocument(document.id)" ng-repeat="document in documents"> <tr ng-click="viewDocument(document.id)" ng-repeat="document in documents">
<td>{{ document.title }} ({{ document.file_count }}) <span class="glyphicon glyphicon-share" ng-if="document.shared" tooltip="Shared"></span></td> <td>
{{ document.title }} ({{ document.file_count }})
<span class="glyphicon glyphicon-share" ng-if="document.shared" tooltip="Shared"></span>
<a href="#/document/view/{{ document.id }}" ng-click="$event.stopPropagation()"><span class="glyphicon glyphicon-link"></span></a>
</td>
<td>{{ document.create_date | date: 'yyyy-MM-dd' }}</td> <td>{{ document.create_date | date: 'yyyy-MM-dd' }}</td>
<td class="hidden-xs cell-tags"> <td class="hidden-xs cell-tags">
<div class="tags"> <div class="tags">

View File

@ -4,7 +4,7 @@
<div class="text-right"> <div class="text-right">
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-danger" ng-click="deleteDocument(document)"><span class="glyphicon glyphicon-trash"></span> Delete</button> <button class="btn btn-danger" ng-click="deleteDocument(document)"><span class="glyphicon glyphicon-trash"></span> Delete</button>
<button class="btn btn-primary" ng-click="editDocument(document.id)"><span class="glyphicon glyphicon-pencil"></span> Edit</button> <a href="#/document/edit/{{ document.id }}" class="btn btn-primary"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
</div> </div>
</div> </div>