mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #634 from openclassify/dia
#1929 Site meta description doesn't seen for home
This commit is contained in:
commit
afdae12350
@ -5,6 +5,7 @@ use Anomaly\Streams\Platform\Addon\AddonCollection;
|
||||
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
||||
use Anomaly\Streams\Platform\Image\Image;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||
use Visiosoft\RecentlyviewedadsModule\Recently\RecentlyModel;
|
||||
use Visiosoft\SubscriptionsModule\User\UserModel;
|
||||
|
||||
@ -12,11 +13,17 @@ class AdvCriteria extends EntryCriteria
|
||||
{
|
||||
|
||||
private $image;
|
||||
private $advRepository;
|
||||
|
||||
public function __construct(SettingRepositoryInterface $repository, Image $image)
|
||||
public function __construct(
|
||||
SettingRepositoryInterface $repository,
|
||||
Image $image,
|
||||
AdvRepositoryInterface $advRepository
|
||||
)
|
||||
{
|
||||
$this->settings = $repository;
|
||||
$this->image = $image;
|
||||
$this->advRepository = $advRepository;
|
||||
}
|
||||
|
||||
public function getAdvsModel()
|
||||
@ -79,20 +86,7 @@ class AdvCriteria extends EntryCriteria
|
||||
|
||||
public function findAdsByCategoryId($catId, $level = 1)
|
||||
{
|
||||
$advModel = new AdvModel();
|
||||
$advs = AdvModel::query()
|
||||
->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
||||
->where('status', '=', 'approved')
|
||||
->where('slug', '!=', '')
|
||||
->where('cat' . $level, $catId)
|
||||
->get();
|
||||
|
||||
$ads = $advModel->getLocationNames($advs);
|
||||
foreach ($ads as $index => $ad) {
|
||||
$ads[$index]->detail_url = $advModel->getAdvDetailLinkByModel($ad, 'list');
|
||||
$ads[$index] = $advModel->AddAdsDefaultCoverImage($ad);
|
||||
}
|
||||
return $ads;
|
||||
return $this->advRepository->getByCat($catId, $level);
|
||||
}
|
||||
|
||||
public function getCurrentLocale()
|
||||
|
||||
@ -405,6 +405,26 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
return $ads;
|
||||
}
|
||||
|
||||
public function getByCat($catID, $level = 1)
|
||||
{
|
||||
$advs = $this->model
|
||||
->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
||||
->where('status', 'approved')
|
||||
->where('slug', '!=', '')
|
||||
->where('cat' . $level, $catID)
|
||||
->limit(20)
|
||||
->get();
|
||||
|
||||
$ads = $this->model->getLocationNames($advs);
|
||||
|
||||
foreach ($ads as $index => $ad) {
|
||||
$ads[$index]->detail_url = $this->model->getAdvDetailLinkByModel($ad, 'list');
|
||||
$ads[$index] = $this->model->AddAdsDefaultCoverImage($ad);
|
||||
}
|
||||
|
||||
return $ads;
|
||||
}
|
||||
|
||||
public function getCategoriesWithAdID($id)
|
||||
{
|
||||
$adv = $this->model->find($id);
|
||||
|
||||
@ -32,6 +32,8 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
||||
|
||||
public function latestAds();
|
||||
|
||||
public function getByCat($catID, $level = 1);
|
||||
|
||||
public function getCategoriesWithAdID($id);
|
||||
|
||||
public function extendAds($allAds, $isAdmin = false);
|
||||
|
||||
@ -216,6 +216,10 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
'as' => 'ajax::getAds',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@getMyAds'
|
||||
],
|
||||
'ajax/get-advs-by-category/{categoryID}' => [
|
||||
'as' => 'ajax::getAds',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@getAdvsByCat'
|
||||
],
|
||||
'advs/extendAll/{isAdmin?}' => [
|
||||
'as' => 'advs::extendAll',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@extendAll',
|
||||
|
||||
@ -85,4 +85,9 @@ class AjaxController extends PublicController
|
||||
|
||||
return response()->json(['success' => true, 'content' => $my_advs, 'title' => $page_title]);
|
||||
}
|
||||
|
||||
public function getAdvsByCat($categoryID, AdvRepositoryInterface $advRepository)
|
||||
{
|
||||
return $advRepository->getByCat($categoryID);
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
{% block ogdata %}
|
||||
<meta property="og:site_name"
|
||||
content="{{ template.get('og_site_name', setting_value('streams::name', config_get('streams::distribution.name'))) }}"/>
|
||||
<meta property="og:description" content="{{ template.get('og_description', trans(template.meta_description))|slice(0,160) }}"/>
|
||||
<meta property="og:description" content="{{ (template.get('meta_description') ?: setting_value('streams::description'))|slice(0,160) }}"/>
|
||||
<meta property="og:title" content="{{ (setting_value('streams::name', config_get('streams::distribution.name'))~" | "~trans(template.meta_title))|slice(0,60) }}"/>
|
||||
<meta property="og:url" content="{{ template.get('og_url', url_current()) }}"/>
|
||||
<meta property="og:image" content="{{ template.get('og_image', trans(template.meta_image)) }}"/>
|
||||
@ -11,6 +11,6 @@
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="{{ template.get('og_site_name', setting_value('streams::name', config_get('streams::distribution.name'))) }}">
|
||||
<meta name="twitter:title" content="{{ (setting_value('streams::name', config_get('streams::distribution.name'))~" | "~trans(template.meta_title))|slice(0,60) }}">
|
||||
<meta name="twitter:description" content="{{ template.get('og_description', trans(template.meta_description))|slice(0,160) }}">
|
||||
<meta name="twitter:description" content="{{ (template.get('meta_description') ?: setting_value('streams::description'))|slice(0,160) }}">
|
||||
<meta name="twitter:image" content="{{ template.get('og_image', trans(template.meta_image)) }}">
|
||||
{% endblock %}
|
||||
Loading…
Reference in New Issue
Block a user