diff options
author | Simon Knox <psimyn@gmail.com> | 2017-09-06 08:50:13 +0300 |
---|---|---|
committer | Simon Knox <psimyn@gmail.com> | 2017-09-06 08:50:13 +0300 |
commit | f1d92cd232d1f4877a18a6ae7839440540124a7a (patch) | |
tree | a5c5c664efa9566d07e7709192b7f19a3b2f89bb /app/views/shared/boards | |
parent | c28d52a3a5e745d20981151b89bfcad07c68fa9c (diff) |
move templates from projects to shared
Diffstat (limited to 'app/views/shared/boards')
10 files changed, 247 insertions, 0 deletions
diff --git a/app/views/shared/boards/_show.html.haml b/app/views/shared/boards/_show.html.haml new file mode 100644 index 00000000000..0f95bfca213 --- /dev/null +++ b/app/views/shared/boards/_show.html.haml @@ -0,0 +1,42 @@ +- @no_breadcrumb_container = true +- @no_container = true +- @content_class = "issue-boards-content" +- page_title "Boards" + +- if show_new_nav? + - add_to_breadcrumbs("Issues", project_issues_path(@project)) + +- content_for :page_specific_javascripts do + = webpack_bundle_tag 'common_vue' + = webpack_bundle_tag 'filtered_search' + = webpack_bundle_tag 'boards' + + %script#js-board-template{ type: "text/x-template" }= render "shared/boards/components/board" + %script#js-board-modal-filter{ type: "text/x-template" }= render "shared/issuable/search_bar", type: :boards_modal + += render "projects/issues/head" + +.hidden-xs.hidden-sm + = render 'shared/issuable/search_bar', 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", + ":root-path" => "rootPath", + ":board-id" => "boardId", + ":key" => "_uid" } + = render "shared/boards/components/sidebar" + %board-add-issues-modal{ "blank-state-image" => render('shared/empty_states/icons/issues.svg'), + "new-issue-path" => new_project_issue_path(@project), + "milestone-path" => milestones_filter_dropdown_path, + "label-path" => labels_filter_path, + ":issue-link-base" => "issueLinkBase", + ":root-path" => "rootPath", + ":project-id" => @project.try(:id) } diff --git a/app/views/shared/boards/components/_board.html.haml b/app/views/shared/boards/components/_board.html.haml new file mode 100644 index 00000000000..64f5f6d7ba0 --- /dev/null +++ b/app/views/shared/boards/components/_board.html.haml @@ -0,0 +1,46 @@ +.board{ ":class" => '{ "is-draggable": !list.preset, "is-expandable": list.isExpandable, "is-collapsed": !list.isExpanded }', + ":data-id" => "list.id" } + .board-inner + %header.board-header{ ":class" => '{ "has-border": list.label && list.label.color }', ":style" => "{ borderTopColor: (list.label && list.label.color ? list.label.color : null) }", "@click" => "toggleExpanded($event)" } + %h3.board-title.js-board-handle{ ":class" => '{ "user-can-drag": (!disabled && !list.preset) }' } + %i.fa.fa-fw.board-title-expandable-toggle{ "v-if": "list.isExpandable", + ":class": "{ \"fa-caret-down\": list.isExpanded, \"fa-caret-right\": !list.isExpanded && list.position === -1, \"fa-caret-left\": !list.isExpanded && list.position !== -1 }", + "aria-hidden": "true" } + + %span.has-tooltip{ "v-if": "list.type !== \"label\"", + ":title" => '(list.label ? list.label.description : "")' } + {{ list.title }} + + %span.has-tooltip{ "v-if": "list.type === \"label\"", + ":title" => '(list.label ? list.label.description : "")', + data: { container: "body", placement: "bottom" }, + class: "label color-label title", + ":style" => "{ backgroundColor: (list.label && list.label.color ? list.label.color : null), color: (list.label && list.label.color ? list.label.text_color : \"#2e2e2e\") }" } + {{ list.title }} + .issue-count-badge.pull-right.clearfix{ "v-if" => 'list.type !== "blank"' } + %span.issue-count-badge-count.pull-left{ ":class" => '{ "has-btn": list.type !== "closed" && !disabled }' } + {{ list.issuesSize }} + - if can?(current_user, :admin_issue, @project) + %button.issue-count-badge-add-button.btn.btn-small.btn-default.has-tooltip.js-no-trigger-collapse{ type: "button", + "@click" => "showNewIssueForm", + "v-if" => 'list.type !== "closed"', + "aria-label" => "New issue", + "title" => "New issue", + data: { placement: "top", container: "body" } } + = icon("plus", class: "js-no-trigger-collapse") + - 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{ "v-if" => 'list.type !== "blank"', + ":list" => "list", + ":issues" => "list.issues", + ":loading" => "list.loading", + ":disabled" => "disabled", + ":issue-link-base" => "issueLinkBase", + ":root-path" => "rootPath", + "ref" => "board-list" } + - if can?(current_user, :admin_list, @project) + %board-blank-state{ "v-if" => 'list.id == "blank"' } diff --git a/app/views/shared/boards/components/_sidebar.html.haml b/app/views/shared/boards/components/_sidebar.html.haml new file mode 100644 index 00000000000..ba5f681c804 --- /dev/null +++ b/app/views/shared/boards/components/_sidebar.html.haml @@ -0,0 +1,27 @@ +%board-sidebar{ "inline-template" => true, + ":current-user" => "#{current_user ? current_user.to_json(only: [:username, :id, :name], methods: [:avatar_url]) : {}}" } + %transition{ name: "boards-sidebar-slide" } + %aside.right-sidebar.right-sidebar-expanded.issue-boards-sidebar{ "v-show" => "showSidebar" } + .issuable-sidebar + .block.issuable-sidebar-header + %span.issuable-header-text.hide-collapsed.pull-left + %strong + {{ issue.title }} + %br/ + %span + = precede "#" do + {{ issue.id }} + %a.gutter-toggle.pull-right{ role: "button", + href: "#", + "@click.prevent" => "closeSidebar", + "aria-label" => "Toggle sidebar" } + = custom_icon("icon_close", size: 15) + .js-issuable-update + = render "shared/boards/components/sidebar/assignee" + = render "shared/boards/components/sidebar/milestone" + = render "shared/boards/components/sidebar/due_date" + = render "shared/boards/components/sidebar/labels" + = render "shared/boards/components/sidebar/notifications" + %remove-btn{ ":issue" => "issue", + ":list" => "list", + "v-if" => "canRemove" } diff --git a/app/views/shared/boards/components/sidebar/_assignee.html.haml b/app/views/shared/boards/components/sidebar/_assignee.html.haml new file mode 100644 index 00000000000..8d957613be1 --- /dev/null +++ b/app/views/shared/boards/components/sidebar/_assignee.html.haml @@ -0,0 +1,32 @@ +.block.assignee{ ref: "assigneeBlock" } + %template{ "v-if" => "issue.assignees" } + %assignee-title{ ":number-of-assignees" => "issue.assignees.length", + ":loading" => "loadingAssignees", + ":editable" => can?(current_user, :admin_issue, @project) } + %assignees.value{ "root-path" => "#{root_url}", + ":users" => "issue.assignees", + ":editable" => can?(current_user, :admin_issue, @project), + "@assign-self" => "assignSelf" } + + - if can?(current_user, :admin_issue, @project) + .selectbox.hide-collapsed + %input.js-vue{ type: "hidden", + name: "issue[assignee_ids][]", + ":value" => "assignee.id", + "v-if" => "issue.assignees", + "v-for" => "assignee in issue.assignees", + ":data-avatar_url" => "assignee.avatar", + ":data-name" => "assignee.name", + ":data-username" => "assignee.username" } + .dropdown + - dropdown_options = issue_assignees_dropdown_options + %button.dropdown-menu-toggle.js-user-search.js-author-search.js-multiselect.js-save-user-data.js-issue-board-sidebar{ type: 'button', ref: 'assigneeDropdown', data: { toggle: 'dropdown', field_name: 'issue[assignee_ids][]', first_user: current_user&.username, current_user: 'true', project_id: @project.id, null_user: 'true', multi_select: 'true', 'dropdown-header': dropdown_options[:data][:'dropdown-header'], 'max-select': dropdown_options[:data][:'max-select'] }, + ":data-issuable-id" => "issue.id", + ":data-issue-update" => "'#{project_issues_path(@project)}/' + issue.id + '.json'" } + = dropdown_options[:title] + = icon("chevron-down") + .dropdown-menu.dropdown-select.dropdown-menu-user.dropdown-menu-selectable.dropdown-menu-author + = dropdown_title("Assign to") + = dropdown_filter("Search users") + = dropdown_content + = dropdown_loading diff --git a/app/views/shared/boards/components/sidebar/_due_date.html.haml b/app/views/shared/boards/components/sidebar/_due_date.html.haml new file mode 100644 index 00000000000..e8394eab213 --- /dev/null +++ b/app/views/shared/boards/components/sidebar/_due_date.html.haml @@ -0,0 +1,32 @@ +.block.due_date + .title + Due date + - if can?(current_user, :admin_issue, @project) + = icon("spinner spin", class: "block-loading") + = link_to "Edit", "#", class: "js-sidebar-dropdown-toggle edit-link pull-right" + .value + .value-content + %span.no-value{ "v-if" => "!issue.dueDate" } + No due date + %span.bold{ "v-if" => "issue.dueDate" } + {{ issue.dueDate | due-date }} + - if can?(current_user, :admin_issue, @project) + %span.no-value.js-remove-due-date-holder{ "v-if" => "issue.dueDate" } + \- + %a.js-remove-due-date{ href: "#", role: "button" } + remove due date + - if can?(current_user, :admin_issue, @project) + .selectbox + %input{ type: "hidden", + name: "issue[due_date]", + ":value" => "issue.dueDate" } + .dropdown + %button.dropdown-menu-toggle.js-due-date-select.js-issue-boards-due-date{ type: 'button', + data: { toggle: 'dropdown', field_name: "issue[due_date]", ability_name: "issue" }, + ":data-issue-update" => "'#{project_issues_path(@project)}/' + issue.id + '.json'" } + %span.dropdown-toggle-text Due date + = icon('chevron-down') + .dropdown-menu.dropdown-menu-due-date + = dropdown_title('Due date') + = dropdown_content do + .js-due-date-calendar diff --git a/app/views/shared/boards/components/sidebar/_labels.html.haml b/app/views/shared/boards/components/sidebar/_labels.html.haml new file mode 100644 index 00000000000..6b389736e8b --- /dev/null +++ b/app/views/shared/boards/components/sidebar/_labels.html.haml @@ -0,0 +1,30 @@ +.block.labels + .title + Labels + - if can?(current_user, :admin_issue, @project) + = icon("spinner spin", class: "block-loading") + = link_to "Edit", "#", class: "js-sidebar-dropdown-toggle edit-link pull-right" + .value.issuable-show-labels + %span.no-value{ "v-if" => "issue.labels && issue.labels.length === 0" } + None + %a{ href: "#", + "v-for" => "label in issue.labels" } + %span.label.color-label.has-tooltip{ ":style" => "{ backgroundColor: label.color, color: label.textColor }" } + {{ label.title }} + - if can?(current_user, :admin_issue, @project) + .selectbox + %input{ type: "hidden", + name: "issue[label_names][]", + "v-for" => "label in issue.labels", + ":value" => "label.id" } + .dropdown + %button.dropdown-menu-toggle.js-label-select.js-multiselect.js-issue-board-sidebar{ type: "button", + data: { toggle: "dropdown", field_name: "issue[label_names][]", show_no: "true", show_any: "true", project_id: @project.id, labels: project_labels_path(@project, :json), namespace_path: @project.try(:namespace).try(:full_path), project_path: @project.try(:path) }, + ":data-issue-update" => "'#{project_issues_path(@project)}/' + issue.id + '.json'" } + %span.dropdown-toggle-text + Label + = icon('chevron-down') + .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable + = render partial: "shared/issuable/label_page_default" + - if can? current_user, :admin_label, @project and @project + = render partial: "shared/issuable/label_page_create" diff --git a/app/views/shared/boards/components/sidebar/_milestone.html.haml b/app/views/shared/boards/components/sidebar/_milestone.html.haml new file mode 100644 index 00000000000..a1ddb261ea3 --- /dev/null +++ b/app/views/shared/boards/components/sidebar/_milestone.html.haml @@ -0,0 +1,29 @@ +.block.milestone + .title + Milestone + - if can?(current_user, :admin_issue, @project) + = icon("spinner spin", class: "block-loading") + = link_to "Edit", "#", class: "js-sidebar-dropdown-toggle edit-link pull-right" + .value + %span.no-value{ "v-if" => "!issue.milestone" } + None + %span.bold.has-tooltip{ "v-if" => "issue.milestone" } + {{ issue.milestone.title }} + - if can?(current_user, :admin_issue, @project) + .selectbox + %input{ type: "hidden", + ":value" => "issue.milestone.id", + name: "issue[milestone_id]", + "v-if" => "issue.milestone" } + .dropdown + %button.dropdown-menu-toggle.js-milestone-select.js-issue-board-sidebar{ type: "button", data: { toggle: "dropdown", show_no: "true", field_name: "issue[milestone_id]", project_id: @project.id, milestones: project_milestones_path(@project, :json), ability_name: "issue", use_id: "true", default_no: "true" }, + ":data-selected" => "milestoneTitle", + ":data-issuable-id" => "issue.id", + ":data-issue-update" => "'#{project_issues_path(@project)}/' + issue.id + '.json'" } + Milestone + = icon("chevron-down") + .dropdown-menu.dropdown-select.dropdown-menu-selectable + = dropdown_title("Assign milestone") + = dropdown_filter("Search milestones") + = dropdown_content + = dropdown_loading diff --git a/app/views/shared/boards/components/sidebar/_notifications.html.haml b/app/views/shared/boards/components/sidebar/_notifications.html.haml new file mode 100644 index 00000000000..aaddd7e249f --- /dev/null +++ b/app/views/shared/boards/components/sidebar/_notifications.html.haml @@ -0,0 +1,7 @@ +- if current_user + .block.light.subscription{ ":data-url" => "'#{project_issues_path(@project)}/' + issue.id + '/toggle_subscription'" } + %span.issuable-header-text.hide-collapsed.pull-left + Notifications + %button.btn.btn-default.pull-right.js-subscribe-button.issuable-subscribe-button.hide-collapsed{ type: "button" } + %span + {{issue.subscribed ? 'Unsubscribe' : 'Subscribe'}} diff --git a/app/views/shared/boards/index.html.haml b/app/views/shared/boards/index.html.haml new file mode 100644 index 00000000000..2a5b8b1441e --- /dev/null +++ b/app/views/shared/boards/index.html.haml @@ -0,0 +1 @@ += render "show" diff --git a/app/views/shared/boards/show.html.haml b/app/views/shared/boards/show.html.haml new file mode 100644 index 00000000000..2a5b8b1441e --- /dev/null +++ b/app/views/shared/boards/show.html.haml @@ -0,0 +1 @@ += render "show" |