Skip to content

Commit

Permalink
Merge pull request #99 from Coderberg/2.x
Browse files Browse the repository at this point in the history
2.x
  • Loading branch information
Coderberg committed Jan 24, 2023
2 parents a3dd455 + 2ca2ad0 commit 02ba69a
Show file tree
Hide file tree
Showing 38 changed files with 716 additions and 798 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018-2022 Valery Maslov
Copyright (c) 2018-2023 Valery Maslov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
91 changes: 49 additions & 42 deletions assets/js/city.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,51 @@
'use strict';

$(document).ready(function () {
let $city = $('#property_city');
let $title = $('#property_title');
let $description = $('#property_meta_description');
let $address = $('#property_address');
let $content = $('#property_content');
let $state = $('#property_state');

$city.change(function () {
let $form = $(this).closest('form');
let data = getPropertyData();

$.ajax({
url: $form.attr('action'),
type: $form.attr('method'),
data: data,
success: function (html) {
$('#property_district').replaceWith(
$(html).find('#property_district')
);
$('#property_neighborhood').replaceWith(
$(html).find('#property_neighborhood')
);
$('#property_metro_station').replaceWith(
$(html).find('#property_metro_station')
);
}
(function ($) {
'use strict';

const renderOptions = (item) =>
`<option value="${item.id}">${item.name}</option>`;

const removeOptions = (selectIds) => {
$.each(selectIds, function (index, selectId) {
$(selectId + ' option').each(function () {
if ($(this).val() !== '') {
$(this).remove();
}
});
});
});
};

const clearOptions = () =>
removeOptions([
'#property_district',
'#property_neighborhood',
'#property_metro_station'
]);

$('body').on('change', '#property_city', function () {
clearOptions();
let cityId = $(this).val();
const token = $('#property_form').data('token');
const url =
'/en/city/' + cityId + '.json?csrf_token=' + token;

function getPropertyData() {
let data = {};
data[$city.attr('name')] = $city.val();
data[$title.attr('name')] = $title.val();
data[$description.attr('name')] = $description.val();
data[$address.attr('name')] = $address.val();
data[$content.attr('name')] = $content.val();
data[$state.attr('name')] = $state.val();

return data;
}
});
if ('' === cityId) {
return;
}

$.get(url).done((data) => {
let { districts, neighborhoods, metro_stations } = data;

districts = districts.map((item) => renderOptions(item));
neighborhoods = neighborhoods.map((item) =>
renderOptions(item)
);
metro_stations = metro_stations.map((item) =>
renderOptions(item)
);

$('#property_district').append(districts);
$('#property_neighborhood').append(neighborhoods);
$('#property_metro_station').append(metro_stations);
});
});
})(window.jQuery);
2 changes: 1 addition & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
locale: 'en'
app_locales: 'en|ru|nl|bg'
images_directory: '%kernel.project_dir%/public/uploads/images'
app_version: '2.4.3'
app_version: '2.4.4'

services:
# default configuration for services in *this* file
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
{
"devDependencies": {
"@babel/eslint-parser": "^7.14.5",
"@symfony/webpack-encore": "^1.7.0",
"@babel/core": "^7.20.12",
"@babel/eslint-parser": "^7.19.1",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.20.2",
"@symfony/webpack-encore": "^4.2.0",
"core-js": "^3.12.1",
"eslint": "^7.28.0",
"prettier": "^2.3.1",
"sass": "1.32.*",
"sass-loader": "^11.0.0",
"webpack-notifier": "^1.6.0"
"sass-loader": "^13.0.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-notifier": "^1.15.0"
},
"license": "UNLICENSED",
"private": true,
Expand Down
10 changes: 5 additions & 5 deletions public/build/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"js/app": {
"js": [
"/build/runtime.9a71ee5d.js",
"/build/js/app.36911f3f.js"
"/build/js/app.1053ee59.js"
]
},
"js/admin": {
Expand Down Expand Up @@ -39,13 +39,13 @@
"js/select2": {
"js": [
"/build/runtime.9a71ee5d.js",
"/build/js/select2.fd3458ee.js"
"/build/js/select2.e4b99976.js"
]
},
"js/settings": {
"js": [
"/build/runtime.9a71ee5d.js",
"/build/js/settings.fb55a353.js"
"/build/js/settings.2162af0d.js"
]
},
"js/slugger": {
Expand All @@ -57,13 +57,13 @@
"js/city": {
"js": [
"/build/runtime.9a71ee5d.js",
"/build/js/city.d3197a35.js"
"/build/js/city.0d36870f.js"
]
},
"js/photo": {
"js": [
"/build/runtime.9a71ee5d.js",
"/build/js/photo.ce050cfd.js"
"/build/js/photo.452a0a9f.js"
]
},
"js/page": {
Expand Down
2 changes: 2 additions & 0 deletions public/build/js/app.1053ee59.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
*/

/*!
* Sizzle CSS Selector Engine v2.3.6
* Sizzle CSS Selector Engine v2.3.9
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
* Date: 2022-12-19
*/

/*!
* jQuery JavaScript Library v3.6.1
* jQuery JavaScript Library v3.6.3
* https://jquery.com/
*
* Includes Sizzle.js
Expand All @@ -26,7 +26,7 @@
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2022-08-26T17:52Z
* Date: 2022-12-20T21:28Z
*/

/*! @preserve
Expand Down
2 changes: 0 additions & 2 deletions public/build/js/app.36911f3f.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/js/city.0d36870f.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/build/js/city.d3197a35.js

This file was deleted.

2 changes: 2 additions & 0 deletions public/build/js/photo.452a0a9f.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* Sizzle CSS Selector Engine v2.3.6
* Sizzle CSS Selector Engine v2.3.9
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
* Date: 2022-12-19
*/

/*!
Expand All @@ -21,7 +21,7 @@
*/

/*!
* jQuery JavaScript Library v3.6.1
* jQuery JavaScript Library v3.6.3
* https://jquery.com/
*
* Includes Sizzle.js
Expand All @@ -31,7 +31,7 @@
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2022-08-26T17:52Z
* Date: 2022-12-20T21:28Z
*/

/*!
Expand Down
2 changes: 0 additions & 2 deletions public/build/js/photo.ce050cfd.js

This file was deleted.

2 changes: 2 additions & 0 deletions public/build/js/select2.e4b99976.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*!
* Sizzle CSS Selector Engine v2.3.6
* Sizzle CSS Selector Engine v2.3.9
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
* Date: 2022-12-19
*/

/*!
* jQuery JavaScript Library v3.6.1
* jQuery JavaScript Library v3.6.3
* https://jquery.com/
*
* Includes Sizzle.js
Expand All @@ -20,7 +20,7 @@
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2022-08-26T17:52Z
* Date: 2022-12-20T21:28Z
*/

/*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 changes: 0 additions & 2 deletions public/build/js/select2.fd3458ee.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/js/settings.2162af0d.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/build/js/settings.fb55a353.js

This file was deleted.

10 changes: 5 additions & 5 deletions public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"build/js/app.js": "/build/js/app.36911f3f.js",
"build/js/app.js": "/build/js/app.1053ee59.js",
"build/js/admin.js": "/build/js/admin.0bc1672c.js",
"build/js/auth.js": "/build/js/auth.3ae01896.js",
"build/js/ekko-lightbox.js": "/build/js/ekko-lightbox.1a972d2c.js",
"build/js/map.js": "/build/js/map.fb35d4d9.js",
"build/js/menu-sorting.js": "/build/js/menu-sorting.91d373b6.js",
"build/js/select2.js": "/build/js/select2.fd3458ee.js",
"build/js/settings.js": "/build/js/settings.fb55a353.js",
"build/js/select2.js": "/build/js/select2.e4b99976.js",
"build/js/settings.js": "/build/js/settings.2162af0d.js",
"build/js/slugger.js": "/build/js/slugger.22e8871f.js",
"build/js/city.js": "/build/js/city.d3197a35.js",
"build/js/photo.js": "/build/js/photo.ce050cfd.js",
"build/js/city.js": "/build/js/city.0d36870f.js",
"build/js/photo.js": "/build/js/photo.452a0a9f.js",
"build/js/page.js": "/build/js/page.eaed21af.js",
"build/js/user.js": "/build/js/user.051ef9ab.js",
"build/js/password.js": "/build/js/password.a4f1763f.js",
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/AbstractPhotoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\Entity\Photo;
use App\Entity\Property;
use App\Repository\PhotoRepository;
use App\Service\FileUploader;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
Expand Down Expand Up @@ -51,6 +52,7 @@ protected function uploadPhoto(Property $property, Request $request, FileUploade
protected function sortPhotos(Request $request, Property $property): JsonResponse
{
$ids = $request->request->all('ids');
/** @var PhotoRepository $repository */
$repository = $this->doctrine->getRepository(Photo::class);
$repository->reorderPhotos($property, $ids);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Controller\Admin\Ajax;
namespace App\Controller\Ajax\Admin;

use App\Controller\AjaxController;
use App\Controller\Ajax\AjaxController;
use App\Repository\MenuRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace App\Controller\Admin\Ajax;
namespace App\Controller\Ajax\Admin;

use App\Controller\AbstractPhotoController;
use App\Controller\AjaxController;
use App\Controller\Ajax\AjaxController;
use App\Entity\Property;
use App\Service\FileUploader;
use Symfony\Component\HttpFoundation\JsonResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Controller\Admin\Ajax;
namespace App\Controller\Ajax\Admin;

use App\Controller\AjaxController;
use App\Controller\Ajax\AjaxController;
use App\Service\Admin\SettingsService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Controller;
namespace App\Controller\Ajax;

interface AjaxController
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Controller\Auth\Ajax;
namespace App\Controller\Ajax\Auth;

use App\Controller\AjaxController;
use App\Controller\Ajax\AjaxController;
use App\Entity\User;
use App\Message\SendEmailConfirmationLink;
use App\Service\Cache\UserDataCache;
Expand Down
Loading

0 comments on commit 02ba69a

Please sign in to comment.