Skip to content
Permalink
Browse files

Visual reply

  • Loading branch information...
Thoulah committed Apr 4, 2019
1 parent 490562e commit 6b689d0b55b5c48302c265e7b1588d6331be83a9
@@ -1,3 +1,6 @@
/mister42/Secrets.php
/mister42/controllers/TestController.php
/mister42/models/test/
/mister42/views/test/
/webroot/.htaccess
/webroot/php.ini
@@ -26,6 +26,7 @@
"2amigos/yii2-usuario": "~1.0",
"codemix/yii2-localeurls": "^1.7",
"gkralik/php-uglifyjs": "^1.0",
"tecnickcom/tcpdf": "^6.2",
"mpdf/mpdf": "^8.0",
"kop/yii2-scroll-pager": "*",
"nezhelskoy/yii2-highlight": "*",

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -30,7 +30,6 @@ public function getValues(): array {
}
private function getComponents(): array {
$mr42components = (new \mr42\Web())->getComponents();
return [
'assetManager' => [
'basePath' => '@assetsroot',
@@ -144,12 +143,12 @@ private function getComponents(): array {
'<alias:\w+>' => 'site/<alias>',
],
],
'urlManagerAssets' => [
'class' => 'codemix\localeurls\UrlManager',
'urlManagerMr42' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'baseUrl' => $this->params['shortDomain'],
'rules' => $mr42components['urlManager']['rules'],
'rules' => ((new \mr42\Web())->getComponents())['urlManager']['rules'],
],
];
}
@@ -55,7 +55,7 @@ public function actionArticle(int $id, string $title = ''): string {
if ($title !== $model->url)
$this->redirect(['article', 'id' => $model->id, 'title' => $model->url], 301)->send();
Yii::$app->view->registerLinkTag(['rel' => 'canonical', 'href' => Url::to(['permalink/articles', 'id' => $model->id])]);
Yii::$app->view->registerLinkTag(['rel' => 'canonical', 'href' => Yii::$app->urlManagerMr42->createUrl(['/permalink/articles', 'id' => $model->id])]);
if ($model->pdf)
Yii::$app->view->registerLinkTag(['rel' => 'alternate', 'href' => Url::to(['pdf', 'id' => $model->id, 'title' => $model->url], true), 'type' => 'application/pdf', 'title' => $model->title]);
@@ -5,4 +5,4 @@

<?= $comment->content.PHP_EOL ?>

<?= Yii::$app->urlManagerAssets->createUrl(['/permalink/articles', 'id' => $model->id]) ?>
<?= Yii::$app->urlManagerMr42->createUrl(['/permalink/articles', 'id' => $model->id]) ?>
@@ -3,5 +3,5 @@
?>
<p>Hello <?= $comment->name ?>,</p>

<p>You receive this email to confirm you have posted a comment on the article "<?= Html::a($model->title, Yii::$app->urlManagerAssets->createUrl(['/permalink/articles', 'id' => $model->id])) ?>".
<p>You receive this email to confirm you have posted a comment on the article "<?= Html::a($model->title, Yii::$app->urlManagerMr42->createUrl(['/permalink/articles', 'id' => $model->id])) ?>".
It will not be visible until approved by an administrator, who are also notified.</p>
@@ -8,8 +8,6 @@
use yii\helpers\FileHelper;
class Pdf {
protected $this;
public function create(string $filename, string $content, int $updated, array $params): string {
$filename = Yii::getAlias($filename.'.pdf');
$created = $params['created'] ?? $updated;
@@ -97,7 +97,7 @@ public static function buildPdf(Articles $model): string {
'author' => $name,
'created' => $model->created,
'footer' => implode('|', ["{$tags}: {$model->tags}", "Author: {$name}", 'Page {PAGENO} of {nb}']),
'header' => implode('|', [Html::a(Yii::$app->name, Yii::$app->params['shortDomain']), Html::a($model->title, Yii::$app->urlManagerAssets->createUrl(['/permalink/articles', 'id' => $model->id])), date('D, j M Y', $model->updated)]),
'header' => implode('|', [Html::a(Yii::$app->name, Yii::$app->params['shortDomain']), Html::a($model->title, Yii::$app->urlManagerMr42->createUrl(['/permalink/articles', 'id' => $model->id])), date('D, j M Y', $model->updated)]),
'keywords' => $model->tags,
'subject' => $model->title,
'title' => $model->title,
@@ -79,7 +79,7 @@ public function sendCommentMail(Articles $model, self $comment): void {
['model' => $model, 'comment' => $comment]
)
->setTo([$model->author->email => $model->author->username])
->setFrom([$secrets['params']['noreplyEmail'] => Yii::$app->name])
->setFrom([$comment->email => $comment->name])
->setSubject("A new comment has been posted on '{$model->title}'.")
->send();
@@ -35,7 +35,7 @@
endif;
$bar[] = Yii::$app->icon->show('clock', ['class' => 'text-muted mr-1']).Html::tag('time', Yii::$app->formatter->asRelativeTime($comment->created), ['datetime' => date(DATE_W3C, $comment->created)]);
$bar[] = Yii::$app->icon->show('user', ['class' => 'text-muted mr-1']).$comment->name.($data->authorId === $comment->user ? Html::tag('sup', Yii::t('mr42', 'Article Author'), ['class' => 'ml-1 badge badge-secondary']) : '');
$bar[] = Yii::$app->icon->show('user', ['class' => 'text-muted mr-1']).$comment->name.($data->authorId === $comment->user ? Html::tag('span', Yii::t('mr42', 'Article Author'), ['class' => 'ml-1 badge badge-info']) : '');
if (!empty($comment->website))
$bar[] = Yii::$app->icon->show('globe', ['class' => 'text-muted mr-1']).Html::a($comment->website, $comment->website);
echo Html::tag('div', implode(' · ', $bar));
@@ -61,7 +61,7 @@
endif;
$bar[] = Yii::$app->icon->show('clock', ['class' => 'text-muted mr-1']).Html::tag('time', Yii::$app->formatter->asRelativeTime($reply->created), ['datetime' => date(DATE_W3C, $reply->created)]);
$bar[] = Yii::$app->icon->show('user', ['class' => 'text-muted mr-1']).$reply->name.($data->authorId === $reply->user ? Html::tag('sup', Yii::t('mr42', 'Article Author'), ['class' => 'ml-1 badge badge-secondary']) : '');
$bar[] = Yii::$app->icon->show('user', ['class' => 'text-muted mr-1']).$reply->name.($data->authorId === $reply->user ? Html::tag('span', Yii::t('mr42', 'Article Author'), ['class' => 'ml-1 badge badge-info']) : '');
if (!empty($reply->website))
$bar[] = Yii::$app->icon->show('globe', ['class' => 'text-muted mr-1']).Html::a($reply->website, $reply->website);
echo Html::tag('div', implode(' · ', $bar));
@@ -39,7 +39,7 @@
'template' => '{label} <div id="chars" class="float-right"></div><div class="input-group">'.Yii::$app->icon->fieldAddon('comment').'{input}</div> {hint} {error}'
])
->textarea(['id' => 'formContent', 'rows' => 6, 'tabindex' => ++$tab])
->hint(Yii::t('mr42', 'You may use {markdown}. HTML is not allowed.', ['markdown' => Html::a(Yii::t('mr42', 'Markdown Syntax'), ['/permalink/articles', 'id' => 4], ['target' => '_blank'])]));
->hint(Yii::t('mr42', 'You may use {markdown}. HTML is not allowed.', ['markdown' => Html::a(Yii::t('mr42', 'Markdown Syntax'), Yii::$app->urlManagerMr42->createUrl(['/permalink/articles', 'id' => 4]), ['target' => '_blank'])]));
if (Yii::$app->user->isGuest)
echo $form->field($model, 'captcha')->widget(ReCaptcha::class)->label(false);
@@ -56,7 +56,7 @@
echo Html::tag('div', $author, ['class' => 'card-footer']);
echo Html::beginTag('div', ['class' => 'card-footer']);
$bar[] = Yii::$app->icon->show('link', ['class' => 'mr-1 text-muted']).Html::a(Yii::t('mr42', 'Permalink'), Yii::$app->urlManagerAssets->createUrl(['/permalink/articles', 'id' => $model->id]));
$bar[] = Yii::$app->icon->show('link', ['class' => 'mr-1 text-muted']).Html::a(Yii::t('mr42', 'Permalink'), Yii::$app->urlManagerMr42->createUrl(['/permalink/articles', 'id' => $model->id]));
$commentText = Yii::t('mr42', '{results, plural, =0{no comments yet} =1{1 comment} other{# comments}}', ['results' => count($model->comments)]);
$bar[] = Yii::$app->icon->show('comment', ['class' => 'mr-1 text-muted']).Html::a($commentText, ['article', 'id' => $model->id, 'title' => $model->url, '#' => 'comments']);
@@ -57,7 +57,7 @@
endforeach;
$doc->startElement('guid');
$doc->writeAttribute('isPermaLink', 'true');
$doc->text(Yii::$app->urlManagerAssets->createUrl(['/permalink/articles', 'id' => $article->id]));
$doc->text(Yii::$app->urlManagerMr42->createUrl(['/permalink/articles', 'id' => $article->id]));
$doc->endElement();
$doc->writeElement('pubDate', date(DATE_RSS, $article->created));
if ($article->source) :
@@ -38,7 +38,7 @@
->label(false);
ActiveForm::end();
if ($this->beginCache('articlewidgets', ['dependency' => $dependency, 'duration' => 0, 'enabled' => !YII_DEBUG, 'variations' => Yii::$app->language])) :
if ($this->beginCache('articlewidgets', ['dependency' => $dependency, 'duration' => 0, 'enabled' => !YII_DEBUG, 'variations' => [Yii::$app->language]])) :
$widgets = [
Yii::t('mr42', 'Recent Articles') => ['class' => RecentArticles::widget(), 'icon' => 'newspaper'],
Yii::t('mr42', 'Recent Comments') => ['class' => RecentComments::widget(), 'icon' => 'comments'],
@@ -41,7 +41,20 @@
elseif ($track->wip) :
echo Html::tag('i', 'Work in Progress');
else :
echo Html::img('@assets/images/TrebleClef.png');
echo Html::tag('strong', 'Instrumental');
echo Html::beginTag('svg', ['viewBox' => '0 0 473.254 473.253', 'xmlns' => 'http://www.w3.org/2000/svg']);
echo Html::tag('title', 'Instrumental');
echo Html::tag('path', null, ['d' => 'M200.923,55.916l14.413-16.681C180.331,21.524,143.528,8.101,106.907,0.267c-12.968-2.771-19.955,16.861-6.869,19.664 C134.9,27.383,168.781,39.782,200.923,55.916z']);
echo Html::tag('path', null, ['d' => 'M461.853,388.945c-1.463-79.64-46.237-168.853-96.771-231.034l-13.753,15.911c17.921,22.428,32.965,47.001,45.912,72.835 c20.859,41.621,42.972,93.781,43.83,140.893C441.314,400.868,462.097,402.374,461.853,388.945z']);
echo Html::tag('path', null, ['d' => 'M288.398,181.493l13.811-15.985c-24.241-24.742-52.169-47.164-82.349-66.341l-14.403,16.667 c29.491,18.714,56.994,40.491,81.724,64.429C287.602,180.659,287.979,181.082,288.398,181.493z']);
echo Html::tag('path', null, ['d' => 'M62.741,56.104c36.385,7.783,71.727,20.907,105.111,38.091l14.371-16.633C145.979,58.783,107.7,44.581,69.609,36.44 C56.631,33.668,49.654,53.303,62.741,56.104z']);
echo Html::tag('path', null, ['d' => 'M395.714,372.034c4.7,17.4,7.75,34.865,8.059,51.684c0.245,13.325,21.027,14.836,20.783,1.402 c-1.443-78.104-44.526-165.406-93.866-227.401l-13.746,15.914c11.614,14.962,21.965,30.853,31.322,47.399 c7.57,0.021,14.752,3.427,19.713,9.365c21.451,25.632,44.519,62.536,32.572,92.82C399.305,366.383,397.609,369.273,395.714,372.034 z']);
echo Html::tag('path', null, ['d' => 'M285.173,250.388c-0.613,0.754-1.25,1.483-1.899,2.2l-5.635,6.504c9.466,12.808,18.074,26.241,25.965,40.146l14.735-17.304 c-8.524-13.665-17.549-26.693-26.862-38.832l-6.02,6.957L285.173,250.388z']);
echo Html::tag('path', null, ['d' => 'M342.387,352.245c0.201-2.477-1.042-5.658-3.526-9.213c-2.593,3.034-5.482,6.416-8.456,9.91 c1.379,3.122,2.737,6.28,4.072,9.47C339.189,358.946,342.127,355.294,342.387,352.245z']);
echo Html::tag('path', null, ['d' => 'M18.402,94.87c14.481,3.1,28.788,7.099,42.886,11.802c7.827-5.945,17.214-10.201,27.415-12.455 C67.746,86.202,46.48,79.736,25.271,75.198C12.291,72.435,5.309,92.075,18.402,94.87z']);
echo Html::tag('path', null, ['d' => 'M347.4,397.3c6.933,21.812,11.638,44.014,12.03,65.193c0.236,13.324,21.019,14.827,20.774,1.391 c-0.429-23.476-4.721-47.776-11.722-71.989C362.26,394.235,355.227,396.042,347.4,397.3z']);
echo Html::tag('path', null, ['d' => 'M168.108,159.057c9.875,6.508,19.499,13.377,28.875,20.534c7.079-4.222,15.214-7.308,24.045-8.917 c-12.297-10-25.225-19.399-38.586-28.216L168.108,159.057z']);
echo Html::tag('path', null, ['d' => 'M231.075,258.379c1.515,0,3.048-0.057,4.592-0.169c12.594-0.921,23.702-5.53,31.765-12.25 c2.285-1.912,4.373-3.958,6.12-6.182l0.016,0.02l7.971-9.219l25.315-29.304l13.693-15.843l20.554-23.784l13.269-15.364l0.453-0.521 l28.196-32.632L235.613,41.796l-0.996-0.864l-5.009,5.793l-14.407,16.673L196.37,85.19l-14.353,16.613l-22.696,26.267l-8.51,9.854 c-3.342-17.28-22.414-29.849-45.262-29.849c-1.519,0-3.047,0.054-4.584,0.164c-7.498,0.549-14.471,2.427-20.608,5.244 c-15.413,7.081-25.443,20.301-24.393,34.714c1.382,18.967,21.432,33.176,45.729,33.176c1.515,0,3.048-0.052,4.593-0.165 c13.685-0.996,25.655-6.335,33.836-14.034l0.134,0.116l1.356-1.573c1.108-1.142,2.142-2.322,3.078-3.561l10.031-11.609 l14.345-16.599l22.838-26.429l14.42-16.691l9.867-11.423l78.318,37.9l49.428,23.922l-10.427,12.066l-20.479,23.702l-13.661,15.807 l-19.159,22.179c-3.158-16.487-20.675-28.561-42.094-29.691c-1.066-0.054-2.099-0.22-3.179-0.22c-1.519,0-3.047,0.054-4.584,0.167 c-7.241,0.525-13.976,2.292-19.957,4.951c-15.781,7.011-26.11,20.397-25.042,35.005 C186.729,244.172,206.78,258.379,231.075,258.379z']);
echo Html::tag('path', null, ['d' => 'M363.479,289.969c-2.693-3.586-5.282-6.805-7.538-9.505c-2.101-2.505-4.921-3.739-7.767-3.739 c-2.941,0-5.903,1.326-8.095,3.907l-13.201,15.497l-15.216,17.877l-16.347,19.195c-2.048-3.627-4.708-6.969-8.051-9.806 c-6.837-5.827-15.2-8.669-23.535-8.669c-10.271,0-20.482,4.328-27.667,12.772c-13.011,15.276-11.173,38.198,4.104,51.211 c6.828,5.811,15.199,8.664,23.52,8.664c5.306,0,10.587-1.15,15.452-3.435c6.06-2.838,13.473-10.933,17.825-16.002 c7.069-8.255,17.604-20.59,26.257-30.74c8.375-9.814,14.987-17.589,14.987-17.589c0.998,0.857,1.796,1.663,2.717,2.5 c16.099,14.712,19.06,26.771,16.122,36.208c-2.645,8.495-9.935,14.851-16.582,19.066c-0.521,0.329-1.042,0.674-1.552,0.975 c-4.761,2.837-5.373,4.436-1.662,4.436c0.761,0,1.711-0.068,2.845-0.196c0.766-0.1,1.45-0.232,2.192-0.332 c8.548-1.194,15.677-3.002,21.56-5.302c16.911-6.633,23.552-17.364,24.177-29.531C389.006,328.225,375.184,305.542,363.479,289.969 z']);
echo Html::endTag('svg');
endif;
endforeach;
@@ -71,7 +71,7 @@
'inputTemplate' => '<div class="row"><div id="chars" class="col-12 text-right"></div></div><div class="input-group">'.Yii::$app->icon->fieldAddon('info-circle').'{input}</div>',
])
->textArea(['id' => 'formContent', 'rows' => 8, 'tabindex' => ++$tab])
->hint(Yii::t('mr42', 'You may use {markdown} and {age} to show your age, calculated from <nobr>{birthday}</nobr>. HTML is not allowed.', ['markdown' => Html::a(Yii::t('mr42', 'Markdown Syntax'), ['/permalink/articles', 'id' => 4], ['target' => '_blank']), 'age' => '<code>%age%</code>', 'birthday' => Html::tag('code', $model->getAttributeLabel('birthday'))]));
->hint(Yii::t('mr42', 'You may use {markdown} and {age} to show your age, calculated from <nobr>{birthday}</nobr>. HTML is not allowed.', ['markdown' => Html::a(Yii::t('mr42', 'Markdown Syntax'), Yii::$app->urlManagerMr42->createUrl(['/permalink/articles', 'id' => 4]), ['target' => '_blank']), 'age' => '<code>%age%</code>', 'birthday' => Html::tag('code', $model->getAttributeLabel('birthday'))]));
echo $form->field($model, 'timezone', [
'inputTemplate' => '<div class="input-group">'.Yii::$app->icon->fieldAddon('clock').'{input}</div>',
@@ -12,6 +12,7 @@ public function run(): string {
->orderBy(['created' => SORT_DESC])
->with('article')
->where(['active' => true])
->andWhere(['parent_comment' => null])
->limit($this->limit)
->all();
Oops, something went wrong.

0 comments on commit 6b689d0

Please sign in to comment.
You can’t perform that action at this time.