소스 검색

[Administration] Producteurs admin : lien de connexion/inscription

feature/rotating_product
Guillaume Bourgeois 4 달 전
부모
커밋
ce776916f5
3개의 변경된 파일62개의 추가작업 그리고 0개의 파일을 삭제
  1. +42
    -0
      backend/views/producer-admin/_form.php
  2. +10
    -0
      backend/web/js/backend.js
  3. +10
    -0
      domain/Producer/Producer/Producer.php

+ 42
- 0
backend/views/producer-admin/_form.php 파일 보기

@@ -57,6 +57,7 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'slug') ?>
<?= $form->field($model, 'name') ?>
<?= $form->field($model, 'type')->textInput(['placeholder' => 'Boulangerie, brasserie, ferme ...']); ?>
<?= $form->field($model, 'address')->textarea(['rows' => 4]) ?>
<?= $form->field($model, 'postcode') ?>
<?= $form->field($model, 'city') ?>
<?= $form->field($model, 'contact_email') ?>
@@ -70,6 +71,47 @@ use yii\widgets\ActiveForm;
</div>
</div>
<div class="col-md-6">

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-copy"></i>
Données à copier
</h3>
</div>
<div class="panel-body">
<ul class="list-group list-group-unbordered">
<li class="list-group-item">
<strong>Email</strong>
<span class="pull-right">
<a class="btn btn-xs btn-default" href="mailto:<?= $model->contact_email ?>">
<span class="glyphicon glyphicon-send"></span>
</a>
<a class="btn btn-xs btn-default clipboard-paste" data-clipboard-paste="<?= $model->contact_email ?>">
<span class="glyphicon glyphicon-copy"></span>
</a>
</span>
</li>
<li class="list-group-item">
<strong>Url courte boutique</strong>
<span class="pull-right">
<a class="btn btn-xs btn-default clipboard-paste" data-clipboard-paste="<?= $model->getShortShopUrl() ?>">
<span class="glyphicon glyphicon-copy"></span>
</a>
</span>
</li>
<li class="list-group-item">
<strong>Url connexion / inscription</strong>
<span class="pull-right">
<a class="btn btn-xs btn-default clipboard-paste" data-clipboard-paste="<?= $model->getLoginSignupUrl() ?>">
<span class="glyphicon glyphicon-copy"></span>
</a>
</span>
</li>
</ul>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">

+ 10
- 0
backend/web/js/backend.js 파일 보기

@@ -60,6 +60,7 @@ $(document).ready(function () {
opendistrib_dashboard_admin_statistics();
opendistrib_tinymce_responsive();
opendistrib_sponsorship();
opendistrib_clipboard_paste();
});


@@ -74,6 +75,15 @@ function label_unit_reference(unit) {
return 'litre(s)';
}
}

function opendistrib_clipboard_paste() {
$('.clipboard-paste').click(function() {
navigator.clipboard.writeText($(this).attr('data-clipboard-paste'));
appAlerts.alert('success', 'Copié dans le presse-papier');
return false;
});
}

function opendistrib_sponsorship() {
$('#sponsorship-link-copy').click(function() {
navigator.clipboard.writeText($(this).attr('href'));

+ 10
- 0
domain/Producer/Producer/Producer.php 파일 보기

@@ -684,5 +684,15 @@ class Producer extends ActiveRecordCommon

return false;
}

public function getShortShopUrl(): string
{
return 'https://'.$this->slug.'.souke.fr';
}

public function getLoginSignupUrl(): string
{
return \Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/producer', 'id' => $this->id]);
}
}

Loading…
취소
저장