Commit 615f1927 authored by Filipa Lacerda's avatar Filipa Lacerda

[ci skip] Fix some rules

parent 41cc4cf5
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"promise" "promise"
], ],
"settings": { "settings": {
"html/html-extensions": [".html", ".html.raw", ".vue"], "html/html-extensions": [".html", ".html.raw"],
"import/resolver": { "import/resolver": {
"webpack": { "webpack": {
"config": "./config/webpack.config.js" "config": "./config/webpack.config.js"
......
...@@ -10,12 +10,30 @@ export default { ...@@ -10,12 +10,30 @@ export default {
'issue-card-inner': gl.issueBoards.IssueCardInner, 'issue-card-inner': gl.issueBoards.IssueCardInner,
}, },
props: { props: {
list: Object, list: {
issue: Object, type: Object,
issueLinkBase: String, default: () => ({}),
disabled: Boolean, },
index: Number, issue: {
rootPath: String, type: Object,
default: () => ({}),
},
issueLinkBase: {
type: String,
default: '',
},
disabled: {
type: Boolean,
default: false,
},
index: {
type: Number,
default: 0,
},
rootPath: {
type: String,
default: '',
},
}, },
data() { data() {
return { return {
...@@ -54,8 +72,13 @@ export default { ...@@ -54,8 +72,13 @@ export default {
</script> </script>
<template> <template>
<li class="card" <li
:class="{ 'user-can-drag': !disabled && issue.id, 'is-disabled': disabled || !issue.id, 'is-active': issueDetailVisible }" class="card"
:class="{
'user-can-drag': !disabled && issue.id,
'is-disabled': disabled || !issue.id,
'is-active': issueDetailVisible
}"
:index="index" :index="index"
:data-issue-id="issue.id" :data-issue-id="issue.id"
@mousedown="mouseDown" @mousedown="mouseDown"
......
...@@ -23,8 +23,79 @@ export default class ImageFile { ...@@ -23,8 +23,79 @@ export default class ImageFile {
}); });
}; };
})(this)); })(this));
}
initViewModes() {
const viewMode = viewModes[0];
$('.view-modes', this.file).removeClass('hide');
$('.view-modes-menu', this.file).on('click', 'li', (function(_this) {
return function(event) {
if (!$(event.currentTarget).hasClass('active')) {
return _this.activateViewMode(event.currentTarget.className);
}
};
})(this));
return this.activateViewMode(viewMode);
}
activateViewMode(viewMode) {
$('.view-modes-menu li', this.file).removeClass('active').filter("." + viewMode).addClass('active');
return $(".view:visible:not(." + viewMode + ")", this.file).fadeOut(200, (function(_this) {
return function() {
$(".view." + viewMode, _this.file).fadeIn(200);
return _this.initView(viewMode);
};
})(this));
}
initView(viewMode) {
return this.views[viewMode].call(this);
}
// eslint-disable-next-line class-methods-use-this
initDraggable($el, padding, callback) {
var dragging = false;
var $body = $('body');
var $offsetEl = $el.parent();
$el.off('mousedown').on('mousedown', function() {
dragging = true;
$body.css('user-select', 'none');
});
$body.off('mouseup').off('mousemove').on('mouseup', function() {
dragging = false;
$body.css('user-select', '');
})
.on('mousemove', function(e) {
var left;
if (!dragging) return;
left = e.pageX - ($offsetEl.offset().left + padding);
callback(e, left);
});
}
prepareFrames(view) {
var maxHeight, maxWidth;
maxWidth = 0;
maxHeight = 0;
$('.frame', view).each((function(_this) {
return function(index, frame) {
var height, width;
width = $(frame).width();
height = $(frame).height();
maxWidth = width > maxWidth ? width : maxWidth;
return maxHeight = height > maxHeight ? height : maxHeight;
};
})(this)).css({
width: maxWidth,
height: maxHeight
});
return [maxWidth, maxHeight];
}
this.views = { views = {
'two-up': function() { 'two-up': function() {
return $('.two-up.view .wrap', this.file).each((function(_this) { return $('.two-up.view .wrap', this.file).each((function(_this) {
return function(index, wrap) { return function(index, wrap) {
...@@ -119,77 +190,6 @@ export default class ImageFile { ...@@ -119,77 +190,6 @@ export default class ImageFile {
}; };
})(this)); })(this));
} }
};
}
initViewModes() {
const viewMode = viewModes[0];
$('.view-modes', this.file).removeClass('hide');
$('.view-modes-menu', this.file).on('click', 'li', (function(_this) {
return function(event) {
if (!$(event.currentTarget).hasClass('active')) {
return _this.activateViewMode(event.currentTarget.className);
}
};
})(this));
return this.activateViewMode(viewMode);
}
activateViewMode(viewMode) {
$('.view-modes-menu li', this.file).removeClass('active').filter("." + viewMode).addClass('active');
return $(".view:visible:not(." + viewMode + ")", this.file).fadeOut(200, (function(_this) {
return function() {
$(".view." + viewMode, _this.file).fadeIn(200);
return _this.initView(viewMode);
};
})(this));
}
initView(viewMode) {
return this.views[viewMode].call(this);
}
// eslint-disable-next-line class-methods-use-this
initDraggable($el, padding, callback) {
var dragging = false;
var $body = $('body');
var $offsetEl = $el.parent();
$el.off('mousedown').on('mousedown', function() {
dragging = true;
$body.css('user-select', 'none');
});
$body.off('mouseup').off('mousemove').on('mouseup', function() {
dragging = false;
$body.css('user-select', '');
})
.on('mousemove', function(e) {
var left;
if (!dragging) return;
left = e.pageX - ($offsetEl.offset().left + padding);
callback(e, left);
});
}
prepareFrames(view) {
var maxHeight, maxWidth;
maxWidth = 0;
maxHeight = 0;
$('.frame', view).each((function(_this) {
return function(index, frame) {
var height, width;
width = $(frame).width();
height = $(frame).height();
maxWidth = width > maxWidth ? width : maxWidth;
return maxHeight = height > maxHeight ? height : maxHeight;
};
})(this)).css({
width: maxWidth,
height: maxHeight
});
return [maxWidth, maxHeight];
} }
requestImageInfo(img, callback) { requestImageInfo(img, callback) {
......
...@@ -8,6 +8,12 @@ import '../../lib/utils/datetime_utility'; ...@@ -8,6 +8,12 @@ import '../../lib/utils/datetime_utility';
*/ */
export default { export default {
directives: {
tooltip,
},
mixins: [
timeagoMixin,
],
props: { props: {
time: { time: {
type: String, type: String,
...@@ -26,14 +32,6 @@ export default { ...@@ -26,14 +32,6 @@ export default {
default: '', default: '',
}, },
}, },
mixins: [
timeagoMixin,
],
directives: {
tooltip,
},
}; };
</script> </script>
<template> <template>
...@@ -43,6 +41,6 @@ export default { ...@@ -43,6 +41,6 @@ export default {
:title="tooltipTitle(time)" :title="tooltipTitle(time)"
:data-placement="tooltipPlacement" :data-placement="tooltipPlacement"
data-container="body"> data-container="body">
{{timeFormated(time)}} {{ timeFormated(time) }}
</time> </time>
</template> </template>
...@@ -9,6 +9,16 @@ ...@@ -9,6 +9,16 @@
const LABEL_OFF = s__('ToggleButton|Toggle Status: OFF'); const LABEL_OFF = s__('ToggleButton|Toggle Status: OFF');
export default { export default {
components: {
icon,
loadingIcon,
},
model: {
prop: 'value',
event: 'change',
},
props: { props: {
name: { name: {
type: String, type: String,
...@@ -31,16 +41,6 @@ ...@@ -31,16 +41,6 @@
}, },
}, },
components: {
icon,
loadingIcon,
},
model: {
prop: 'value',
event: 'change',
},
computed: { computed: {
toggleIcon() { toggleIcon() {
return this.value ? ICON_ON : ICON_OFF; return this.value ? ICON_ON : ICON_OFF;
......
...@@ -22,6 +22,9 @@ import tooltip from '../../directives/tooltip'; ...@@ -22,6 +22,9 @@ import tooltip from '../../directives/tooltip';
export default { export default {
name: 'UserAvatarImage', name: 'UserAvatarImage',
directives: {
tooltip,
},
props: { props: {
lazy: { lazy: {
type: Boolean, type: Boolean,
...@@ -59,9 +62,6 @@ export default { ...@@ -59,9 +62,6 @@ export default {
default: 'top', default: 'top',
}, },
}, },
directives: {
tooltip,
},
computed: { computed: {
// API response sends null when gravatar is disabled and // API response sends null when gravatar is disabled and
// we provide an empty string when we use it inside user avatar link. // we provide an empty string when we use it inside user avatar link.
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
v-tooltip v-tooltip
class="avatar" class="avatar"
:class="{ :class="{
lazy, lazy: lazy,
[avatarSizeClass]: true, [avatarSizeClass]: true,
[cssClasses]: true [cssClasses]: true
}" }"
......
...@@ -26,6 +26,9 @@ export default { ...@@ -26,6 +26,9 @@ export default {
components: { components: {
userAvatarImage, userAvatarImage,
}, },
directives: {
tooltip,
},
props: { props: {
linkHref: { linkHref: {
type: String, type: String,
...@@ -76,9 +79,6 @@ export default { ...@@ -76,9 +79,6 @@ export default {
return this.shouldShowUsername ? '' : this.tooltipText; return this.shouldShowUsername ? '' : this.tooltipText;
}, },
}, },
directives: {
tooltip,
},
}; };
</script> </script>
...@@ -98,6 +98,6 @@ export default { ...@@ -98,6 +98,6 @@ export default {
v-tooltip v-tooltip
:title="tooltipText" :title="tooltipText"
:tooltip-placement="tooltipPlacement" :tooltip-placement="tooltipPlacement"
>{{username}}</span> >{{ username }}</span>
</a> </a>
</template> </template>
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
:class="avatarSizeClass" :class="avatarSizeClass"
:height="size" :height="size"
:width="size" :width="size"
v-html="svg"> v-html="svg"
</svg> />
</template> </template>
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