mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Fix star board.
Thanks to xet7 !
This commit is contained in:
parent
df9fba4765
commit
8711b476be
5 changed files with 45 additions and 18 deletions
|
|
@ -16,13 +16,6 @@ template(name="boardHeaderBar")
|
||||||
a.board-header-btn(class="{{#if currentUser.isBoardAdmin}}js-edit-board-title{{else}}is-disabled{{/if}}" title="{{_ 'edit'}}" value=title)
|
a.board-header-btn(class="{{#if currentUser.isBoardAdmin}}js-edit-board-title{{else}}is-disabled{{/if}}" title="{{_ 'edit'}}" value=title)
|
||||||
| ✏️
|
| ✏️
|
||||||
|
|
||||||
a.board-header-btn.js-star-board(class="{{#if isStarred}}is-active{{/if}}"
|
|
||||||
title="{{#if isStarred}}{{_ 'star-board-short-unstar'}}{{else}}{{_ 'star-board-short-star'}}{{/if}}" aria-label="{{#if isStarred}}{{_ 'star-board-short-unstar'}}{{else}}{{_ 'star-board-short-star'}}{{/if}}")
|
|
||||||
| {{#if isStarred}}⭐{{else}}☆{{/if}}
|
|
||||||
if showStarCounter
|
|
||||||
span
|
|
||||||
= currentBoard.stars
|
|
||||||
|
|
||||||
a.board-header-btn(
|
a.board-header-btn(
|
||||||
class="{{#if currentUser.isBoardAdmin}}js-change-visibility{{else}}is-disabled{{/if}}"
|
class="{{#if currentUser.isBoardAdmin}}js-change-visibility{{else}}is-disabled{{/if}}"
|
||||||
title="{{_ currentBoard.permission}}")
|
title="{{_ currentBoard.permission}}")
|
||||||
|
|
@ -38,6 +31,13 @@ template(name="boardHeaderBar")
|
||||||
if $eq watchLevel "muted"
|
if $eq watchLevel "muted"
|
||||||
| 🔕
|
| 🔕
|
||||||
span {{_ watchLevel}}
|
span {{_ watchLevel}}
|
||||||
|
a.board-header-btn.js-star-board(title="{{_ 'star-board'}}")
|
||||||
|
if isStarred
|
||||||
|
| ⭐
|
||||||
|
else
|
||||||
|
| ☆
|
||||||
|
if showStarCounter
|
||||||
|
span.board-star-counter {{currentBoard.stars}}
|
||||||
a.board-header-btn(title="{{_ 'sort-cards'}}" class="{{#if isSortActive }}emphasis{{else}} js-sort-cards {{/if}}")
|
a.board-header-btn(title="{{_ 'sort-cards'}}" class="{{#if isSortActive }}emphasis{{else}} js-sort-cards {{/if}}")
|
||||||
| {{sortCardsIcon}}
|
| {{sortCardsIcon}}
|
||||||
span {{#if isSortActive }}{{_ 'sort-is-on'}}{{else}}{{_ 'sort-cards'}}{{/if}}
|
span {{#if isSortActive }}{{_ 'sort-is-on'}}{{else}}{{_ 'sort-cards'}}{{/if}}
|
||||||
|
|
@ -61,10 +61,6 @@ template(name="boardHeaderBar")
|
||||||
a.board-header-btn(class="{{#if currentUser.isBoardAdmin}}js-edit-board-title{{else}}is-disabled{{/if}}" title="{{_ 'edit'}}" value=title)
|
a.board-header-btn(class="{{#if currentUser.isBoardAdmin}}js-edit-board-title{{else}}is-disabled{{/if}}" title="{{_ 'edit'}}" value=title)
|
||||||
| ✏️
|
| ✏️
|
||||||
|
|
||||||
a.board-header-btn.js-star-board(class="{{#if isStarred}}is-active{{/if}}"
|
|
||||||
title="{{#if isStarred}}{{_ 'click-to-unstar'}}{{else}}{{_ 'click-to-star'}}{{/if}} {{_ 'starred-boards-description'}}")
|
|
||||||
| {{#if isStarred}}⭐{{else}}☆{{/if}}
|
|
||||||
|
|
||||||
a.board-header-btn(
|
a.board-header-btn(
|
||||||
class="{{#if currentUser.isBoardAdmin}}js-change-visibility{{else}}is-disabled{{/if}}"
|
class="{{#if currentUser.isBoardAdmin}}js-change-visibility{{else}}is-disabled{{/if}}"
|
||||||
title="{{_ currentBoard.permission}}")
|
title="{{_ currentBoard.permission}}")
|
||||||
|
|
@ -78,6 +74,11 @@ template(name="boardHeaderBar")
|
||||||
| 🔔
|
| 🔔
|
||||||
if $eq watchLevel "muted"
|
if $eq watchLevel "muted"
|
||||||
| 🔕
|
| 🔕
|
||||||
|
a.board-header-btn.js-star-board(title="{{_ 'star-board'}}")
|
||||||
|
if isStarred
|
||||||
|
| ⭐
|
||||||
|
else
|
||||||
|
| ☆
|
||||||
a.board-header-btn(title="{{_ 'sort-cards'}}" class="{{#if isSortActive }}emphasis{{else}} js-sort-cards {{/if}}")
|
a.board-header-btn(title="{{_ 'sort-cards'}}" class="{{#if isSortActive }}emphasis{{else}} js-sort-cards {{/if}}")
|
||||||
| {{sortCardsIcon}}
|
| {{sortCardsIcon}}
|
||||||
if isSortActive
|
if isSortActive
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,10 @@ BlazeComponent.extendComponent({
|
||||||
{
|
{
|
||||||
'click .js-edit-board-title': Popup.open('boardChangeTitle'),
|
'click .js-edit-board-title': Popup.open('boardChangeTitle'),
|
||||||
'click .js-star-board'() {
|
'click .js-star-board'() {
|
||||||
ReactiveCache.getCurrentUser().toggleBoardStar(Session.get('currentBoard'));
|
const boardId = Session.get('currentBoard');
|
||||||
|
if (boardId) {
|
||||||
|
Meteor.call('toggleBoardStar', boardId);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
'click .js-open-board-menu': Popup.open('boardMenu'),
|
'click .js-open-board-menu': Popup.open('boardMenu'),
|
||||||
'click .js-change-visibility': Popup.open('boardChangeVisibility'),
|
'click .js-change-visibility': Popup.open('boardChangeVisibility'),
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,9 @@ BlazeComponent.extendComponent({
|
||||||
'click .js-add-board': Popup.open('createBoard'),
|
'click .js-add-board': Popup.open('createBoard'),
|
||||||
'click .js-star-board'(evt) {
|
'click .js-star-board'(evt) {
|
||||||
const boardId = this.currentData()._id;
|
const boardId = this.currentData()._id;
|
||||||
ReactiveCache.getCurrentUser().toggleBoardStar(boardId);
|
if (boardId) {
|
||||||
|
Meteor.call('toggleBoardStar', boardId);
|
||||||
|
}
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
},
|
},
|
||||||
'click .js-clone-board'(evt) {
|
'click .js-clone-board'(evt) {
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,6 @@ template(name="headerUserBar")
|
||||||
|
|
||||||
template(name="memberMenuPopup")
|
template(name="memberMenuPopup")
|
||||||
ul.pop-over-list
|
ul.pop-over-list
|
||||||
// Bookmarks at the very top
|
|
||||||
li
|
|
||||||
a.js-open-bookmarks
|
|
||||||
| 🔖
|
|
||||||
| {{_ 'bookmarks'}}
|
|
||||||
with currentUser
|
with currentUser
|
||||||
li
|
li
|
||||||
a.js-my-cards(href="{{pathFor 'my-cards'}}")
|
a.js-my-cards(href="{{pathFor 'my-cards'}}")
|
||||||
|
|
@ -32,6 +27,11 @@ template(name="memberMenuPopup")
|
||||||
| {{_ 'globalSearch-title'}}
|
| {{_ 'globalSearch-title'}}
|
||||||
li
|
li
|
||||||
a(href="{{pathFor 'home'}}")
|
a(href="{{pathFor 'home'}}")
|
||||||
|
| ⭐
|
||||||
|
| {{_ 'my-bookmarks'}}
|
||||||
|
li
|
||||||
|
a(href="{{pathFor 'home'}}")
|
||||||
|
| 🏠
|
||||||
| 🏠
|
| 🏠
|
||||||
| {{_ 'all-boards'}}
|
| {{_ 'all-boards'}}
|
||||||
li
|
li
|
||||||
|
|
|
||||||
|
|
@ -1643,6 +1643,27 @@ Meteor.methods({
|
||||||
check(value, String);
|
check(value, String);
|
||||||
ReactiveCache.getCurrentUser().setListSortBy(value);
|
ReactiveCache.getCurrentUser().setListSortBy(value);
|
||||||
},
|
},
|
||||||
|
toggleBoardStar(boardId) {
|
||||||
|
check(boardId, String);
|
||||||
|
if (!this.userId) {
|
||||||
|
throw new Meteor.Error('not-logged-in', 'User must be logged in');
|
||||||
|
}
|
||||||
|
const user = Users.findOne(this.userId);
|
||||||
|
if (!user) {
|
||||||
|
throw new Meteor.Error('user-not-found', 'User not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if board is already starred
|
||||||
|
const starredBoards = (user.profile && user.profile.starredBoards) || [];
|
||||||
|
const isStarred = starredBoards.includes(boardId);
|
||||||
|
|
||||||
|
// Build update object
|
||||||
|
const updateObject = isStarred
|
||||||
|
? { $pull: { 'profile.starredBoards': boardId } }
|
||||||
|
: { $addToSet: { 'profile.starredBoards': boardId } };
|
||||||
|
|
||||||
|
Users.update(this.userId, updateObject);
|
||||||
|
},
|
||||||
toggleDesktopDragHandles() {
|
toggleDesktopDragHandles() {
|
||||||
const user = ReactiveCache.getCurrentUser();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
user.toggleDesktopHandles(user.hasShowDesktopDragHandles());
|
user.toggleDesktopHandles(user.hasShowDesktopDragHandles());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue