mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 07:16:06 -06:00
Merge pull request #657 from openclassify/dia
improve the way vue js is compiled to prevent errors
This commit is contained in:
commit
5c43e64308
@ -292,7 +292,9 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
->inRandomOrder()
|
->inRandomOrder()
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$adv = $this->getLocationNames($adv);
|
if ($adv) {
|
||||||
|
$adv = $this->getLocationNames($adv);
|
||||||
|
}
|
||||||
|
|
||||||
return $adv;
|
return $adv;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -343,89 +343,90 @@ class AdvsController extends PublicController
|
|||||||
{
|
{
|
||||||
$id = is_null($id) ? $seo : $id;
|
$id = is_null($id) ? $seo : $id;
|
||||||
|
|
||||||
$categories = array();
|
|
||||||
$categories_id = array();
|
|
||||||
$isActiveComplaints = $this->adv_model->is_enabled('complaints');
|
|
||||||
$isCommentActive = $this->adv_model->is_enabled('comments');
|
|
||||||
|
|
||||||
if ($isActiveComplaints) {
|
|
||||||
$complaints = ComplaintsComplainTypesEntryModel::all();
|
|
||||||
}
|
|
||||||
|
|
||||||
$adv = $this->adv_repository->getListItemAdv($id);
|
$adv = $this->adv_repository->getListItemAdv($id);
|
||||||
|
|
||||||
$recommended_advs = $this->adv_repository->getRecommendedAds($adv->id);
|
if ($adv) {
|
||||||
|
|
||||||
foreach ($recommended_advs as $index => $ad) {
|
if ($this->adv_model->is_enabled('complaints')) {
|
||||||
$recommended_advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');
|
$complaints = ComplaintsComplainTypesEntryModel::all();
|
||||||
$recommended_advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad);
|
}
|
||||||
}
|
|
||||||
|
$recommended_advs = $this->adv_repository->getRecommendedAds($adv->id);
|
||||||
|
|
||||||
|
foreach ($recommended_advs as $index => $ad) {
|
||||||
|
$recommended_advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');
|
||||||
|
$recommended_advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad);
|
||||||
|
}
|
||||||
|
|
||||||
|
$categories = array();
|
||||||
|
$categories_id = array();
|
||||||
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
|
$cat = "cat" . $i;
|
||||||
|
if ($adv->$cat != null) {
|
||||||
|
$item = $this->category_repository->getItem($adv->$cat);
|
||||||
|
if (!is_null($item)) {
|
||||||
|
$categories['cat' . $i] = [
|
||||||
|
'name' => $item->name,
|
||||||
|
'id' => $item->id
|
||||||
|
];
|
||||||
|
$categories_id[] = $item->id;
|
||||||
|
}
|
||||||
|
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
|
||||||
$cat = "cat" . $i;
|
|
||||||
if ($adv->$cat != null) {
|
|
||||||
$item = $this->category_repository->getItem($adv->$cat);
|
|
||||||
if (!is_null($item)) {
|
|
||||||
$categories['cat' . $i] = [
|
|
||||||
'name' => $item->name,
|
|
||||||
'id' => $item->id
|
|
||||||
];
|
|
||||||
$categories_id[] = $item->id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->adv_model->is_enabled('customfields')) {
|
if ($this->adv_model->is_enabled('customfields')) {
|
||||||
$features = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->view($adv);
|
$features = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->view($adv);
|
||||||
}
|
|
||||||
|
|
||||||
//Cloudinary Module
|
|
||||||
$adv->video_url = null;
|
|
||||||
$isActiveCloudinary = $this->adv_model->is_enabled('cloudinary');
|
|
||||||
if ($isActiveCloudinary) {
|
|
||||||
|
|
||||||
$CloudinaryModel = new VideoModel();
|
|
||||||
$Cloudinary = $CloudinaryModel->getVideo($id);
|
|
||||||
|
|
||||||
if (count($Cloudinary->get()) > 0) {
|
|
||||||
$adv->video_url = $Cloudinary->first()->toArray()['url'];
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$options = $this->optionRepository->findAllBy('adv_id', $id);
|
//Cloudinary Module
|
||||||
|
$adv->video_url = null;
|
||||||
|
if ($this->adv_model->is_enabled('cloudinary')) {
|
||||||
|
|
||||||
if ($isCommentActive) {
|
$CloudinaryModel = new VideoModel();
|
||||||
$CommentModel = new CommentModel();
|
$Cloudinary = $CloudinaryModel->getVideo($id);
|
||||||
$comments = $CommentModel->getComments($adv->id)->get();
|
|
||||||
}
|
|
||||||
$this->event->dispatch(new viewAd($adv));//view ad
|
|
||||||
|
|
||||||
$this->template->set('meta_keywords', implode(',', explode(' ', $adv->name)));
|
if (count($Cloudinary->get()) > 0) {
|
||||||
$this->template->set('meta_description', strip_tags($adv->advs_desc, ''));
|
$adv->video_url = $Cloudinary->first()->toArray()['url'];
|
||||||
$this->template->set('showTitle', false);
|
}
|
||||||
$this->template->set(
|
}
|
||||||
'meta_title',
|
|
||||||
$adv->name . " " . end($categories)['name'] . ' ' . setting_value('streams::domain')
|
$options = $this->optionRepository->findAllBy('adv_id', $id);
|
||||||
);
|
|
||||||
if (substr($adv->cover_photo, 0, 4) === "http") {
|
if ($this->adv_model->is_enabled('comments')) {
|
||||||
$coverPhoto = $adv->cover_photo;
|
$CommentModel = new CommentModel();
|
||||||
} else {
|
$comments = $CommentModel->getComments($adv->id)->get();
|
||||||
if (substr($adv->cover_photo, 0, 1) === "/") {
|
}
|
||||||
$coverPhoto = \Illuminate\Support\Facades\Request::root() . $adv->cover_photo;
|
$this->event->dispatch(new viewAd($adv));//view ad
|
||||||
|
|
||||||
|
$this->template->set('meta_keywords', implode(',', explode(' ', $adv->name)));
|
||||||
|
$this->template->set('meta_description', strip_tags($adv->advs_desc, ''));
|
||||||
|
$this->template->set('showTitle', false);
|
||||||
|
$this->template->set(
|
||||||
|
'meta_title',
|
||||||
|
$adv->name . " " . end($categories)['name'] . ' ' . setting_value('streams::domain')
|
||||||
|
);
|
||||||
|
if (substr($adv->cover_photo, 0, 4) === "http") {
|
||||||
|
$coverPhoto = $adv->cover_photo;
|
||||||
} else {
|
} else {
|
||||||
$coverPhoto = \Illuminate\Support\Facades\Request::root() . '/' . $adv->cover_photo;
|
if (substr($adv->cover_photo, 0, 1) === "/") {
|
||||||
|
$coverPhoto = \Illuminate\Support\Facades\Request::root() . $adv->cover_photo;
|
||||||
|
} else {
|
||||||
|
$coverPhoto = \Illuminate\Support\Facades\Request::root() . '/' . $adv->cover_photo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
$this->template->set('meta_image', $coverPhoto);
|
||||||
$this->template->set('meta_image', $coverPhoto);
|
|
||||||
|
|
||||||
if ($adv->created_by_id == isset(auth()->user()->id) OR $adv->status == "approved") {
|
if ($adv->created_by_id == isset(auth()->user()->id) OR $adv->status == "approved") {
|
||||||
return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints',
|
return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints',
|
||||||
'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options'));
|
'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options'));
|
||||||
|
} else {
|
||||||
|
return back();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return back();
|
$this->messages->error(trans('visiosoft.module.advs::message.ad_doesnt_exist'));
|
||||||
|
return redirect()->route('visiosoft.module.advs::list');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preview($id)
|
public function preview($id)
|
||||||
|
|||||||
@ -7,4 +7,11 @@ return [
|
|||||||
"default_value" => 5000,
|
"default_value" => 5000,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"include_cities_sitemap" => [
|
||||||
|
"type" => "anomaly.field_type.boolean",
|
||||||
|
"config" => [
|
||||||
|
"default_value" => true,
|
||||||
|
"mode" => "checkbox",
|
||||||
|
]
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|||||||
@ -4,4 +4,7 @@ return [
|
|||||||
'sitemap_dividing_number' => [
|
'sitemap_dividing_number' => [
|
||||||
'name' => 'Sitemap Dividing Number',
|
'name' => 'Sitemap Dividing Number',
|
||||||
],
|
],
|
||||||
|
'include_cities_sitemap' => [
|
||||||
|
'name' => 'Include Cities in Sitemap',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -23,9 +23,14 @@ class SitemapController extends PublicController
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$categoriesCount = $this->categoryRepository->count();
|
$categoriesCount = $this->categoryRepository->count();
|
||||||
$citiesCount = $this->cityRepository->count();
|
|
||||||
|
|
||||||
$pagesCount = $citiesCount ? $categoriesCount * $citiesCount : $categoriesCount;
|
if (setting_value('visiosoft.module.cats::include_cities_sitemap')) {
|
||||||
|
$citiesCount = $this->cityRepository->count();
|
||||||
|
$pagesCount = $citiesCount ? $categoriesCount * $citiesCount : $categoriesCount;
|
||||||
|
} else {
|
||||||
|
$pagesCount = $categoriesCount;
|
||||||
|
}
|
||||||
|
|
||||||
$pagesCount = ceil($pagesCount / setting_value('visiosoft.module.cats::sitemap_dividing_number'));
|
$pagesCount = ceil($pagesCount / setting_value('visiosoft.module.cats::sitemap_dividing_number'));
|
||||||
|
|
||||||
return response()->view('visiosoft.module.cats::sitemap.index', [
|
return response()->view('visiosoft.module.cats::sitemap.index', [
|
||||||
@ -39,8 +44,8 @@ class SitemapController extends PublicController
|
|||||||
$page = request()->page ?: 1;
|
$page = request()->page ?: 1;
|
||||||
$skip = $page - 1;
|
$skip = $page - 1;
|
||||||
|
|
||||||
$citiesCount = $this->cityRepository->count();
|
if (setting_value('visiosoft.module.cats::include_cities_sitemap')
|
||||||
if ($citiesCount) {
|
&& $citiesCount = $this->cityRepository->count()) {
|
||||||
$categoriesCount = $this->categoryRepository->count();
|
$categoriesCount = $this->categoryRepository->count();
|
||||||
|
|
||||||
$takeCategories = $categoriesCount / ($categoriesCount * $citiesCount / $sitemapDividingNumber);
|
$takeCategories = $categoriesCount / ($categoriesCount * $citiesCount / $sitemapDividingNumber);
|
||||||
|
|||||||
@ -18,6 +18,12 @@ return [
|
|||||||
"default_value" => 'OpenClassify',
|
"default_value" => 'OpenClassify',
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"footer_copyright_org_name" => [
|
||||||
|
"type" => "anomaly.field_type.text",
|
||||||
|
"config" => [
|
||||||
|
"default_value" => 'OpenClassify, Inc',
|
||||||
|
]
|
||||||
|
],
|
||||||
"sidebar_main_color" => [
|
"sidebar_main_color" => [
|
||||||
"type" => "anomaly.field_type.colorpicker",
|
"type" => "anomaly.field_type.colorpicker",
|
||||||
"config" => [
|
"config" => [
|
||||||
|
|||||||
@ -17,6 +17,9 @@ return [
|
|||||||
"title" => [
|
"title" => [
|
||||||
'name' => 'Title',
|
'name' => 'Title',
|
||||||
],
|
],
|
||||||
|
"footer_copyright_org_name" => [
|
||||||
|
'name' => 'Footer Copyright Organization Name',
|
||||||
|
],
|
||||||
"sidebar_main_color" => [
|
"sidebar_main_color" => [
|
||||||
'name' => 'Sidebar Main Color',
|
'name' => 'Sidebar Main Color',
|
||||||
],
|
],
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<ul class="meta">
|
<ul class="meta">
|
||||||
<li class="copyright">
|
<li class="copyright">
|
||||||
© {{ 'now'|date('Y') }} OpenClassify, Inc
|
© {{ 'now'|date('Y') }} {{ setting_value('visiosoft.theme.defaultadmin::footer_copyright_org_name') }}
|
||||||
</li>
|
</li>
|
||||||
<li class="footprint">
|
<li class="footprint">
|
||||||
{{ request_time() }} <span>|</span> {{ memory_usage() }}
|
{{ request_time() }} <span>|</span> {{ memory_usage() }}
|
||||||
|
|||||||
@ -15,8 +15,29 @@ require('./bootstrap');
|
|||||||
|
|
||||||
window.Vue = require('vue');
|
window.Vue = require('vue');
|
||||||
|
|
||||||
|
const requireModulesVueFiles = (moduleVueFiles) => {
|
||||||
|
moduleVueFiles.keys().map(key => {
|
||||||
|
Vue.component(
|
||||||
|
key.split('/').pop().split('.')[0],
|
||||||
|
moduleVueFiles(key).default
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
requireModulesVueFiles(require.context(
|
||||||
|
'../../../addons/default/visiosoft',
|
||||||
|
true,
|
||||||
|
/\.vue$/i
|
||||||
|
))
|
||||||
|
|
||||||
|
requireModulesVueFiles(require.context(
|
||||||
|
'../../../core/visiosoft',
|
||||||
|
true,
|
||||||
|
/\.vue$/i
|
||||||
|
))
|
||||||
|
|
||||||
// Vue.component('example', require('./components/Example.vue').default);
|
// Vue.component('example', require('./components/Example.vue').default);
|
||||||
//
|
|
||||||
// const app = new Vue({
|
const app = new Vue({
|
||||||
// el: '#app'
|
el: '#openclassify'
|
||||||
// });
|
});
|
||||||
|
|||||||
@ -13,6 +13,4 @@ let mix = require('laravel-mix');
|
|||||||
|
|
||||||
mix
|
mix
|
||||||
.js('resources/assets/js/app.js', 'public/js')
|
.js('resources/assets/js/app.js', 'public/js')
|
||||||
.js('addons/default/visiosoft/*/resources/js/vue/app.js', 'public/js')
|
|
||||||
.js('core/visiosoft/*/resources/js/vue/app.js', 'public/js')
|
|
||||||
.sass('resources/assets/sass/app.scss', 'public/css');
|
.sass('resources/assets/sass/app.scss', 'public/css');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user