Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion components/commit/commit.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
+<span data-bind="text: numberOfAddedLines"></span>,
-<span data-bind="text: numberOfRemovedLines"></span>
|
<span data-bind="text: sha1.substr(0, 8)"></span>
<!-- ko if: commitLink() -->
<a data-bind="text: sha1.substr(0, 8), attr: { href: commitLink(), target: '_blank' }"></a>
<!-- /ko -->
<!-- ko ifnot: commitLink() -->
<span data-bind="text: sha1.substr(0, 8)"></span>
<!-- /ko -->
</div>
</div>
</div>
Expand Down
10 changes: 10 additions & 0 deletions components/commit/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ function CommitViewModel(gitNode) {
this.authorDateFromNow = ko.observable();
this.authorName = ko.observable();
this.authorEmail = ko.observable();
this.commitLink = ko.computed(function() {
var short_sha1 = self.sha1.substr(0, 8);
var link_to_commit = ungit.config.linkToCommit[self.repoPath()]
if (link_to_commit != undefined) {
return ungit.config.linkToCommit[self.repoPath()].replace(/%h/g, short_sha1).replace(/%H/g, self.sha1)
}
else {
return null
}
});
this.fileLineDiffs = ko.observable();
this.numberOfAddedLines = ko.observable();
this.numberOfRemovedLines = ko.observable();
Expand Down
3 changes: 3 additions & 0 deletions source/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ const defaultConfig = {

// a string of ip to bind to, default is `127.0.0.1`
ungitBindIp: '127.0.0.1',

// example { "/home/projects/ungit" : "https://github.com/FredrikNoren/ungit/commit/%H" } use %H for full commit hash and %h for short commit hash
linkToCommit: {},
};

// Works for now but should be moved to bin/ungit
Expand Down