From 6a664e88c77f1ddd9c5bff4898e21a8271a5da9a Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 13 Nov 2015 12:11:45 -0500 Subject: [PATCH] #1854 show issue content --- models/action.go | 12 +++++++++++- public/config.codekit | 13 ++++++++++++- public/js/gogs.js | 4 +--- public/js/min/gogs-min.js | 1 + templates/repo/issue/new_form.tmpl | 2 +- templates/user/dashboard/feeds.tmpl | 3 ++- 6 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 public/js/min/gogs-min.js diff --git a/models/action.go b/models/action.go index c514a4c47d..536476d7e1 100644 --- a/models/action.go +++ b/models/action.go @@ -142,11 +142,21 @@ func (a Action) GetIssueTitle() string { issue, err := GetIssueByIndex(a.RepoID, index) if err != nil { log.Error(4, "GetIssueByIndex: %v", err) - return "500 when get title" + return "500 when get issue" } return issue.Name } +func (a Action) GetIssueContent() string { + index := com.StrTo(a.GetIssueInfos()[0]).MustInt64() + issue, err := GetIssueByIndex(a.RepoID, index) + if err != nil { + log.Error(4, "GetIssueByIndex: %v", err) + return "500 when get issue" + } + return issue.Content +} + func newRepoAction(e Engine, u *User, repo *Repository) (err error) { if err = notifyWatchers(e, &Action{ ActUserID: u.Id, diff --git a/public/config.codekit b/public/config.codekit index 59d0c333e6..f5d95f6d83 100644 --- a/public/config.codekit +++ b/public/config.codekit @@ -191,7 +191,7 @@ "outputPathIsOutsideProject": 0, "outputPathIsSetByUser": 0, "outputStyle": 1, - "syntaxCheckerStyle": 0 + "syntaxCheckerStyle": 1 }, "\/js\/jquery-1.11.3.min.js": { "fileType": 64, @@ -281,6 +281,17 @@ "outputPathIsSetByUser": 0, "processed": 0 }, + "\/js\/min\/gogs-min.js": { + "fileType": 64, + "ignore": 1, + "ignoreWasSetByUser": 0, + "inputAbbreviatedPath": "\/js\/min\/gogs-min.js", + "outputAbbreviatedPath": "\/js\/min\/min\/gogs-min-min.js", + "outputPathIsOutsideProject": 0, + "outputPathIsSetByUser": 0, + "outputStyle": 1, + "syntaxCheckerStyle": 1 + }, "\/js\/semantic-2.1.5.min.js": { "fileType": 64, "ignore": 0, diff --git a/public/js/gogs.js b/public/js/gogs.js index 81a9c1f443..34c8c9222b 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -630,9 +630,7 @@ $(document).ready(function () { emojify.setConfig({ img_dir: suburl + '/img/emoji' }); - $('.emojify').each(function () { - emojify.run($(this)[0]); - }); + emojify.run(); // Clipboard JS var clipboard = new Clipboard('.clipboard'); diff --git a/public/js/min/gogs-min.js b/public/js/min/gogs-min.js new file mode 100644 index 0000000000..0430f95660 --- /dev/null +++ b/public/js/min/gogs-min.js @@ -0,0 +1 @@ +"use strict";function initCommentPreviewTab(t){var e=t.find(".tabular.menu");e.find(".item").tab(),e.find('.item[data-tab="'+e.data("preview")+'"]').click(function(){var i=$(this);$.post(i.data("url"),{_csrf:csrf,mode:"gfm",context:i.data("context"),text:t.find('.tab.segment[data-tab="'+e.data("write")+'"] textarea').val()},function(i){var a=t.find('.tab.segment[data-tab="'+e.data("preview")+'"]');a.html(i),emojify.run(a[0])})}),buttonsClickOnEnter()}function initCommentForm(){function t(t,e,i){$.post(t,{_csrf:csrf,action:e,id:i})}function e(e,i){var a=$(e+" .menu"),n=$(".ui"+e+".list"),o="update"==a.data("action");a.find(".item:not(.no-select)").click(function(){switch($(this).parent().find(".item").each(function(){$(this).removeClass("selected active")}),$(this).addClass("selected active"),o&&t(a.data("update-url"),"",$(this).data("id")),i){case"#milestone_id":n.find(".selected").html('')}),this.on("removedfile",function(e){e.name in t&&$("#"+t[e.name]).remove()})}})}emojify.setConfig({img_dir:suburl+"/img/emoji"}),emojify.run();var i=new Clipboard(".clipboard");i.on("success",function(t){t.clearSelection(),$("#"+t.trigger.getAttribute("id")).popup("destroy"),t.trigger.setAttribute("data-content",t.trigger.getAttribute("data-success")),$("#"+t.trigger.getAttribute("id")).popup("show"),t.trigger.setAttribute("data-content",t.trigger.getAttribute("data-original"))}),i.on("error",function(t){$("#"+t.trigger.getAttribute("id")).popup("destroy"),t.trigger.setAttribute("data-content",t.trigger.getAttribute("data-error")),$("#"+t.trigger.getAttribute("id")).popup("show"),t.trigger.setAttribute("data-content",t.trigger.getAttribute("data-original"))}),$(".delete-button").click(function(){var t=$(this);return $(".delete.modal").modal({closable:!1,onApprove:function(){return"form"==t.data("type")?void $(t.data("form")).submit():void $.post(t.data("url"),{_csrf:csrf,id:t.data("id")}).done(function(t){window.location.href=t.redirect})}}).modal("show"),!1}),$(".show-panel.button").click(function(){$($(this).data("panel")).show()}),$(".show-modal.button").click(function(){$($(this).data("modal")).modal("show")}),buttonsClickOnEnter(),initCommentForm(),initInstall(),initRepository(),initOrganization(),initUser(),initWebhook(),initAdmin()}); \ No newline at end of file diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index b3cf99257b..8576d7db8d 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -13,7 +13,7 @@
- +
{{template "repo/issue/comment_tab" .}}
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl index 57c2e85982..c814a283ca 100644 --- a/templates/user/dashboard/feeds.tmpl +++ b/templates/user/dashboard/feeds.tmpl @@ -46,7 +46,8 @@
{{else if eq .GetOpType 6}} -

{{index .GetIssueInfos 1}}

+ {{index .GetIssueInfos 1}} +

{{.GetIssueContent}}

{{else if eq .GetOpType 7}}

{{index .GetIssueInfos 1}}

{{else if eq .GetOpType 10}}