Skip to content

Commit

Permalink
markdown filter added as twig extension
Browse files Browse the repository at this point in the history
  • Loading branch information
giannisdaras committed Feb 19, 2018
1 parent d50940f commit 743e968
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Speaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Speaker extends Model
{
// other fields: id,img_src,schedule_id;
use HasTranslations;
public $translatable = ['name','bio'];
public $translatable = ['name','bio','talk_title','talk_prev'];
public $timestamps = false;

public function talk() {
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.3",
"jralph/twig-markdown": "1.0.1",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"mcamara/laravel-localization": "^1.3",
Expand Down
86 changes: 85 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions config/active.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Active class
|--------------------------------------------------------------------------
|
| Here you may set the class string to be returned when the provided routes
| or paths were identified as applicable for the current route.
|
*/

'class' => 'active',

];
2 changes: 2 additions & 0 deletions config/twigbridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@

'App\TwigLocaleHelper',
'App\TwigEnvHelper',
new Jralph\Twig\Markdown\Extension(
new Jralph\Twig\Markdown\Parsedown\ParsedownExtraMarkdown),
],

/*
Expand Down
2 changes: 2 additions & 0 deletions database/seeds/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ public function run()
{
/* Speakers are seeded through the Schedule seeder */
$this->call(ScheduleSeeder::class);
$this->call(PeopleTableSeeder::class);
$this->call(SpeakersSeeder::class);
}
}
35 changes: 35 additions & 0 deletions database/seeds/SpeakersSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Seeder;

class SpeakersSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('speakers')->insert([
'name'=>json_encode([
'en'=> 'Michail Styllas',
'el'=> 'Μιχάλης Στύλας'
]),
'id'=>'styllas',
'img_src'=>'styllas.jpeg',
'talk_title'=>json_encode([
'en'=>'Everest, the end of chaos!',
'el'=> 'Το τέλος του χάους στο everest!',
]),
'talk_prev'=>json_encode([
'en'=>'Chaos is ** extreme weather **, chaos is extreme love!',
'el'=>'Χάος είναι ο ακραίος καιρός του έβερεστ, χάος είναι η αγάπη'
]),
'bio'=>json_encode([
'en'=>'dede',
'el'=>'δεδεδ'
])
]);
}
}
2 changes: 1 addition & 1 deletion resources/views/speakers.twig
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</p>
</div>
<div class="col col-12 col-lg-6">
<h3 class="text-center primary">{{ trans('general.speakers.talk') }}: {{ speaker.talk.event_prev }}</h3>
<h3 class="text-center primary">{{ trans('general.speakers.talk') }}: {{ speaker.talk_prev|markdown }}</h3>
<p class="text-justify">
{{ speaker.talk.subtitle }}
</p>
Expand Down

0 comments on commit 743e968

Please sign in to comment.