Render emojis in more places.

This commit is contained in:
Andrey Nering 2016-03-02 21:18:58 -03:00
parent 37ac743da7
commit 13e71acadf
11 changed files with 24 additions and 19 deletions

View File

@ -878,7 +878,10 @@ $(document).ready(function () {
img_dir: suburl + '/img/emoji', img_dir: suburl + '/img/emoji',
ignore_emoticons: true ignore_emoticons: true
}); });
emojify.run(); var hasEmoji = document.getElementsByClassName('has-emoji');
for (var i = 0; i < hasEmoji.length; i++) {
emojify.run(hasEmoji[i]);
}
// Clipboard JS // Clipboard JS
var clipboard = new Clipboard('.clipboard'); var clipboard = new Clipboard('.clipboard');

View File

@ -16,7 +16,7 @@
<span class="text grey"><i class="octicon octicon-git-branch"></i> {{.NumForks}}</span> <span class="text grey"><i class="octicon octicon-git-branch"></i> {{.NumForks}}</span>
</div> </div>
</div> </div>
{{if .Description}}<p>{{.Description}}</p>{{end}} {{if .Description}}<p class="has-emoji">{{.Description}}</p>{{end}}
<p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}</p> <p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}</p>
</div> </div>
{{end}} {{end}}

View File

@ -35,7 +35,7 @@
<img class="ui avatar image" src="{{AvatarLink .Author.Email}}" alt=""/>&nbsp;&nbsp;{{.Author.Name}} <img class="ui avatar image" src="{{AvatarLink .Author.Email}}" alt=""/>&nbsp;&nbsp;{{.Author.Name}}
{{end}} {{end}}
</td> </td>
<td class="message collapsing"> <td class="message collapsing has-emoji">
<a rel="nofollow" class="ui sha label" href="{{AppSubUrl}}/{{$.Username}}/{{$.Reponame}}/commit/{{.ID}}">{{ShortSha .ID.String}}</a> <a rel="nofollow" class="ui sha label" href="{{AppSubUrl}}/{{$.Username}}/{{$.Reponame}}/commit/{{.ID}}">{{ShortSha .ID.String}}</a>
{{RenderCommitMessage false .Summary $.RepoLink $.Repository.ComposeMetas}} {{RenderCommitMessage false .Summary $.RepoLink $.Repository.ComposeMetas}}
</td> </td>

View File

@ -3,7 +3,7 @@
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<p id="repo-desc"> <p id="repo-desc">
{{if .Repository.DescriptionHtml}}<span class="description">{{.Repository.DescriptionHtml}}</span>{{else}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}} {{if .Repository.DescriptionHtml}}<span class="description has-emoji">{{.Repository.DescriptionHtml}}</span>{{else}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}}
<a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a> <a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
</p> </p>
<div class="ui secondary menu"> <div class="ui secondary menu">

View File

@ -102,7 +102,7 @@
{{ $timeStr:= TimeSince .Created $.Lang }} {{ $timeStr:= TimeSince .Created $.Lang }}
<li class="item"> <li class="item">
<div class="ui {{if .IsRead}}black{{else}}green{{end}} label">#{{.Index}}</div> <div class="ui {{if .IsRead}}black{{else}}green{{end}} label">#{{.Index}}</div>
<a class="title" href="{{$.Link}}/{{.Index}}">{{.Name}}</a> <a class="title has-emoji" href="{{$.Link}}/{{.Index}}">{{.Name}}</a>
{{range .Labels}} {{range .Labels}}
<a class="ui label" href="{{$.Link}}?type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name}}</a> <a class="ui label" href="{{$.Link}}?type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name}}</a>

View File

@ -16,11 +16,13 @@
{{if .Issue.IsPull}} {{if .Issue.IsPull}}
{{template "repo/issue/view_title" .}} {{template "repo/issue/view_title" .}}
{{template "repo/pulls/tab_menu" .}} {{template "repo/pulls/tab_menu" .}}
<div class="ui bottom attached tab pull segment active" data-tab="request-{{.ID}}"> <div class="ui bottom attached tab pull segment active has-emoji" data-tab="request-{{.ID}}">
{{template "repo/issue/view_content" .}} {{template "repo/issue/view_content" .}}
</div> </div>
{{else}} {{else}}
{{template "repo/issue/view_content" .}} <div class="has-emoji">
{{template "repo/issue/view_content" .}}
</div>
{{end}} {{end}}
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
<div class="sixteen wide column title"> <div class="sixteen wide column title">
<div class="ui grid"> <div class="ui grid">
<h1 class="twelve wide column"> <h1 class="twelve wide column">
<span class="index">#{{.Issue.Index}}</span> <span id="issue-title">{{.Issue.Name}}</span> <span class="index">#{{.Issue.Index}}</span> <span id="issue-title" class="has-emoji">{{.Issue.Name}}</span>
<div id="edit-title-input" class="ui input" style="display: none"> <div id="edit-title-input" class="ui input" style="display: none">
<input value="{{.Issue.Name}}"> <input value="{{.Issue.Name}}">
</div> </div>

View File

@ -24,7 +24,7 @@
{{end}} {{end}}
</h4> </h4>
<div class="ui attached table segment"> <div class="ui attached table segment">
<div class="file-view {{if .ReadmeExist}}markdown{{else if .IsFileText}}code-view{{end}}"> <div class="file-view {{if .ReadmeExist}}markdown{{else if .IsFileText}}code-view{{end}} has-emoji">
{{if .ReadmeExist}} {{if .ReadmeExist}}
{{if .FileContent}}{{.FileContent | Str2html}}{{end}} {{if .FileContent}}{{.FileContent | Str2html}}{{end}}
{{else if not .IsFileText}} {{else if not .IsFileText}}

View File

@ -10,7 +10,7 @@
<strong>{{.LastCommit.Author.Name}}</strong> <strong>{{.LastCommit.Author.Name}}</strong>
{{end}} {{end}}
<a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.LastCommit.ID}}" rel="nofollow">{{ShortSha .LastCommit.ID.String}}</a> <a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.LastCommit.ID}}" rel="nofollow">{{ShortSha .LastCommit.ID.String}}</a>
<span class="grey">{{RenderCommitMessage false .LastCommit.Summary .RepoLink $.Repository.ComposeMetas}}</span> <span class="grey has-emoji">{{RenderCommitMessage false .LastCommit.Summary .RepoLink $.Repository.ComposeMetas}}</span>
</th> </th>
<th class="nine wide"> <th class="nine wide">
</th> </th>
@ -42,7 +42,7 @@
<a href="{{EscapePound $.BranchLink}}/{{EscapePound $.TreePath}}{{EscapePound $entry.Name}}">{{$entry.Name}}</a> <a href="{{EscapePound $.BranchLink}}/{{EscapePound $.TreePath}}{{EscapePound $entry.Name}}">{{$entry.Name}}</a>
</td> </td>
{{end}} {{end}}
<td class="message collapsing"> <td class="message collapsing has-emoji">
<a rel="nofollow" class="ui sha label" href="{{AppSubUrl}}/{{$.Username}}/{{$.Reponame}}/commit/{{$commit.ID}}">{{ShortSha $commit.ID.String}}</a> <a rel="nofollow" class="ui sha label" href="{{AppSubUrl}}/{{$.Username}}/{{$.Reponame}}/commit/{{$commit.ID}}">{{ShortSha $commit.ID.String}}</a>
{{RenderCommitMessage false $commit.Summary $.RepoLink $.Repository.ComposeMetas}} {{RenderCommitMessage false $commit.Summary $.RepoLink $.Repository.ComposeMetas}}
</td> </td>

View File

@ -46,23 +46,23 @@
{{ $repoLink := .GetRepoLink}} {{ $repoLink := .GetRepoLink}}
{{if $push.Commits}} {{if $push.Commits}}
{{range $push.Commits}} {{range $push.Commits}}
<li><img class="img-8" src="{{$push.AvatarLink .AuthorEmail}}"> <a class="commit-id" href="{{$repoLink}}/commit/{{.Sha1}}">{{ShortSha .Sha1}}</a> <span class="text truncate light grey">{{.Message}}</span></li> <li><img class="img-8" src="{{$push.AvatarLink .AuthorEmail}}"> <a class="commit-id" href="{{$repoLink}}/commit/{{.Sha1}}">{{ShortSha .Sha1}}</a> <span class="text truncate light grey has-emoji">{{.Message}}</span></li>
{{end}} {{end}}
{{end}} {{end}}
{{if and (gt $push.Len 1) $push.CompareUrl}}<li><a href="{{AppSubUrl}}/{{$push.CompareUrl}}">{{$.i18n.Tr "action.compare_commits" $push.Len}} »</a></li>{{end}} {{if and (gt $push.Len 1) $push.CompareUrl}}<li><a href="{{AppSubUrl}}/{{$push.CompareUrl}}">{{$.i18n.Tr "action.compare_commits" $push.Len}} »</a></li>{{end}}
</ul> </ul>
</div> </div>
{{else if eq .GetOpType 6}} {{else if eq .GetOpType 6}}
<span class="text truncate issue title">{{index .GetIssueInfos 1}}</span> <span class="text truncate issue title has-emoji">{{index .GetIssueInfos 1}}</span>
{{else if eq .GetOpType 7}} {{else if eq .GetOpType 7}}
<p class="text light grey">{{index .GetIssueInfos 1}}</p> <p class="text light grey has-emoji">{{index .GetIssueInfos 1}}</p>
{{else if eq .GetOpType 10}} {{else if eq .GetOpType 10}}
<span class="text truncate issue title">{{.GetIssueTitle}}</span> <span class="text truncate issue title has-emoji">{{.GetIssueTitle}}</span>
<p class="text light grey">{{index .GetIssueInfos 1}}</p> <p class="text light grey has-emoji">{{index .GetIssueInfos 1}}</p>
{{else if eq .GetOpType 11}} {{else if eq .GetOpType 11}}
<p class="text light grey">{{index .GetIssueInfos 1}}</p> <p class="text light grey has-emoji">{{index .GetIssueInfos 1}}</p>
{{else if (or (eq .GetOpType 12) (eq .GetOpType 13))}} {{else if (or (eq .GetOpType 12) (eq .GetOpType 13))}}
<span class="text truncate issue title">{{.GetIssueTitle}}</span> <span class="text truncate issue title has-emoji">{{.GetIssueTitle}}</span>
{{end}} {{end}}
<p class="text italic light grey">{{TimeSince .GetCreate $.i18n.Lang}}</p> <p class="text italic light grey">{{TimeSince .GetCreate $.i18n.Lang}}</p>
</div> </div>

View File

@ -62,7 +62,7 @@
{{ $timeStr:= TimeSince .Created $.Lang }} {{ $timeStr:= TimeSince .Created $.Lang }}
<li class="item"> <li class="item">
<div class="ui label">{{if not $.RepoID}}{{.Repo.Name}}{{end}}#{{.Index}}</div> <div class="ui label">{{if not $.RepoID}}{{.Repo.Name}}{{end}}#{{.Index}}</div>
<a class="title" href="{{AppSubUrl}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}/issues/{{.Index}}">{{.Name}}</a> <a class="title has-emoji" href="{{AppSubUrl}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}/issues/{{.Index}}">{{.Name}}</a>
{{if .NumComments}} {{if .NumComments}}
<span class="comment ui right"><i class="octicon octicon-comment"></i> {{.NumComments}}</span> <span class="comment ui right"><i class="octicon octicon-comment"></i> {{.NumComments}}</span>