This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func initConfig() { | |
viper.SetConfigType("toml") | |
cobra.CheckErr(viper.ReadConfig(bytes.NewBuffer(defaultConfig))) | |
cobra.CheckErr(viper.BindPFlags(rootCmd.PersistentFlags())) | |
viper.SetEnvPrefix(envPrefix) | |
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) | |
cobra.CheckErr(viper.BindPFlag("log.level", rootCmd.PersistentFlags().Lookup("level"))) | |
cobra.CheckErr(viper.BindPFlag("log.pretty", rootCmd.PersistentFlags().Lookup("pretty"))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param $url | |
* @return string | |
* @throws \yii\base\InvalidConfigException | |
*/ | |
public static function getAssetUrl($url) | |
{ | |
$class = ArrayHelper::getValue([ | |
'app-frontend' => \frontend\assets\AppAsset::class, | |
], \Yii::$app->id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Alexey Samoylov <[email protected]> | |
*/ | |
namespace common\components; | |
use yii\data\DataProviderInterface; | |
class MapDataProvider implements DataProviderInterface | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options FollowSymLinks | |
AddDefaultCharset utf-8 | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# the main rewrite rule for the frontend application | |
RewriteCond %{REQUEST_URI} !^/(backend/web|admin) | |
RewriteRule !^frontend/web /frontend/web%{REQUEST_URI} [L] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ymaps.ready(init); | |
var myMap, myPlaceMark; | |
function init() { | |
myMap = new ymaps.Map("map", { | |
center: [<?=$model->latitude?>, <?=$model->longitude?>], | |
zoom: <?=$city->defaultZoom?>, | |
minZoom: <?=$city->minZoom?>, | |
maxZoom: <?=$city->maxZoom?>, | |
controls: ['searchControl', 'typeSelector', 'zoomControl', 'geolocationControl'] | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function getAssetUrl($url) | |
{ | |
return \Yii::$app->assetManager->getBundle('frontend\assets\AppAsset')->baseUrl . $url; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace common\components; | |
/** | |
* Class ActiveRecord | |
* @package common\components | |
*/ | |
class ActiveRecord extends \yii\db\ActiveRecord | |
{ | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace common\traits; | |
use yii\base\InvalidConfigException; | |
use yii\helpers\ArrayHelper; | |
/** | |
* Trait for default status column | |
* | |
* Class StatusTrait |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$js = <<<JS | |
// Change hash for page-reload | |
$('.nav-tabs a').on('shown.bs.tab', function (e) { | |
window.location.hash = e.target.hash; | |
}) | |
// Javascript to enable link to tab | |
var url = document.location.toString(); | |
if (url.match('#')) { | |
$('.nav-tabs a[href=#'+url.split('#')[1]+']').tab('show') ; |
NewerOlder