Skip to content

Commit

Permalink
Merge pull request #3442 from TIM-JYU/manage-page-translation-links
Browse files Browse the repository at this point in the history
Add links to a document's translations to the Manage-page
  • Loading branch information
dezhidki authored Jul 28, 2023
2 parents 61a71b9 + e767b38 commit fbb3ec6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions timApp/static/scripts/tim/item/manageCtrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,17 @@ export class PermCtrl implements IController {
loggedIn() {
return Users.isLoggedIn();
}

/**
* Returns the path to a document specified by doc_id
* @param doc_id
*/
getTranslationPath(doc_id: number) {
return (
this.translations.find((tr) => tr.id == doc_id)?.path ??
this.item.path
);
}
}

timApp.component("timManage", {
Expand Down
6 changes: 5 additions & 1 deletion timApp/static/templates/manage.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@
<input type="text" class="form-control" ng-model="tr.title" placeholder="Title"/>
</td>
<td>{{tr.owner.name}}</td>
<td>{{tr.id}}</td>
<td>{{tr.id}}
<a href="/view/{{$ctrl.getTranslationPath(tr.id)}}">
<i class="glyphicon glyphicon-link"></i>
</a>
</td>
<td>
<button class="timButton" ng-click="$ctrl.updateTranslation(tr)"
ng-disabled="!$ctrl.trChanged(tr)">Update
Expand Down

0 comments on commit fbb3ec6

Please sign in to comment.