Merge branches 'fatihalp' and 'master' of https://github.com/openclassify/openclassify into fatihalp

This commit is contained in:
Fatih Alp 2021-02-07 23:42:14 +03:00
commit 6abb14dfb5
18 changed files with 99 additions and 59 deletions

View File

@ -23,6 +23,7 @@
.upper-list-banner { .upper-list-banner {
min-height: 300px; min-height: 300px;
background-size: cover;
} }
.upper-list-banner img { .upper-list-banner img {
@ -226,31 +227,14 @@ a.sort-by-open-dropdown:hover {
padding: 5px 0; padding: 5px 0;
} }
.p-3{
background-color: #f4f4f4;
}
.card { .card {
border: none; border: none;
} }
.py-1 {
padding-top: 3px!important;
padding-bottom: 3px!important;
}
.px-2 {
padding: 0!important;
}
.btn-link { .btn-link {
font-weight: bold; font-weight: bold;
} }
.p-3 {
padding: 8px !important;
}
.searchbut { .searchbut {
padding: 0px !important; padding: 0px !important;
} }

View File

@ -60,13 +60,15 @@ $(document).ready(function () {
$('.cat-item-3').parent().css('display', 'flex'); $('.cat-item-3').parent().css('display', 'flex');
stop(); stop();
} else { } else {
response.forEach(function(options){ if (!$('li', catId).length) {
$(catId).append("<li class='text-truncate pl-1 my-1' data-value="+options.id+">"+options.name+"</li>"); response.forEach(function(options){
}); $(catId).append("<li class='text-truncate pl-1 my-1' data-value="+options.id+">"+options.name+"</li>");
$('.focus-select').removeClass('focus-select'); });
// $(catId).animate({height: '14rem'}, 200); $('.focus-select').removeClass('focus-select');
$(catId).css({height: '14rem'}); // $(catId).animate({height: '14rem'}, 200);
$(catId).closest('.cat-item-2').show().addClass('focus-select') $(catId).css({height: '14rem'});
$(catId).closest('.cat-item-2').show().addClass('focus-select')
}
} }
// Auto scroll right // Auto scroll right
let categoryTab = $('.category-tab'); let categoryTab = $('.category-tab');

View File

@ -322,6 +322,8 @@ return [
'upload_files' => 'Upload Files', 'upload_files' => 'Upload Files',
'additional_fields' => 'Additional Fields', 'additional_fields' => 'Additional Fields',
'ad_location' => 'Ad Location', 'ad_location' => 'Ad Location',
'owner' => 'Owner',
'default_owner_instruction' => 'The owner will default to the current user if no user is selected',
'free' => 'Free', 'free' => 'Free',
'ad_date' => 'Ad Date', 'ad_date' => 'Ad Date',

View File

@ -4,9 +4,20 @@
{{ content|raw }} {{ content|raw }}
{% if form.mode == 'edit' %} {% if form.mode == 'edit' %}
{% set entry = form.entry.setAttribute('cf_json', null) %} {% set entry = form.entry %}
<script> <script>
const ad = JSON.parse(`{{ entry|json_encode|raw }}`) const ad = {
cat1: `{{ entry.cat1 }}`,
cat2: `{{ entry.cat2 }}`,
cat3: `{{ entry.cat3 }}`,
cat4: `{{ entry.cat4 }}`,
cat5: `{{ entry.cat5 }}`,
cat6: `{{ entry.cat6 }}`,
cat7: `{{ entry.cat7 }}`,
cat8: `{{ entry.cat8 }}`,
cat9: `{{ entry.cat9 }}`,
cat10: `{{ entry.cat10 }}`,
}
</script> </script>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -11,7 +11,9 @@
</p> </p>
</div> </div>
<div class="preview-actions text-center"> <div class="preview-actions text-center">
{% if isActiveDopings %} {% if isActive('packages') and setting_value('visiosoft.module.packages::move_the_buy_package_to_the_end') %}
{% set continueLink = url_route('visiosoft.module.packages::add_package', [adv.id]) %}
{% elseif isActive('dopings') %}
{% set continueLink = url_route('add_doping', [adv.id]) %} {% set continueLink = url_route('add_doping', [adv.id]) %}
{% else %} {% else %}
{% set continueLink = url_route('adv_detail_seo', [adv.slug, adv.id]) %} {% set continueLink = url_route('adv_detail_seo', [adv.slug, adv.id]) %}

View File

@ -1,6 +1,7 @@
<?php namespace Visiosoft\AdvsModule\Adv; <?php namespace Visiosoft\AdvsModule\Adv;
use Anomaly\Streams\Platform\Entry\EntryCollection; use Anomaly\Streams\Platform\Entry\EntryCollection;
use Carbon\Carbon;
use Illuminate\Container\Container; use Illuminate\Container\Container;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator; use Illuminate\Pagination\Paginator;
@ -26,4 +27,13 @@ class AdvCollection extends EntryCollection
'items', 'total', 'perPage', 'currentPage', 'options' 'items', 'total', 'perPage', 'currentPage', 'options'
)); ));
} }
public function nonExpired()
{
return $this->filter(
function ($ad) {
return $ad->finish_at->gt(Carbon::now());
}
);
}
} }

View File

@ -466,15 +466,16 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
{ {
$ads = $this $ads = $this
->newQuery() ->newQuery()
->whereIn('advs_advs.created_by_id', $usersIDs) ->whereIn('advs_advs.created_by_id', $usersIDs);
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
if ($status) { if ($status) {
$ads = $ads->where('advs_advs.status', 'approved'); $ads = $ads->where('advs_advs.status', 'approved');
} }
if (!$withDraft) { if (!$withDraft) {
$ads = $ads->where('advs_advs.slug', '!=', ""); $ads = $ads
->where('advs_advs.slug', '!=', "")
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
} }
return $ads; return $ads;

View File

@ -1,6 +1,7 @@
<?php namespace Visiosoft\AdvsModule\Adv\Form; <?php namespace Visiosoft\AdvsModule\Adv\Form;
use Anomaly\Streams\Platform\Ui\Form\FormBuilder; use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
use Anomaly\UsersModule\User\UserModel;
use Visiosoft\AdvsModule\Adv\AdvModel; use Visiosoft\AdvsModule\Adv\AdvModel;
class SimpleAdvFormBuilder extends FormBuilder class SimpleAdvFormBuilder extends FormBuilder
@ -8,6 +9,15 @@ class SimpleAdvFormBuilder extends FormBuilder
protected $model = AdvModel::class; protected $model = AdvModel::class;
protected $fields = [ protected $fields = [
"created_by_id" => [
'label' => 'visiosoft.module.advs::field.owner',
'instructions' => 'visiosoft.module.advs::field.default_owner_instruction',
"type" => "anomaly.field_type.relationship",
"config" => [
"related" => UserModel::class,
"mode" => "lookup",
]
],
'name', 'name',
'price', 'price',
'currency', 'currency',

View File

@ -11,6 +11,10 @@ class SimpleAdvFormHandler
return; return;
} }
if (!$builder->getFormValue('created_by_id')) {
$builder->setFormValue('created_by_id', auth()->id());
}
$builder->saveForm(); $builder->saveForm();
$ad = $advRepository->find($builder->getFormEntryId()); $ad = $advRepository->find($builder->getFormEntryId());

View File

@ -128,9 +128,12 @@ class AdvsModulePlugin extends Plugin
return [ return [
new \Twig_SimpleFilter( new \Twig_SimpleFilter(
'ksort', 'ksort',
function (array $array) { function ($array) {
ksort($array); if ($array) {
return $array; ksort($array);
return $array;
}
return null;
} }
), ),
]; ];

View File

@ -666,8 +666,7 @@ class AdvsController extends PublicController
public function getCatsForNewAd($id) public function getCatsForNewAd($id)
{ {
if ($this->adv_model->is_enabled('packages') and !setting_value('visiosoft.module.packages::move_the_buy_package_to_the_end')) {
if ($this->adv_model->is_enabled('packages')) {
$cats = app('Visiosoft\PackagesModule\Http\Controller\PackageFEController')->AdLimitForCategorySelection($id); $cats = app('Visiosoft\PackagesModule\Http\Controller\PackageFEController')->AdLimitForCategorySelection($id);
} else { } else {
$cats = $this->getCats($id); $cats = $this->getCats($id);
@ -962,7 +961,7 @@ class AdvsController extends PublicController
} elseif ($type === 'sold') { } elseif ($type === 'sold') {
$message = trans('visiosoft.module.advs::message.sold_status_change'); $message = trans('visiosoft.module.advs::message.sold_status_change');
} else { } else {
trans('visiosoft.module.advs::message.passive_status_change'); $message = trans('visiosoft.module.advs::message.passive_status_change');
} }
$this->messages->success($message); $this->messages->success($message);
return back(); return back();

View File

@ -4076,7 +4076,7 @@ readers do not read off random characters that represent icons */
content: "\f7bc"; content: "\f7bc";
} }
.fa-redo:before { .fa-redo:before, .fa-repeat:before {
content: "\f01e"; content: "\f01e";
} }

View File

@ -2761,3 +2761,8 @@ body {
font-size: 2rem; font-size: 2rem;
} }
} }
/** bootstrap 4.1 Column Fix**/
.col-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}
.col-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}

View File

@ -2,8 +2,14 @@
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
$("div#myDrop").dropzone({url: "/file/post"}); $("div#myDrop").dropzone({url: "/file/post"});
var doc_input = $('input[name="doc_files"]');
var uploaded = $('input[name="files"]').val().split(',').map(Number); var uploaded = $('input[name="files"]').val().split(',').map(Number);
var docsUploaded = $('input[name="doc_files"]').val().split(',').map(Number);
if (doc_input.length) {
var docsUploaded = doc_input.val().split(',').map(Number);
}
$(function () { $(function () {
@ -69,7 +75,7 @@ $(function () {
var response = JSON.parse(file.xhr.response); var response = JSON.parse(file.xhr.response);
var mimeType = response.mime_type.split('/') var mimeType = response.mime_type.split('/')
if (mimeType[0] === 'image'){ if (mimeType[0] === 'image') {
uploaded.push(response.id); uploaded.push(response.id);
$('.media-selected-wrapper').load( $('.media-selected-wrapper').load(
@ -87,21 +93,23 @@ $(function () {
file.previewElement.remove(); file.previewElement.remove();
}, 500); }, 500);
} else { } else {
docsUploaded.push(response.id); if (doc_input.length) {
$('input[name="doc_files"]').val(docsUploaded.join(',')) docsUploaded.push(response.id);
$('input[name="doc_files"]').val(docsUploaded.join(','))
$('.doc_list').append(` $('.doc_list').append(`
<a id="${ response.id }" href="javascript:void(0)" onclick="deleteDocs(${ response.id })" class="text-dark"> <a id="${response.id}" href="javascript:void(0)" onclick="deleteDocs(${response.id})" class="text-dark">
${ response.name } ${response.name}
<i class="fa fa-trash text-danger"></i> <i class="fa fa-trash text-danger"></i>
</a><br> </a><br>
`) `)
setTimeout(function () { setTimeout(function () {
addAppendByData(docsUploaded[0]) addAppendByData(docsUploaded[0])
file.previewElement.remove(); file.previewElement.remove();
}, 500); }, 500);
}
} }
}); });

View File

@ -101,7 +101,6 @@ class UploadController extends AdminController
$constraint->aspectRatio(); $constraint->aspectRatio();
}); });
if ($settings_value['add_canvas']) { if ($settings_value['add_canvas']) {
$fullImg->resizeCanvas( $fullImg->resizeCanvas(
@ -132,13 +131,15 @@ class UploadController extends AdminController
$w = $image->width() / 2; $w = $image->width() / 2;
$h1 = $image->height() / 2; $h1 = $image->height() / 2;
$font_size = $w / 20; $font_size = $w / 20;
$image->text($settings_value['watermark_text'], $w, $h1, function ($font) use ($v, $h, $font_size) { $image->text(($watermark_text = setting_value('visiosoft.module.advs::watermark_text')) ? $watermark_text : 'Openclassify', $w, $h1, function ($font) use ($v, $h, $font_size) {
$font->file(public_path('Antonio-Bold.ttf')); $font->file(public_path('Antonio-Bold.ttf'));
$font->size($font_size); $font->size($font_size);
$font->align($h); $font->align($h);
$font->valign($v); $font->valign($v);
}); });
} }
if ($key === "full") { if ($key === "full") {
$fileName = $file->getAttributes()['name']; $fileName = $file->getAttributes()['name'];
} else { } else {

View File

@ -65,7 +65,7 @@ class ValueTableBuilder extends TableBuilder
], ],
'rotate' => [ 'rotate' => [
'target' => '_blank', 'target' => '_blank',
'icon' => 'fas fa-redo', 'icon' => 'fa fa-repeat',
'type' => 'info', 'type' => 'info',
'text' => '', 'text' => '',
'class' => 'col-4', 'class' => 'col-4',
@ -76,7 +76,7 @@ class ValueTableBuilder extends TableBuilder
], ],
'deleteImage' => [ 'deleteImage' => [
'target' => '_blank', 'target' => '_blank',
'icon' => 'fas fa-trash', 'icon' => 'fa fa-trash',
'type' => 'danger', 'type' => 'danger',
'text' => '', 'text' => '',
'class' => 'col-4 deleteImage', 'class' => 'col-4 deleteImage',

View File

@ -4,10 +4,12 @@ class UserUpdated
{ {
public $oldCustomerInfo; public $oldCustomerInfo;
public $changes; public $changes;
public $builder;
public function __construct($oldCustomerInfo, $changes) public function __construct($oldCustomerInfo, $changes, $builder = null)
{ {
$this->oldCustomerInfo = $oldCustomerInfo; $this->oldCustomerInfo = $oldCustomerInfo;
$this->changes = $changes; $this->changes = $changes;
$this->builder = $builder;
} }
} }

View File

@ -2,11 +2,7 @@
use Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection; use Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection;
use Anomaly\Streams\Platform\Message\MessageBag; use Anomaly\Streams\Platform\Message\MessageBag;
use Anomaly\UsersModule\User\Authenticator\Contract\AuthenticatorExtensionInterface;
use Anomaly\UsersModule\User\Contract\UserInterface;
use Anomaly\UsersModule\User\UserModel; use Anomaly\UsersModule\User\UserModel;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Redirect;
use Visiosoft\ProfileModule\Events\UserUpdated; use Visiosoft\ProfileModule\Events\UserUpdated;
class ProfileFormHandler class ProfileFormHandler
@ -72,7 +68,7 @@ class ProfileFormHandler
$changes = $this->change($user, $parameters); $changes = $this->change($user, $parameters);
event(new UserUpdated($oldCustomerInfo, $changes)); event(new UserUpdated($oldCustomerInfo, $changes, $builder));
$messages->success(trans('visiosoft.module.profile::message.success_update')); $messages->success(trans('visiosoft.module.profile::message.success_update'));
} }
@ -97,7 +93,7 @@ class ProfileFormHandler
foreach ($validators as $validator) { foreach ($validators as $validator) {
$valid = $validator->validate($fields); $valid = $validator->validate($fields);
if ($valid['error']) { if (isset($valid['error']) && $valid['error']) {
return $valid; return $valid;
} }
} }