Disabled add issues button if no lists exist

This commit is contained in:
Phil Hughes 2017-01-30 15:56:45 +00:00 committed by Fatih Acet
parent b129187267
commit 6c828906a2
3 changed files with 23 additions and 11 deletions

View File

@ -88,12 +88,25 @@ $(() => {
}
});
// This element is outside the Vue app
$(document)
.off('click', '.js-show-add-issues')
.on('click', '.js-show-add-issues', (e) => {
e.preventDefault();
ModalStore.store.showAddIssuesModal = true;
});
gl.IssueBoardsModalAddBtn = new Vue({
el: '#js-add-issues-btn',
data: {
modal: ModalStore.store,
store: Store.state,
},
computed: {
disabled() {
return Store.shouldAddBlankState();
},
},
template: `
<button
class="btn btn-create pull-right prepend-left-10 has-tooltip"
type="button"
:disabled="disabled"
@click="modal.showAddIssuesModal = true">
Add issues
</button>
`,
});
});

View File

@ -7,7 +7,7 @@ module Projects
def index
issues = ::Boards::Issues::ListService.new(project, current_user, filter_params).execute
issues = issues.page(params[:page])
issues = issues.page(params[:page]).per(params[:per] || 20)
render json: {
issues: serialize_as_json(issues),

View File

@ -38,8 +38,7 @@
#js-boards-search.issue-boards-search
%input.pull-left.form-control{ type: "search", placeholder: "Filter by name...", "v-model" => "filters.search", "debounce" => "250" }
- if can?(current_user, :admin_list, @project)
%button.btn.btn-create.pull-right.prepend-left-10.js-show-add-issues{ type: "button" }
Add issues
#js-add-issues-btn.pull-right.prepend-left-10
.dropdown.pull-right
%button.btn.btn-create.btn-inverted.js-new-board-list{ type: "button", data: { toggle: "dropdown", labels: labels_filter_path, namespace_path: @project.try(:namespace).try(:path), project_path: @project.try(:path) } }
Add list