-
Notifications
You must be signed in to change notification settings - Fork 11
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
Articles reactions #539
base: master
Are you sure you want to change the base?
Articles reactions #539
Changes from 9 commits
a163695
474b98d
ed8570d
c8c24db
63eefe3
13a2f09
383deab
5f6d3f3
103483c
a42aed9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,6 +178,15 @@ | |
<?= View::factory('templates/quizzes/quiz', array('quizData' => $quiz->quiz_data)); ?> | ||
<? endif ?> | ||
|
||
<div class="js_reactions-voting" data-module="reactions"> | ||
<textarea name="module-settings" hidden> | ||
{ | ||
"parent" : "js_reactions-voting", | ||
"title" : "How do you like this article?" | ||
} | ||
</textarea> | ||
</div> | ||
|
||
<?= View::factory('templates/blocks/share', array('share' => array( | ||
'offer' => 'Если вам понравилась статья, поделитесь ссылкой на нее', | ||
'url' => 'https://' . Arr::get($_SERVER, 'HTTP_HOST', Arr::get($_SERVER, 'SERVER_NAME', 'codex.so')) . '/' . $article->uri ?: 'article/' . $article->id, | ||
|
@@ -208,4 +217,7 @@ | |
->set('course', $course) | ||
?> | ||
<? endif; ?> | ||
</div> | ||
</div> | ||
|
||
|
||
<script type="text/javascript" src="/public/build/codex.bundle.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. зачем? этот бандл и так подключается в главном шаблоне всех страниц |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,4 @@ module.exports = require('@codexteam/reactions'); | |
// | ||
// } | ||
// | ||
// module.exports = new ReactionsModule(); | ||
// module.exports = new ReactionsModule(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. зачем два одинаковых по смыслу модуля? надо сделать один универсальный |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,25 @@ | ||||||
'use strict'; | ||||||
|
||||||
const reactions = require('@codexteam/reactions'); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. класс реакций и надо вынести в отдельный чанк, как сделано с редактором |
||||||
|
||||||
/** | ||||||
* Module for reactions module initialization and inserting it in a specified place on an article's page | ||||||
*/ | ||||||
|
||||||
export default class Reactions { | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/** | ||||||
* Initialize reactions on pages | ||||||
* @param {Object} settings - reactions parameters | ||||||
* @param {String} settings.parent - container's class name for reactions module | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
* @param {String} settings.title - title for reactions module | ||||||
* | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. тогда уж и массив с эмоциями можно тоже передавать через настройки |
||||||
*/ | ||||||
init(settings) { | ||||||
|
||||||
let parentElement = document.querySelector('.' + settings.parent), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. после поиска parentElement нужно проверять, нашелся ли такой. а вдруг нет? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Я изначально сделала так, что можно любой передевать селектор, но меня попросили переделать только на класс. Тоже считаю, что правильнее дать возможность передавать какой-то еще селектор There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
reactionsModule = new reactions({parent: parentElement, title: settings.title, reactions: ['👍', '❤', '👎']}); | ||||||
|
||||||
}; | ||||||
|
||||||
}; |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
эмоции можно тоже тут задавать, а не в модуле