Skip to content

Commit

Permalink
moving cms contentFrontpages -> frontpages so its easier to use
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Jan 17, 2010
1 parent 6d64be3 commit 5ac9388
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 104 deletions.
Expand Up @@ -17,8 +17,8 @@
* @since 0.5a
*/

class ContentFrontpagesController extends CmsAppController {
var $name = 'ContentFrontpages';
class FrontpagesController extends CmsAppController {
var $name = 'Frontpages';

/**
* Helpers.
Expand All @@ -29,20 +29,20 @@ class ContentFrontpagesController extends CmsAppController {
var $helpers = array('Filter.Filter');

function index() {
$this->ContentFrontpage->recursive = 0;
$this->set('contentFrontpages', $this->paginate());
$this->Frontpage->recursive = 0;
$this->set('frontpages', $this->paginate());
}

function admin_index() {
$this->ContentFrontpage->recursive = 0;
$this->Frontpage->recursive = 0;

$this->paginate = array(
'fields' => array(
'ContentFrontpage.id',
'ContentFrontpage.content_id',
'ContentFrontpage.ordering',
'ContentFrontpage.created',
'ContentFrontpage.modified'
'Frontpage.id',
'Frontpage.content_id',
'Frontpage.ordering',
'Frontpage.created',
'Frontpage.modified'
),
'contain' => array(
'Content' => array(
Expand All @@ -61,41 +61,41 @@ function admin_index() {
)
);

$contentFrontpages = $this->paginate();
$frontpages = $this->paginate();

$this->set('contentFrontpages', $contentFrontpages);
$this->set('frontpages', $frontpages);
$this->set('filterOptions', $this->Filter->filterOptions);
}

function admin_add() {
if (!empty($this->data)) {
$this->ContentFrontpage->create();
if ($this->ContentFrontpage->save($this->data)) {
$this->Session->setFlash(__('The content frontpage has been saved', true));
$this->Frontpage->create();
if ($this->Frontpage->save($this->data)) {
$this->Session->setFlash(__('The frontpage has been saved', true));
$this->redirect(array('action' => 'index'));
}else {
$this->Session->setFlash(__('The content frontpage could not be saved. Please, try again.', true));
$this->Session->setFlash(__('The frontpage could not be saved. Please, try again.', true));
}
}

/**
* check what is already in the table so that the list only shows
* what is available.
*/
$content_ids = $this->ContentFrontpage->find(
$content_ids = $this->Frontpage->find(
'list',
array(
'fields' => array(
'ContentFrontpage.content_id',
'ContentFrontpage.content_id'
'Frontpage.content_id',
'Frontpage.content_id'
)
)
);

/**
* only get the content itmes that are not being used.
*/
$contents = $this->ContentFrontpage->Content->find(
$contents = $this->Frontpage->Content->find(
'list',
array(
'conditions' => array(
Expand Down
Expand Up @@ -17,8 +17,8 @@
* @since 0.5a
*/

class ContentFrontpage extends CmsAppModel {
var $name = 'ContentFrontpage';
class Frontpage extends CmsAppModel {
var $name = 'Frontpage';

var $actsAs = array(
'Libs.Ordered'
Expand Down
70 changes: 0 additions & 70 deletions infinitas/cms/views/content_frontpages/index.ctp

This file was deleted.

23 changes: 23 additions & 0 deletions infinitas/cms/views/frontpages/index.ctp
@@ -0,0 +1,23 @@
<?php
/**
* Comment Template.
*
* @todo -c Implement .this needs to be sorted out.
*
* Copyright (c) 2009 Carl Sutton ( dogmatic69 )
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2009 Carl Sutton ( dogmatic69 )
* @link http://www.dogmatic.co.za
* @package sort
* @subpackage sort.comments
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @since 0.5a
*/
?>
<?php
pr( $frontpages );
?>
17 changes: 5 additions & 12 deletions infinitas/cms/views/layouts/admin_index.ctp
Expand Up @@ -43,7 +43,9 @@
'style' => 'width:25px;'
),
$this->Paginator->sort( 'name' ),
$this->Paginator->sort( 'Content', 'Content.name' ),
$this->Paginator->sort( 'Contents', 'content_count' ) => array(
'style' => 'width:100px;'
),
$this->Paginator->sort( 'modified' ) => array(
'style' => 'width:100px;'
),
Expand All @@ -58,7 +60,7 @@
{
?>
<tr class="<?php echo $this->Cms->rowClass(); ?>">
<td><?php echo $this->Form->checkbox( $layout['Content']['id'] ); ?>&nbsp;</td>
<td><?php echo $this->Form->checkbox( $layout['Layout']['id'] ); ?>&nbsp;</td>
<td>
<?php
echo $this->Html->link(
Expand All @@ -71,16 +73,7 @@
?>
</td>
<td>
<?php
echo $this->Html->link(
$layout['Content']['title'],
array(
'controller' => 'contents',
'action' => 'edit',
$layout['Content']['id']
)
);
?>
<?php echo $layout['Layout']['content_count']; ?>
</td>
<td>
<?php echo $this->Time->niceShort($layout['Layout']['modified']); ?>
Expand Down

0 comments on commit 5ac9388

Please sign in to comment.