Merge pull request #201 from openclassify/basetheme

fixed login and register form action
This commit is contained in:
Fatih Alp 2020-01-02 16:46:27 +03:00 committed by GitHub
commit 106476ae56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 18 deletions

View File

@ -72,9 +72,13 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
public function userAdv() public function userAdv()
{ {
if (Auth::user()->hasRole('admin')) {
return $this->getAdv();
} else {
return $this->getAdv()
->where('advs_advs.created_by_id', Auth::id());
}
return $this->getAdv()
->where('advs_advs.created_by_id', Auth::id());
} }
public function getAdvByCat($cat_id) public function getAdvByCat($cat_id)
@ -195,10 +199,10 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
$country = CountryModel::query()->where('location_countries.id', $adv->country_id)->first(); $country = CountryModel::query()->where('location_countries.id', $adv->country_id)->first();
$city = CityModel::query()->where('location_cities.id', $adv->city)->first(); $city = CityModel::query()->where('location_cities.id', $adv->city)->first();
if($country != null) { if ($country != null) {
$adv->setAttribute('country_name', $country->name); $adv->setAttribute('country_name', $country->name);
} }
if($city != null) { if ($city != null) {
$adv->setAttribute('city_name', $city->name); $adv->setAttribute('city_name', $city->name);
} }
} }

View File

@ -3,18 +3,12 @@
{% block content %} {% block content %}
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-12 col-sm-8 col-md-6 col-lg-4 text-left bg-light p-3 m-0"> <div class="col-12 col-sm-8 col-md-6 col-lg-4 text-left bg-light p-3 m-0">
{% set form = form('login').redirect(request_get('redirect', '/')) {% set form = form('login')
.actions( .redirect(app.request.get('redirect'))
{'submit': .get() %}
{'type':'primary',
'text':'<i class="fas fa-key"></i> '~trans('anomaly.module.users::button.login'),
'class':'w-100 py-2'
}
}).get() %}
{{ form_open({ {{ form_open({
'class': 'row form ' ~ form.options.class , 'class':'aaa',
'enctype': 'multipart/form-data', 'url':form.options.url
'url': 'advs/save_adv',
})|raw }} })|raw }}
<div class="col-12"> <div class="col-12">
{{ form.fields.email|raw }} {{ form.fields.email|raw }}
@ -31,8 +25,11 @@
</label> </label>
</div> </div>
<div class="col-12 row m-0"> <div class="col-12 row m-0">
<div class="col-6 pl-0 pr-1"> <div class="col-6 pr-0 pl-1">
{{ form.actions|raw }} <button class="btn btn-sm btn-primary w-100 py-2">
<i class="fas fa-key"></i>
{{ trans('anomaly.module.users::button.login') }}
</button>
</div> </div>
<div class="col-6 pr-0 pl-1"> <div class="col-6 pr-0 pl-1">
<a href="{{ url('register') }}" class="btn btn-sm btn-success w-100 py-2"> <a href="{{ url('register') }}" class="btn btn-sm btn-success w-100 py-2">

View File

@ -14,7 +14,7 @@
{{ form_open({ {{ form_open({
'class': 'row form ' ~ form.options.class , 'class': 'row form ' ~ form.options.class ,
'enctype': 'multipart/form-data', 'enctype': 'multipart/form-data',
'url': 'advs/save_adv', 'url':form.options.url
})|raw }} })|raw }}
<div class="col-12"> <div class="col-12">
{{ form.fields.display_name|raw }} {{ form.fields.display_name|raw }}