Merge branch 'master' of https://github.com/openclassify/openclassify into muammertop

This commit is contained in:
Muammer Top 2020-11-16 16:22:43 +03:00
commit 05fe86bdd5
20 changed files with 506 additions and 103 deletions

View File

@ -26,4 +26,5 @@ return [
'replicated_success' => 'The ad has been replicated successfully!',
'ad_doesnt_exist' => "This ad doesn't exist!",
'select_location_error' => "Please select a location on the map!",
'this_ad_is_not_valid_anymore' => "This ad is not valid anymore!",
];

View File

@ -77,7 +77,12 @@ class AjaxController extends PublicController
}
$my_advs = $my_advs->select(['id', 'cover_photo', 'slug', 'price', 'currency', 'city', 'country_id', 'cat1', 'cat2', 'status'])
->orderByDesc('id');
$my_advs = $advRepository->addAttributes($my_advs->get());
if (\request()->paginate === 'true') {
$my_advs = $advRepository->addAttributes($my_advs->paginate(setting_value('streams::per_page')));
} else {
$my_advs = $advRepository->addAttributes($my_advs->get());
}
foreach ($my_advs as $index => $ad) {
$my_advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');

View File

@ -436,9 +436,10 @@ class AdvsController extends PublicController
$user = null;
if (\request()->user) {
$user = $this->userRepository->find(\request()->user);
$showTitle = false;
$metaTitle = $user->name() . ' ' . trans('visiosoft.module.advs::field.ads');
if ($user = $this->userRepository->find(\request()->user)) {
$showTitle = false;
$metaTitle = $user->name() . ' ' . trans('visiosoft.module.advs::field.ads');
}
}
$this->template->set('showTitle', $showTitle);
@ -484,6 +485,11 @@ class AdvsController extends PublicController
$adv = $this->adv_repository->getListItemAdv($id);
if ($adv && (!$adv->expired() || $adv->created_by_id === \auth()->id())) {
// Check if created by exists
if (!$adv->created_by) {
$this->messages->error('visiosoft.module.advs::message.this_ad_is_not_valid_anymore');
return $this->redirect->route('visiosoft.module.advs::list');
}
if ($this->adv_model->is_enabled('complaints')) {
$complaints = ComplaintsComplainTypesEntryModel::all();

View File

@ -0,0 +1,85 @@
let initModal = function () {
let modal = $('.modal.remote:not([data-initialized])');
let loading = '<div class="modal-loading text-center"><div class="active spinner-border spinner-border text-secondary m-5"></div></div>';
// Loading state
modal.on('loading', function() {
$(this).find('.modal-content').append(loading);
});
// Clear remote modals when closed.
modal.on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
$(this).find('.modal-content').html(loading);
});
// Show loader for remote modals.
modal.on('show.bs.modal', function () {
$(this).find('.modal-content').html(loading);
});
// Handle ajax links in modals.
modal.on('click', 'a.ajax, .pagination a', function (e) {
e.preventDefault();
let wrapper = $(this).closest('.modal-content');
wrapper.append(loading);
$.get($(this).attr('href'), function (html) {
wrapper.html(html);
});
});
// Handle ajax forms in modals.
modal.on('submit', 'form.ajax', function (e) {
e.preventDefault();
let wrapper = $(this).closest('.modal-content');
wrapper.append(loading);
if ($(this).attr('method') == 'GET') {
$.get($(this).attr('action'), $(this).serializeArray(), function (html) {
wrapper.html(html);
});
} else {
$.post($(this).attr('action'), $(this).serializeArray(), function (html) {
wrapper.html(html);
});
}
});
// Handle load indicators in modals.
modal.on('click', '[data-toggle="loader"]', function () {
let wrapper = $(this).closest('.modal-content');
wrapper.append(loading);
});
// Mark as initialized.
modal.attr('data-initialized', '');
};
$(document).ready(function () {
initModal();
});
$(document).ajaxComplete(function () {
initModal();
});
$(document).on('show.bs.modal', '.modal', function () {
let zIndex = 1040 + (10 * $('.modal:visible').length);
$(this).css('z-index', zIndex);
setTimeout(function() {
$('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack');
}, 0);
});

View File

@ -0,0 +1,191 @@
$(function () {
var form = $('#search');
var input = form.find('input');
var list = form.find('.results');
var items = list.find('a');
var selected = null;
// Don't submit on return.
form.on('submit', function () {
return false;
});
// Open search
input.on('focus', function () {
form.addClass('open');
});
// Close search.
$(window).click(function () {
form.removeClass('open');
});
form.click(function (e) {
e.stopPropagation();
});
// Handle simple searching
input.on('keydown', function (e) {
/**
* Capture the down arrow.
*/
if (e.which == 40) {
if (selected) {
/**
* If we have a selection then
* push to the next visible option.
*/
if (selected.nextAll('a:visible').length) {
items.removeClass('active');
selected = selected.nextAll('a:visible').first();
selected.addClass('active');
}
} else {
/**
* Otherwise select the first
* visible option in the list.
*/
selected = items.filter('a:visible').first();
selected.addClass('active');
}
}
/**
* Capture the up arrow.
*/
if (e.which == 38) {
if (selected) {
/**
* If we have a selection then push
* to the previous visible option.
*/
if (selected.prevAll('a:visible').length) {
items.removeClass('active');
selected = selected.prevAll('a:visible').first();
selected.addClass('active');
}
} else {
/**
* Otherwise select the last
* visible option in the list.
*/
selected = items.filter('a:visible').last();
selected.addClass('active');
}
}
/**
* Capture the enter key.
*/
if (e.which == 13) {
if (selected) {
/**
* If the key press was the return
* key and we have a selection
* then follow the link.
*/
if (selected.hasClass('has-click-event') || selected.hasClass('ajax')) {
selected.trigger('click');
} else {
/**
* If nothing is selected
* there's nothing to do.
*/
if (!selected.length) {
return false;
}
/**
* If control or the meta key is
* being held open a new window.
*/
if (e.ctrlKey || e.metaKey) {
window.open(selected.attr('href'), "_blank");
} else {
window.location = selected.attr('href');
}
input.val('');
input.blur();
form.removeClass('open');
modal.find('.modal-content').append('<div class="modal-loading text-center"><div class="active spinner-border spinner-border text-secondary m-5"></div></div>');
}
}
}
/**
* Capture up and down arrows.
*/
if (e.which == 38 || e.which == 40) {
// store current positions in variables
var start = input[0].selectionStart,
end = input[0].selectionEnd;
// restore from variables...
input[0].setSelectionRange(start, end);
e.preventDefault();
}
/**
* Capture the escape key.
*/
if (e.which == 27) {
form.removeClass('open');
items
.show()
.removeClass('active');
input.val('').blur();
}
});
input.on('keyup', function (e) {
/**
* If the keyup was a an arrow
* up or down then skip this step.
*/
if (e.which == 38 || e.which == 40) {
return;
}
var value = $(this).val();
/**
* Filter the list by the items to
* show only those containing value.
*/
items.each(function () {
if ($(this).text().toLowerCase().indexOf(value.toLowerCase()) >= 0) {
$(this).show();
} else {
$(this).hide();
}
});
/**
* If we don't have a selected item
* then choose the first visible option.
*/
if (!selected || !selected.is(':visible')) {
selected = items.filter(':visible').first();
selected.addClass('active');
}
});
});

View File

@ -17,8 +17,9 @@
{{ asset_add("theme.js", "visiosoft.theme.base::js/script.js") }}
{# Theme Scripts #}
{#{{ asset_add("theme.js", "visiosoft.theme.base::js/plugins/*") }}#}
{{ asset_add("theme.js", "visiosoft.theme.base::js/theme/initialize.js") }}
{{ asset_add("theme.js", "visiosoft.theme.base::js/theme/search.js") }}
{{ asset_add("theme.js", "visiosoft.theme.base::js/theme/modal.js") }}
{{ asset_script("theme.js") }}

View File

@ -94,7 +94,8 @@ return [
'options' => [
'slug' => 'slug',
'id' => 'id',
'order' => 'order'
'order' => 'order',
'name' => 'name',
],
],
],

View File

@ -1,5 +1,6 @@
<?php namespace Visiosoft\LocationModule\City;
use Anomaly\Streams\Platform\Model\Location\LocationCitiesEntryTranslationsModel;
use Visiosoft\LocationModule\City\Contract\CityRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository;
@ -13,18 +14,38 @@ class CityRepository extends EntryRepository implements CityRepositoryInterface
*/
protected $model;
/**
* @var LocationCitiesEntryTranslationsModel
*/
private $citiesEntryTranslationsModel;
/**
* Create a new CityRepository instance.
*
* @param CityModel $model
*/
public function __construct(CityModel $model)
public function __construct(CityModel $model, LocationCitiesEntryTranslationsModel $citiesEntryTranslationsModel)
{
$this->model = $model;
$this->citiesEntryTranslationsModel = $citiesEntryTranslationsModel;
}
public function findById($id)
{
return $this->model->orderBy('created_at', 'DESC')->where('location_cities.id', $id)->first();
}
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc')
{
return $this->citiesEntryTranslationsModel->newQuery()
->select('entry_id as id', 'name')
->whereIn('locale', [
Request()->session()->get('_locale'),
setting_value('streams::default_locale'),
'en'
])
->whereIn('entry_id', $entryIDs)
->orderBy($orderBy, $direction)
->get();
}
}

View File

@ -5,4 +5,6 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
interface CityRepositoryInterface extends EntryRepositoryInterface
{
public function findById($id);
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
}

View File

@ -7,4 +7,6 @@ interface CountryRepositoryInterface extends EntryRepositoryInterface
public function findById($id);
public function viewAll();
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
}

View File

@ -1,5 +1,6 @@
<?php namespace Visiosoft\LocationModule\Country;
use Anomaly\Streams\Platform\Model\Location\LocationCountriesEntryTranslationsModel;
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository;
@ -13,14 +14,23 @@ class CountryRepository extends EntryRepository implements CountryRepositoryInte
*/
protected $model;
/**
* @var LocationCountriesEntryTranslationsModel
*/
private $countriesEntryTranslationsModel;
/**
* Create a new CountryRepository instance.
*
* @param CountryModel $model
*/
public function __construct(CountryModel $model)
public function __construct(
CountryModel $model,
LocationCountriesEntryTranslationsModel $countriesEntryTranslationsModel
)
{
$this->model = $model;
$this->countriesEntryTranslationsModel = $countriesEntryTranslationsModel;
}
public function findById($id)
{
@ -30,4 +40,18 @@ class CountryRepository extends EntryRepository implements CountryRepositoryInte
public function viewAll(){
return $this->model->get();
}
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc')
{
return $this->countriesEntryTranslationsModel->newQuery()
->select('entry_id as id', 'name')
->whereIn('locale', [
Request()->session()->get('_locale'),
setting_value('streams::default_locale'),
'en'
])
->whereIn('entry_id', $entryIDs)
->orderBy($orderBy, $direction)
->get();
}
}

View File

@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
interface DistrictRepositoryInterface extends EntryRepositoryInterface
{
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
}

View File

@ -1,5 +1,6 @@
<?php namespace Visiosoft\LocationModule\District;
use Anomaly\Streams\Platform\Model\Location\LocationDistrictsEntryTranslationsModel;
use Visiosoft\LocationModule\District\Contract\DistrictRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository;
@ -13,13 +14,36 @@ class DistrictRepository extends EntryRepository implements DistrictRepositoryIn
*/
protected $model;
/**
* @var LocationDistrictsEntryTranslationsModel
*/
private $districtsEntryTranslationsModel;
/**
* Create a new DistrictRepository instance.
*
* @param DistrictModel $model
*/
public function __construct(DistrictModel $model)
public function __construct(
DistrictModel $model,
LocationDistrictsEntryTranslationsModel $districtsEntryTranslationsModel
)
{
$this->model = $model;
$this->districtsEntryTranslationsModel = $districtsEntryTranslationsModel;
}
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc')
{
return $this->districtsEntryTranslationsModel->newQuery()
->select('entry_id as id', 'name')
->whereIn('locale', [
Request()->session()->get('_locale'),
setting_value('streams::default_locale'),
'en'
])
->whereIn('entry_id', $entryIDs)
->orderBy($orderBy, $direction)
->get();
}
}

View File

@ -1,131 +1,95 @@
<?php namespace Visiosoft\LocationModule\Http\Controller;
use Anomaly\Streams\Platform\Http\Controller\PublicController;
use Visiosoft\LocationModule\City\CityModel;
use Visiosoft\LocationModule\Country\CountryModel;
use Visiosoft\LocationModule\District\DistrictModel;
use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel;
use Visiosoft\LocationModule\Village\VillageModel;
use Visiosoft\LocationModule\City\Contract\CityRepositoryInterface;
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
use Visiosoft\LocationModule\District\Contract\DistrictRepositoryInterface;
use Visiosoft\LocationModule\Neighborhood\Contract\NeighborhoodRepositoryInterface;
use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface;
use Illuminate\Support\Str;
class AjaxController extends PublicController
{
/**
* @var CountryModel
*/
private $country_model;
/**
* @var CityModel
*/
private $city_model;
/**
* @var DistrictModel
*/
private $district_model;
/**
* @var NeighborhoodModel
*/
private $neighborhood_model;
/**
* @var VillageModel
*/
private $village_model;
private $cityRepository;
private $countryRepository;
private $districtRepository;
private $neighborhoodRepository;
private $villageRepository;
/**
* AjaxController constructor.
* @param CountryModel $countryModel
*/
public function __construct(
CountryModel $countryModel,
CityModel $cityModel,
DistrictModel $districtModel,
NeighborhoodModel $neighborhoodModel,
VillageModel $villageModel)
CityRepositoryInterface $cityRepository,
CountryRepositoryInterface $countryRepository,
DistrictRepositoryInterface $districtRepository,
NeighborhoodRepositoryInterface $neighborhoodRepository,
VillageRepositoryInterface $villageRepository
)
{
$this->country_model = $countryModel;
$this->city_model = $cityModel;
$this->district_model = $districtModel;
$this->neighborhood_model = $neighborhoodModel;
$this->village_model = $villageModel;
parent::__construct();
$this->cityRepository = $cityRepository;
$this->countryRepository = $countryRepository;
$this->districtRepository = $districtRepository;
$this->neighborhoodRepository = $neighborhoodRepository;
$this->villageRepository = $villageRepository;
}
/**
* @return mixed
*/
public function getCountries()
{
if ($this->request->id)
return $this->country_model->find($this->request->id);
return $this->countryRepository->getModel()->find($this->request->id);
else {
$query = $this->country_model;
return $this->queryOrder($query);
$query = $this->countryRepository->getModel();
return $this->queryOrder($query, $this->countryRepository);
}
}
/**
* @return mixed
*/
public function getCities()
{
if ($this->request->id) {
$id = explode(',', $this->request->id);
$query = $this->city_model->whereIn('parent_country_id', $id);
$query = $this->cityRepository->getModel()->whereIn('parent_country_id', $id);
return $this->queryOrder($query);
return $this->queryOrder($query, $this->cityRepository);
}
}
/**
* @return mixed
*/
public function getDistricts()
{
if ($this->request->id) {
$id = explode(',', $this->request->id);
$query = $this->district_model->whereIn('parent_city_id', $id);
$query = $this->districtRepository->getModel()->whereIn('parent_city_id', $id);
return $this->queryOrder($query);
return $this->queryOrder($query, $this->districtRepository);
}
}
/**
* @return mixed
*/
public function getNeighborhoods()
{
if ($this->request->id) {
$id = explode(',', $this->request->id);
$query = $this->neighborhood_model->whereIn('parent_district_id', $id);
$query = $this->neighborhoodRepository->getModel()->whereIn('parent_district_id', $id);
return $this->queryOrder($query);
return $this->queryOrder($query, $this->neighborhoodRepository);
}
}
/**
* @return mixed
*/
public function getVillage()
{
if ($this->request->id) {
$id = explode(',', $this->request->id);
$query = $this->village_model->whereIn('parent_neighborhood_id', $id);
$query = $this->villageRepository->getModel()->whereIn('parent_neighborhood_id', $id);
return $this->queryOrder($query);
return $this->queryOrder($query, $this->villageRepository);
}
}
/**
* @return mixed
*/
public function getCity()
{
if ($this->request->name) {
$slug = Str::slug($this->request->name, '_');
if ($city = $this->city_model->newQuery()->where('slug', 'LIKE', $slug . '%')->first()) {
if ($city = $this->cityRepository->getModel()->newQuery()->where('slug', 'LIKE', $slug . '%')->first()) {
return ['success' => true, 'city' => $city];
} else {
return ['success' => false];
@ -133,11 +97,19 @@ class AjaxController extends PublicController
}
}
public function queryOrder($query)
public function queryOrder($query, $repository)
{
$sorting_type = setting_value('visiosoft.module.location::sorting_type');
$sorting_column = setting_value('visiosoft.module.location::sorting_column');
if ($repository->getModel()->isTranslatedAttribute($sorting_column)) {
return $repository->getByEntryIDsAndOrderByTransCol(
$query->pluck('id')->all(),
$sorting_column,
$sorting_type
);
}
return $query->orderBy($sorting_column, $sorting_type)->get();
}
}

View File

@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
interface NeighborhoodRepositoryInterface extends EntryRepositoryInterface
{
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
}

View File

@ -1,5 +1,6 @@
<?php namespace Visiosoft\LocationModule\Neighborhood;
use Anomaly\Streams\Platform\Model\Location\LocationNeighborhoodsEntryTranslationsModel;
use Visiosoft\LocationModule\Neighborhood\Contract\NeighborhoodRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository;
@ -13,13 +14,36 @@ class NeighborhoodRepository extends EntryRepository implements NeighborhoodRepo
*/
protected $model;
/**
* @var LocationNeighborhoodsEntryTranslationsModel
*/
private $neighborhoodsEntryTranslationsModel;
/**
* Create a new NeighborhoodRepository instance.
*
* @param NeighborhoodModel $model
*/
public function __construct(NeighborhoodModel $model)
public function __construct(
NeighborhoodModel $model,
LocationNeighborhoodsEntryTranslationsModel $neighborhoodsEntryTranslationsModel
)
{
$this->model = $model;
$this->neighborhoodsEntryTranslationsModel = $neighborhoodsEntryTranslationsModel;
}
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc')
{
return $this->neighborhoodsEntryTranslationsModel->newQuery()
->select('entry_id as id', 'name')
->whereIn('locale', [
Request()->session()->get('_locale'),
setting_value('streams::default_locale'),
'en'
])
->whereIn('entry_id', $entryIDs)
->orderBy($orderBy, $direction)
->get();
}
}

View File

@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
interface VillageRepositoryInterface extends EntryRepositoryInterface
{
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
}

View File

@ -1,5 +1,6 @@
<?php namespace Visiosoft\LocationModule\Village;
use Anomaly\Streams\Platform\Model\Location\LocationVillageEntryTranslationsModel;
use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository;
@ -13,13 +14,36 @@ class VillageRepository extends EntryRepository implements VillageRepositoryInte
*/
protected $model;
/**
* @var LocationVillageEntryTranslationsModel
*/
private $villageEntryTranslationsModel;
/**
* Create a new VillageRepository instance.
*
* @param VillageModel $model
*/
public function __construct(VillageModel $model)
public function __construct(
VillageModel $model,
LocationVillageEntryTranslationsModel $villageEntryTranslationsModel
)
{
$this->model = $model;
$this->villageEntryTranslationsModel = $villageEntryTranslationsModel;
}
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc')
{
return $this->villageEntryTranslationsModel->newQuery()
->select('entry_id as id', 'name')
->whereIn('locale', [
Request()->session()->get('_locale'),
setting_value('streams::default_locale'),
'en'
])
->whereIn('entry_id', $entryIDs)
->orderBy($orderBy, $direction)
->get();
}
}

View File

@ -3,18 +3,19 @@ var records_per_page = ads_per_page;
var ads_type = "";
var objJson = [];
let totalAdvs = 0
function prevPage() {
if (current_page > 1) {
current_page--;
changePage(current_page);
getMyAdvs(ads_type)
}
}
function nextPage(event) {
if (current_page < numPages()) {
current_page++;
changePage(current_page);
getMyAdvs(ads_type)
}
}
@ -30,17 +31,21 @@ function changePage(page) {
listing_table.html("");
if (objJson.length == 0) {
listing_table.html('<div class="alert alert-warning" role="alert">' +
no_ads_message +
'</div>');
if (objJson.length === 0) {
listing_table.html(`
<div class="alert alert-warning" role="alert">
${no_ads_message}
</div>
`);
}
for (var i = (page - 1) * records_per_page; i < (page * records_per_page) && i < objJson.length; i++) {
for (var i = 0; i < objJson.length; i++) {
listing_table.append(addAdsRow(objJson[i].id, objJson[i].detail_url, objJson[i].cover_photo, objJson[i].name,
objJson[i].formatted_price, objJson[i].city_name, objJson[i].country_name, objJson[i].cat1_name,
objJson[i].cat2_name, objJson[i].status));
}
addDropdownBlock()
page_span.html(page + "/" + numPages());
if (numPages() === 1) {
@ -63,7 +68,7 @@ function changePage(page) {
}
function numPages() {
return Math.ceil(objJson.length / records_per_page);
return Math.ceil(totalAdvs / records_per_page);
}
function crud(params, url, type, callback) {
@ -78,15 +83,16 @@ function crud(params, url, type, callback) {
}
function getMyAdvs(type) {
crud({'type': type}, '/ajax/getAdvs', 'GET', function (callback) {
crud({'type': type, 'paginate': true, 'page': current_page}, '/ajax/getAdvs', 'GET', function (callback) {
ads_type = type;
current_page = 1;
objJson = callback.content;
changePage(1);
objJson = callback.content.data;
totalAdvs = callback.content.total
changePage(current_page);
})
}
$('.profile-advs-tab a').on('click', function () {
current_page = 1
getMyAdvs($(this).attr('data-type'))
});
@ -128,7 +134,7 @@ function addAdsRow(id, href, image, name, formatted_price, city, country, cat1,
}
function dropdownRow(id, type) {
var dropdown = "<div class='dropdown'>\n" +
var dropdown = "<div class='dropdown my-ads-dropdown' data-id='" + id + "'>\n" +
" <button class='dropdown-toggle btn btn-outline-dark' type='button' id='dropdownMenuButton' data-toggle='dropdown'>\n" +
"<i class=\"fas fa-ellipsis-v\"></i>" +
" </button>\n" +
@ -160,7 +166,16 @@ function dropdownRow(id, type) {
extend_ad +
"</a>\n";
dropdown += getBlock('profile/dropdown-ad', {'id': id}) + "</div></div>";
return dropdown;
dropdown += "</div></div>";
}
return dropdown;
}
const dropdownBlock = getBlock('profile/dropdown-ad', {'id': ':id'})
function addDropdownBlock () {
const dropdowns = $('.my-ads-dropdown')
for (let i = 0; i < dropdowns.length; i++) {
const currentDropdown = $(dropdowns[i])
$('.dropdown-menu', currentDropdown).append(dropdownBlock.replace(':id', currentDropdown.data('id')))
}
}

View File

@ -64,9 +64,6 @@ $(function () {
var response = JSON.parse(file.xhr.response);
uploaded.push(response.id);
$('[data-provides="visiosoft.field_type.singlefile"]').val(response.id)
$('#file-modal').modal('hide');
$('#profile-detail').submit();
file.previewElement.querySelector('[data-dz-uploadprogress]').setAttribute('class', 'progress progress-success');
@ -83,4 +80,12 @@ $(function () {
alert(message.error ? message.error : message);
});
// When all files are processed.
dropzone.on('queuecomplete', function () {
uploader.find('.uploaded .modal-body').html(element.data('loading') + '...');
uploader.find('.uploaded').load(REQUEST_ROOT_PATH + '/streams/singlefile-field_type/recent?uploaded=' + uploaded.join(','));
});
});