Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endorse by course staff feature / button #32

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions nodebb-theme-harmony/templates/partials/post_bar.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
<!-- IMPORT partials/topic/sort.tpl -->
<!-- IMPORT partials/topic/tools.tpl -->

{{{ if isAdminOrGlobalMod }}}
<button component="topic/mark-unread" class="btn-ghost-sm ff-secondary d-flex gap-2 align-items-center">
<i class="fa fa-fw fa-inbox text-primary"></i>
<span class="d-none d-md-inline fw-semibold"> Endorse </span>
</button>
{{{ else }}}
status of endorsed or not
{{{ end }}}

<!-- IF loggedIn -->
<div component="topic/heart" class="topic-heart">
<a href="#" class="heart btn-ghost-sm ff-secondary" data-tid="{tid}">
Expand Down
10 changes: 10 additions & 0 deletions nodebb-theme-harmony/templates/partials/topic/topic-menu-list.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{{{ if privileges.editable }}}

<li {{{ if endorsed }}}hidden{{{ end }}}>
<a component="topic/endorse" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if endorsed }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-lock text-secondary"></i> [[topic:thread-tools.endorse]]</a>
</li>

<li {{{ if !endorsed }}}hidden{{{ end }}}>
<a component="topic/unendorse" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if !endorsed }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-unlock text-secondary"></i> [[topic:thread-tools.unendorse]]</a>
</li>


<li {{{ if locked }}}hidden{{{ end }}}>
<a component="topic/lock" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if locked }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-lock text-secondary"></i> [[topic:thread-tools.lock]]</a>
</li>
Expand Down
2 changes: 2 additions & 0 deletions public/language/en-GB/topic.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
"thread-tools.markAsUnreadForAll": "Mark Unread For All",
"thread-tools.pin": "Pin Topic",
"thread-tools.unpin": "Unpin Topic",
"thread-tools.endorse": "Endorse Topic",
"thread-tools.unendorse": "Unendorse Topic",
"thread-tools.lock": "Lock Topic",
"thread-tools.unlock": "Unlock Topic",
"thread-tools.move": "Move Topic",
Expand Down
2 changes: 2 additions & 0 deletions public/language/en-US/topic.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
"thread-tools.markAsUnreadForAll": "Mark Unread For All",
"thread-tools.pin": "Pin Topic",
"thread-tools.unpin": "Unpin Topic",
"thread-tools.endorse": "Endorse Topic",
"thread-tools.unendorse": "Unendorse Topic",
"thread-tools.lock": "Lock Topic",
"thread-tools.unlock": "Unlock Topic",
"thread-tools.move": "Move Topic",
Expand Down
16 changes: 16 additions & 0 deletions public/src/client/topic/threadTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,22 @@
return false;
});


Check failure on line 44 in public/src/client/topic/threadTools.js

View workflow job for this annotation

GitHub Actions / test

Trailing spaces not allowed
topicContainer.on('click', '[component="topic/endorse"]', function () {
console.log('#######endorse executed');
topicCommand('put', '/endorse', 'endorse');
return false;
});

topicContainer.on('click', '[component="topic/unendorse"]', function () {
console.log('#######unendorse executed');
topicCommand('del', '/endorse', 'unendorse');
return false;
});

topicContainer.on('click', '[component="topic/lock"]', function () {
console.log('#######lock executed');

topicCommand('put', '/lock', 'lock');
return false;
});
Expand Down Expand Up @@ -201,6 +216,7 @@
};

function renderMenu(container) {
console.log('####renderMenu executed');
if (!container) {
return;
}
Expand Down
17 changes: 17 additions & 0 deletions src/api/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@
});
};

topicsAPI.endorse = async function (caller, data) {
console.log('****endorse', data);
// await doTopicAction('endorse', 'event:topic_endorse', caller, {
// tids: data.tids,

Check failure on line 155 in src/api/topics.js

View workflow job for this annotation

GitHub Actions / test

Unexpected tab character
// });
await doTopicAction('lock', 'event:topic_locked', caller, {
tids: data.tids,
});
};

topicsAPI.unendorse = async function (caller, data) {
console.log('*****unendorse', data);
// await doTopicAction('unendorse', 'event:topic_unendorse', caller, {
// tids: data.tids,

Check failure on line 165 in src/api/topics.js

View workflow job for this annotation

GitHub Actions / test

Unexpected tab character
// });
};

topicsAPI.lock = async function (caller, data) {
await doTopicAction('lock', 'event:topic_locked', caller, {
tids: data.tids,
Expand Down
Loading