mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -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()
|
||||
->first();
|
||||
|
||||
$adv = $this->getLocationNames($adv);
|
||||
if ($adv) {
|
||||
$adv = $this->getLocationNames($adv);
|
||||
}
|
||||
|
||||
return $adv;
|
||||
}
|
||||
|
||||
@ -343,89 +343,90 @@ class AdvsController extends PublicController
|
||||
{
|
||||
$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);
|
||||
|
||||
$recommended_advs = $this->adv_repository->getRecommendedAds($adv->id);
|
||||
if ($adv) {
|
||||
|
||||
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);
|
||||
}
|
||||
if ($this->adv_model->is_enabled('complaints')) {
|
||||
$complaints = ComplaintsComplainTypesEntryModel::all();
|
||||
}
|
||||
|
||||
$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')) {
|
||||
$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'];
|
||||
if ($this->adv_model->is_enabled('customfields')) {
|
||||
$features = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->view($adv);
|
||||
}
|
||||
}
|
||||
|
||||
$options = $this->optionRepository->findAllBy('adv_id', $id);
|
||||
//Cloudinary Module
|
||||
$adv->video_url = null;
|
||||
if ($this->adv_model->is_enabled('cloudinary')) {
|
||||
|
||||
if ($isCommentActive) {
|
||||
$CommentModel = new CommentModel();
|
||||
$comments = $CommentModel->getComments($adv->id)->get();
|
||||
}
|
||||
$this->event->dispatch(new viewAd($adv));//view ad
|
||||
$CloudinaryModel = new VideoModel();
|
||||
$Cloudinary = $CloudinaryModel->getVideo($id);
|
||||
|
||||
$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 {
|
||||
if (substr($adv->cover_photo, 0, 1) === "/") {
|
||||
$coverPhoto = \Illuminate\Support\Facades\Request::root() . $adv->cover_photo;
|
||||
if (count($Cloudinary->get()) > 0) {
|
||||
$adv->video_url = $Cloudinary->first()->toArray()['url'];
|
||||
}
|
||||
}
|
||||
|
||||
$options = $this->optionRepository->findAllBy('adv_id', $id);
|
||||
|
||||
if ($this->adv_model->is_enabled('comments')) {
|
||||
$CommentModel = new CommentModel();
|
||||
$comments = $CommentModel->getComments($adv->id)->get();
|
||||
}
|
||||
$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 {
|
||||
$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") {
|
||||
return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints',
|
||||
'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options'));
|
||||
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',
|
||||
'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options'));
|
||||
} else {
|
||||
return back();
|
||||
}
|
||||
} 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)
|
||||
|
||||
@ -7,4 +7,11 @@ return [
|
||||
"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' => [
|
||||
'name' => 'Sitemap Dividing Number',
|
||||
],
|
||||
'include_cities_sitemap' => [
|
||||
'name' => 'Include Cities in Sitemap',
|
||||
],
|
||||
];
|
||||
|
||||
@ -23,9 +23,14 @@ class SitemapController extends PublicController
|
||||
public function index()
|
||||
{
|
||||
$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'));
|
||||
|
||||
return response()->view('visiosoft.module.cats::sitemap.index', [
|
||||
@ -39,8 +44,8 @@ class SitemapController extends PublicController
|
||||
$page = request()->page ?: 1;
|
||||
$skip = $page - 1;
|
||||
|
||||
$citiesCount = $this->cityRepository->count();
|
||||
if ($citiesCount) {
|
||||
if (setting_value('visiosoft.module.cats::include_cities_sitemap')
|
||||
&& $citiesCount = $this->cityRepository->count()) {
|
||||
$categoriesCount = $this->categoryRepository->count();
|
||||
|
||||
$takeCategories = $categoriesCount / ($categoriesCount * $citiesCount / $sitemapDividingNumber);
|
||||
|
||||
@ -18,6 +18,12 @@ return [
|
||||
"default_value" => 'OpenClassify',
|
||||
]
|
||||
],
|
||||
"footer_copyright_org_name" => [
|
||||
"type" => "anomaly.field_type.text",
|
||||
"config" => [
|
||||
"default_value" => 'OpenClassify, Inc',
|
||||
]
|
||||
],
|
||||
"sidebar_main_color" => [
|
||||
"type" => "anomaly.field_type.colorpicker",
|
||||
"config" => [
|
||||
|
||||
@ -17,6 +17,9 @@ return [
|
||||
"title" => [
|
||||
'name' => 'Title',
|
||||
],
|
||||
"footer_copyright_org_name" => [
|
||||
'name' => 'Footer Copyright Organization Name',
|
||||
],
|
||||
"sidebar_main_color" => [
|
||||
'name' => 'Sidebar Main Color',
|
||||
],
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
<ul class="meta">
|
||||
<li class="copyright">
|
||||
© {{ 'now'|date('Y') }} OpenClassify, Inc
|
||||
© {{ 'now'|date('Y') }} {{ setting_value('visiosoft.theme.defaultadmin::footer_copyright_org_name') }}
|
||||
</li>
|
||||
<li class="footprint">
|
||||
{{ request_time() }} <span>|</span> {{ memory_usage() }}
|
||||
|
||||
@ -15,8 +15,29 @@ require('./bootstrap');
|
||||
|
||||
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);
|
||||
//
|
||||
// const app = new Vue({
|
||||
// el: '#app'
|
||||
// });
|
||||
|
||||
const app = new Vue({
|
||||
el: '#openclassify'
|
||||
});
|
||||
|
||||
@ -13,6 +13,4 @@ let mix = require('laravel-mix');
|
||||
|
||||
mix
|
||||
.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');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user