Namespace feature implementation

This commit is contained in:
2020-09-29 17:10:48 +05:00
parent 51e3b370cf
commit 52826391fb
8 changed files with 114 additions and 21 deletions

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Article;
class NameSpaceController extends Controller
{
public function index()
{
return view('namespaces.index');
}
public function show($namespace)
{
if (!array_key_exists($namespace, config('karudhaas.topic_filters'))) return redirect('/namespaces');
return view('namespaces.show',[
'namespace' => config("karudhaas.topic_filters.".$namespace)
]);
}
}

View File

@@ -5,20 +5,33 @@ return [
"topic_filters" => [ "topic_filters" => [
"covid19" => [ "covid19" => [
"description" => "", "dv_name" => "ކޮރޯނާ ވައިރަސް",
"description" => "ކޮރޯނާ ވައިރަހާއި ބެހޭ ޙަބަރުތަކުގެ އެންމެފަހުގެ އަޕްޑޭޓް.",
"keys" => ["covid19", "covid-19", "corona_virus", "covid_19", "coronavirus"], "keys" => ["covid19", "covid-19", "corona_virus", "covid_19", "coronavirus"],
"color" => "border-red-500" "color" => "red"
], ],
"sports" => [ "sports" => [
"description" => "", "dv_name" => "ކުޅިވަރު",
"description" => "ކުޅިވަރުގެ ތަފާތު ޙަބަރުތަށް",
"keys" => [ "keys" => [
"football", "sport", "kulhivaru", "maldives_national_football_tea", "football_association_of_maldiv", "local_sports", "spanish_league", "football", "sport", "kulhivaru", "maldives_national_football_tea", "football_association_of_maldiv", "local_sports", "spanish_league",
"english-premier-league", "spanish-la-liga", "real_madrid", "bayern-munich", "arsenal", "atletico_madrid", "chelsea", "united-victory", "manchester-united" "english-premier-league", "spanish-la-liga", "real_madrid", "bayern-munich", "arsenal", "atletico_madrid", "chelsea", "united-victory", "manchester-united"
], ],
"color" => "border-blue-500" "color" => "blue"
] ],
"business" => [
"dv_name" => "ވިޔަފާރި",
"description" => "ފިޔަފާރިއާ ބެހޭ އެންމެ ފަހުގެ ޙަބަރުތަށް",
"keys" => [
"tourism", "sme_loan","sme_bank","public_companies","mtcc","tourists","world_tourism_day_","mtcc_shares","google","guest_house","fish_products","tax", "business", "dhiraagu",
"raajjeyge_iqthisaadh", "guesthouse", "fathuruverikan", "fathuruverikamuge_dhaairaa", "Airport_development", "regional_airports", "loan-schemes", "economy", "ministry-of-finance-and-treasury",
"ooredoo", "fisheries"
],
"color" => "green"
],
] ]
]; ];

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="mb-10 border-t mt-5"> <div class="mb-10">
<div class="flex flex-col items-center"> <div class="flex flex-col items-center">
<h3 <h3
class="text-gray-800 text-3xl text-center mt-5 mb-2 mr-3 MvAamu" class="text-gray-800 text-3xl text-center mt-5 mb-2 mr-3 MvAamu"

View File

@@ -25,12 +25,4 @@
<available-sources></available-sources> <available-sources></available-sources>
<recent-stories></recent-stories> <recent-stories></recent-stories>
<topic-filter topics="{{implode(',',config('karudhaas.topic_filters.covid19.keys')) }}"
label="ކޮރޯނާވައިރަހުގެ އަދާހަމަ" :per_page="6" color="border-red-500">
</topic-filter>
<topic-filter topics="{{implode(',',config('karudhaas.topic_filters.sports.keys')) }}" label="ކުޅިވަރުގެ އަދާހަމަ"
:per_page="6" color="border-blue-500">
</topic-filter>
@endsection @endsection

View File

@@ -0,0 +1,36 @@
@extends('layouts.app')
@section('content')
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2 mb-10">
@foreach (config('karudhaas.topic_filters') as $namespace)
<div
class="relative flex items-center w-full px-2 transition-all duration-200 transform mini-card lg:max-w-md first:ml-4 last:pr-6 hover:-translate-y-4">
<div class="flex flex-col h-full overflow-hidden bg-white border-2 border-{{$namespace['color']}}-500 rounded-lg w-full">
<div class="flex justify-center px-4 pt-4">
<div class="flex flex-wrap items-center -mb-2">
<a href="#"
class="MvAamu inline-block text-md tracking-wide py-2 px-12 bg-{{$namespace['color']}}-500 text-white rounded-md mr-2 mb-2 transform transition-all duration-100 ease-in-out hover:bg-orange-50 border-2 border-gray-100 hover:border-{{$namespace['color']}}-500 hover:text-{{$namespace['color']}}-700"
style="font-weight: 100;">{{$namespace['dv_name']}}</a>
</div>
</div>
<a href="#" class="relative block h-full px-4 py-4"
style="min-height:auto;">
<div class="leading-7 ">
<p class="MvTyper text-center" style="direction: rtl;">{{$namespace['description']}}</p>
</div>
</a>
</div>
</div>
@endforeach
</div>
@endsection

View File

@@ -0,0 +1,7 @@
@extends('layouts.app')
@section('content')
<topic-filter topics="{{implode(',',$namespace['keys']) }}" label="{{$namespace['dv_name']}}" :per_page="12"
color="border-{{$namespace['color']}}-500">
</topic-filter>
@endsection

View File

@@ -1,5 +1,22 @@
@extends('layouts.app') @extends('layouts.app')
@section('meta')
<title>Karudhaas | {{$topic->slug}}</title>
<meta name="description" content="Discover Stories,Daily news and inspiration for maldivian readers." />
<meta name=" twitter:title" content="Karudhaas" />
<meta name="twitter:description" content="Discover Stories,Daily news and inspiration for maldivian readers." />
<meta name="twitter:site" content="https://karudhaas.net" />
<meta name="twitter:image" content="/images/ogi.jpg">
<meta property="og:locale" content="mv" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Karudhaas">
<meta property="og:description" content="Discover Stories,Daily news and inspiration for maldivian readers." />
<meta property="og:url" content="https://karudhaas.net" />
<meta property="og:site_name" content="karudhaas.net" />
<meta property="og:image" content="/images/og.jpg">
@endsection
@section('content') @section('content')
<div> <div>
<section class="mx-auto max-w-6xl py-5"> <section class="mx-auto max-w-6xl py-5">
@@ -8,7 +25,8 @@
<div class="transition-all ease-in-out duration-1000 flex flex-col justify-center"> <div class="transition-all ease-in-out duration-1000 flex flex-col justify-center">
<div slot="middle-right" class="max-w-xs"> <div slot="middle-right" class="max-w-xs">
<div class="flex flex-col justify-center h-48 p-3"> <div class="flex flex-col justify-center h-48 p-3">
<div class="text-5xl text-gray-800 mb-2 text-center MvAamu" style="font-weight: 100;">{{$topic->name}}</div> <div class="text-5xl text-gray-800 mb-2 text-center MvAamu" style="font-weight: 100;">
{{$topic->name}}</div>
<div class="text-sm my-3 MvTyper text-center leading-6" style="direction:rtl;"> <div class="text-sm my-3 MvTyper text-center leading-6" style="direction:rtl;">
{{$topic->name}} އާއިބެހޭ މަޢުލޫމާތުތަށް އެއްތަންކުރެވިފައި</div> {{$topic->name}} އާއިބެހޭ މަޢުލޫމާތުތަށް އެއްތަންކުރެވިފައި</div>
</div> </div>
@@ -24,7 +42,8 @@
<div slot="bottom-left" class="max-w-xs"> <div slot="bottom-left" class="max-w-xs">
<div class="p-5 shadow-md m-2 mt-4"> <div class="p-5 shadow-md m-2 mt-4">
<a href="{{route('articles.show',['source' => $article->source->slug, 'guid' => $article->guid])}}"> <a
href="{{route('articles.show',['source' => $article->source->slug, 'guid' => $article->guid])}}">
<img class="object-scale-down h-30" src="{{$article->featured_image}}" <img class="object-scale-down h-30" src="{{$article->featured_image}}"
alt="{{$article->meta['title']}}"> alt="{{$article->meta['title']}}">
</a> </a>
@@ -32,7 +51,8 @@
<div class="text-xs font-bold uppercase text-gray-500 text-right mt-1 mb-2 MvTyper"> <div class="text-xs font-bold uppercase text-gray-500 text-right mt-1 mb-2 MvTyper">
{{$article->source->name}}</div> {{$article->source->name}}</div>
<a href="{{route('articles.show',['source' => $article->source->slug, 'guid' => $article->guid])}}"> <a
href="{{route('articles.show',['source' => $article->source->slug, 'guid' => $article->guid])}}">
<div class="text-md font-bold leading-7 mb-2 MvTyper text-right hover:underline"> <div class="text-md font-bold leading-7 mb-2 MvTyper text-right hover:underline">
{{$article->title}}</div> {{$article->title}}</div>
</a> </a>
@@ -44,9 +64,6 @@
</div> </div>
@endforeach @endforeach
</div> </div>
</div> </div>
</section> </section>

View File

@@ -9,7 +9,7 @@ use App\Http\Controllers\ArticlesController;
use App\Http\Controllers\TopicsController; use App\Http\Controllers\TopicsController;
use App\Http\Controllers\SourcesController; use App\Http\Controllers\SourcesController;
use App\Http\Controllers\MylistController; use App\Http\Controllers\MylistController;
use App\Http\Controllers\NameSpaceController;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -38,6 +38,11 @@ Route::get('/source/{source:slug}', [SourcesController::class, 'show'])->name('s
Route::get('/mylist', [MylistController::class, 'index'])->name('mylist.index'); Route::get('/mylist', [MylistController::class, 'index'])->name('mylist.index');
Route::post('/mylist/{article:id}', [MylistController::class, 'store'])->name('mylist.store'); Route::post('/mylist/{article:id}', [MylistController::class, 'store'])->name('mylist.store');
Route::group(['prefix' => 'namespaces'], function(){
Route::get('/', [NameSpaceController::class, 'index'])->name('namespaces.index');
Route::get('/{namespace}', [NameSpaceController::class, 'show'])->name('namespaces.show');
});
Route::get('/about', function () { Route::get('/about', function () {
return view('pages.about', [ return view('pages.about', [
'sources' => Source::all(), 'sources' => Source::all(),