1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-31 18:30:20 +02:00

Pages Plugin: add tags field #4

This commit is contained in:
Awilum
2014-02-17 20:42:38 +02:00
parent 9fc9843639
commit a242cd8804
3 changed files with 58 additions and 14 deletions

View File

@@ -102,6 +102,7 @@ class PagesAdmin extends Backend
'title' => $rand_page_title,
'description' => $orig_page['description'],
'keywords' => $orig_page['keywords'],
'tags' => $orig_page['tags'],
'date' => $orig_page['date'],
'author' => $orig_page['author']))) {
@@ -173,6 +174,7 @@ class PagesAdmin extends Backend
'title' => Request::post('page_title'),
'description' => Request::post('page_description'),
'keywords' => Request::post('page_keywords'),
'tags' => Request::post('page_tags'),
'date' => $date,
'author' => $author))) {
@@ -219,6 +221,7 @@ class PagesAdmin extends Backend
if (Request::post('page_title')) $post_title = Request::post('page_title'); else $post_title = '';
if (Request::post('page_keywords')) $post_keywords = Request::post('page_keywords'); else $post_keywords = '';
if (Request::post('page_description')) $post_description = Request::post('page_description'); else $post_description = '';
if (Request::post('page_tags')) $post_tags = Request::post('page_tags'); else $post_tags = '';
if (Request::post('editor')) $post_content = Request::post('editor'); else $post_content = '';
if (Request::post('templates')) $post_template = Request::post('templates'); else $post_template = 'index';
if (Request::post('status')) $post_status = Request::post('status'); else $post_status = 'published';
@@ -240,6 +243,7 @@ class PagesAdmin extends Backend
->assign('post_title', $post_title)
->assign('post_description', $post_description)
->assign('post_keywords', $post_keywords)
->assign('post_tags', $post_tags)
->assign('post_content', $post_content)
->assign('pages_array', $pages_array)
->assign('parent_page', $parent_page)
@@ -286,6 +290,7 @@ class PagesAdmin extends Backend
if (Request::post('page_title')) $post_title = Request::post('page_title'); else $post_title = '';
if (Request::post('page_keywords')) $post_keywords = Request::post('page_keywords'); else $post_keywords = '';
if (Request::post('page_description')) $post_description = Request::post('page_description'); else $post_description = '';
if (Request::post('page_tags')) $post_tags = Request::post('page_tags'); else $post_tags = '';
if (Request::post('editor')) $post_content = Request::post('editor'); else $post_content = '';
if (Request::post('templates')) $post_template = Request::post('templates'); else $post_template = 'index';
if (Request::post('status')) $post_status = Request::post('status'); else $post_status = 'published';
@@ -324,6 +329,7 @@ class PagesAdmin extends Backend
'title' => Request::post('page_title'),
'description' => Request::post('page_description'),
'keywords' => Request::post('page_keywords'),
'tags' => Request::post('page_tags'),
'robots_index' => $robots_index,
'robots_follow'=> $robots_follow,
'status' => Request::post('status'),
@@ -347,6 +353,7 @@ class PagesAdmin extends Backend
'title' => Request::post('page_title'),
'description' => Request::post('page_description'),
'keywords' => Request::post('page_keywords'),
'tags' => Request::post('page_tags'),
'robots_index' => $robots_index,
'robots_follow'=> $robots_follow,
'status' => Request::post('status'),
@@ -408,6 +415,7 @@ class PagesAdmin extends Backend
if (Request::post('page_title')) $title_to_edit = Request::post('page_title'); else $title_to_edit = $page['title'];
if (Request::post('page_description')) $description_to_edit = Request::post('page_description'); else $description_to_edit = $page['description'];
if (Request::post('page_keywords')) $keywords_to_edit = Request::post('page_keywords'); else $keywords_to_edit = $page['keywords'];
if (Request::post('page_tags')) $tags_to_edit = Request::post('page_tags'); else $tags_to_edit = $page['tags'];
if (Request::post('editor')) $to_edit = Request::post('editor'); else $to_edit = Text::toHtml($page_content);
if (Request::post('robots_index')) $post_robots_index = true; else if ($page['robots_index'] == 'noindex') $post_robots_index = true; else $post_robots_index = false;
@@ -440,6 +448,7 @@ class PagesAdmin extends Backend
->assign('title_to_edit', $title_to_edit)
->assign('description_to_edit', $description_to_edit)
->assign('keywords_to_edit', $keywords_to_edit)
->assign('tags_to_edit', $tags_to_edit)
->assign('page', $page)
->assign('to_edit', $to_edit)
->assign('pages_array', $pages_array)
@@ -559,7 +568,7 @@ class PagesAdmin extends Backend
$count = 0;
// Get pages
$pages_list = $pages->select(null, 'all', null, array('slug', 'title', 'status', 'date', 'author', 'expand', 'access', 'parent', 'template'));
$pages_list = $pages->select(null, 'all', null, array('slug', 'title', 'status', 'date', 'author', 'expand', 'access', 'parent', 'template', 'tags'));
// Loop
foreach ($pages_list as $page) {
@@ -574,6 +583,7 @@ class PagesAdmin extends Backend
$pages_array[$count]['author'] = $page['author'];
$pages_array[$count]['expand'] = $page['expand'];
$pages_array[$count]['slug'] = $page['slug'];
$pages_array[$count]['tags'] = $page['tags'];
$pages_array[$count]['template']= $page['template'];
if (isset($page['parent'])) {

View File

@@ -13,7 +13,7 @@
<li <?php if (Notification::get('settings')) { ?>class="active"<?php } ?>><a href="#settings" data-toggle="tab"><?php echo __('Settings', 'pages'); ?></a></li>
</ul>
<div class="tab-content tab-page">
<div class="tab-content tab-page margin-bottom-1em">
<div class="tab-pane <?php if (Notification::get('page')) { ?>active<?php } ?>" id="page">
<div class="form-group">
<?php
@@ -102,13 +102,30 @@
</div>
</div>
<br>
<div class="row margin-bottom-1em">
<div class="col-xs-12">
<?php Action::run('admin_editor', array(Html::toText($post_content))); ?>
</div>
</div>
<?php Action::run('admin_editor', array(Html::toText($post_content))); ?>
<div class="row margin-top-1em">
<div class="col-xs-12">
<div class="form-group">
<div class="input-group">
<?php
echo (
Form::input('page_tags', $post_tags, array('class' => 'form-control'))
);
?>
<span class="input-group-addon add-on">
<?php echo __('Tags', 'pages'); ?>
</span>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="row margin-top-1em">
<div class="col-xs-6">
<?php
echo (
@@ -129,4 +146,4 @@
</div>
<?php echo Form::close(); ?>
</div>
</div>
</div>

View File

@@ -16,7 +16,7 @@
<li <?php if (Notification::get('settings')) { ?>class="active"<?php } ?>><a href="#settings" data-toggle="tab"><?php echo __('Settings', 'pages'); ?></a></li>
</ul>
<div class="tab-content tab-page">
<div class="tab-content tab-page margin-bottom-1em">
<div class="tab-pane <?php if (Notification::get('page')) { ?>active<?php } ?>" id="page">
<div class="form-group">
<?php
@@ -135,13 +135,30 @@
</div>
</div>
<br>
<div class="row margin-bottom-1em">
<div class="col-xs-12">
<?php Action::run('admin_editor', array(Html::toText($to_edit))); ?>
</div>
</div>
<?php Action::run('admin_editor', array(Html::toText($to_edit))); ?>
<div class="row margin-top-1em">
<div class="col-xs-12">
<div class="form-group">
<div class="input-group">
<?php
echo (
Form::input('page_tags', $tags_to_edit, array('class' => 'form-control'))
);
?>
<span class="input-group-addon add-on">
<?php echo __('Tags', 'pages'); ?>
</span>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="row margin-top-1em">
<div class="col-xs-6">
<?php
echo (