mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-12-30 20:29:58 +01:00
Use completion is disabled in the Wiki editor
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
@(owner: String, repository: String, generateScript: Boolean = true)(textarea: Html)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import gitbucket.core.util.FileUtil
|
||||
@(owner: String, repository: String, completion: Seq[String], generateScript: Boolean = true)(textarea: Html)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context.path
|
||||
@import context.baseUrl
|
||||
@import gitbucket.core.util.{FileUtil, EmojiUtil}
|
||||
<div class="muted attachable">
|
||||
@textarea
|
||||
<div class="clickable">Attach images or documents by dragging & dropping, or selecting them.</div>
|
||||
@@ -8,41 +9,47 @@
|
||||
@defining("(id=\")([\\w\\-]*)(\")".r.findFirstMatchIn(textarea.body).map(_.group(2))){ textareaId =>
|
||||
<script>
|
||||
$(function(){
|
||||
var emojis = @Html(gitbucket.core.util.EmojiUtil.emojis.map("\"" + _ + "\"").mkString("[", ", ", "]"));
|
||||
var users = [];
|
||||
|
||||
$.get('@path/_user/proposals', { query: '' }, function (data) { users = data.options; });
|
||||
@if(completion.contains("emoji")){
|
||||
var emojis = @Html(EmojiUtil.emojis.map("\"" + _ + "\"").mkString("[", ", ", "]"));
|
||||
}
|
||||
@if(completion.contains("user")){
|
||||
var users = [];
|
||||
$.get('@path/_user/proposals', { query: '' }, function (data) { users = data.options; });
|
||||
}
|
||||
|
||||
$('#@textareaId').textcomplete([
|
||||
{ // emoji strategy
|
||||
id: 'emoji',
|
||||
match: /\B:([\-+\w]*)$/,
|
||||
search: function (term, callback) {
|
||||
callback($.map(emojis, function (emoji) {
|
||||
return emoji.indexOf(term) === 0 ? emoji : null;
|
||||
}));
|
||||
@if(completion.contains("emoji")){
|
||||
{
|
||||
id: 'emoji',
|
||||
match: /\B:([\-+\w]*)$/,
|
||||
search: function (term, callback) {
|
||||
callback($.map(emojis, function (emoji) {
|
||||
return emoji.indexOf(term) === 0 ? emoji : null;
|
||||
}));
|
||||
},
|
||||
template: function (value) {
|
||||
return '<img src="@path/assets/common/images/emojis/' + value + '.png" class="emoji"></img>' + value;
|
||||
},
|
||||
replace: function (value) {
|
||||
return ':' + value + ': ';
|
||||
},
|
||||
index: 1
|
||||
},
|
||||
template: function (value) {
|
||||
return '<img src="@path/assets/common/images/emojis/' + value + '.png" class="emoji"></img>' + value;
|
||||
}
|
||||
@if(completion.contains("user")){
|
||||
{
|
||||
id: 'user',
|
||||
match: /\B@@([\-+\w]*)$/,
|
||||
search: function (term, callback) {
|
||||
callback($.map(users, function (word) {
|
||||
return word.indexOf(term) === 0 ? word : null;
|
||||
}));
|
||||
},
|
||||
index: 1,
|
||||
replace: function (word) {
|
||||
return '@@' + word + ' ';
|
||||
}
|
||||
},
|
||||
replace: function (value) {
|
||||
return ':' + value + ': ';
|
||||
},
|
||||
index: 1
|
||||
},
|
||||
{ // users
|
||||
id: 'user',
|
||||
//words: users,
|
||||
match: /\B@@([\-+\w]*)$/,
|
||||
search: function (term, callback) {
|
||||
callback($.map(users, function (word) {
|
||||
return word.indexOf(term) === 0 ? word : null;
|
||||
}));
|
||||
},
|
||||
index: 1,
|
||||
replace: function (word) {
|
||||
return '@@' + word + ' ';
|
||||
}
|
||||
}
|
||||
], {
|
||||
onKeydown: function (e, commands) {
|
||||
|
||||
@@ -5,15 +5,14 @@
|
||||
enableLineBreaks: Boolean,
|
||||
enableTaskList: Boolean,
|
||||
hasWritePermission: Boolean,
|
||||
completion: Seq[String],
|
||||
style: String = "",
|
||||
styleClass: String = "",
|
||||
placeholder: String = "Leave a comment",
|
||||
elastic: Boolean = false,
|
||||
tabIndex: Int = -2,
|
||||
uid: Long = new java.util.Date().getTime())(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import gitbucket.core._
|
||||
@import gitbucket.core.view.helpers._
|
||||
@import gitbucket.core.view.helpers.{assets, url}
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs fill-width" style="margin-bottom: 10px;">
|
||||
<li class="active"><a href="#tab@uid" data-toggle="tab">Write</a></li>
|
||||
@@ -28,7 +27,12 @@
|
||||
@if(style.nonEmpty){ style="@style"}
|
||||
@if(styleClass.nonEmpty){ class="@styleClass" }>@content</textarea>
|
||||
}
|
||||
@helper.html.attached(repository.owner, repository.name, enableWikiLink)(textarea)
|
||||
@gitbucket.core.helper.html.attached(
|
||||
owner = repository.owner,
|
||||
repository = repository.name,
|
||||
completion = completion,
|
||||
generateScript = enableWikiLink
|
||||
)(textarea)
|
||||
</div>
|
||||
<div class="tab-pane" id="tab@(uid+1)">
|
||||
<div class="markdown-body" id="preview-area@uid">
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
reopenable: Boolean,
|
||||
hasWritePermission: Boolean,
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import gitbucket.core.view.helpers._
|
||||
@import context.loginAccount
|
||||
@import gitbucket.core.view.helpers.{avatarLink, url}
|
||||
@if(loginAccount.isDefined){
|
||||
<hr/><br/>
|
||||
<form method="POST" validate="true">
|
||||
<div class="issue-avatar-image">@avatarLink(loginAccount.get.userName, 48)</div>
|
||||
<div class="panel panel-default issue-comment-box">
|
||||
<div class="panel-body">
|
||||
@helper.html.preview(
|
||||
@gitbucket.core.helper.html.preview(
|
||||
repository = repository,
|
||||
content = "",
|
||||
enableWikiLink = false,
|
||||
@@ -18,6 +18,7 @@
|
||||
enableLineBreaks = true,
|
||||
enableTaskList = true,
|
||||
hasWritePermission = hasWritePermission,
|
||||
completion = Seq("emoji", "user"),
|
||||
style = "",
|
||||
elastic = true,
|
||||
tabIndex = 1
|
||||
|
||||
@@ -3,16 +3,15 @@
|
||||
labels: List[gitbucket.core.model.Label],
|
||||
hasWritePermission: Boolean,
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import gitbucket.core.view.helpers._
|
||||
@html.main(s"New Issue - ${repository.owner}/${repository.name}", Some(repository)){
|
||||
@html.menu("issues", repository){
|
||||
@gitbucket.core.html.main(s"New Issue - ${repository.owner}/${repository.name}", Some(repository)){
|
||||
@gitbucket.core.html.menu("issues", repository){
|
||||
<form action="@url(repository)/issues/new" method="POST" validate="true" class="form-group">
|
||||
<div class="row-fluid">
|
||||
<div class="col-md-9">
|
||||
<span id="error-title" class="error"></span>
|
||||
<input type="text" id="issue-title" name="title" class="form-control" value="" placeholder="Title" style="margin-bottom: 6px;" autofocus/>
|
||||
@helper.html.preview(
|
||||
@gitbucket.core.helper.html.preview(
|
||||
repository = repository,
|
||||
content = "",
|
||||
enableWikiLink = false,
|
||||
@@ -20,6 +19,7 @@
|
||||
enableLineBreaks = true,
|
||||
enableTaskList = true,
|
||||
hasWritePermission = hasWritePermission,
|
||||
completion = Seq("emoji", "user"),
|
||||
style = "height: 200px; max-height: 250px;",
|
||||
elastic = true
|
||||
)
|
||||
@@ -28,7 +28,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
@issueinfo(None, Nil, Nil, collaborators, milestones.map(x => (x, 0, 0)), labels, hasWritePermission, repository)
|
||||
@gitbucket.core.issues.html.issueinfo(None, Nil, Nil, collaborators, milestones.map(x => (x, 0, 0)), labels, hasWritePermission, repository)
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
@(content: String, commentId: Int, owner: String, repository: String)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
<span id="error-edit-content-@commentId" class="error"></span>
|
||||
@helper.html.attached(owner, repository){
|
||||
@gitbucket.core.helper.html.attached(owner, repository, completion = Seq("emoji", "user")){
|
||||
<textarea id="edit-content-@commentId" class="form-control">@content</textarea>
|
||||
}
|
||||
<div>
|
||||
@@ -19,7 +18,7 @@ $(function(){
|
||||
$('#update-comment-@commentId').click(function(){
|
||||
$('#update-comment-@commentId, #cancel-comment-@commentId').attr('disabled', 'disabled');
|
||||
$.ajax({
|
||||
url: '@path/@owner/@repository/issue_comments/edit/@commentId',
|
||||
url: '@context.path/@owner/@repository/issue_comments/edit/@commentId',
|
||||
type: 'POST',
|
||||
data: {
|
||||
issueId : 0, // TODO
|
||||
@@ -35,7 +34,7 @@ $(function(){
|
||||
|
||||
$('#cancel-comment-@commentId').click(function(){
|
||||
$('#update-comment-@commentId, #cancel-comment-@commentId').attr('disabled', 'disabled');
|
||||
$.get('@path/@owner/@repository/issue_comments/_data/@commentId', callback);
|
||||
$.get('@context.path/@owner/@repository/issue_comments/_data/@commentId', callback);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@(content: Option[String], issueId: Int, owner: String, repository: String)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@helper.html.attached(owner, repository){
|
||||
@import context.path
|
||||
@gitbucket.core.helper.html.attached(owner, repository, Seq("emoji", "user")){
|
||||
<textarea id="edit-content" class="form-control">@content.getOrElse("")</textarea>
|
||||
}
|
||||
<div>
|
||||
|
||||
@@ -14,31 +14,33 @@
|
||||
collaborators: List[String],
|
||||
milestones: List[gitbucket.core.model.Milestone],
|
||||
labels: List[gitbucket.core.model.Label])(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import context.loginAccount
|
||||
@import context.path
|
||||
@import gitbucket.core.helper.html._
|
||||
@import gitbucket.core.view.helpers._
|
||||
@html.main(s"Pull Requests - ${repository.owner}/${repository.name}", Some(repository)){
|
||||
@html.menu("pulls", repository){
|
||||
@gitbucket.core.html.main(s"Pull Requests - ${repository.owner}/${repository.name}", Some(repository)){
|
||||
@gitbucket.core.html.menu("pulls", repository){
|
||||
<div class="pullreq-info">
|
||||
<div id="compare-edit">
|
||||
@helper.html.dropdown(originRepository.owner + "/" + originRepository.name, "base fork") {
|
||||
@dropdown(originRepository.owner + "/" + originRepository.name, "base fork") {
|
||||
@members.map { case (owner, name) =>
|
||||
<li><a href="#" class="origin-owner" data-owner="@owner" data-name="@name">@helper.html.checkicon(owner == originRepository.owner) @owner/@name</a></li>
|
||||
<li><a href="#" class="origin-owner" data-owner="@owner" data-name="@name">@checkicon(owner == originRepository.owner) @owner/@name</a></li>
|
||||
}
|
||||
}
|
||||
@helper.html.dropdown(originId, "base") {
|
||||
@dropdown(originId, "base") {
|
||||
@originRepository.branchList.map { branch =>
|
||||
<li><a href="#" class="origin-branch" data-branch="@encodeRefName(branch)">@helper.html.checkicon(branch == originId) @branch</a></li>
|
||||
<li><a href="#" class="origin-branch" data-branch="@encodeRefName(branch)">@checkicon(branch == originId) @branch</a></li>
|
||||
}
|
||||
}
|
||||
...
|
||||
@helper.html.dropdown(forkedRepository.owner + "/" + forkedRepository.name, "head fork") {
|
||||
@dropdown(forkedRepository.owner + "/" + forkedRepository.name, "head fork") {
|
||||
@members.map { case (owner, name) =>
|
||||
<li><a href="#" class="forked-owner" data-owner="@owner" data-name="@name">@helper.html.checkicon(owner == forkedRepository.owner) @owner/@name</a></li>
|
||||
<li><a href="#" class="forked-owner" data-owner="@owner" data-name="@name">@checkicon(owner == forkedRepository.owner) @owner/@name</a></li>
|
||||
}
|
||||
}
|
||||
@helper.html.dropdown(forkedId, "compare") {
|
||||
@dropdown(forkedId, "compare") {
|
||||
@forkedRepository.branchList.map { branch =>
|
||||
<li><a href="#" class="forked-branch" data-branch="@encodeRefName(branch)">@helper.html.checkicon(branch == forkedId) @branch</a></li>
|
||||
<li><a href="#" class="forked-branch" data-branch="@encodeRefName(branch)">@checkicon(branch == forkedId) @branch</a></li>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -58,7 +60,7 @@
|
||||
<div class="col-md-9">
|
||||
<span class="error" id="error-title"></span>
|
||||
<input type="text" name="title" value="@title" class="form-control" style="margin-bottom: 6px;" placeholder="Title"/>
|
||||
@helper.html.preview(
|
||||
@gitbucket.core.helper.html.preview(
|
||||
repository = repository,
|
||||
content = "",
|
||||
enableWikiLink = false,
|
||||
@@ -66,6 +68,7 @@
|
||||
enableLineBreaks = true,
|
||||
enableTaskList = true,
|
||||
hasWritePermission = true,
|
||||
completion = Seq("emoji", "user"),
|
||||
style = "height: 200px;"
|
||||
)
|
||||
<input type="hidden" name="targetUserName" value="@originRepository.owner"/>
|
||||
@@ -80,7 +83,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
@issues.html.issueinfo(None, Nil, Nil, collaborators, milestones.map((_, 0, 0)), labels, hasOriginWritePermission, repository)
|
||||
@gitbucket.core.issues.html.issueinfo(None, Nil, Nil, collaborators, milestones.map((_, 0, 0)), labels, hasOriginWritePermission, repository)
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -160,13 +163,13 @@
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
@helper.html.diff(diffs, repository, Some(commitId), Some(sourceId), true, None, false, false)
|
||||
@gitbucket.core.helper.html.diff(diffs, repository, Some(commitId), Some(sourceId), true, None, false, false)
|
||||
<p>Showing you all comments on commits in this comparison.</p>
|
||||
@issues.html.commentlist(None, comments, false, repository, None)
|
||||
@gitbucket.core.issues.html.commentlist(None, comments, false, repository, None)
|
||||
}
|
||||
}
|
||||
}
|
||||
<script>
|
||||
<script><script>
|
||||
$(function(){
|
||||
$('a.origin-owner, a.forked-owner, a.origin-branch, a.forked-branch').click(function(){
|
||||
var e = $(this);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
issueId: Option[Int] = None,
|
||||
hasWritePermission: Boolean,
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import context.loginAccount
|
||||
@import gitbucket.core.view.helpers._
|
||||
@if(loginAccount.isDefined){
|
||||
@if(!fileName.isDefined){<hr/><br/>}
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
<div class="panel panel-default issue-comment-box">
|
||||
<div class="panel-body">
|
||||
@helper.html.preview(
|
||||
@gitbucket.core.helper.html.preview(
|
||||
repository = repository,
|
||||
content = "",
|
||||
enableWikiLink = false,
|
||||
@@ -23,6 +23,7 @@
|
||||
enableLineBreaks = true,
|
||||
enableTaskList = true,
|
||||
hasWritePermission = hasWritePermission,
|
||||
completion = Seq("emoji", "user"),
|
||||
style = "height: 100px; max-height: 150px;",
|
||||
elastic = true
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@(content: String, commentId: Int, owner: String, repository: String)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import context.path
|
||||
<span class="error-edit-content-@commentId error"></span>
|
||||
@helper.html.attached(owner, repository){
|
||||
@gitbucket.core.helper.html.attached(owner, repository, Seq("emoji", "user")){
|
||||
<textarea style="height: 100px;" id="edit-content-@commentId" class="form-control">@content</textarea>
|
||||
}
|
||||
<div>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
@import gitbucket.core.view.helpers._
|
||||
@import gitbucket.core.util.FileUtil
|
||||
@html.main(s"${if(pageName.isEmpty) "New Page" else pageName} - ${repository.owner}/${repository.name}", Some(repository)){
|
||||
@html.menu("wiki", repository){
|
||||
@gitbucket.core.html.main(s"${if(pageName.isEmpty) "New Page" else pageName} - ${repository.owner}/${repository.name}", Some(repository)){
|
||||
@gitbucket.core.html.menu("wiki", repository){
|
||||
<div class="pull-right">
|
||||
@if(page.isDefined){
|
||||
<a class="btn btn-small btn-default" href="@url(repository)/wiki/@urlEncode(pageName)/_history">Page History</a>
|
||||
@@ -17,7 +17,7 @@
|
||||
<span id="error-pageName" class="error"></span>
|
||||
<input type="text" name="pageName" value="@pageName" class="form-control" style="font-weight: bold; margin-bottom: 10px;" placeholder="Input a page name."/>
|
||||
<div class="muted attachable">
|
||||
@helper.html.preview(
|
||||
@gitbucket.core.helper.html.preview(
|
||||
repository = repository,
|
||||
content = page.map(_.content).getOrElse(""),
|
||||
enableWikiLink = true,
|
||||
@@ -25,6 +25,7 @@
|
||||
enableLineBreaks = false,
|
||||
enableTaskList = false,
|
||||
hasWritePermission = false,
|
||||
completion = Seq("emoji"),
|
||||
style = "height: 400px;",
|
||||
styleClass = "monospace",
|
||||
placeholder = "",
|
||||
|
||||
Reference in New Issue
Block a user