Skip to content

Commit

Permalink
Change: prevent user from drag/drop readonly issues
Browse files Browse the repository at this point in the history
Fixes #109
  • Loading branch information
satrun77 committed Jul 10, 2016
1 parent 6ac5ea6 commit 507318d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
10 changes: 8 additions & 2 deletions app/Model/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,17 @@ public function canView()
/**
* Whether or not the tag to mark issue as ready only.
*
* @param User $user
*
* @return bool
*/
public function isReadOnly()
public function isReadOnly(User $user = null)
{
return (boolean) $this->readonly;
if (is_null($user)) {
return (boolean) $this->readonly;
}

return (boolean) $this->readonly && $user->role_id <= $this->readonly;
}

/**
Expand Down
Binary file added resources/assets/images/icons/lock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions resources/assets/less/app/kanban.less
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,18 @@
padding-right: 2px;
}
}

.readonly {
.issue {
background: #fff url(../../images/icons/lock.png) no-repeat left 83%;
background-size: 20px;
border-right: 1px solid;
border-top: 1px solid;
border-bottom: 1px solid;
box-shadow: none;
cursor: default;
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ function Kanban() {
}

var win = $(window);
container = kanban.find(".column .content");
container = kanban.find(".column .content:not(.readonly)");
task = kanban.find('.issue');
setKanbantWidth = function () {
var bodyWidth = win.width();
Expand Down
2 changes: 1 addition & 1 deletion resources/views/user/issues-kanban.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<div class="arrowcaption" style="color:{{ $column->bgcolor or 'gray' }};">{{ $column->name }}</div>
<div class="arrow"></div>

<div class="content" data-column="{{ $column->id }}">
<div class="content @if($column->isReadOnly(auth()->user()))readonly @endif" data-column="{{ $column->id }}">
@if ($issues->get($column->name))
@foreach($issues->get($column->name) as $issue)
<div class="issue issue-{{ $issue->id }}"
Expand Down

0 comments on commit 507318d

Please sign in to comment.