Rename a few attribute suffixes from _url to _path

This commit is contained in:
Douwe Maan 2017-08-17 19:25:56 +02:00
parent 09338e397c
commit 9c22974cd1
21 changed files with 84 additions and 84 deletions

View file

@ -80,11 +80,11 @@ export default {
type: Boolean, type: Boolean,
required: true, required: true,
}, },
markdownPreviewUrl: { markdownPreviewPath: {
type: String, type: String,
required: true, required: true,
}, },
markdownDocs: { markdownDocsPath: {
type: String, type: String,
required: true, required: true,
}, },
@ -96,7 +96,7 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
projectsAutocompleteUrl: { projectsAutocompletePath: {
type: String, type: String,
required: true, required: true,
}, },
@ -242,11 +242,11 @@ export default {
:can-move="canMove" :can-move="canMove"
:can-destroy="canDestroy" :can-destroy="canDestroy"
:issuable-templates="issuableTemplates" :issuable-templates="issuableTemplates"
:markdown-docs="markdownDocs" :markdown-docs-path="markdownDocsPath"
:markdown-preview-url="markdownPreviewUrl" :markdown-preview-path="markdownPreviewPath"
:project-path="projectPath" :project-path="projectPath"
:project-namespace="projectNamespace" :project-namespace="projectNamespace"
:projects-autocomplete-url="projectsAutocompleteUrl" :projects-autocomplete-path="projectsAutocompletePath"
/> />
<div v-else> <div v-else>
<title-component <title-component

View file

@ -10,11 +10,11 @@
type: Object, type: Object,
required: true, required: true,
}, },
markdownPreviewUrl: { markdownPreviewPath: {
type: String, type: String,
required: true, required: true,
}, },
markdownDocs: { markdownDocsPath: {
type: String, type: String,
required: true, required: true,
}, },
@ -36,8 +36,8 @@
Description Description
</label> </label>
<markdown-field <markdown-field
:markdown-preview-url="markdownPreviewUrl" :markdown-preview-path="markdownPreviewPath"
:markdown-docs="markdownDocs"> :markdown-docs-path="markdownDocsPath">
<textarea <textarea
id="issue-description" id="issue-description"
class="note-textarea js-gfm-input js-autosize markdown-area" class="note-textarea js-gfm-input js-autosize markdown-area"

View file

@ -10,7 +10,7 @@
type: Object, type: Object,
required: true, required: true,
}, },
projectsAutocompleteUrl: { projectsAutocompletePath: {
type: String, type: String,
required: true, required: true,
}, },
@ -20,7 +20,7 @@
$moveDropdown.select2({ $moveDropdown.select2({
ajax: { ajax: {
url: this.projectsAutocompleteUrl, url: this.projectsAutocompletePath,
quietMillis: 125, quietMillis: 125,
data(term, page, context) { data(term, page, context) {
return { return {

View file

@ -26,11 +26,11 @@
required: false, required: false,
default: () => [], default: () => [],
}, },
markdownPreviewUrl: { markdownPreviewPath: {
type: String, type: String,
required: true, required: true,
}, },
markdownDocs: { markdownDocsPath: {
type: String, type: String,
required: true, required: true,
}, },
@ -42,7 +42,7 @@
type: String, type: String,
required: true, required: true,
}, },
projectsAutocompleteUrl: { projectsAutocompletePath: {
type: String, type: String,
required: true, required: true,
}, },
@ -89,14 +89,14 @@
</div> </div>
<description-field <description-field
:form-state="formState" :form-state="formState"
:markdown-preview-url="markdownPreviewUrl" :markdown-preview-path="markdownPreviewPath"
:markdown-docs="markdownDocs" /> :markdown-docs-path="markdownDocsPath" />
<confidential-checkbox <confidential-checkbox
:form-state="formState" /> :form-state="formState" />
<project-move <project-move
v-if="canMove" v-if="canMove"
:form-state="formState" :form-state="formState"
:projects-autocomplete-url="projectsAutocompleteUrl" /> :projects-autocomplete-path="projectsAutocompletePath" />
<edit-actions <edit-actions
:form-state="formState" :form-state="formState"
:can-destroy="canDestroy" /> :can-destroy="canDestroy" />

View file

@ -37,11 +37,11 @@ document.addEventListener('DOMContentLoaded', () => {
initialDescriptionText: this.initialDescriptionText, initialDescriptionText: this.initialDescriptionText,
issuableTemplates: this.issuableTemplates, issuableTemplates: this.issuableTemplates,
isConfidential: this.isConfidential, isConfidential: this.isConfidential,
markdownPreviewUrl: this.markdownPreviewUrl, markdownPreviewPath: this.markdownPreviewPath,
markdownDocs: this.markdownDocs, markdownDocsPath: this.markdownDocsPath,
projectPath: this.projectPath, projectPath: this.projectPath,
projectNamespace: this.projectNamespace, projectNamespace: this.projectNamespace,
projectsAutocompleteUrl: this.projectsAutocompleteUrl, projectsAutocompletePath: this.projectsAutocompletePath,
updatedAt: this.updatedAt, updatedAt: this.updatedAt,
updatedByName: this.updatedByName, updatedByName: this.updatedByName,
updatedByPath: this.updatedByPath, updatedByPath: this.updatedByPath,

View file

@ -71,13 +71,13 @@
'js-note-target-reopen': !this.isIssueOpen, 'js-note-target-reopen': !this.isIssueOpen,
}; };
}, },
markdownDocsUrl() { markdownDocsPath() {
return this.getNotesData.markdownDocs; return this.getNotesData.markdownDocsPath;
}, },
quickActionsDocsUrl() { quickActionsDocsPath() {
return this.getNotesData.quickActionsDocs; return this.getNotesData.quickActionsDocsPath;
}, },
markdownPreviewUrl() { markdownPreviewPath() {
return this.getIssueData.preview_note_path; return this.getIssueData.preview_note_path;
}, },
author() { author() {
@ -231,9 +231,9 @@
<div class="flash-container error-alert timeline-content"></div> <div class="flash-container error-alert timeline-content"></div>
<confidentialIssue v-if="isConfidentialIssue" /> <confidentialIssue v-if="isConfidentialIssue" />
<markdown-field <markdown-field
:markdown-preview-url="markdownPreviewUrl" :markdown-preview-path="markdownPreviewPath"
:markdown-docs="markdownDocsUrl" :markdown-docs-path="markdownDocsPath"
:quick-actions-docs="quickActionsDocsUrl" :quick-actions-docs-path="quickActionsDocsPath"
:add-spacing-classes="false" :add-spacing-classes="false"
:is-confidential-issue="isConfidentialIssue"> :is-confidential-issue="isConfidentialIssue">
<textarea <textarea

View file

@ -52,14 +52,14 @@
noteHash() { noteHash() {
return `#note_${this.noteId}`; return `#note_${this.noteId}`;
}, },
markdownPreviewUrl() { markdownPreviewPath() {
return this.getIssueDataByProp('preview_note_path'); return this.getIssueDataByProp('preview_note_path');
}, },
markdownDocsUrl() { markdownDocsPath() {
return this.getNotesDataByProp('markdownDocs'); return this.getNotesDataByProp('markdownDocsPath');
}, },
quickActionsDocsUrl() { quickActionsDocsPath() {
return !this.isEditing ? this.getNotesDataByProp('quickActionsDocs') : undefined; return !this.isEditing ? this.getNotesDataByProp('quickActionsDocsPath') : undefined;
}, },
currentUserId() { currentUserId() {
return this.getUserDataByProp('id'); return this.getUserDataByProp('id');
@ -124,9 +124,9 @@
class="edit-note common-note-form js-quick-submit gfm-form"> class="edit-note common-note-form js-quick-submit gfm-form">
<confidentialIssue v-if="isConfidentialIssue" /> <confidentialIssue v-if="isConfidentialIssue" />
<markdown-field <markdown-field
:markdown-preview-url="markdownPreviewUrl" :markdown-preview-path="markdownPreviewPath"
:markdown-docs="markdownDocsUrl" :markdown-docs-path="markdownDocsPath"
:quick-actions-docs="quickActionsDocsUrl" :quick-actions-docs-path="quickActionsDocsPath"
:add-spacing-classes="false"> :add-spacing-classes="false">
<textarea <textarea
id="note_note" id="note_note"

View file

@ -18,8 +18,8 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
newSessionPath: notesDataset.newSessionPath, newSessionPath: notesDataset.newSessionPath,
registerPath: notesDataset.registerPath, registerPath: notesDataset.registerPath,
notesPath: notesDataset.notesPath, notesPath: notesDataset.notesPath,
markdownDocs: notesDataset.markdownDocs, markdownDocsPath: notesDataset.markdownDocsPath,
quickActionsDocs: notesDataset.quickActionsDocs, quickActionsDocsPath: notesDataset.quickActionsDocsPath,
}, },
}; };
}, },

View file

@ -5,12 +5,12 @@
export default { export default {
props: { props: {
markdownPreviewUrl: { markdownPreviewPath: {
type: String, type: String,
required: false, required: false,
default: '', default: '',
}, },
markdownDocs: { markdownDocsPath: {
type: String, type: String,
required: true, required: true,
}, },
@ -19,7 +19,7 @@
required: false, required: false,
default: true, default: true,
}, },
quickActionsDocs: { quickActionsDocsPath: {
type: String, type: String,
required: false, required: false,
}, },
@ -52,7 +52,7 @@
} else { } else {
this.markdownPreviewLoading = true; this.markdownPreviewLoading = true;
this.$http.post( this.$http.post(
this.markdownPreviewUrl, this.markdownPreviewPath,
{ {
/* /*
Can't use `$refs` as the component is technically in the parent component Can't use `$refs` as the component is technically in the parent component
@ -117,8 +117,8 @@
</i> </i>
</a> </a>
<markdown-toolbar <markdown-toolbar
:markdown-docs="markdownDocs" :markdown-docs-path="markdownDocsPath"
:quick-actions-docs="quickActionsDocs" :quick-actions-docs-path="quickActionsDocsPath"
/> />
</div> </div>
</div> </div>

View file

@ -1,11 +1,11 @@
<script> <script>
export default { export default {
props: { props: {
markdownDocs: { markdownDocsPath: {
type: String, type: String,
required: true, required: true,
}, },
quickActionsDocs: { quickActionsDocsPath: {
type: String, type: String,
required: false, required: false,
}, },
@ -16,24 +16,24 @@
<template> <template>
<div class="comment-toolbar clearfix"> <div class="comment-toolbar clearfix">
<div class="toolbar-text"> <div class="toolbar-text">
<template v-if="!quickActionsDocs && markdownDocs"> <template v-if="!quickActionsDocsPath && markdownDocsPath">
<a <a
:href="markdownDocs" :href="markdownDocsPath"
target="_blank" target="_blank"
tabindex="-1"> tabindex="-1">
Markdown is supported Markdown is supported
</a> </a>
</template> </template>
<template v-if="quickActionsDocs && markdownDocs"> <template v-if="quickActionsDocsPath && markdownDocsPath">
<a <a
:href="markdownDocs" :href="markdownDocsPath"
target="_blank" target="_blank"
tabindex="-1"> tabindex="-1">
Markdown Markdown
</a> </a>
and and
<a <a
:href="quickActionsDocs" :href="quickActionsDocsPath"
target="_blank" target="_blank"
tabindex="-1"> tabindex="-1">
quick actions quick actions

View file

@ -210,9 +210,9 @@ module IssuablesHelper
canMove: current_user ? issuable.can_move?(current_user) : false, canMove: current_user ? issuable.can_move?(current_user) : false,
issuableRef: issuable.to_reference, issuableRef: issuable.to_reference,
isConfidential: issuable.confidential, isConfidential: issuable.confidential,
markdownPreviewUrl: preview_markdown_path(@project), markdownPreviewPath: preview_markdown_path(@project),
markdownDocs: help_page_path('user/markdown'), markdownDocsPath: help_page_path('user/markdown'),
projectsAutocompleteUrl: autocomplete_projects_path(project_id: @project.id), projectsAutocompletePath: autocomplete_projects_path(project_id: @project.id),
issuableTemplates: issuable_templates(issuable), issuableTemplates: issuable_templates(issuable),
projectPath: ref_project.path, projectPath: ref_project.path,
projectNamespace: ref_project.namespace.full_path, projectNamespace: ref_project.namespace.full_path,

View file

@ -8,8 +8,8 @@
#js-vue-notes{ data: { discussions_path: discussions_namespace_project_issue_path(@project.namespace, @project, @issue, format: :json), #js-vue-notes{ data: { discussions_path: discussions_namespace_project_issue_path(@project.namespace, @project, @issue, format: :json),
register_path: "#{new_session_path(:user, redirect_to_referer: 'yes')}#register-pane", register_path: "#{new_session_path(:user, redirect_to_referer: 'yes')}#register-pane",
new_session_path: new_session_path(:user, redirect_to_referer: 'yes'), new_session_path: new_session_path(:user, redirect_to_referer: 'yes'),
markdown_docs: help_page_path('user/markdown'), markdown_docs_path: help_page_path('user/markdown'),
quick_actions_docs: help_page_path('user/project/quick_actions'), quick_actions_docs_path: help_page_path('user/project/quick_actions'),
notes_path: notes_url, notes_path: notes_url,
last_fetched_at: Time.now.to_i, last_fetched_at: Time.now.to_i,
issue_data: serialize_issuable(@issue), issue_data: serialize_issuable(@issue),

View file

@ -41,9 +41,9 @@ describe('Issuable output', () => {
initialTitleText: '', initialTitleText: '',
initialDescriptionHtml: '', initialDescriptionHtml: '',
initialDescriptionText: '', initialDescriptionText: '',
markdownPreviewUrl: '/', markdownPreviewPath: '/',
markdownDocs: '/', markdownDocsPath: '/',
projectsAutocompleteUrl: '/', projectsAutocompletePath: '/',
isConfidential: false, isConfidential: false,
projectNamespace: '/', projectNamespace: '/',
projectPath: '/', projectPath: '/',

View file

@ -25,8 +25,8 @@ describe('Description field component', () => {
vm = new Component({ vm = new Component({
el, el,
propsData: { propsData: {
markdownPreviewUrl: '/', markdownPreviewPath: '/',
markdownDocs: '/', markdownDocsPath: '/',
formState: store.formState, formState: store.formState,
}, },
}).$mount(); }).$mount();

View file

@ -15,7 +15,7 @@ describe('Project move field component', () => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
formState, formState,
projectsAutocompleteUrl: '/autocomplete', projectsAutocompletePath: '/autocomplete',
}, },
}).$mount(); }).$mount();

View file

@ -18,9 +18,9 @@ describe('Inline edit form component', () => {
description: 'a', description: 'a',
lockedWarningVisible: false, lockedWarningVisible: false,
}, },
markdownPreviewUrl: '/', markdownPreviewPath: '/',
markdownDocs: '/', markdownDocsPath: '/',
projectsAutocompleteUrl: '/', projectsAutocompletePath: '/',
projectPath: '/', projectPath: '/',
projectNamespace: '/', projectNamespace: '/',
}, },

View file

@ -46,13 +46,13 @@ describe('issue_comment_form component', () => {
}); });
it('should link to markdown docs', () => { it('should link to markdown docs', () => {
const { markdownDocs } = notesDataMock; const { markdownDocsPath } = notesDataMock;
expect(vm.$el.querySelector(`a[href="${markdownDocs}"]`).textContent.trim()).toEqual('Markdown'); expect(vm.$el.querySelector(`a[href="${markdownDocsPath}"]`).textContent.trim()).toEqual('Markdown');
}); });
it('should link to quick actions docs', () => { it('should link to quick actions docs', () => {
const { quickActionsDocs } = notesDataMock; const { quickActionsDocsPath } = notesDataMock;
expect(vm.$el.querySelector(`a[href="${quickActionsDocs}"]`).textContent.trim()).toEqual('quick actions'); expect(vm.$el.querySelector(`a[href="${quickActionsDocsPath}"]`).textContent.trim()).toEqual('quick actions');
}); });
describe('edit mode', () => { describe('edit mode', () => {

View file

@ -204,13 +204,13 @@ describe('issue_note_app', () => {
}); });
it('should render markdown docs url', () => { it('should render markdown docs url', () => {
const { markdownDocs } = mockData.notesDataMock; const { markdownDocsPath } = mockData.notesDataMock;
expect(vm.$el.querySelector(`a[href="${markdownDocs}"]`).textContent.trim()).toEqual('Markdown'); expect(vm.$el.querySelector(`a[href="${markdownDocsPath}"]`).textContent.trim()).toEqual('Markdown');
}); });
it('should render quick action docs url', () => { it('should render quick action docs url', () => {
const { quickActionsDocs } = mockData.notesDataMock; const { quickActionsDocsPath } = mockData.notesDataMock;
expect(vm.$el.querySelector(`a[href="${quickActionsDocs}"]`).textContent.trim()).toEqual('quick actions'); expect(vm.$el.querySelector(`a[href="${quickActionsDocsPath}"]`).textContent.trim()).toEqual('quick actions');
}); });
}); });
@ -227,11 +227,11 @@ describe('issue_note_app', () => {
it('should render markdown docs url', (done) => { it('should render markdown docs url', (done) => {
setTimeout(() => { setTimeout(() => {
vm.$el.querySelector('.js-note-edit').click(); vm.$el.querySelector('.js-note-edit').click();
const { markdownDocs } = mockData.notesDataMock; const { markdownDocsPath } = mockData.notesDataMock;
Vue.nextTick(() => { Vue.nextTick(() => {
expect( expect(
vm.$el.querySelector(`.edit-note a[href="${markdownDocs}"]`).textContent.trim(), vm.$el.querySelector(`.edit-note a[href="${markdownDocsPath}"]`).textContent.trim(),
).toEqual('Markdown is supported'); ).toEqual('Markdown is supported');
done(); done();
}); });
@ -241,11 +241,11 @@ describe('issue_note_app', () => {
it('should not render quick actions docs url', (done) => { it('should not render quick actions docs url', (done) => {
setTimeout(() => { setTimeout(() => {
vm.$el.querySelector('.js-note-edit').click(); vm.$el.querySelector('.js-note-edit').click();
const { quickActionsDocs } = mockData.notesDataMock; const { quickActionsDocsPath } = mockData.notesDataMock;
Vue.nextTick(() => { Vue.nextTick(() => {
expect( expect(
vm.$el.querySelector(`.edit-note a[href="${quickActionsDocs}"]`), vm.$el.querySelector(`.edit-note a[href="${quickActionsDocsPath}"]`),
).toEqual(null); ).toEqual(null);
done(); done();
}); });

View file

@ -53,8 +53,8 @@ describe('issue_note_form component', () => {
}); });
it('should link to markdown docs', () => { it('should link to markdown docs', () => {
const { markdownDocs } = notesDataMock; const { markdownDocsPath } = notesDataMock;
expect(vm.$el.querySelector(`a[href="${markdownDocs}"]`).textContent.trim()).toEqual('Markdown'); expect(vm.$el.querySelector(`a[href="${markdownDocsPath}"]`).textContent.trim()).toEqual('Markdown');
}); });
describe('keyboard events', () => { describe('keyboard events', () => {

View file

@ -2,10 +2,10 @@
export const notesDataMock = { export const notesDataMock = {
discussionsPath: '/gitlab-org/gitlab-ce/issues/26/discussions.json', discussionsPath: '/gitlab-org/gitlab-ce/issues/26/discussions.json',
lastFetchedAt: '1501862675', lastFetchedAt: '1501862675',
markdownDocs: '/help/user/markdown', markdownDocsPath: '/help/user/markdown',
newSessionPath: '/users/sign_in?redirect_to_referer=yes', newSessionPath: '/users/sign_in?redirect_to_referer=yes',
notesPath: '/gitlab-org/gitlab-ce/noteable/issue/98/notes', notesPath: '/gitlab-org/gitlab-ce/noteable/issue/98/notes',
quickActionsDocs: '/help/user/project/quick_actions', quickActionsDocsPath: '/help/user/project/quick_actions',
registerPath: '/users/sign_in?redirect_to_referer=yes#register-pane', registerPath: '/users/sign_in?redirect_to_referer=yes#register-pane',
}; };

View file

@ -16,8 +16,8 @@ describe('Markdown field component', () => {
}, },
template: ` template: `
<field-component <field-component
marodown-preview-url="/preview" markdown-preview-path="/preview"
markdown-docs="/docs" markdown-docs-path="/docs"
> >
<textarea <textarea
slot="textarea" slot="textarea"