mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
Fix pin notes with grid icon..
This commit is contained in:
@@ -168,7 +168,7 @@ const QnDialogs = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
input.val(selectedUsers.map(function (value) { return value.name }));
|
input.val(selectedUsers.map(function (value) { return value.shared_user }));
|
||||||
input.trigger("change");
|
input.trigger("change");
|
||||||
|
|
||||||
$('.select2-input').on("keyup", function (event) {
|
$('.select2-input').on("keyup", function (event) {
|
||||||
|
|||||||
12
js/script.js
12
js/script.js
@@ -206,7 +206,7 @@ View.prototype = {
|
|||||||
this._editableContent(note.content);
|
this._editableContent(note.content);
|
||||||
this._editablePinned(note.ispinned);
|
this._editablePinned(note.ispinned);
|
||||||
this._editableColor(note.color);
|
this._editableColor(note.color);
|
||||||
this._editableShares(note.shared_with, note.shared_by);
|
this._editableShares(note.shared_with);
|
||||||
this._editableTags(note.tags);
|
this._editableTags(note.tags);
|
||||||
this._editableAttachts(note.attachts, !note.is_shared);
|
this._editableAttachts(note.attachts, !note.is_shared);
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ View.prototype = {
|
|||||||
color: this._editableColor(),
|
color: this._editableColor(),
|
||||||
pinned: this._editablePinned(),
|
pinned: this._editablePinned(),
|
||||||
tags: this._editableTags(),
|
tags: this._editableTags(),
|
||||||
shares: this._editableShares()
|
shared_with: this._editableShares()
|
||||||
};
|
};
|
||||||
var self = this;
|
var self = this;
|
||||||
this._notes.update(fakeNote).done(function (note) {
|
this._notes.update(fakeNote).done(function (note) {
|
||||||
@@ -514,7 +514,7 @@ View.prototype = {
|
|||||||
self._editableShares(),
|
self._editableShares(),
|
||||||
function(result, newShares) {
|
function(result, newShares) {
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
self._editableShares(newShares, []);
|
self._editableShares(newShares);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -842,16 +842,16 @@ View.prototype = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_editableShares: function(shared_with, shared_by) {
|
_editableShares: function(shared_with) {
|
||||||
if (shared_with === undefined) {
|
if (shared_with === undefined) {
|
||||||
return $("#modal-note-div .slim-share").toArray().map(function (value) {
|
return $("#modal-note-div .slim-share").toArray().map(function (value) {
|
||||||
return {
|
return {
|
||||||
id: value.getAttribute('share-id'),
|
id: value.getAttribute('share-id'),
|
||||||
name: value.textContent.trim()
|
shared_user: value.textContent.trim()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var html = Handlebars.templates['shares']({ shared_by: shared_by, shared_with: shared_with});
|
var html = Handlebars.templates['shares']({shared_with: shared_with});
|
||||||
$("#modal-note-div .note-shares").replaceWith(html);
|
$("#modal-note-div .note-shares").replaceWith(html);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -111,11 +111,11 @@ class NoteController extends Controller {
|
|||||||
* @param array $attachts
|
* @param array $attachts
|
||||||
* @param bool $pinned
|
* @param bool $pinned
|
||||||
* @param array $tags
|
* @param array $tags
|
||||||
* @param array $shares
|
* @param array $shared_with
|
||||||
* @param string $color
|
* @param string $color
|
||||||
*/
|
*/
|
||||||
public function update(int $id, string $title, string $content, array $attachts, bool $pinned, array $tags, array $shares, string $color = "#F7EB96"): JSONResponse {
|
public function update(int $id, string $title, string $content, array $attachts, bool $pinned, array $tags, array $shared_with, string $color = "#F7EB96"): JSONResponse {
|
||||||
$note = $this->noteService->update($this->userId, $id, $title, $content, $attachts, $pinned, $tags, $shares, $color);
|
$note = $this->noteService->update($this->userId, $id, $title, $content, $attachts, $pinned, $tags, $shared_with, $color);
|
||||||
if (is_null($note)) {
|
if (is_null($note)) {
|
||||||
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ class NoteService {
|
|||||||
foreach ($dbShares as $dbShare) {
|
foreach ($dbShares as $dbShare) {
|
||||||
$delete = true;
|
$delete = true;
|
||||||
foreach ($shares as $share) {
|
foreach ($shares as $share) {
|
||||||
if ($dbShare->getSharedUser() === $share['name']) {
|
if ($dbShare->getSharedUser() === $share['shared_user']) {
|
||||||
$delete = false;
|
$delete = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -272,10 +272,10 @@ class NoteService {
|
|||||||
|
|
||||||
// Add new shares
|
// Add new shares
|
||||||
foreach ($shares as $share) {
|
foreach ($shares as $share) {
|
||||||
if (!$this->noteShareMapper->existsByNoteAndUser($id, $share['name'])) {
|
if (!$this->noteShareMapper->existsByNoteAndUser($id, $share['shared_user'])) {
|
||||||
$hShare = new NoteShare();
|
$hShare = new NoteShare();
|
||||||
$hShare->setNoteId($id);
|
$hShare->setNoteId($id);
|
||||||
$hShare->setSharedUser($share['name']);
|
$hShare->setSharedUser($share['shared_user']);
|
||||||
$this->noteShareMapper->insert($hShare);
|
$this->noteShareMapper->insert($hShare);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user