Commit 46e3ad4b authored by Mike Greiling's avatar Mike Greiling

Prettify sidebar modules

parent 4695b311
......@@ -69,7 +69,8 @@ export default {
this.loading = false;
}
this.mediator.saveAssignees(this.field)
this.mediator
.saveAssignees(this.field)
.then(setLoadingFalse.bind(this))
.catch(() => {
setLoadingFalse();
......
......@@ -56,11 +56,7 @@ export default {
.update('issue', { confidential })
.then(() => window.location.reload())
.catch(() => {
Flash(
__(
'Something went wrong trying to change the confidentiality of this issue',
),
);
Flash(__('Something went wrong trying to change the confidentiality of this issue'));
});
},
},
......
......@@ -34,11 +34,7 @@ export default {
required: true,
type: Object,
validator(mediatorObject) {
return (
mediatorObject.service &&
mediatorObject.service.update &&
mediatorObject.store
);
return mediatorObject.service && mediatorObject.service.update && mediatorObject.store;
},
},
},
......@@ -67,8 +63,7 @@ export default {
methods: {
toggleForm() {
this.mediator.store.isLockDialogOpen = !this.mediator.store
.isLockDialogOpen;
this.mediator.store.isLockDialogOpen = !this.mediator.store.isLockDialogOpen;
},
updateLockedAttribute(locked) {
......@@ -79,9 +74,14 @@ export default {
.then(() => window.location.reload())
.catch(() =>
Flash(
sprintf(__('Something went wrong trying to change the locked state of this %{issuableDisplayName}'), {
sprintf(
__(
'Something went wrong trying to change the locked state of this %{issuableDisplayName}',
),
{
issuableDisplayName: this.issuableDisplayName,
}),
},
),
),
);
},
......
<script>
import { __, n__, sprintf } from '~/locale';
import tooltip from '~/vue_shared/directives/tooltip';
import userAvatarImage from '~/vue_shared/components/user_avatar/user_avatar_image.vue';
import { __, n__, sprintf } from '~/locale';
import tooltip from '~/vue_shared/directives/tooltip';
import userAvatarImage from '~/vue_shared/components/user_avatar/user_avatar_image.vue';
export default {
export default {
directives: {
tooltip,
},
......@@ -72,7 +72,7 @@
this.$emit('toggleSidebar');
},
},
};
};
</script>
<template>
......
<script>
import Store from '../../stores/sidebar_store';
import participants from './participants.vue';
import Store from '../../stores/sidebar_store';
import participants from './participants.vue';
export default {
export default {
components: {
participants,
},
......@@ -17,7 +17,7 @@
store: new Store(),
};
},
};
};
</script>
<template>
......
......@@ -21,8 +21,7 @@ export default {
},
methods: {
onToggleSubscription() {
this.mediator.toggleSubscription()
.catch(() => {
this.mediator.toggleSubscription().catch(() => {
Flash(__('Error occurred when toggling the notification subscription'));
});
},
......
<script>
import { __, sprintf } from '~/locale';
import { abbreviateTime } from '~/lib/utils/pretty_time';
import icon from '~/vue_shared/components/icon.vue';
import tooltip from '~/vue_shared/directives/tooltip';
import { __, sprintf } from '~/locale';
import { abbreviateTime } from '~/lib/utils/pretty_time';
import icon from '~/vue_shared/components/icon.vue';
import tooltip from '~/vue_shared/directives/tooltip';
export default {
export default {
name: 'TimeTrackingCollapsedState',
components: {
icon,
......@@ -94,7 +94,7 @@
title = __('Time spent');
}
return sprintf('%{title}: %{text}', ({ title, text: this.text }));
return sprintf('%{title}: %{text}', { title, text: this.text });
},
tooltipText() {
return this.showNoTimeTrackingState ? __('Time tracking') : this.timeTrackedTooltipText;
......@@ -105,7 +105,7 @@
return abbreviateTime(timeStr);
},
},
};
};
</script>
<template>
......
......@@ -15,16 +15,22 @@ export default {
},
estimateText() {
return sprintf(
s__('estimateCommand|%{slash_command} will update the estimated time with the latest command.'), {
s__(
'estimateCommand|%{slash_command} will update the estimated time with the latest command.',
),
{
slash_command: '<code>/estimate</code>',
}, false,
},
false,
);
},
spendText() {
return sprintf(
s__('spendCommand|%{slash_command} will update the sum of the time spent.'), {
s__('spendCommand|%{slash_command} will update the sum of the time spent.'),
{
slash_command: '<code>/spend</code>',
}, false,
},
false,
);
},
},
......
......@@ -26,7 +26,7 @@ export default {
methods: {
listenForQuickActions() {
$(document).on('ajax:success', '.gfm-form', this.quickActionListened);
eventHub.$on('timeTrackingUpdated', (data) => {
eventHub.$on('timeTrackingUpdated', data => {
this.quickActionListened(null, data);
});
},
......@@ -34,9 +34,7 @@ export default {
const subscribedCommands = ['spend_time', 'time_estimate'];
let changedCommands;
if (data !== undefined) {
changedCommands = data.commands_changes
? Object.keys(data.commands_changes)
: [];
changedCommands = data.commands_changes ? Object.keys(data.commands_changes) : [];
} else {
changedCommands = [];
}
......
......@@ -41,9 +41,9 @@ export default {
},
computed: {
buttonClasses() {
return this.collapsed ?
'btn-blank btn-todo sidebar-collapsed-icon dont-change-state' :
'btn btn-default btn-todo issuable-header-btn float-right';
return this.collapsed
? 'btn-blank btn-todo sidebar-collapsed-icon dont-change-state'
: 'btn btn-default btn-todo issuable-header-btn float-right';
},
buttonLabel() {
return this.isTodo ? MARK_TEXT : TODO_TEXT;
......
......@@ -37,7 +37,8 @@ class SidebarMoveIssue {
// Keep the dropdown open after selecting an option
shouldPropagate: false,
data: (searchTerm, callback) => {
this.mediator.fetchAutocompleteProjects(searchTerm)
this.mediator
.fetchAutocompleteProjects(searchTerm)
.then(callback)
.catch(() => new window.Flash('An error occurred while fetching projects autocomplete.'));
},
......@@ -48,7 +49,7 @@ class SidebarMoveIssue {
</a>
</li>
`,
clicked: (options) => {
clicked: options => {
const project = options.selectedObj;
const selectedProjectId = options.isMarking ? project.id : 0;
this.mediator.setMoveToProjectId(selectedProjectId);
......@@ -68,16 +69,11 @@ class SidebarMoveIssue {
onConfirmClicked() {
if (isValidProjectId(this.mediator.store.moveToProjectId)) {
this.$confirmButton
.disable()
.addClass('is-loading');
this.$confirmButton.disable().addClass('is-loading');
this.mediator.moveIssue()
.catch(() => {
this.mediator.moveIssue().catch(() => {
window.Flash('An error occurred while moving the issue.');
this.$confirmButton
.enable()
.removeClass('is-loading');
this.$confirmButton.enable().removeClass('is-loading');
});
}
}
......
......@@ -15,7 +15,8 @@ export default class SidebarMilestone {
components: {
timeTracker,
},
render: createElement => createElement('timeTracker', {
render: createElement =>
createElement('timeTracker', {
props: {
timeEstimate: parseInt(timeEstimate, 10),
timeSpent: parseInt(timeSpent, 10),
......
......@@ -22,7 +22,8 @@ function mountAssigneesComponent(mediator) {
components: {
SidebarAssignees,
},
render: createElement => createElement('sidebar-assignees', {
render: createElement =>
createElement('sidebar-assignees', {
props: {
mediator,
field: el.dataset.field,
......@@ -83,7 +84,8 @@ function mountParticipantsComponent(mediator) {
components: {
sidebarParticipants,
},
render: createElement => createElement('sidebar-participants', {
render: createElement =>
createElement('sidebar-participants', {
props: {
mediator,
},
......@@ -102,7 +104,8 @@ function mountSubscriptionsComponent(mediator) {
components: {
sidebarSubscriptions,
},
render: createElement => createElement('sidebar-subscriptions', {
render: createElement =>
createElement('sidebar-subscriptions', {
props: {
mediator,
},
......
......@@ -22,11 +22,15 @@ export default class SidebarService {
}
update(key, data) {
return Vue.http.put(this.endpoint, {
return Vue.http.put(
this.endpoint,
{
[key]: data,
}, {
},
{
emulateJSON: true,
});
},
);
}
getProjectsAutocomplete(searchTerm) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment