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

Articles reactions #539

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
12 changes: 11 additions & 1 deletion www/application/views/templates/articles/article.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@
<?= View::factory('templates/quizzes/quiz', array('quizData' => $quiz->quiz_data)); ?>
<? endif ?>

<div class='reactions-page_voting'></div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Используй класс с префиксом js_



<?= 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,
Expand Down Expand Up @@ -208,4 +211,11 @@
->set('course', $course)
?>
<? endif; ?>
</div>
</div>


<script type="text/javascript" src="/public/build/codex.bundle.js"></script>
<script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мы решили отказаться от использования инлайновых скриптов. Создай модуль с методом init и вызови его через ModuleDispatcher

const parent = document.querySelector('.reactions-page_voting');
let reactionsModule = new codex.reaction({parent: parent, title: '', reactions: ['👍', '❤', '👎']});
</script>
10,364 changes: 10,364 additions & 0 deletions www/package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@
"stylelint-webpack-plugin": "^0.10.5",
"webpack": "^4.21.0",
"webpack-cli": "^3.1.2"
},
"dependencies": {
"@codexteam/reactions": "^1.0.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему dependencies, a не devDependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Потому что этот модуль нужен не во время разработки, а во время продакшена

}
}
1 change: 1 addition & 0 deletions www/public/app/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ codex.vkWidget = require('./modules/vkWidget');
codex.codeStyling = require('./modules/codeStyling');
codex.deeplinker = require('@codexteam/deeplinker');
codex.pluginsFilter = require('./modules/pluginsFilter');
codex.reaction = require('@codexteam/reactions');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может, лучше codex.reactions?


import EditorLanding from './modules/editorLanding';
codex.editorLanding = new EditorLanding();
Expand Down
24 changes: 18 additions & 6 deletions www/public/build/codex.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion www/public/build/codex.css

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions www/public/build/editor.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion www/public/build/hawk.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.