From ebfb471028d44b9ce0c965f560f4f3cf996c8480 Mon Sep 17 00:00:00 2001 From: HUET Benjamin Date: Wed, 13 Dec 2017 22:35:25 +0100 Subject: [PATCH] fixed bbcode using a new package since last one is now deleted --- composer.json | 2 +- src/Models/Operation.php | 10 ++++++++-- src/resources/assets/js/calendar.js | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index cd70fdb..c88d9a7 100755 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "eveseat/web": "^2.0.13", "eveseat/eveapi": "^2.0", "eveseat/services": "^2.0", - "golonka/bbcodeparser": "^2.0" + "s9e/text-formatter": "*" }, "authors": [{ "name": "Kassie Yvo", diff --git a/src/Models/Operation.php b/src/Models/Operation.php index 842be29..11e0484 100755 --- a/src/Models/Operation.php +++ b/src/Models/Operation.php @@ -5,6 +5,8 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Notifications\Notifiable; +use s9e\TextFormatter\Bundles\Forum as TextFormatter; + use Carbon\Carbon; use \DateTime; use Seat\Web\Models\User; @@ -53,8 +55,12 @@ public function setDescriptionAttribute($value) { $this->attributes['description_new'] = $value; } public function getParsedDescriptionAttribute() { - $bbcode = new \Golonka\BBCode\BBCodeParser; - return $bbcode->parse($this->description ?: $this->description_new); + $parser = TextFormatter::getParser(); + $parser->disablePlugin('Emoji'); + + $xml = $parser->parse($this->description ?: $this->description_new); + + return TextFormatter::render($xml); } public function getDurationAttribute() { diff --git a/src/resources/assets/js/calendar.js b/src/resources/assets/js/calendar.js index aca598f..cfd48fd 100755 --- a/src/resources/assets/js/calendar.js +++ b/src/resources/assets/js/calendar.js @@ -89,6 +89,8 @@ $('#modalUpdateOperation').on('show.bs.modal', function(e) { nowRounded = moment.utc(); nowRounded = moment.utc(Math.ceil((+nowRounded) / ROUNDING) * ROUNDING); + + $.getJSON("/calendar/operation/find/" + operation_id, function(op) { $('#modalUpdateOperation').find('input[name=title]').val(op.title); $('#modalUpdateOperation').find('option[value="' + op.type + '"]').prop('selected', true); @@ -97,8 +99,8 @@ $('#modalUpdateOperation').on('show.bs.modal', function(e) { $('#modalUpdateOperation').find('input[name=staging_info]').val(op.staging_info); $('#modalUpdateOperation').find('input[name=fc]').val(op.fc); $('#modalUpdateOperation').find('input[name=fc_character_id]').val(op.fc_character_id); - $('#modalUpdateOperation').find('input[name=description]').val(op.description); - + $('#modalUpdateOperation').find('textarea[name=description]').val(op.description); + $.each(op.tags, function(i, tag) { $('#checkbox-update-' + tag.id).prop('checked', true); });