Commit f385d647 authored by Simon Knox's avatar Simon Knox

simplify usage of issuable mixin

parent 0a87e307
...@@ -18,11 +18,6 @@ export default { ...@@ -18,11 +18,6 @@ export default {
required: true, required: true,
type: Function, type: Function,
}, },
issuableType: {
required: true,
type: String,
},
}, },
mixins: [ mixins: [
...@@ -39,13 +34,13 @@ export default { ...@@ -39,13 +34,13 @@ export default {
<div class="dropdown open"> <div class="dropdown open">
<div class="dropdown-menu sidebar-item-warning-message"> <div class="dropdown-menu sidebar-item-warning-message">
<p class="text" v-if="isLocked"> <p class="text" v-if="isLocked">
Unlock this {{ issuableDisplayName(issuableType) }}? Unlock this {{ issuableDisplayName }}?
<strong>Everyone</strong> <strong>Everyone</strong>
will be able to comment. will be able to comment.
</p> </p>
<p class="text" v-else> <p class="text" v-else>
Lock this {{ issuableDisplayName(issuableType) }}? Lock this {{ issuableDisplayName }}?
Only Only
<strong>project members</strong> <strong>project members</strong>
will be able to comment. will be able to comment.
......
...@@ -23,11 +23,6 @@ export default { ...@@ -23,11 +23,6 @@ export default {
return mediatorObject.service && mediatorObject.service.update && mediatorObject.store; return mediatorObject.service && mediatorObject.service.update && mediatorObject.store;
}, },
}, },
issuableType: {
required: true,
type: String,
},
}, },
mixins: [ mixins: [
...@@ -59,7 +54,7 @@ export default { ...@@ -59,7 +54,7 @@ export default {
discussion_locked: locked, discussion_locked: locked,
}) })
.then(() => location.reload()) .then(() => location.reload())
.catch(() => Flash(this.__(`Something went wrong trying to change the locked state of this ${this.issuableDisplayName(this.issuableType)}`))); .catch(() => Flash(this.__(`Something went wrong trying to change the locked state of this ${this.issuableDisplayName}`)));
}, },
}, },
}; };
...@@ -77,7 +72,7 @@ export default { ...@@ -77,7 +72,7 @@ export default {
</div> </div>
<div class="title hide-collapsed"> <div class="title hide-collapsed">
Lock {{issuableDisplayName(issuableType) }} Lock {{ issuableDisplayName }}
<button <button
v-if="isEditable" v-if="isEditable"
class="pull-right lock-edit btn btn-blank" class="pull-right lock-edit btn btn-blank"
......
export default { export default {
methods: { props: {
issuableDisplayName(issuableType) { issuableType: {
const displayName = issuableType.replace(/_/, ' '); required: true,
type: String,
},
},
return this.__ ? this.__(displayName) : displayName; computed: {
issuableDisplayName() {
return this.issuableType.replace(/_/g, ' ');
}, },
}, },
}; };
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