mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-13 00:36:04 -06:00
Merge pull request #1213 from openclassify/vedat
optional preview && dynamic profile fields
This commit is contained in:
commit
602fa815de
@ -24,6 +24,7 @@ return [
|
||||
'ads' => [
|
||||
'title' => 'visiosoft.module.advs::section.ads',
|
||||
'fields' => [
|
||||
'preview_mode',
|
||||
'show_finish_and_publish_date',
|
||||
'latest-limit',
|
||||
'popular_ads_limit',
|
||||
|
||||
@ -493,4 +493,11 @@ return [
|
||||
'default_value' => false,
|
||||
]
|
||||
],
|
||||
'preview_mode' => [
|
||||
'type' => 'anomaly.field_type.boolean',
|
||||
'bind' => 'adv.preview_mode',
|
||||
'config' => [
|
||||
'default_value' => true,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
@ -296,5 +296,9 @@ return [
|
||||
],
|
||||
'only_email_login' => [
|
||||
'name' => 'Only Email Login'
|
||||
]
|
||||
],
|
||||
'preview_mode' => [
|
||||
'name' => 'Preview Mode',
|
||||
'instructions' => 'When this mode is enabled, the ad is previewed by the user.'
|
||||
],
|
||||
];
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="select-price">
|
||||
{% set HideStandardPrice = setting_value('visiosoft.module.advs::hide_standard_price_field') or setting_value('visiosoft.module.advs::market_place') != true ? ' d-none' %}
|
||||
{% set HideStandardPrice = setting_value('visiosoft.module.advs::hide_standard_price_field') or setting_value('visiosoft.module.advs::market_place') != true ? ' d-none' : '' %}
|
||||
|
||||
<label>
|
||||
<span class="{{ HideStandardPrice }}">
|
||||
@ -123,7 +123,7 @@
|
||||
</div>
|
||||
|
||||
<div class="d-flex">
|
||||
<div class="d-flex flex-fill {{ HideStandardPrice }}">
|
||||
<div class=" flex-fill {{ (HideStandardPrice) ? HideStandardPrice : 'd-flex' }}">
|
||||
{% set standardPriceValue = form.fields.standard_price.value|split('.') %}
|
||||
<input class="mt-3 border-0 text-right standard-price-field whole-price flex-fill"
|
||||
placeholder="0" value="{{ standardPriceValue|first }}"
|
||||
|
||||
@ -930,9 +930,14 @@ class AdvsController extends PublicController
|
||||
event(new EditedAd($before_editing, $adv));
|
||||
}
|
||||
|
||||
if (config('adv.preview_mode')) {
|
||||
return redirect(route('advs_preview', [$this->request->update_id]));
|
||||
}
|
||||
|
||||
return redirect(route('adv_detail_seo', [$adv->slug, $adv->id]));
|
||||
|
||||
}
|
||||
|
||||
/* New Create Adv */
|
||||
$this->request->publish_at = date('Y-m-d H:i:s');
|
||||
$all = $this->request->all();
|
||||
|
||||
@ -7,25 +7,6 @@ class ProfileFormBuilder extends FormBuilder
|
||||
{
|
||||
protected $model = UserModel::class;
|
||||
|
||||
protected $fields = [
|
||||
'gsm_phone',
|
||||
'office_phone',
|
||||
'land_phone',
|
||||
'identification_number',
|
||||
'education' => [
|
||||
'type' => 'anomaly.field_type.select',
|
||||
'config' => [
|
||||
'handler' => 'Visiosoft\ProfileModule\OptionHandler\EducationOptions@handle',
|
||||
]
|
||||
],
|
||||
'education_part' => 'anomaly.field_type.select',
|
||||
'profession',
|
||||
'birthday',
|
||||
'register_type',
|
||||
'facebook_address',
|
||||
'google_address',
|
||||
];
|
||||
|
||||
protected $actions = [
|
||||
'update' => [
|
||||
'text' => 'visiosoft.module.profile::button.update_profile'
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile\Profile;
|
||||
|
||||
use Anomaly\UsersModule\User\UserModel;
|
||||
|
||||
class ProfileFormFields
|
||||
{
|
||||
public function handle(ProfileFormBuilder $builder, UserModel $model)
|
||||
{
|
||||
$fields = [
|
||||
'gsm_phone',
|
||||
'office_phone',
|
||||
'land_phone',
|
||||
'identification_number',
|
||||
'education' => [
|
||||
'type' => 'anomaly.field_type.select',
|
||||
'config' => [
|
||||
'handler' => 'Visiosoft\ProfileModule\OptionHandler\EducationOptions@handle',
|
||||
]
|
||||
],
|
||||
'education_part' => 'anomaly.field_type.select',
|
||||
'profession',
|
||||
'birthday',
|
||||
'register_type',
|
||||
'facebook_address',
|
||||
'google_address',
|
||||
];
|
||||
|
||||
$assignments = $model->getAssignments();
|
||||
$builder->setFields(array_merge($fields, $assignments->notLocked()->fieldSlugs()));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user