Extract complex condition to computed prop

This commit is contained in:
Heinrich Lee Yu 2018-10-26 10:24:30 +08:00
parent 2ba71571de
commit fdb46c55ee
2 changed files with 4 additions and 1 deletions

View file

@ -53,6 +53,9 @@ export default Vue.extend({
const { issuesSize } = this.list; const { issuesSize } = this.list;
return `${n__('%d issue', '%d issues', issuesSize)}`; return `${n__('%d issue', '%d issues', issuesSize)}`;
}, },
isNewIssueShown() {
return this.list.type === 'backlog' || (!this.disabled && this.list.type !== 'closed');
}
}, },
watch: { watch: {
filter: { filter: {

View file

@ -41,7 +41,7 @@
%button.issue-count-badge-add-button.btn.btn-sm.btn-default.ml-1.has-tooltip.js-no-trigger-collapse{ type: "button", %button.issue-count-badge-add-button.btn.btn-sm.btn-default.ml-1.has-tooltip.js-no-trigger-collapse{ type: "button",
"@click" => "showNewIssueForm", "@click" => "showNewIssueForm",
"v-if" => 'list.type == "backlog" || (!disabled && list.type !== "closed")', "v-if" => "isNewIssueShown",
"aria-label" => _("New issue"), "aria-label" => _("New issue"),
"title" => _("New issue"), "title" => _("New issue"),
data: { placement: "top", container: "body" } } data: { placement: "top", container: "body" } }