diff options
author | Phil Hughes <me@iamphill.com> | 2016-11-04 10:24:59 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-11-10 17:53:34 +0300 |
commit | 1505fc3ac5a596966773abd886fb98c096322803 (patch) | |
tree | 263ab9251ccaf055db5c355b1c9b7ce110562941 /app/views | |
parent | a1fc04dfad84822d0e26e60ac109f83d42d5403a (diff) | |
download | gitlab-ce-1505fc3ac5a596966773abd886fb98c096322803.tar.gz |
Refactor of issue boards to work with Vue2
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/projects/boards/_show.html.haml | 28 | ||||
-rw-r--r-- | app/views/projects/boards/components/_blank_state.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/boards/components/_board.html.haml | 112 | ||||
-rw-r--r-- | app/views/projects/boards/components/_board_list.html.haml | 44 | ||||
-rw-r--r-- | app/views/projects/boards/components/_card.html.haml | 62 | ||||
-rw-r--r-- | app/views/projects/boards/index.html.haml | 19 | ||||
-rw-r--r-- | app/views/projects/boards/show.html.haml | 19 |
7 files changed, 134 insertions, 152 deletions
diff --git a/app/views/projects/boards/_show.html.haml b/app/views/projects/boards/_show.html.haml new file mode 100644 index 00000000000..356bd50f7f3 --- /dev/null +++ b/app/views/projects/boards/_show.html.haml @@ -0,0 +1,28 @@ +- @no_container = true +- @content_class = "issue-boards-content" +- page_title "Boards" + +- content_for :page_specific_javascripts do + = page_specific_javascript_tag('boards/boards_bundle.js') + = page_specific_javascript_tag('boards/test_utils/simulate_drag.js') if Rails.env.test? + + %script#js-board-template{ type: "text/x-template" }= render "projects/boards/components/board" + %script#js-board-list-template{ type: "text/x-template" }= render "projects/boards/components/board_list" + %script#js-board-list-card{ type: "text/x-template" }= render "projects/boards/components/card" + += render "projects/issues/head" + += render 'shared/issuable/filter', type: :boards + +#board-app.boards-app{ "v-cloak" => true, data: board_data } + .boards-list{ ":class" => "{ 'is-compact': detailIssueVisible }" } + .boards-app-loading.text-center{ "v-if" => "loading" } + = icon("spinner spin") + %board{ "v-cloak" => true, + "v-for" => "list in state.lists", + "ref" => "board", + ":list" => "list", + ":disabled" => "disabled", + ":issue-link-base" => "issueLinkBase", + ":key" => "_uid" } + = render "projects/boards/components/sidebar" diff --git a/app/views/projects/boards/components/_blank_state.html.haml b/app/views/projects/boards/components/_blank_state.html.haml index 97eb952eff1..0af40ddf8fe 100644 --- a/app/views/projects/boards/components/_blank_state.html.haml +++ b/app/views/projects/boards/components/_blank_state.html.haml @@ -1,5 +1,5 @@ %board-blank-state{ "inline-template" => true, - "v-if" => "list.id == 'blank'" } + "v-if" => 'list.id == "blank"' } .board-blank-state %p Add the following default lists to your Issue Board with one click: diff --git a/app/views/projects/boards/components/_board.html.haml b/app/views/projects/boards/components/_board.html.haml index f7071051efc..47165c70097 100644 --- a/app/views/projects/boards/components/_board.html.haml +++ b/app/views/projects/boards/components/_board.html.haml @@ -1,80 +1,34 @@ -%board{ "inline-template" => true, - "v-cloak" => true, - "v-for" => "list in state.lists | orderBy 'position'", - "v-ref:board" => true, - ":list" => "list", - ":disabled" => "disabled", - ":issue-link-base" => "issueLinkBase", - "track-by" => "_uid" } - .board{ ":class" => "{ 'is-draggable': !list.preset }", - ":data-id" => "list.id" } - .board-inner - %header.board-header{ ":class" => "{ 'has-border': list.label }", ":style" => "{ borderTopColor: (list.label ? list.label.color : null) }" } - %h3.board-title.js-board-handle{ ":class" => "{ 'user-can-drag': (!disabled && !list.preset) }" } - %span.has-tooltip{ ":title" => "(list.label ? list.label.description : '')", - data: { container: "body", placement: "bottom" } } - {{ list.title }} - .board-issue-count-holder.pull-right.clearfix{ "v-if" => "list.type !== 'blank'" } - %span.board-issue-count.pull-left{ ":class" => "{ 'has-btn': list.type !== 'done' }" } - {{ list.issuesSize }} - - if can?(current_user, :admin_issue, @project) - %button.btn.btn-small.btn-default.pull-right.has-tooltip{ type: "button", - "@click" => "showNewIssueForm", - "v-if" => "list.type !== 'done'", - "aria-label" => "Add an issue", - "title" => "Add an issue", - data: { placement: "top", container: "body" } } - = icon("plus") - - if can?(current_user, :admin_list, @project) - %board-delete{ "inline-template" => true, - ":list" => "list", - "v-if" => "!list.preset && list.id" } - %button.board-delete.has-tooltip.pull-right{ type: "button", title: "Delete list", "aria-label" => "Delete list", data: { placement: "bottom" }, "@click.stop" => "deleteBoard" } - = icon("trash") - %board-list{ "inline-template" => true, - "v-if" => "list.type !== 'blank'", - ":list" => "list", - ":issues" => "list.issues", - ":loading" => "list.loading", - ":disabled" => "disabled", - ":show-issue-form.sync" => "showIssueForm", - ":issue-link-base" => "issueLinkBase" } - .board-list-loading.text-center{ "v-if" => "loading" } - = icon("spinner spin") - - if can? current_user, :create_issue, @project - %board-new-issue{ "inline-template" => true, +.board{ ":class" => '{ "is-draggable": !list.preset }', + ":data-id" => "list.id" } + .board-inner + %header.board-header{ ":class" => '{ "has-border": list.label }', ":style" => "{ borderTopColor: (list.label ? list.label.color : null) }" } + %h3.board-title.js-board-handle{ ":class" => '{ "user-can-drag": (!disabled && !list.preset) }' } + %span.has-tooltip{ ":title" => '(list.label ? list.label.description : "")', + data: { container: "body", placement: "bottom" } } + {{ list.title }} + .board-issue-count-holder.pull-right.clearfix{ "v-if" => 'list.type !== "blank"' } + %span.board-issue-count.pull-left{ ":class" => '{ "has-btn": list.type !== "done" }' } + {{ list.issuesSize }} + - if can?(current_user, :admin_issue, @project) + %button.btn.btn-small.btn-default.pull-right.has-tooltip{ type: "button", + "@click" => "showNewIssueForm", + "v-if" => 'list.type !== "done"', + "aria-label" => "Add an issue", + "title" => "Add an issue", + data: { placement: "top", container: "body" } } + = icon("plus") + - if can?(current_user, :admin_list, @project) + %board-delete{ "inline-template" => true, ":list" => "list", - ":show-issue-form.sync" => "showIssueForm", - "v-show" => "list.type !== 'done' && showIssueForm" } - .card.board-new-issue-form - %form{ "@submit" => "submit($event)" } - .flash-container{ "v-if" => "error" } - .flash-alert - An error occured. Please try again. - %label.label-light{ ":for" => "list.id + '-title'" } - Title - %input.form-control{ type: "text", - "v-model" => "title", - "v-el:input" => true, - ":id" => "list.id + '-title'" } - .clearfix.prepend-top-10 - %button.btn.btn-success.pull-left{ type: "submit", - ":disabled" => "title === ''", - "v-el:submit-button" => true } - Submit issue - %button.btn.btn-default.pull-right{ type: "button", - "@click" => "cancel" } - Cancel - %ul.board-list{ "v-el:list" => true, - "v-show" => "!loading", - ":data-board" => "list.id", - ":class" => "{ 'is-smaller': showIssueForm }" } - = render "projects/boards/components/card" - %li.board-list-count.text-center{ "v-if" => "showCount" } - = icon("spinner spin", "v-show" => "list.loadingMore" ) - %span{ "v-if" => "list.issues.length === list.issuesSize" } - Showing all issues - %span{ "v-else" => true } - Showing {{ list.issues.length }} of {{ list.issuesSize }} issues - - if can?(current_user, :admin_list, @project) - = render "projects/boards/components/blank_state" + "v-if" => "!list.preset && list.id" } + %button.board-delete.has-tooltip.pull-right{ type: "button", title: "Delete list", "aria-label" => "Delete list", data: { placement: "bottom" }, "@click.stop" => "deleteBoard" } + = icon("trash") + %board-list{ "v-if" => 'list.type !== "blank"', + ":list" => "list", + ":issues" => "list.issues", + ":loading" => "list.loading", + ":disabled" => "disabled", + ":issue-link-base" => "issueLinkBase", + "ref" => "board-list" } + - if can?(current_user, :admin_list, @project) + = render "projects/boards/components/blank_state" diff --git a/app/views/projects/boards/components/_board_list.html.haml b/app/views/projects/boards/components/_board_list.html.haml new file mode 100644 index 00000000000..d86e0ed8540 --- /dev/null +++ b/app/views/projects/boards/components/_board_list.html.haml @@ -0,0 +1,44 @@ +.board-list-component + .board-list-loading.text-center{ "v-if" => "loading" } + = icon("spinner spin") + - if can? current_user, :create_issue, @project + %board-new-issue{ "inline-template" => true, + ":list" => "list", + "v-if" => 'list.type !== "done" && showIssueForm' } + .card.board-new-issue-form + %form{ "@submit" => "submit($event)" } + .flash-container{ "v-if" => "error" } + .flash-alert + An error occured. Please try again. + %label.label-light{ ":for" => 'list.id + "-title"' } + Title + %input.form-control{ type: "text", + "v-model" => "title", + "ref" => "input", + ":id" => 'list.id + "-title"' } + .clearfix.prepend-top-10 + %button.btn.btn-success.pull-left{ type: "submit", + ":disabled" => 'title === ""', + "ref" => "submit-button" } + Submit issue + %button.btn.btn-default.pull-right{ type: "button", + "@click" => "cancel" } + Cancel + %ul.board-list{ "ref" => "list", + "v-show" => "!loading", + ":data-board" => "list.id", + ":class" => '{ "is-smaller": showIssueForm }' } + %board-card{ "v-for" => "(issue, index) in orderedIssues", + "ref" => "issue", + ":index" => "index", + ":list" => "list", + ":issue" => "issue", + ":issue-link-base" => "issueLinkBase", + ":disabled" => "disabled", + "key" => "id" } + %li.board-list-count.text-center{ "v-if" => "showCount" } + = icon("spinner spin", "v-show" => "list.loadingMore" ) + %span{ "v-if" => "list.issues.length === list.issuesSize" } + Showing all issues + %span{ "v-else" => true } + Showing {{ list.issues.length }} of {{ list.issuesSize }} issues diff --git a/app/views/projects/boards/components/_card.html.haml b/app/views/projects/boards/components/_card.html.haml index 8fce702314c..72b31b8cdae 100644 --- a/app/views/projects/boards/components/_card.html.haml +++ b/app/views/projects/boards/components/_card.html.haml @@ -1,36 +1,26 @@ -%board-card{ "inline-template" => true, - "v-for" => "issue in issues | orderBy 'priority'", - "v-ref:issue" => true, - ":index" => "$index", - ":list" => "list", - ":issue" => "issue", - ":issue-link-base" => "issueLinkBase", - ":disabled" => "disabled", - "track-by" => "id" } - %li.card{ ":class" => "{ 'user-can-drag': !disabled && issue.id, 'is-disabled': disabled || !issue.id, 'is-active': issueDetailVisible }", - ":index" => "index", - "@mousedown" => "mouseDown", - "@mouseMove" => "mouseMove", - "@mouseup" => "showIssue($event)" } - %h4.card-title - = icon("eye-slash", class: "confidential-icon", "v-if" => "issue.confidential") - %a{ ":href" => "issueLinkBase + '/' + issue.id", - ":title" => "issue.title" } - {{ issue.title }} - .card-footer - %span.card-number{ "v-if" => "issue.id" } - = precede '#' do - {{ issue.id }} - %a.has-tooltip{ ":href" => "'#{root_path}' + issue.assignee.username", - ":title" => "'Assigned to ' + issue.assignee.name", - "v-if" => "issue.assignee", - data: { container: 'body' } } - %img.avatar.avatar-inline.s20{ ":src" => "issue.assignee.avatar", width: 20, height: 20 } - %button.label.color-label.has-tooltip{ "v-for" => "label in issue.labels", - type: "button", - "v-if" => "(!list.label || label.id !== list.label.id)", - "@click" => "filterByLabel(label, $event)", - ":style" => "{ backgroundColor: label.color, color: label.textColor }", - ":title" => "label.description", - data: { container: 'body' } } - {{ label.title }} +%li.card{ ":class" => '{ "user-can-drag": !disabled && issue.id, "is-disabled": disabled || !issue.id, "is-active": issueDetailVisible }', + ":index" => "index", + "@mousedown" => "mouseDown", + "@mouseup" => "showIssue($event)" } + %h4.card-title + = icon("eye-slash", class: "confidential-icon", "v-if" => "issue.confidential") + %a{ ":href" => 'issueLinkBase + "/" + issue.id', + ":title" => "issue.title" } + {{ issue.title }} + .card-footer + %span.card-number{ "v-if" => "issue.id" } + = precede '#' do + {{ issue.id }} + %a.has-tooltip{ ":href" => "\"#{root_path}\" + issue.assignee.username", + ":title" => '"Assigned to " + issue.assignee.name', + "v-if" => "issue.assignee", + data: { container: 'body' } } + %img.avatar.avatar-inline.s20{ ":src" => "issue.assignee.avatar", width: 20, height: 20 } + %button.label.color-label.has-tooltip{ "v-for" => "label in issue.labels", + type: "button", + "v-if" => "(!list.label || label.id !== list.label.id)", + "@click" => "filterByLabel(label, $event)", + ":style" => "{ backgroundColor: label.color, color: label.textColor }", + ":title" => "label.description", + data: { container: 'body' } } + {{ label.title }} diff --git a/app/views/projects/boards/index.html.haml b/app/views/projects/boards/index.html.haml index 29c9a43a0c1..2a5b8b1441e 100644 --- a/app/views/projects/boards/index.html.haml +++ b/app/views/projects/boards/index.html.haml @@ -1,18 +1 @@ -- @no_container = true -- @content_class = "issue-boards-content" -- page_title "Boards" - -- content_for :page_specific_javascripts do - = page_specific_javascript_tag('boards/boards_bundle.js') - = page_specific_javascript_tag('boards/test_utils/simulate_drag.js') if Rails.env.test? - -= render "projects/issues/head" - -= render 'shared/issuable/filter', type: :boards - -#board-app.boards-app{ "v-cloak" => true, data: board_data } - .boards-list{ ":class" => "{ 'is-compact': detailIssueVisible }" } - .boards-app-loading.text-center{ "v-if" => "loading" } - = icon("spinner spin") - = render "projects/boards/components/board" - = render "projects/boards/components/sidebar" += render "show" diff --git a/app/views/projects/boards/show.html.haml b/app/views/projects/boards/show.html.haml index 29c9a43a0c1..2a5b8b1441e 100644 --- a/app/views/projects/boards/show.html.haml +++ b/app/views/projects/boards/show.html.haml @@ -1,18 +1 @@ -- @no_container = true -- @content_class = "issue-boards-content" -- page_title "Boards" - -- content_for :page_specific_javascripts do - = page_specific_javascript_tag('boards/boards_bundle.js') - = page_specific_javascript_tag('boards/test_utils/simulate_drag.js') if Rails.env.test? - -= render "projects/issues/head" - -= render 'shared/issuable/filter', type: :boards - -#board-app.boards-app{ "v-cloak" => true, data: board_data } - .boards-list{ ":class" => "{ 'is-compact': detailIssueVisible }" } - .boards-app-loading.text-center{ "v-if" => "loading" } - = icon("spinner spin") - = render "projects/boards/components/board" - = render "projects/boards/components/sidebar" += render "show" |