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
13 changes: 12 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,14 @@
<?= View::factory('templates/quizzes/quiz', array('quizData' => $quiz->quiz_data)); ?>
<? endif ?>

<div class='js_reactions-page_voting' data-module="reactionsCreate">
Copy link
Contributor

Choose a reason for hiding this comment

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

Придерусь к неодинаковым (одинарным|двойным) кавычкам

<textarea name="module-settings" hidden>
{
"parent" : ".js_reactions-page_voting"
Copy link
Contributor

Choose a reason for hiding this comment

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

Давай в настройки передавать просто класс, без точки. Точку для querySelector можно дописать прямо в js-модуле

}
Copy link
Member

Choose a reason for hiding this comment

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

эмоции можно тоже тут задавать, а не в модуле

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


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

Choose a reason for hiding this comment

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

зачем? этот бандл и так подключается в главном шаблоне всех страниц

10,339 changes: 10,339 additions & 0 deletions www/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@babel/preset-env": "^7.1.0",
"@codexteam/ajax": "^3.1.1",
"@codexteam/deeplinker": "^1.0.7",
"@codexteam/reactions": "^1.0.3",
"@editorjs/code": "^2.4.0",
"@editorjs/delimiter": "^1.1.0",
"@editorjs/editorjs": "^2.11.9",
Expand Down
4 changes: 4 additions & 0 deletions www/public/app/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,16 @@ codex.vkWidget = require('./modules/vkWidget');
codex.codeStyling = require('./modules/codeStyling');
codex.deeplinker = require('@codexteam/deeplinker');
codex.pluginsFilter = require('./modules/pluginsFilter');
codex.reactions = 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.

Не нужно реквайрить пакет в общую сборку. Лучше сделай это в модуле


import EditorLanding from './modules/editorLanding';
codex.editorLanding = new EditorLanding();

import ArticleCreate from './modules/articleCreate';
codex.articleCreate = new ArticleCreate();

import Reactions from './modules/reactions';
codex.reactionsCreate = new 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


module.exports = codex;

19 changes: 19 additions & 0 deletions www/public/app/js/modules/reactions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Звездочки не выровнены. Поправь, плиз

* Module for reactions init
Copy link
Contributor

Choose a reason for hiding this comment

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

Не очень понятный коммент. Можешь емко описать, что эта за класс и где он используется?

*/

export default class Reactions {

/**
* Initialize reactions on pages
* @param {Object} settings - reactions parameters
* @param {String} settings.parent - container's selector for reactions module
*/
init(settings) {

let parentElement = document.querySelector(settings.parent),
reactionsModule = new codex.reactions({parent: parentElement, title: '', reactions: ['👍', '❤', '👎']});
};
};
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.