Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/js/post-form.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+function ($) { "use strict";
var PostForm = function () {
this.$form = $('#post-form')
this.$form = $('.fancy-layout > form')
this.$markdownEditor = $('[data-field-name=content] [data-control=markdowneditor]:first', this.$form)
this.$preview = $('.editor-preview', this.$markdownEditor)

Expand Down Expand Up @@ -150,7 +150,7 @@
}

PostForm.prototype.initFormEvents = function() {
$(document).on('ajaxSuccess', '#post-form', function(event, context, data){
$(document).on('ajaxSuccess', '.fancy-layout > form', function(event, context, data){
if (context.handler == 'onSave' && !data.X_WINTER_ERROR_FIELDS) {
$(this).trigger('unchange.wn.changeMonitor')
}
Expand Down
13 changes: 5 additions & 8 deletions components/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,14 @@ public function getCategoryPageOptions()
public function init()
{
Event::listen('translate.localePicker.translateParams', function ($page, $params, $oldLocale, $newLocale) {
$newParams = $params;

if (isset($params['slug'])) {
$records = BlogPost::transWhere('slug', $params['slug'], $oldLocale)->first();
if ($records) {
$records->translateContext($newLocale);
$newParams['slug'] = $records['slug'];
$newParams = $params;
$record = BlogPost::transWhere('slug', $params['slug'], $oldLocale)->first();
if ($record) {
$newParams['slug'] = $record->getAttributeTranslated('slug', $newLocale);
return $newParams;
}
}

return $newParams;
});
}

Expand Down
15 changes: 15 additions & 0 deletions components/Posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Winter\Blog\Models\Post as BlogPost;
use Winter\Blog\Models\Settings as BlogSettings;
use Winter\Storm\Database\Collection;
use Winter\Storm\Support\Facades\Event;

class Posts extends ComponentBase
{
Expand Down Expand Up @@ -149,6 +150,20 @@ public function getSortOrderOptions()
return $options;
}

public function init()
{
Event::listen('translate.localePicker.translateParams', function ($page, $params, $oldLocale, $newLocale) {
if (isset($params['slug'])) {
$newParams = $params;
$record = BlogCategory::transWhere('slug', $params['slug'], $oldLocale)->first();
if ($record) {
$newParams['slug'] = $record->getAttributeTranslated('slug', $newLocale);
return $newParams;
}
}
});
}

public function onRun()
{
$this->prepareVars();
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
},
"require": {
"php": ">=7.0",
"winter/wn-backend-module": "~1.2.8",
"composer/installers": "~1.0"
},
"replace": {
Expand Down
8 changes: 0 additions & 8 deletions controllers/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Winter\Blog\Controllers;

use Backend\Classes\Controller;
use Backend\Facades\BackendMenu;
use Illuminate\Support\Facades\Lang;
use Winter\Blog\Models\Category;
use Winter\Storm\Support\Facades\Flash;
Expand All @@ -18,13 +17,6 @@ class Categories extends Controller

public $requiredPermissions = ['winter.blog.access_categories'];

public function __construct()
{
parent::__construct();

BackendMenu::setContext('Winter.Blog', 'blog', 'categories');
}

public function index_onDelete()
{
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
Expand Down
8 changes: 1 addition & 7 deletions controllers/Posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ class Posts extends Controller

public $requiredPermissions = ['winter.blog.access_other_posts', 'winter.blog.access_posts'];

public function __construct()
{
parent::__construct();

BackendMenu::setContext('Winter.Blog', 'blog', 'posts');
}
protected $formLayout = 'fancy';

public function index()
{
Expand All @@ -40,7 +35,6 @@ public function create()
{
BackendMenu::setContextSideMenu('new_post');

$this->bodyClass = 'compact-container';
$this->addCss('/plugins/winter/blog/assets/css/winter.blog-preview.css');
$this->addJs('/plugins/winter/blog/assets/js/post-form.js');

Expand Down
23 changes: 0 additions & 23 deletions controllers/categories/_list_toolbar.htm

This file was deleted.

5 changes: 0 additions & 5 deletions controllers/categories/_reorder_toolbar.htm

This file was deleted.

2 changes: 1 addition & 1 deletion controllers/categories/config_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ list: ~/plugins/winter/blog/models/category/columns.yaml
modelClass: Winter\Blog\Models\Category

# List Title
title: winter.blog::lang.categories.list_title
title: winter.blog::lang.category.label_plural

# Link URL for each record
recordUrl: winter/blog/categories/update/:id
Expand Down
46 changes: 0 additions & 46 deletions controllers/categories/create.htm

This file was deleted.

2 changes: 0 additions & 2 deletions controllers/categories/index.htm

This file was deleted.

1 change: 0 additions & 1 deletion controllers/categories/reorder.htm

This file was deleted.

54 changes: 0 additions & 54 deletions controllers/categories/update.htm

This file was deleted.

37 changes: 0 additions & 37 deletions controllers/posts/_list_toolbar.htm

This file was deleted.

50 changes: 0 additions & 50 deletions controllers/posts/_post_toolbar.htm

This file was deleted.

2 changes: 1 addition & 1 deletion controllers/posts/config_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ list: ~/plugins/winter/blog/models/post/columns.yaml
modelClass: Winter\Blog\Models\Post

# List Title
title: winter.blog::lang.posts.list_title
title: winter.blog::lang.post.label_plural

# Link URL for each record
recordUrl: winter/blog/posts/update/:id
Expand Down
23 changes: 0 additions & 23 deletions controllers/posts/create.htm

This file was deleted.

Loading