summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>2019-02-16 11:33:09 -0600
committerLauris BH <lauris@nix.lv>2019-02-16 19:33:09 +0200
commit0b72c00fadcacda920893c991cd858a3d6dd52c7 (patch)
treeb198df05a5d275733f2ff2d6c9d2154c0ac0271d /templates
parent8c8ac1a16260c075e854bd370812284e0121613e (diff)
downloadgitea-0b72c00fadcacda920893c991cd858a3d6dd52c7.tar.gz
gitea-0b72c00fadcacda920893c991cd858a3d6dd52c7.zip
Allow labels to contain emoji (#6063)
* Add emoji to labels Minor cleanup of tribute code in footer.tmpl Signed-off-by: jolheiser <john.olheiser@gmail.com> * Quick find/replace in other i18n files containing label translations Signed-off-by: jolheiser <john.olheiser@gmail.com> * Revert "Quick find/replace in other i18n files containing label translations" This reverts commit ec3e1a3a1775989301bb2c1cd08e8871b317688d. * Add style to overwrite emoji height in labels * Revert Makefile change that makes Windows work
Diffstat (limited to 'templates')
-rw-r--r--templates/base/footer.tmpl18
-rw-r--r--templates/repo/issue/labels.tmpl6
-rw-r--r--templates/repo/issue/list.tmpl2
-rw-r--r--templates/repo/issue/new_form.tmpl4
-rw-r--r--templates/repo/issue/view_content/sidebar.tmpl4
5 files changed, 22 insertions, 12 deletions
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl
index 6868b918b6..2481b2187c 100644
--- a/templates/base/footer.tmpl
+++ b/templates/base/footer.tmpl
@@ -68,8 +68,11 @@
}
return itemStr;
}
- })
- issuesTribute.attach(document.getElementById('content'))
+ });
+ var content = document.getElementById('content');
+ if (content != null) {
+ issuesTribute.attach(content);
+ }
</script>
<script>
var emojiTribute = new Tribute({
@@ -93,7 +96,7 @@
return item;
},
selectTemplate: function (item) {
- if (typeof item === 'undefinied') return null;
+ if (typeof item === 'undefined') return null;
return ':' + item.original + ':';
},
menuItemTemplate: function (item) {
@@ -101,7 +104,14 @@
}
}]
});
- emojiTribute.attach(document.getElementById('content'))
+ var emojiInputs = document.querySelectorAll('.emoji-input');
+ if (emojiInputs.length > 0) {
+ emojiTribute.attach(emojiInputs);
+ }
+ var content = document.getElementById('content');
+ if (content != null) {
+ emojiTribute.attach(document.getElementById('content'));
+ }
</script>
{{end}}
<script src="{{AppSubUrl}}/vendor/plugins/emojify/emojify.min.js"></script>
diff --git a/templates/repo/issue/labels.tmpl b/templates/repo/issue/labels.tmpl
index 877ba1c176..956fc955a0 100644
--- a/templates/repo/issue/labels.tmpl
+++ b/templates/repo/issue/labels.tmpl
@@ -17,7 +17,7 @@
<div class="ui grid">
<div class="three wide column">
<div class="ui small input">
- <input class="new-label-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required>
+ <input class="new-label-input emoji-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required>
</div>
</div>
<div class="five wide column">
@@ -98,7 +98,7 @@
<li class="item">
<div class="ui grid">
<div class="three wide column">
- <div class="ui label" style="color: {{.ForegroundColor}}; background-color: {{.Color}}"><i class="octicon octicon-tag"></i> {{.Name}}</div>
+ <div class="ui label has-emoji" style="color: {{.ForegroundColor}}; background-color: {{.Color}}"><i class="octicon octicon-tag"></i> {{.Name}}</div>
</div>
<div class="seven wide column">
{{.Description}}
@@ -151,7 +151,7 @@
<div class="ui grid">
<div class="three wide column">
<div class="ui small input">
- <input class="new-label-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required>
+ <input class="new-label-input emoji-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required>
</div>
</div>
<div class="five wide column">
diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl
index edf88ebf41..ebdd3dbb67 100644
--- a/templates/repo/issue/list.tmpl
+++ b/templates/repo/issue/list.tmpl
@@ -192,7 +192,7 @@
<a class="ui label" href="{{$.RepoLink}}/src/branch/{{.Ref}}">{{.Ref}}</a>
{{end}}
{{range .Labels}}
- <a class="ui label" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description}}">{{.Name}}</a>
+ <a class="ui label has-emoji" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description}}">{{.Name}}</a>
{{end}}
{{if .NumComments}}
diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl
index f05ea333ba..7dafc6766c 100644
--- a/templates/repo/issue/new_form.tmpl
+++ b/templates/repo/issue/new_form.tmpl
@@ -46,14 +46,14 @@
<div class="filter menu" data-id="#label_ids">
<div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_labels"}}</div>
{{range .Labels}}
- <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon {{if .IsChecked}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
+ <a class="{{if .IsChecked}}checked{{end}} item has-emoji" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon {{if .IsChecked}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
{{end}}
</div>
</div>
<div class="ui labels list">
<span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
{{range .Labels}}
- <a class="{{if not .IsChecked}}hide{{end}} item" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text">{{.Name}}</span></a>
+ <a class="{{if not .IsChecked}}hide{{end}} item" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text has-emoji">{{.Name}}</span></a>
{{end}}
</div>
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index 4eb55cdd41..8cb01fe00e 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -10,7 +10,7 @@
<div class="filter menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/labels">
<div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_labels"}}</div>
{{range .Labels}}
- <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon {{if .IsChecked}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
+ <a class="{{if .IsChecked}}checked{{end}} item has-emoji" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon {{if .IsChecked}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
{{if .Description }}<br><small class="desc">{{.Description}}</small>{{end}}</a>
{{end}}
</div>
@@ -19,7 +19,7 @@
<span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
{{range .Labels}}
<div class="item">
- <a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description}}">{{.Name}}</a>
+ <a class="ui label has-emoji {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description}}">{{.Name}}</a>
</div>
{{end}}