Skip to content
Permalink
Browse files

Complete integration of yii2-fontawesome-inline

  • Loading branch information...
Thoulah committed Jun 22, 2019
1 parent 317c376 commit cfb87b6c3bf2d9068b8c321d2aba00b41d4d72a0
@@ -16,4 +16,5 @@ install:
- travis_retry composer install --prefer-dist --no-interaction

script:
- ../vendor/bin/phpunit --verbose $PHPUNIT_FLAGS
- find $HOME -type d -name vendor
- phpunit --verbose $PHPUNIT_FLAGS
@@ -14,6 +14,7 @@
},
"require": {
"php": ">=7.3.0",
"ext-dom": "*",
"yiisoft/yii2": "~2.0.14",
"yiisoft/yii2-bootstrap4": "^2.0",
"yiisoft/yii2-httpclient": "^2.0",

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

@@ -35,9 +35,6 @@ private function getComponents(): array {
'basePath' => '@assetsroot',
'baseUrl' => '@assets',
'bundles' => [
'thoulah\fontawesome\FontAwesomeAsset' => [
'css' => [],
],
'yii\bootstrap4\BootstrapAsset' => [
'css' => [],
],
@@ -86,7 +83,10 @@ private function getComponents(): array {
],
'icon' => [
'class' => 'app\models\Icon',
'prefix' => 'icon',
'config' => [
'prefix' => 'icon',
'registerAssets' => false,
],
],
'i18n' => [
'translations' => [
@@ -103,6 +103,7 @@
'Home Telephone Number' => 'Telefonnummer (privat)',
'If you enter your email address the image will be mailed to that address.' => 'Wenn Sie Ihre E-Mail-Adresse eingeben, wird das Bild an diese Adresse geschickt.',
'If you have inquiries or other questions, please fill out the following form to contact {siteName}. Thank you.' => 'Wenn Sie Fragen haben, füllen Sie bitte das folgende Formular aus, um {siteName} zu kontaktieren. Vielen Dank.',
'Instrumental' => 'Instrumental',
'It will not be visible until approved by an administrator, who are also notified.' => 'Es wird nicht sichtbar sein, bis es von einem Administrator genehmigt wurde, der ebenfalls benachrichtigt wird.',
'JavaScript is disabled in your web browser. This tool does not work without JavaScript.' => 'JavaScript ist in Ihrem Webbrowser deaktiviert. Dieses Tool funktioniert nicht ohne JavaScript.',
'Last Day' => 'Letzter Tag',
@@ -222,6 +223,7 @@
'Updated {date}' => 'Aktualisiert am {date}',
'Use the minus sign (-) to subtract days.' => 'Verwenden Sie das Minuszeichen (-), um die Tage zu subtrahieren.',
'Validate HTML' => 'HTML validieren',
'Video' => 'Video',
'Video Phone' => 'Video-Telefon',
'View Profile' => 'Profil ansehen',
'WEP' => 'WEP',
@@ -240,6 +242,7 @@
'With this calculator you can check the date and time in any timezone around the world.' => 'Mit diesem Rechner können Sie Datum und Uhrzeit in jeder Zeitzone auf der ganzen Welt überprüfen.',
'Work Address' => 'Adresse (arbeit)',
'Work Telephone Number' => 'Telefonnummer (arbeit)',
'Work in Progress' => 'In Bearbeitung',
'Year' => 'Jahr',
'You cannot renew your subscription for more than three years.' => 'Sie können Ihr Abonnement nicht länger als drei Jahre verlängern.',
'You may use {markdown} and {age} to show your age, calculated from <nobr>{birthday}</nobr>. HTML is not allowed.' => 'Sie können {markdown} und {age} verwenden, um Ihr Alter anzuzeigen, berechnet von <nobr>{birthday}</nobr>. HTML ist nicht erlaubt.',
@@ -103,6 +103,7 @@
'Home Telephone Number' => 'Домашний телефонный номер',
'If you enter your email address the image will be mailed to that address.' => 'Если вы укажете свой адрес электронной почты, изображение будет отправлено на этот адрес.',
'If you have inquiries or other questions, please fill out the following form to contact {siteName}. Thank you.' => 'Если у вас есть вопросы или другие вопросы, заполните следующую форму, чтобы связаться с {siteName}. Спасибо.',
'Instrumental' => 'Творительный',
'It will not be visible until approved by an administrator, who are also notified.' => 'Он не будет виден до тех пор, пока не будет одобрен администратором, который также получит уведомление.',
'JavaScript is disabled in your web browser. This tool does not work without JavaScript.' => 'JavaScript отключен в вашем веб-браузере. Этот инструмент не работает без JavaScript.',
'Last Day' => 'Последний сутки',
@@ -222,6 +223,7 @@
'Updated {date}' => 'Обновлено {date}',
'Use the minus sign (-) to subtract days.' => 'Используйте знак минус (-) для вычитания дней.',
'Validate HTML' => 'Проверить HTML',
'Video' => 'Видео',
'Video Phone' => 'Видео-телефон',
'View Profile' => 'Просмотреть профиль',
'WEP' => 'WEP',
@@ -240,6 +242,7 @@
'With this calculator you can check the date and time in any timezone around the world.' => 'С помощью этого калькулятора вы можете проверить дату и время в любом часовом поясе по всему миру.',
'Work Address' => 'Рабочий адрес',
'Work Telephone Number' => 'Рабочий номер телефона',
'Work in Progress' => 'Работа в процессе',
'Year' => 'Год',
'You cannot renew your subscription for more than three years.' => 'Вы не можете продлить подписку на более чем три года.',
'You may use {markdown} and {age} to show your age, calculated from <nobr>{birthday}</nobr>. HTML is not allowed.' => 'Вы можете использовать {markdown} и {age}, чтобы показать свой возраст, рассчитанный с <nobr>{birthday}</nobr>. HTML не разрешен.',
@@ -9,7 +9,7 @@ public function togglePassword($model, int $tab, array $options = []): string {
$this->getView()->registerJs("var togglePassword = {lang:{hide:'".Yii::t('mr42', 'Hide Password')."', show:'".Yii::t('mr42', 'Show Password')."'}};".Yii::$app->formatter->jspack('togglePassword.js'), View::POS_READY);
Html::addCssClass($options, 'form-group');
return $this->field($model, 'password', [
'inputTemplate' => '<div class="input-group" id="pwdToggle">'.Yii::$app->icon->activeFieldIcon('lock').'{input}<span class="input-group-append">'.Html::button(Yii::$app->icon->show('eye', ['class' => 'append']).Yii::$app->icon->show('eye-slash', ['class' => 'd-none append']), ['class' => 'btn btn-primary', 'title' => Yii::t('mr42', 'Show Password')]).'</span></div>',
'inputTemplate' => '<div class="input-group" id="pwdToggle">'.Yii::$app->icon->name('lock')->activeFieldIcon().'{input}<span class="input-group-append">'.Html::button(Yii::$app->icon->name('eye')->class('append').Yii::$app->icon->name('eye-slash')->class('append d-none'), ['class' => 'btn btn-primary', 'title' => Yii::t('mr42', 'Show Password')]).'</span></div>',
'options' => $options,
])->passwordInput(['tabindex' => $tab]);
}
@@ -1,12 +1,13 @@
<?php
namespace app\models;
use yii\bootstrap4\Html;
use yii\helpers\ArrayHelper;
use Yii;
class Icon extends \thoulah\fontawesome\Icon {
public function instrumental(array $options = []): string {
$svg = $this->loadSvg('@assetsroot/images/instrumental.svg');
ArrayHelper::setValue($options, 'title', 'Instrumental');
return $this->processSvg($svg, $options);
class Icon extends \thoulah\fontawesome\IconComponent {
public function instrumental(): self {
$this->icon['fontAwesomeFolder'] = '@assetsroot';
$this->icon['style'] = '';
$this->icon['name'] = 'images/instrumental';
$this->icon['title'] = Yii::t('mr42', 'Instrumental');
return $this;
}
}
@@ -46,9 +46,9 @@ public function getUrlList($items = null): array {
private function getData(): array {
return [
['label' => Yii::$app->icon->show('certificate').Html::tag('span', 'Test'), 'url' => ['/test/index'], 'visible' => $this->isAdmin()],
['label' => Yii::$app->icon->show('newspaper').Html::tag('span', Yii::t('mr42', 'Articles')), 'url' => ['/articles/index'], 'visible' => true, 'active' => Yii::$app->controller->id === 'articles'],
['label' => Yii::$app->icon->show('calculator').Html::tag('span', Yii::t('mr42', 'Calculator')),
['label' => Yii::$app->icon->name('certificate').Html::tag('span', 'Test'), 'url' => ['/test/index'], 'visible' => $this->isAdmin()],
['label' => Yii::$app->icon->name('newspaper').Html::tag('span', Yii::t('mr42', 'Articles')), 'url' => ['/articles/index'], 'visible' => true, 'active' => Yii::$app->controller->id === 'articles'],
['label' => Yii::$app->icon->name('calculator').Html::tag('span', Yii::t('mr42', 'Calculator')),
'items' => [
['label' => Yii::t('mr42', 'Date (add/subtract)'), 'url' => ['/calculator/date']],
['label' => Yii::t('mr42', 'Date to Date (duration)'), 'url' => ['/calculator/duration']],
@@ -58,7 +58,7 @@ private function getData(): array {
['label' => Yii::t('mr42', 'Wifi Protected Access Pre-Shared Key'), 'url' => ['/calculator/wpapsk']],
],
],
['label' => Yii::$app->icon->show('tools').Html::tag('span', Yii::t('mr42', 'Tools')),
['label' => Yii::$app->icon->name('tools').Html::tag('span', Yii::t('mr42', 'Tools')),
'items' => [
['label' => Yii::t('mr42', 'Barcode Generator'), 'url' => ['/tools/barcode']],
['label' => Yii::t('mr42', 'Browser Headers'), 'url' => ['/tools/headers']],
@@ -70,13 +70,13 @@ private function getData(): array {
['label' => Yii::t('mr42', 'QR Code Generator'), 'url' => ['/tools/qr']],
],
],
['label' => Yii::$app->icon->show('music').Html::tag('span', Yii::t('mr42', 'Music')),
['label' => Yii::$app->icon->name('music').Html::tag('span', Yii::t('mr42', 'Music')),
'items' => [
['label' => Yii::t('mr42', 'Collection'), 'url' => ['/music/collection']],
['label' => Yii::t('mr42', 'Lyrics'), 'url' => ['/music/lyrics'], 'visible' => true],
],
],
['label' => Yii::$app->icon->show('share-alt').Html::tag('span', Yii::$app->name),
['label' => Yii::$app->icon->name('share-alt').Html::tag('span', Yii::$app->name),
'items' => [
['label' => Yii::t('mr42', 'Contact'), 'url' => ['/my/contact']],
['label' => Yii::t('mr42', 'My Pi'), 'url' => ['/my/pi']],
@@ -87,7 +87,7 @@ private function getData(): array {
private function getUserMenu(): array {
if ($this->isGuest())
return [['label' => Yii::$app->icon->show('sign-in-alt').Html::tag('span', Yii::t('usuario', 'Login')), 'url' => ['/user/security/login'], 'visible' => true]];
return [['label' => Yii::$app->icon->name('sign-in-alt').Html::tag('span', Yii::t('usuario', 'Login')), 'url' => ['/user/security/login'], 'visible' => true]];
if ($this->isAdmin()) :
$subMenu[] = ['label' => Yii::t('mr42', 'Create Article'), 'url' => ['/articles/create']];
@@ -105,7 +105,7 @@ private function getUserMenu(): array {
$unread = $this->isAdmin() ? ArticlesComments::find()->where(['not', ['active' => true]])->count() : 0;
$unreadBadge = $unread > 0 ? Html::tag('sup', $unread, ['class' => 'badge badge-info ml-1']) : '';
return [['label' => Yii::$app->icon->show('user-circle').Html::tag('span', Yii::$app->user->identity->username.$unreadBadge), 'items' => $subMenu]];
return [['label' => Yii::$app->icon->name('user-circle').Html::tag('span', Yii::$app->user->identity->username.$unreadBadge), 'items' => $subMenu]];
}
private function isAdmin(): bool {
@@ -65,8 +65,8 @@ public function afterFind(): void {
public function showApprovalButton(): string {
return Html::a(
$this->active
? Yii::$app->icon->show('thumbs-down', ['class' => 'mr-1']).Yii::t('mr42', 'Renounce')
: Yii::$app->icon->show('thumbs-up', ['class' => 'mr-1']).Yii::t('mr42', 'Approve'),
? Yii::$app->icon->name('thumbs-down')->class('mr-1').Yii::t('mr42', 'Renounce')
: Yii::$app->icon->name('thumbs-up')->class('mr-1').Yii::t('mr42', 'Approve'),
['togglecomment', 'id' => $this->id],
['class' => $this->active ? 'btn btn-sm btn-outline-warning ml-1' : 'btn btn-sm btn-outline-success ml-1']
);
@@ -7,6 +7,7 @@
class Lyrics3Tracks extends \yii\db\ActiveRecord {
public $max;
public $nameExtra;
public $icons;
public $video;
public static function tableName(): string {
@@ -20,6 +21,15 @@ public function afterFind(): void {
$this->video_status = boolval($this->video_status);
$this->wip = boolval($this->wip);
$this->video = $this->video_source && $this->video_id && $this->video_ratio && $this->video_status ? Video::getEmbed($this->video_source, $this->video_id, $this->video_ratio) : null;
$icons = [];
if ($this->video)
$icons[] = Yii::$app->icon->name($this->video_source, 'brands')->class('text-muted ml-1')->title(Yii::t('mr42', 'Video'));
if ($this->wip)
$icons[] = Yii::$app->icon->name('plus')->class('text-muted ml-1')->title(Yii::t('mr42', 'Work in Progress'));
elseif (!$this->lyricid)
$icons[] = Yii::$app->icon->name('music')->class('text-muted ml-1')->title(Yii::t('mr42', 'Instrumental'));
$this->icons = implode($icons);
}
public function beforeSave($insert): bool {
@@ -18,7 +18,7 @@ public function display(int $userid): string {
return Item::widget([
'body' => RecentTracksWidget::widget(['tracks' => self::find()->where(['userid' => $userid])->orderBy(['count' => SORT_DESC])->limit($this->limit)->all()]),
'header' => Yii::$app->icon->show('lastfm-square', ['class' => 'mr-1', 'style' => 'brands']).Yii::t('mr42', 'Recently Played Tracks'),
'header' => Yii::$app->icon->name('lastfm-square', 'brands')->class('mr-1').Yii::t('mr42', 'Recently Played Tracks'),
]);
}

0 comments on commit cfb87b6

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