Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

implement i18n categories views and tests

  • Loading branch information...
commit 5f985f0778905f8fa8a6d598d7005aa2091117ef 1 parent add5d2c
@skie skie authored
View
21 views/i18n_categories/admin_add.ctp
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<?php echo $this->Form->create('I18nCategory');?>
+ <fieldset>
+ <legend><?php __d('categories', 'Add i18n Category');?></legend>
+ <?php
+ echo $this->Form->input('category_id', array('empty' => true));
+ echo $this->Form->input('name');
+ echo $this->Form->input('description');
+ ?>
+ </fieldset>
+<?php echo $this->Form->end(__d('categories', 'Submit', true));?>
View
30 views/i18n_categories/admin_edit.ctp
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<?php echo $this->Form->create('I18nCategory');?>
+ <fieldset>
+ <legend><?php __d('categories', 'Edit Category');?></legend>
+ <?php
+ echo $this->Form->input('id');
+ echo $this->Form->input('category_id', array('empty' => true));
+ echo $this->Form->input('name');
+ echo $this->Form->input('description');
+ ?>
+ </fieldset>
+
+ <fieldset>
+ <?php foreach($actualLanguages as $language): ?>
+ <?php echo $this->Form->input($modelName . '.name_translation.' . $language, array(
+ 'label' => $languages[$language])); ?>
+ <?php endforeach; ?>
+ </fieldset>
+
+<?php echo $this->Form->end(__d('categories', 'Submit', true));?>
View
60 views/i18n_categories/admin_index.ctp
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<h2><?php __d('categories', 'Categories');?></h2>
+<p>
+<?php
+echo $this->Paginator->counter(array(
+'format' => __d('categories', 'Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
+));
+?></p>
+<table cellpadding="0" cellspacing="0">
+<tr>
+ <th><?php echo $this->Paginator->sort('category_id');?></th>
+ <th><?php echo $this->Paginator->sort('user_id');?></th>
+ <th><?php echo $this->Paginator->sort('name');?></th>
+ <th><?php echo $this->Paginator->sort('description');?></th>
+ <th><?php echo $this->Paginator->sort('created');?></th>
+ <th class="actions"><?php __d('categories', 'Actions');?></th>
+</tr>
+<?php
+$i = 0;
+foreach ($categories as $category):
+ $class = null;
+ if ($i++ % 2 == 0) {
+ $class = ' class="altrow"';
+ }
+?>
+ <tr<?php echo $class;?>>
+ <td>
+ <?php echo $this->Html->link($category['ParentCategory']['name'], array('controller'=> 'categories', 'action'=>'view', $category['ParentCategory']['id'])); ?>
+ </td>
+ <td>
+ <?php echo $this->Html->link($category['User']['id'], array('controller'=> 'users', 'action'=>'view', $category['User']['id'])); ?>
+ </td>
+ <td>
+ <?php echo $category[$modelName]['name']; ?>
+ </td>
+ <td>
+ <?php echo $category[$modelName]['description']; ?>
+ </td>
+ <td>
+ <?php echo $category[$modelName]['created']; ?>
+ </td>
+ <td class="actions">
+ <?php echo $this->Html->link(__d('categories', 'View', true), array('action'=>'view', $category[$modelName]['id'])); ?>
+ <?php echo $this->Html->link(__d('categories', 'Edit', true), array('action'=>'edit', $category[$modelName]['id'])); ?>
+ <?php echo $this->Html->link(__d('categories', 'Delete', true), array('action'=>'delete', $category[$modelName]['id']), null, sprintf(__d('categories', 'Are you sure you want to delete # %s?', true), $category[$modelName]['id'])); ?>
+ </td>
+ </tr>
+<?php endforeach; ?>
+</table>
+<?php echo $this->element('paging');?>
View
54 views/i18n_categories/admin_tree.ctp
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<h2><?php __d('categories', 'Categories');?></h2>
+<?php
+ $this->Html->script(
+ array(
+ '/categories/js/jquery.treeview',
+ '/categories/js/jquery.contextmenu',
+ '/categories/js/views/categories/admin_tree'),
+ array('inline' => false));
+ $this->Html->css(
+ array(
+ '/categories/css/jquery.treeview',
+ '/categories/css/jquery.contextmenu',
+ '/categories/css/basic'),
+ null,
+ array('inline' => false));
+ $this->Html->scriptBlock('App.pagesAdminIndex.init();');
+?>
+
+<div id="category-menu">
+ <?php if (empty($categories)) : ?>
+ <p class="error-message">
+ <?php
+ echo String::insert(
+ __d('categories', 'No categories were added yet. :add-a-new-one now!', true),
+ array('add-a-new-one' => $this->Html->link(__d('categories', 'Add a new one', true), array('action' => 'add'))));
+ ?>
+ </p>
+ <?php else :
+ echo $this->Tree->generate($categories, array('element' => 'categories/tree_item', 'class' => 'categorytree', 'id' => 'categorytree'));
+ endif; ?>
+ <ul class="actions">
+ <li><?php echo $this->Html->link(__d('categories', 'Add category', true), array('action' => 'add')); ?></li>
+ </ul>
+</div>
+
+<div id="placeholder"></div>
+
+<ul id="actions-list" class="contextMenu">
+ <li class="view"><?php echo $this->Html->link(__d('categories', 'View', true), array('action' => 'view', 'admin' => true)); ?></li>
+ <li class="add separator"><?php echo $this->Html->link(__d('categories', 'Add a child', true), array('action' => 'add')); ?></li>
+ <li class="edit"><?php echo $this->Html->link(__d('categories', 'Edit', true), array('action' => 'edit')); ?></li>
+ <li class="delete separator"><?php echo $this->Html->link(__d('categories', 'Delete', true), array('action' => 'delete')); ?></li>
+</ul>
View
48 views/i18n_categories/admin_view.ctp
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<h2><?php __d('categories', 'Category');?></h2>
+ <dl><?php $i = 0; $class = ' class="altrow"';?>
+ <dt<?php if ($i % 2 == 0) echo $class;?>><?php __d('categories', 'Parent Category'); ?></dt>
+ <dd<?php if ($i++ % 2 == 0) echo $class;?>>
+ <?php echo $this->Html->link($category['ParentCategory']['name'], array('controller'=> 'categories', 'action'=>'view', $category['ParentCategory']['id'])); ?>
+ &nbsp;
+ </dd>
+ <dt<?php if ($i % 2 == 0) echo $class;?>><?php __d('categories', 'User'); ?></dt>
+ <dd<?php if ($i++ % 2 == 0) echo $class;?>>
+ <?php echo $this->Html->link($category['User']['id'], array('controller'=> 'users', 'action'=>'view', $category['User']['id'])); ?>
+ &nbsp;
+ </dd>
+ <dt<?php if ($i % 2 == 0) echo $class;?>><?php __d('categories', 'Name'); ?></dt>
+ <dd<?php if ($i++ % 2 == 0) echo $class;?>>
+ <?php echo $category[$modelName]['name']; ?>
+ &nbsp;
+ </dd>
+ <dt<?php if ($i % 2 == 0) echo $class;?>><?php __d('categories', 'Description'); ?></dt>
+ <dd<?php if ($i++ % 2 == 0) echo $class;?>>
+ <?php echo $category[$modelName]['description']; ?>
+ &nbsp;
+ </dd>
+ <dt<?php if ($i % 2 == 0) echo $class;?>><?php __d('categories', 'Created'); ?></dt>
+ <dd<?php if ($i++ % 2 == 0) echo $class;?>>
+ <?php echo $category[$modelName]['created']; ?>
+ &nbsp;
+ </dd>
+ </dl>
+</div>
+<div class="actions">
+ <ul>
+ <li><?php echo $this->Html->link(__d('categories', 'Edit Category', true), array('action'=>'edit', $category[$modelName]['id'])); ?> </li>
+ <li><?php echo $this->Html->link(__d('categories', 'Delete Category', true), array('action'=>'delete', $category[$modelName]['id']), null, sprintf(__d('categories', 'Are you sure you want to delete # %s?', true), $category[$modelName]['id'])); ?> </li>
+ <li><?php echo $this->Html->link(__d('categories', 'List Categories', true), array('action'=>'index')); ?> </li>
+ <li><?php echo $this->Html->link(__d('categories', 'New Category', true), array('action'=>'add')); ?> </li>
+ </ul>
+</div>
View
60 views/i18n_categories/index.ctp
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<h2><?php __d('categories', 'Categories');?></h2>
+<p>
+<?php
+echo $this->Paginator->counter(array(
+'format' => __d('categories', 'Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
+));
+?></p>
+<table cellpadding="0" cellspacing="0">
+<tr>
+ <th><?php echo $this->Paginator->sort('category_id');?></th>
+ <th><?php echo $this->Paginator->sort('user_id');?></th>
+ <th><?php echo $this->Paginator->sort('name');?></th>
+ <th><?php echo $this->Paginator->sort('description');?></th>
+ <th><?php echo $this->Paginator->sort('created');?></th>
+ <th class="actions"><?php __d('categories', 'Actions');?></th>
+</tr>
+<?php
+$i = 0;
+foreach ($categories as $category):
+ $class = null;
+ if ($i++ % 2 == 0) {
+ $class = ' class="altrow"';
+ }
+?>
+ <tr<?php echo $class;?>>
+ <td>
+ <?php echo $html->link($category['ParentCategory']['name'], array('controller'=> 'categories', 'action'=>'view', $category['ParentCategory']['id'])); ?>
+ </td>
+ <td>
+ <?php echo $html->link($category['User']['id'], array('controller'=> 'users', 'action'=>'view', $category['User']['id'])); ?>
+ </td>
+ <td>
+ <?php echo $category[$modelName]['name']; ?>
+ </td>
+ <td>
+ <?php echo $category[$modelName]['description']; ?>
+ </td>
+ <td>
+ <?php echo $category[$modelName]['created']; ?>
+ </td>
+ <td class="actions">
+ <?php echo $this->Html->link(__d('categories', 'View', true), array('action'=>'view', $category[$modelName]['id'])); ?>
+ <?php echo $this->Html->link(__d('categories', 'Edit', true), array('action'=>'edit', $category[$modelName]['id'])); ?>
+ <?php echo $this->Html->link(__d('categories', 'Delete', true), array('action'=>'delete', $category[$modelName]['id']), null, sprintf(__d('categories', 'Are you sure you want to delete # %s?', true), $category[$modelName]['id'])); ?>
+ </td>
+ </tr>
+<?php endforeach; ?>
+</table>
+<?php echo $this->element('paging');?>
View
45 views/i18n_categories/view.ctp
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2010, Cake Development Corporation (http://cakedc.com)
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<h2><?php __d('categories', 'Category');?></h2>
+ <dl><?php $i = 0; $class = ' class="altrow"';?>
+ <dt<?php if ($i % 2 == 0) echo $class;?>><?php __d('categories', 'Parent Category'); ?></dt>
+ <dd<?php if ($i++ % 2 == 0) echo $class;?>>
+ <?php echo $this->Html->link($category['ParentCategory']['name'], array('controller'=> 'categories', 'action'=>'view', $category['ParentCategory']['id'])); ?>
+ &nbsp;
+ </dd>
+ <dt<?php if ($i % 2 == 0) echo $class;?>><?php __d('categories', 'User'); ?></dt>
+ <dd<?php if ($i++ % 2 == 0) echo $class;?>>
+ <?php echo $this->Html->link($category['User']['id'], array('controller'=> 'users', 'action'=>'view', $category['User']['id'])); ?>
+ &nbsp;
+ </dd>
+ <dt<?php if ($i % 2 == 0) echo $class;?>><?php __d('categories', 'Name'); ?></dt>
+ <dd<?php if ($i++ % 2 == 0) echo $class;?>>
+ <?php echo $category[$modelName]['name']; ?>
+ &nbsp;
+ </dd>
+ <dt<?php if ($i % 2 == 0) echo $class;?>><?php __d('categories', 'Description'); ?></dt>
+ <dd<?php if ($i++ % 2 == 0) echo $class;?>>
+ <?php echo $category[$modelName]['description']; ?>
+ &nbsp;
+ </dd>
+ <dt<?php if ($i % 2 == 0) echo $class;?>><?php __d('categories', 'Created'); ?></dt>
+ <dd<?php if ($i++ % 2 == 0) echo $class;?>>
+ <?php echo $category[$modelName]['created']; ?>
+ &nbsp;
+ </dd>
+ </dl>
+</div>
+<div class="actions">
+ <ul>
+ <li><?php echo $this->Html->link(__d('categories', 'List Categories', true), array('action'=>'index')); ?> </li>
+ </ul>
+</div>
Please sign in to comment.
Something went wrong with that request. Please try again.