diff --git a/extensions/yii/authclient/BaseClient.php b/extensions/yii/authclient/BaseClient.php index 2741c2e..d155074 100644 --- a/extensions/yii/authclient/BaseClient.php +++ b/extensions/yii/authclient/BaseClient.php @@ -10,6 +10,7 @@ namespace yii\authclient; use Yii; use yii\base\Component; use yii\base\NotSupportedException; +use yii\helpers\Inflector; use yii\helpers\StringHelper; /** @@ -178,7 +179,7 @@ abstract class BaseClient extends Component implements ClientInterface */ protected function defaultName() { - return StringHelper::basename(get_class($this)); + return Inflector::camel2id(StringHelper::basename(get_class($this))); } /** diff --git a/extensions/yii/authclient/widgets/Choice.php b/extensions/yii/authclient/widgets/Choice.php index 3cf2247..c9fcacf 100644 --- a/extensions/yii/authclient/widgets/Choice.php +++ b/extensions/yii/authclient/widgets/Choice.php @@ -166,9 +166,9 @@ class Choice extends Widget */ protected function renderMainContent() { - echo Html::beginTag('ul', ['class' => 'auth-services clear']); + echo Html::beginTag('ul', ['class' => 'auth-clients clear']); foreach ($this->getClients() as $externalService) { - echo Html::beginTag('li', ['class' => 'auth-service']); + echo Html::beginTag('li', ['class' => 'auth-client']); $this->providerLink($externalService); echo Html::endTag('li'); } diff --git a/extensions/yii/authclient/widgets/ChoiceAsset.php b/extensions/yii/authclient/widgets/ChoiceAsset.php index c5fcbef..bc1acc4 100644 --- a/extensions/yii/authclient/widgets/ChoiceAsset.php +++ b/extensions/yii/authclient/widgets/ChoiceAsset.php @@ -21,6 +21,9 @@ class ChoiceAsset extends AssetBundle public $js = [ 'authchoice.js', ]; + public $css = [ + 'authchoice.css', + ]; public $depends = [ 'yii\web\YiiAsset', ]; diff --git a/extensions/yii/authclient/widgets/assets/authchoice.css b/extensions/yii/authclient/widgets/assets/authchoice.css new file mode 100644 index 0000000..e9195f0 --- /dev/null +++ b/extensions/yii/authclient/widgets/assets/authchoice.css @@ -0,0 +1,82 @@ +.clients { + overflow:auto; +} + +.auth-icon { + display: block; + width: 32px; + height: 32px; + background: url(authchoice.png) no-repeat; +} + +.auth-icon.google, +.auth-icon.google_openid, +.auth-icon.google_oauth { + background-position: 0 -34px; +} +.auth-icon.twitter { + background-position: 0 -68px; +} +.auth-icon.yandex, +.auth-icon.yandex_openid, +.auth-icon.yandex_oauth { + background-position: 0 -102px; +} +.auth-icon.vkontakte { + background-position: 0 -136px; +} +.auth-icon.facebook { + background-position: 0 -170px; +} +.auth-icon.mailru { + background-position: 0 -204px; +} +.auth-icon.moikrug { + background-position: 0 -238px; +} +.auth-icon.odnoklassniki { + background-position: 0 -272px; +} +.auth-icon.linkedin { + background-position: 0 -306px; +} +.auth-icon.github { + background-position: 0 -340px; +} +.auth-icon.live { + background-position: 0 -372px; +} + +.auth-link:hover .auth-icon i, +.auth-link:focus .auth-icon i { + display: block; + width: 32px; + height: 32px; + background: url(authchoice.png) 0 0 no-repeat; +} + +.auth-clients { + margin: 0 0 1em; + list-style: none; + overflow: auto; +} + +.auth-client { + float: left; + margin: 0 1em 0 0; +} + +.auth-clients .auth-client .auth-link { + display: block; + width: 58px; +} + +.auth-client .auth-link .auth-icon { + margin: 0 auto; +} + +.auth-client .auth-link .auth-title { + display: block; + margin-top: 0.4em; + text-align: center; +} \ No newline at end of file diff --git a/extensions/yii/authclient/widgets/assets/authchoice.png b/extensions/yii/authclient/widgets/assets/authchoice.png new file mode 100644 index 0000000..ffc3c5e Binary files /dev/null and b/extensions/yii/authclient/widgets/assets/authchoice.png differ