mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
add share icon to owner's note as well
This commit is contained in:
@@ -45,6 +45,16 @@ class NoteController extends Controller {
|
|||||||
$notes = $this->notemapper->findAll($this->userId);
|
$notes = $this->notemapper->findAll($this->userId);
|
||||||
foreach($notes as $note) {
|
foreach($notes as $note) {
|
||||||
$note->setIsShared(false);
|
$note->setIsShared(false);
|
||||||
|
$sharedWith = $this->notesharemapper->getSharesForNote($note->getId());
|
||||||
|
if(count($sharedWith) > 0) {
|
||||||
|
$shareList = array();
|
||||||
|
foreach($sharedWith as $share) {
|
||||||
|
$shareList[] = $share->getSharedUser();
|
||||||
|
}
|
||||||
|
$note->setSharedWith(implode(", ", $shareList));
|
||||||
|
} else {
|
||||||
|
$note->setSharedWith(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$shareEntries = $this->notesharemapper->findForUser($this->userId);
|
$shareEntries = $this->notesharemapper->findForUser($this->userId);
|
||||||
$shares = array();
|
$shares = array();
|
||||||
|
|||||||
@@ -54,12 +54,16 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#div-content .shared-title {
|
#div-content .shared-title, #div-content .shared-title-owner {
|
||||||
float: right;
|
float: right;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#div-content .shared-title-owner {
|
||||||
|
margin-right: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
.noselect {
|
.noselect {
|
||||||
-webkit-touch-callout: none; /* iOS Safari */
|
-webkit-touch-callout: none; /* iOS Safari */
|
||||||
-webkit-user-select: none; /* Chrome/Safari/Opera */
|
-webkit-user-select: none; /* Chrome/Safari/Opera */
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class Note extends Entity implements JsonSerializable {
|
|||||||
protected $timestamp;
|
protected $timestamp;
|
||||||
protected $colorId;
|
protected $colorId;
|
||||||
protected $userId;
|
protected $userId;
|
||||||
|
protected $sharedWith;
|
||||||
protected $isShared;
|
protected $isShared;
|
||||||
|
|
||||||
protected $color;
|
protected $color;
|
||||||
@@ -29,6 +30,7 @@ class Note extends Entity implements JsonSerializable {
|
|||||||
'colorid' => $this->colorId,
|
'colorid' => $this->colorId,
|
||||||
'color' => $this->color,
|
'color' => $this->color,
|
||||||
'userid' => $this->userId,
|
'userid' => $this->userId,
|
||||||
|
'sharedwith' => $this->sharedWith,
|
||||||
'isshared' => $this->isShared
|
'isshared' => $this->isShared
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ class NoteShareMapper extends Mapper {
|
|||||||
return $this->findEntities($sql, [$groupId]);
|
return $this->findEntities($sql, [$groupId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSharesForNote($noteId) {
|
||||||
|
$sql = 'SELECT * FROM *PREFIX*quicknotes_shares WHERE note_id = ?';
|
||||||
|
return $this->findEntities($sql, [$noteId]);
|
||||||
|
}
|
||||||
|
|
||||||
public function deleteByNoteId($noteId) {
|
public function deleteByNoteId($noteId) {
|
||||||
$sql = 'DELETE FROM *PREFIX*quicknotes_shares WHERE note_id = ?';
|
$sql = 'DELETE FROM *PREFIX*quicknotes_shares WHERE note_id = ?';
|
||||||
$this->execute($sql, [$noteId]);
|
$this->execute($sql, [$noteId]);
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
<div class='icon-share shared-title' title="shared with you by {{ userid }}"></div><div id='title' class='note-title'>{{{ title }}}</div>
|
<div class='icon-share shared-title' title="shared with you by {{ userid }}"></div><div id='title' class='note-title'>{{{ title }}}</div>
|
||||||
<div id='content' class='note-content'>{{{ content }}}</div>
|
<div id='content' class='note-content'>{{{ content }}}</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
{{#if sharedwith}}
|
||||||
|
<div class='icon-share shared-title-owner' title="shared with {{ sharedwith }}"></div>
|
||||||
|
{{/if}}
|
||||||
<div id='title-editable' class='note-title'>{{{ title }}}</div>
|
<div id='title-editable' class='note-title'>{{{ title }}}</div>
|
||||||
<button class="icon-delete hide-delete-icon icon-delete-note" title="Delete"></button>
|
<button class="icon-delete hide-delete-icon icon-delete-note" title="Delete"></button>
|
||||||
<div id='content-editable' class='note-content'>{{{ content }}}</div>
|
<div id='content-editable' class='note-content'>{{{ content }}}</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user