feat: kanban view style update

This commit is contained in:
prssanna 2020-07-08 16:11:42 +05:30
parent de409efc4d
commit 7c2337597e
7 changed files with 447 additions and 202 deletions

View file

@ -1,13 +1,13 @@
<div class="kanban">
<div class="kanban-column add-new-column">
<div class="kanban-column-title compose-column">
<a class="text-muted"> {{ __("Add a column") }}</a>
</div>
<form class="compose-column-form kanban-column-title">
<input class="new-column-title" name="title" type="text" autocomplete="off">
</form>
</div>
<div class="kanban-empty-state text-muted text-center" style="display: none;">
{{ __("Loading...") }}
</div>
<div class="kanban-column add-new-column">
<div class="kanban-column-title compose-column">
<a class="text-muted"> + {{ __("Add Column") }}</a>
</div>
<form class="compose-column-form kanban-column-title">
<input class="new-column-title" name="title" type="text" autocomplete="off">
</form>
</div>
<div class="kanban-empty-state text-muted text-center" style="display: none;">
{{ __("Loading...") }}
</div>
</div>

View file

@ -350,12 +350,12 @@ frappe.provide("frappe.views");
if (!archived_columns.length) return;
var options = archived_columns.reduce(function(a, b) {
return a + "<li><a class='option'>" +
return a + `<li><a class='option'>" +
"<span class='ellipsis' style='max-width: 100px; display: inline-block'>" +
__(b.title) + "</span>" +
"<button style='float:right;' data-column='" + b.title +
"' class='btn btn-default btn-xs restore-column text-muted'>"
+ __('Restore') + "</button></a></li>";
+ __('Restore') + "</button></a></li>`;
}, "");
var $dropdown = $("<div class='dropdown pull-right'>" +
"<a class='text-muted dropdown-toggle' data-toggle='dropdown'>" +
@ -520,7 +520,7 @@ frappe.provide("frappe.views");
html += indicators.reduce(function(prev, curr) {
return prev + '<div \
data-action="indicator" data-indicator="'+curr+'"\
class="btn btn-default btn-xs indicator ' + curr + '"></div>';
class="btn btn-default btn-xs indicator-pill ' + curr + '"></div>';
}, "");
html += '</li>';
self.$kanban_column.find(".column-options .dropdown-menu")
@ -555,10 +555,17 @@ frappe.provide("frappe.views");
function render_card_meta() {
var html = "";
if (card.comment_count > 0)
html += '<span class="list-comment-count small text-muted ">' +
'<i class="octicon octicon-comment"></i> ' + card.comment_count +
'</span>';
html += get_assignees_html();
html +=
`<span class="list-comment-count small text-muted ">
<svg class="icon icon-sm">
<use xlink:href="#icon-small-message"></use>
</svg>
${card.comment_count}
</span>`;
assignees_html = get_assignees_html();
html += `<span class="kanban-assignments">${assignees_html}</span>`;
if (card.color && frappe.ui.color.validate_hex(card.color)) {
const $div = $('<div>');
@ -578,7 +585,7 @@ frappe.provide("frappe.views");
function add_task_link() {
let taskLink = frappe.utils.get_form_link(card.doctype, card.name);
self.$card.find('.kanban-card-redirect').attr('href', taskLink);
self.$card.find('.kanban-card-redirect').attr('href', taskLink);
}
function refresh_dialog() {
@ -597,8 +604,15 @@ frappe.provide("frappe.views");
function make_assignees() {
var d = self.edit_dialog;
var html = get_assignees_html() + '<a class="add-assignment avatar avatar-small avatar-empty">\
<i class="octicon octicon-plus text-muted" style="margin: 3px 0 0 5px;"></i></a>';
var html =
`<span class="kanban-assignments">
${get_assignees_html()}
<a class="add-assignment avatar avatar-small avatar-empty">
<svg class="icon icon-sm">
<use xlink:href="#icon-small-message"></use>
</svg>
</a>
</span>`;
d.$wrapper.find("[data-fieldname='assignees'] .control-input-wrapper").empty().append(html);
d.$wrapper.find(".add-assignment").on("click", function() {
@ -611,9 +625,7 @@ frappe.provide("frappe.views");
}
function get_assignees_html() {
return card.assigned_list.reduce(function(a, b) {
return a + frappe.avatar(b);
}, "");
return frappe.avatar_group(card.assigned_list, 3);
}
function show_assign_to_dialog() {

View file

@ -1,7 +1,7 @@
<div class="kanban-card-wrapper {{ disable_click }}" data-name="{{name}}">
<a class="kanban-card-redirect" href="#">
<div class="kanban-card content">
<div class="kanban-card-title">
<div class="kanban-card-title ellipsis" title="{{title}}">
{{ title }}
</div>
<div class="kanban-card-meta">

View file

@ -1,23 +1,26 @@
<div class="kanban-column" data-column-value="{{title}}">
<div class="kanban-column-title indicator {{indicator}}">
<span>{{ __(title) }}</span>
<div class="btn-group column-options dropdown pull-right">
<a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<button class="btn btn-default btn-xs"><span class="caret"></span></button>
</a>
<ul class="dropdown-menu" style="max-height: 300px; overflow-y: auto;">
<li><a data-action="archive">{{ __("Archive") }}</a></li>
</ul>
<div class="kanban-column-header">
<span class="kanban-column-title">
<span class="indicator-pill {{indicator}}"></span>
<span class="kanban-title">{{ __(title) }}</span>
</span>
<div class="column-options dropdown pull-right">
<a data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<svg class="icon icon-sm">
<use xlink:href="#icon-dot-horizontal"></use>
</svg>
</a>
<ul class="dropdown-menu" style="max-height: 300px; overflow-y: auto;">
<li><a class="dropdown-item" data-action="archive">{{ __("Archive") }}</a></li>
</ul>
</div>
</div>
<div class="add-card">
<div class="kanban-card-title ellipsis">
+ {{ __("Add " + doctype) }}
</div>
</div>
<div class="kanban-cards">
</div>
<div class="kanban-card add-card">
<div class="kanban-card-title">
<i class="octicon octicon-plus"></i> {{ __("Add " + doctype) }}
</div>
</div>
<div class="kanban-card new-card-area">
<textarea name="title"></textarea>

View file

@ -1,195 +1,195 @@
@import "variables.less";
// @import "variables.less";
.kanban {
min-height: ~"calc(100vh - 252px)";
background-color: @light-bg;
display: flex;
overflow: auto;
// .kanban {
// min-height: ~"calc(100vh - 252px)";
// background-color: @light-bg;
// display: flex;
// overflow: auto;
.kanban-column {
flex: 0 0 230px;
max-width: 230px;
background-color: @light-bg;
border-right: 1px solid @border-color;
padding: 15px;
// .kanban-column {
// flex: 0 0 230px;
// max-width: 230px;
// background-color: @light-bg;
// border-right: 1px solid @border-color;
// padding: 15px;
&.add-new-column {
order: 1;
border-right: none;
}
}
// &.add-new-column {
// order: 1;
// border-right: none;
// }
// }
.kanban-column-title {
margin-top: 0;
margin-bottom: 15px;
position: relative;
font-weight: bold;
font-size: 12px;
// .kanban-column-title {
// margin-top: 0;
// margin-bottom: 15px;
// position: relative;
// font-weight: bold;
// font-size: 12px;
.column-options {
// .column-options {
.button-group {
display: flex;
padding: 12px 14px;
// .button-group {
// display: flex;
// padding: 12px 14px;
.btn.indicator {
flex: 1;
}
}
// .btn.indicator {
// flex: 1;
// }
// }
.indicator::before {
margin: 0;
}
}
// .indicator::before {
// margin: 0;
// }
// }
&:hover {
cursor: pointer;
}
}
// &:hover {
// cursor: pointer;
// }
// }
.sortable-ghost > .kanban-card:not(.add-card) {
background: #ccc !important;
color: transparent;
// .sortable-ghost > .kanban-card:not(.add-card) {
// background: #ccc !important;
// color: transparent;
* {
background: transparent !important;
color: transparent !important;
}
// * {
// background: transparent !important;
// color: transparent !important;
// }
}
// }
.kanban-card {
background-color: #fff;
box-shadow: 0 1px 3px rgba(0,0,0,0.30);
border-radius: 2px;
padding: 6px 6px 6px 8px;
margin-top: 10px;
// .kanban-card {
// background-color: #fff;
// box-shadow: 0 1px 3px rgba(0,0,0,0.30);
// border-radius: 2px;
// padding: 6px 6px 6px 8px;
// margin-top: 10px;
&.add-card {
background-color: transparent;
box-shadow: none;
color: @text-muted;
// &.add-card {
// background-color: transparent;
// box-shadow: none;
// color: @text-muted;
&:hover {
box-shadow: none;
color: @text-color;
cursor: pointer;
}
// &:hover {
// box-shadow: none;
// color: @text-color;
// cursor: pointer;
// }
.octicon-plus {
top: -1px;
font-size: 1em;
margin-right: 5px;
position:relative;
}
}
}
// .octicon-plus {
// top: -1px;
// font-size: 1em;
// margin-right: 5px;
// position:relative;
// }
// }
// }
.kanban-card-wrapper {
position: relative;
// .kanban-card-wrapper {
// position: relative;
.kanban-card-redirect {
display: block;
// .kanban-card-redirect {
// display: block;
&:hover,
&:focus {
text-decoration: none;
}
}
}
// &:hover,
// &:focus {
// text-decoration: none;
// }
// }
// }
.kanban-card:hover, .new-card-area, .edit-card-area {
box-shadow: 0 2px 4px rgba(0,0,0,0.30);
}
// .kanban-card:hover, .new-card-area, .edit-card-area {
// box-shadow: 0 2px 4px rgba(0,0,0,0.30);
// }
.kanban-card-wrapper:hover {
cursor: pointer;
text-decoration: none;
// .kanban-card-wrapper:hover {
// cursor: pointer;
// text-decoration: none;
.kanban-card-edit {
opacity: 1;
}
}
// .kanban-card-edit {
// opacity: 1;
// }
// }
.kanban-card-title {
max-width: 90%;
font-size: 12px;
}
// .kanban-card-title {
// max-width: 90%;
// font-size: 12px;
// }
.kanban-card-edit {
position: absolute;
right: 10px;
opacity: 0;
transition: 0.2s ease;
}
// .kanban-card-edit {
// position: absolute;
// right: 10px;
// opacity: 0;
// transition: 0.2s ease;
// }
.new-card-area, .edit-card-area {
margin-bottom: 10px;
// .new-card-area, .edit-card-area {
// margin-bottom: 10px;
textarea {
font-size: 12px;
resize: none;
border: none;
background: none;
overflow: hidden;
word-wrap: break-word;
width: 100%;
// textarea {
// font-size: 12px;
// resize: none;
// border: none;
// background: none;
// overflow: hidden;
// word-wrap: break-word;
// width: 100%;
&:focus {
outline: none;
}
}
}
// &:focus {
// outline: none;
// }
// }
// }
.compose-column-form {
.new-column-title {
background: transparent;
border: none;
outline: none;
}
}
// .compose-column-form {
// .new-column-title {
// background: transparent;
// border: none;
// outline: none;
// }
// }
.add-new-column a:hover {
color: @text-color !important;
}
// .add-new-column a:hover {
// color: @text-color !important;
// }
.kanban-card-meta {
margin-top: 8px;
text-align: right;
// .kanban-card-meta {
// margin-top: 8px;
// text-align: right;
.avatar {
width: 16px;
height: 16px;
}
}
// .avatar {
// width: 16px;
// height: 16px;
// }
// }
.kanban-empty-state {
width: 100%;
line-height: 400px;
}
}
// .kanban-empty-state {
// width: 100%;
// line-height: 400px;
// }
// }
body[data-route*="Kanban"] {
.modal .add-assignment:hover {
// border-color: @text-color;
i {
color: @text-color !important;
}
}
}
// body[data-route*="Kanban"] {
// .modal .add-assignment:hover {
// // border-color: @text-color;
// i {
// color: @text-color !important;
// }
// }
// }
.edit-card-title {
.h4 {
margin-top: 5px;
margin-bottom: 5px;
}
span:hover {
background-color: @light-yellow;
cursor: pointer;
}
input {
border: none;
outline: none;
width: 100%;
}
}
// .edit-card-title {
// .h4 {
// margin-top: 5px;
// margin-bottom: 5px;
// }
// span:hover {
// background-color: @light-yellow;
// cursor: pointer;
// }
// input {
// border: none;
// outline: none;
// width: 100%;
// }
// }

View file

@ -0,0 +1,229 @@
.kanban {
min-height: #{"calc(100vh - 252px)"};
// background-color: @light-bg;
display: flex;
overflow: auto;
.kanban-column {
flex: 0 0 290px;
max-width: 290px;
border-right: 1px solid $border-color;
padding: 15px;
border-radius: $border-radius;
&.add-new-column {
order: 1;
border-right: none;
background-color: var(--grey-50);
}
}
.kanban-column-header {
margin-top: 0;
margin-bottom: 15px;
position: relative;
font-weight: 500;
font-size: 12px;
display: flex;
justify-content: space-between;
// align-items: center;
.indicator-pill {
padding: 2px 8px;
width: 20px;
height: 20px;
&:before{
margin-right: 0px;
}
}
.column-options {
.button-group {
display: flex;
padding: 8px;
div.indicator-pill {
margin: 0 5px;
}
.btn.indicator {
flex: 1;
}
}
.indicator::before {
margin: 0;
}
}
&:hover {
cursor: pointer;
}
}
.kanban-column-title {
font-size: $font-size-lg;
color: var(--grey-900);
display: flex;
align-items: center;
font-weight: normal;
// margin-left: 10px;
.kanban-title {
margin-left: 10px;
}
}
.sortable-ghost > .kanban-card:not(.add-card) {
background: #ccc !important;
color: transparent;
* {
background: transparent !important;
color: transparent !important;
}
}
.kanban-card {
background-color: #fff;
background: #FFFFFF;
box-shadow: 0px 0px 2px rgba(17, 43, 66, 0.16), 0px 1px 5px rgba(17, 43, 66, 0.1);
border-radius: 8px;
padding: 10px 14px;
margin-top: 10px;
width: 260px;
min-height: 100px;
display: flex;
justify-content: space-between;
flex-direction: column;
}
.add-card {
justify-content: center;
display: flex;
align-items: center;
color: var(--grey-700);
background-color: var(--grey-100);
box-shadow: none;
height: 28px;
border-radius: 8px;
&:hover {
box-shadow: none;
color: $text-color;
cursor: pointer;
}
.octicon-plus {
top: -1px;
font-size: 1em;
margin-right: 5px;
position:relative;
}
}
.kanban-card-wrapper {
position: relative;
.kanban-card-redirect {
display: block;
&:hover,
&:focus {
text-decoration: none;
}
}
}
.kanban-card:hover, .new-card-area, .edit-card-area {
box-shadow: 0 2px 4px rgba(0,0,0,0.30);
}
.kanban-card-wrapper:hover {
cursor: pointer;
text-decoration: none;
.kanban-card-edit {
opacity: 1;
}
}
.kanban-card-title {
max-width: 90%;
font-size: $font-size-base;
}
.kanban-card-edit {
position: absolute;
right: 10px;
opacity: 0;
transition: 0.2s ease;
}
.new-card-area, .edit-card-area {
margin-bottom: 10px;
textarea {
font-size: 12px;
resize: none;
border: none;
background: none;
overflow: hidden;
word-wrap: break-word;
width: 100%;
&:focus {
outline: none;
}
}
}
.compose-column-form {
.new-column-title {
background: transparent;
border: none;
outline: none;
}
}
.add-new-column a:hover {
color: $text-color !important;
}
.kanban-card-meta {
.kanban-assignments {
float: right;
}
}
.kanban-empty-state {
width: 100%;
line-height: 400px;
}
}
body[data-route*="Kanban"] {
.modal .add-assignment:hover {
// border-color: @text-color;
i {
color: $text-color !important;
}
}
}
.edit-card-title {
.h4 {
margin-top: 5px;
margin-bottom: 5px;
}
span:hover {
// background-color: @light-yellow;
cursor: pointer;
}
input {
border: none;
outline: none;
width: 100%;
}
}

View file

@ -21,6 +21,7 @@
@import "report";
@import "frappe-datatable";
@import "image-view";
@import "kanban";
@import "frappe/public/css/font-awesome";
@import "multilevel-dropdown";