diff options
7 files changed, 52 insertions, 26 deletions
diff --git a/app/assets/javascripts/issue_show/components/app.vue b/app/assets/javascripts/issue_show/components/app.vue index 695d849e017..6ec66da0ed4 100644 --- a/app/assets/javascripts/issue_show/components/app.vue +++ b/app/assets/javascripts/issue_show/components/app.vue @@ -45,6 +45,10 @@ export default { type: String, required: true, }, + markdownDocs: { + type: String, + required: true, + }, }, data() { const store = new Store({ @@ -152,11 +156,8 @@ export default { :store="store" :show-form="showForm" :can-update="canUpdate" - :description-html="state.descriptionHtml" - :description-text="state.descriptionText" - :updated-at="state.updatedAt" - :task-status="state.taskStatus" - :markdown-preview-url="markdownPreviewUrl" /> + :markdown-preview-url="markdownPreviewUrl" + :markdown-docs="markdownDocs" /> <edit-actions v-if="canUpdate && showForm" :can-destroy="canDestroy" /> diff --git a/app/assets/javascripts/issue_show/components/description.vue b/app/assets/javascripts/issue_show/components/description.vue index b7a0a1bf7e4..fb542c70489 100644 --- a/app/assets/javascripts/issue_show/components/description.vue +++ b/app/assets/javascripts/issue_show/components/description.vue @@ -9,22 +9,6 @@ type: Boolean, required: true, }, - descriptionHtml: { - type: String, - required: true, - }, - descriptionText: { - type: String, - required: true, - }, - updatedAt: { - type: String, - required: true, - }, - taskStatus: { - type: String, - required: true, - }, store: { type: Object, required: true, @@ -37,14 +21,33 @@ type: String, required: true, }, + markdownDocs: { + type: String, + required: true, + }, }, data() { return { + state: this.store.state, preAnimation: false, pulseAnimation: false, timeAgoEl: $('.js-issue-edited-ago'), }; }, + computed: { + descriptionHtml() { + return this.state.descriptionHtml; + }, + descriptionText() { + return this.state.descriptionText; + }, + updatedAt() { + return this.state.updated_at; + }, + taskStatus() { + return this.state.taskStatus; + }, + }, watch: { descriptionHtml() { this.animateChange(); @@ -102,7 +105,8 @@ <description-field v-if="showForm" :store="store" - :markdown-preview-url="markdownPreviewUrl" /> + :markdown-preview-url="markdownPreviewUrl" + :markdown-docs="markdownDocs" /> <div v-else-if="descriptionHtml" class="description" diff --git a/app/assets/javascripts/issue_show/components/fields/description.vue b/app/assets/javascripts/issue_show/components/fields/description.vue index ba8d2d4869b..bade7634e72 100644 --- a/app/assets/javascripts/issue_show/components/fields/description.vue +++ b/app/assets/javascripts/issue_show/components/fields/description.vue @@ -12,6 +12,10 @@ type: String, required: true, }, + markdownDocs: { + type: String, + required: true, + }, }, data() { return { @@ -32,7 +36,8 @@ Description </label> <markdown-field - :markdown-preview-url="markdownPreviewUrl"> + :markdown-preview-url="markdownPreviewUrl" + :markdown-docs="markdownDocs"> <textarea id="issue-description" class="note-textarea js-gfm-input js-autosize markdown-area" diff --git a/app/assets/javascripts/issue_show/index.js b/app/assets/javascripts/issue_show/index.js index 77c77237647..d13e24a468b 100644 --- a/app/assets/javascripts/issue_show/index.js +++ b/app/assets/javascripts/issue_show/index.js @@ -26,6 +26,7 @@ document.addEventListener('DOMContentLoaded', () => { endpoint, issuableRef, markdownPreviewUrl, + markdownDocs, } = issuableElement.dataset; return { @@ -37,6 +38,7 @@ document.addEventListener('DOMContentLoaded', () => { initialDescriptionHtml: issuableDescriptionElement ? issuableDescriptionElement.innerHTML : '', initialDescriptionText: issuableDescriptionTextarea ? issuableDescriptionTextarea.textContent : '', markdownPreviewUrl, + markdownDocs, }; }, render(createElement) { @@ -50,6 +52,7 @@ document.addEventListener('DOMContentLoaded', () => { initialDescriptionHtml: this.initialDescriptionHtml, initialDescriptionText: this.initialDescriptionText, markdownPreviewUrl: this.markdownPreviewUrl, + markdownDocs: this.markdownDocs, }, }); }, diff --git a/app/assets/javascripts/vue_shared/components/markdown/field.vue b/app/assets/javascripts/vue_shared/components/markdown/field.vue index d0424a18579..f08ebac260e 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/field.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/field.vue @@ -10,6 +10,10 @@ required: false, default: '', }, + markdownDocs: { + type: String, + required: true, + }, }, data() { return { @@ -84,7 +88,8 @@ aria-hidden="true"> </i> </a> - <markdown-toolbar /> + <markdown-toolbar + :markdown-docs="markdownDocs" /> </div> </div> <div diff --git a/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue b/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue index 47f41ba4c03..93252293ba6 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue @@ -1,12 +1,19 @@ <script> - + export default { + props: { + markdownDocs: { + type: String, + required: true, + }, + }, + }; </script> <template> <div class="comment-toolbar clearfix"> <div class="toolbar-text"> <a - href="/docs" + :href="markdownDocs" target="_blank" tabindex="-1"> Markdown is supported diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index a552771d167..2b095648dcf 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -56,6 +56,7 @@ "can-destroy" => can?(current_user, :destroy_issue, @issue).to_s, "issuable-ref" => @issue.to_reference, "markdown-preview-url" => preview_markdown_path(@project), + "markdown-docs" => help_page_path('user/markdown'), } } %h2.title= markdown_field(@issue, :title) - if @issue.description.present? |