Skip to content

Commit

Permalink
Merge pull request #19 from s-nakajima/master
Browse files Browse the repository at this point in the history
NetCommonFormHelperに統一するように修正、URLの仕様変更による修正
  • Loading branch information
s-nakajima committed Oct 9, 2015
2 parents 31bda09 + d9d68c3 commit 8f06f0a
Show file tree
Hide file tree
Showing 21 changed files with 92 additions and 78 deletions.
5 changes: 5 additions & 0 deletions Controller/BbsArticlesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public function add() {
$url = NetCommonsUrl::actionUrl(array(
'controller' => $this->params['controller'],
'action' => 'view',
'block_id' => $this->data['Block']['id'],
'frame_id' => $this->data['Frame']['id'],
'key' => $bbsArticle['BbsArticle']['key']
));
Expand Down Expand Up @@ -268,6 +269,7 @@ public function reply() {
$url = NetCommonsUrl::actionUrl(array(
'controller' => $this->params['controller'],
'action' => 'view',
'block_id' => $this->data['Block']['id'],
'frame_id' => $this->data['Frame']['id'],
'key' => $bbsArticle['BbsArticle']['key']
));
Expand Down Expand Up @@ -362,6 +364,7 @@ public function edit() {
$url = NetCommonsUrl::actionUrl(array(
'controller' => $this->params['controller'],
'action' => 'view',
'block_id' => $this->data['Block']['id'],
'frame_id' => $this->data['Frame']['id'],
'key' => $bbsArticle['BbsArticle']['key']
));
Expand Down Expand Up @@ -433,6 +436,7 @@ public function delete() {
$url = NetCommonsUrl::actionUrl(array(
'controller' => $this->params['controller'],
'action' => 'view',
'block_id' => $this->data['Block']['id'],
'frame_id' => $this->data['Frame']['id'],
'key' => $parentBbsArticle['BbsArticle']['key']
));
Expand Down Expand Up @@ -466,6 +470,7 @@ public function approve() {
$url = NetCommonsUrl::actionUrl(array(
'controller' => $this->params['controller'],
'action' => 'view',
'block_id' => $this->data['Block']['id'],
'frame_id' => $this->data['Frame']['id'],
'key' => $this->data['BbsArticle']['key']
));
Expand Down
2 changes: 0 additions & 2 deletions Controller/BbsBlockRolePermissionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ class BbsBlockRolePermissionsController extends BbsesAppController {
* @return void
*/
public function edit() {
CurrentFrame::setBlock($this->request->params['pass'][1]);

if (! $bbs = $this->Bbs->getBbs()) {
$this->setAction('throwBadRequest');
return false;
Expand Down
1 change: 0 additions & 1 deletion Controller/BbsBlocksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public function edit() {

} else {
//表示処理(初期データセット)
CurrentFrame::setBlock($this->request->params['pass'][1]);
if (! $bbs = $this->Bbs->getBbs()) {
$this->setAction('throwBadRequest');
return false;
Expand Down
4 changes: 1 addition & 3 deletions Model/Bbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Bbs extends BbsesAppModel {
'name' => 'Bbs.name',
'loadModels' => array(
'Like' => 'Likes.Like',
'Comment' => 'Comments.Comment',
'WorkflowComment' => 'Workflow.WorkflowComment',
)
),
'NetCommons.OriginalKey',
Expand Down Expand Up @@ -108,8 +108,6 @@ public function beforeValidate($options = array()) {
),
),

//status to set in PublishableBehavior.

'name' => array(
'notBlank' => array(
'rule' => array('notBlank'),
Expand Down
2 changes: 1 addition & 1 deletion Model/BbsArticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class BbsArticle extends BbsesAppModel {
public $actsAs = array(
'Bbses.BbsArticle',
'Bbses.BbsArticlesUser',
'Comments.Comment',
'Likes.Like',
'NetCommons.OriginalKey',
'Workflow.WorkflowComment',
'Workflow.Workflow',
);

Expand Down
2 changes: 1 addition & 1 deletion Test/Case/Controller/BbsesControllerTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BbsesControllerTestBase extends YAControllerTestCase {
'plugin.bbses.bbs_frame_setting',
'plugin.bbses.bbs_articles_user',
'plugin.bbses.bbs_article',
'plugin.comments.comment',
'plugin.workflow.workflow_comment',
);

/**
Expand Down
5 changes: 3 additions & 2 deletions Test/Case/Model/BbsModelTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BbsModelTestBase extends YACakeTestCase {
'plugin.bbses.bbs_frame_setting',
'plugin.bbses.bbs_articles_user',
'plugin.bbses.bbs_article',
'plugin.comments.comment',
'plugin.workflow.workflow_comment',
);

/**
Expand All @@ -55,7 +55,7 @@ public function tearDown() {
unset($this->BbsFrameSetting);
unset($this->BbsArticle);
unset($this->BbsArticlesUser);
unset($this->Comment);
unset($this->WorkflowComment);
parent::tearDown();
}

Expand All @@ -66,6 +66,7 @@ public function tearDown() {
* @param mixed $value array or string, number
* @param array $result result data
* @return void
* @SuppressWarnings(PHPMD.DevelopmentCodeFragment)
*/
protected function _assertArray($key, $value, $result) {
if ($key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion View/BbsArticles/edit.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $bbsArticle['content'] = $this->data['BbsArticle']['content'];
</div>

<?php echo $this->Workflow->buttons('BbsArticle.status'); ?>
<?php echo $this->Form->end(); ?>
<?php echo $this->NetCommonsForm->end(); ?>

<?php if ($this->request->params['action'] === 'edit' && $this->Workflow->canDelete('BbsArticle', $this->data)) : ?>
<div class="panel-footer text-right">
Expand Down
5 changes: 2 additions & 3 deletions View/BbsBlockRolePermissions/edit.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
?>

<div class="block-setting-body">
<?php echo $this->Block->mainTabs(BlockTabsComponent::MAIN_TAB_BLOCK_INDEX); ?>
<?php echo $this->BlockTabs->main(BlockTabsComponent::MAIN_TAB_BLOCK_INDEX); ?>

<div class="tab-content">
<?php echo $this->Block->blockTabs(BlockTabsComponent::BLOCK_TAB_PERMISSION); ?>
<?php echo $this->BlockTabs->block(BlockTabsComponent::BLOCK_TAB_PERMISSION); ?>

<?php echo $this->element('Blocks.edit_form', array(
'model' => 'BbsBlockRolePermission',
'action' => 'edit' . '/' . $this->data['Frame']['id'] . '/' . $this->data['Block']['id'],
'callback' => 'Bbses.BbsBlockRolePermissions/edit_form',
'cancelUrl' => NetCommonsUrl::backToIndexUrl('default_setting_action'),
)); ?>
Expand Down
11 changes: 8 additions & 3 deletions View/BbsBlocks/edit.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
?>

<article class="block-setting-body">
<?php echo $this->Block->mainTabs(BlockTabsComponent::MAIN_TAB_BLOCK_INDEX); ?>
<?php echo $this->BlockTabs->main(BlockTabsComponent::MAIN_TAB_BLOCK_INDEX); ?>

<div class="tab-content">
<?php echo $this->Block->blockTabs(BlockTabsComponent::BLOCK_TAB_SETTING); ?>
<?php echo $this->BlockTabs->block(BlockTabsComponent::BLOCK_TAB_SETTING); ?>

<?php echo $this->element('Blocks.edit_form', array(
'model' => 'Bbs',
Expand All @@ -25,7 +25,12 @@
<?php if ($this->request->params['action'] === 'edit') : ?>
<?php echo $this->element('Blocks.delete_form', array(
'model' => 'BbsBlock',
'action' => 'delete/' . Current::read('Frame.id') . '/' . Current::read('Block.id'),
'action' => NetCommonsUrl::actionUrl(array(
'controller' => $this->params['controller'],
'action' => 'delete',
'block_id' => Current::read('Block.id'),
'frame_id' => Current::read('Frame.id')
)),
'callback' => 'Bbses.BbsBlocks/delete_form'
)); ?>
<?php endif; ?>
Expand Down
6 changes: 3 additions & 3 deletions View/BbsBlocks/index.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
?>

<article class="block-setting-body">
<?php echo $this->Block->mainTabs(BlockTabsComponent::MAIN_TAB_BLOCK_INDEX); ?>
<?php echo $this->BlockTabs->main(BlockTabsComponent::MAIN_TAB_BLOCK_INDEX); ?>

<div class="tab-content">
<div class="text-right">
Expand All @@ -22,7 +22,7 @@
'url' => NetCommonsUrl::actionUrl(array('plugin' => 'frames', 'controller' => 'frames', 'action' => 'edit'))
)); ?>

<?php echo $this->Form->hidden('Frame.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Frame.id'); ?>

<table class="table table-hover">
<thead>
Expand Down Expand Up @@ -58,7 +58,7 @@
<?php endforeach; ?>
</tbody>
</table>
<?php echo $this->Form->end(); ?>
<?php echo $this->NetCommonsForm->end(); ?>

<?php echo $this->element('NetCommons.paginator'); ?>
</div>
Expand Down
2 changes: 1 addition & 1 deletion View/BbsFrameSettings/edit.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
?>

<article class="block-setting-body">
<?php echo $this->Block->mainTabs(BlockTabsComponent::MAIN_TAB_FRAME_SETTING); ?>
<?php echo $this->BlockTabs->main(BlockTabsComponent::MAIN_TAB_FRAME_SETTING); ?>

<div class="tab-content">
<?php echo $this->element('Blocks.edit_form', array(
Expand Down
18 changes: 9 additions & 9 deletions View/Elements/BbsArticles/comment_approving_link.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
'url' => $this->NetCommonsHtml->url(array('action' => 'approve', 'key' => $bbsArticle['BbsArticle']['key']))
)); ?>

<?php echo $this->Form->hidden('Frame.id', array('value' => Current::read('Frame.id'))); ?>
<?php echo $this->Form->hidden('Block.id', array('value' => Current::read('Block.id'))); ?>
<?php echo $this->Form->hidden('Block.key', array('value' => Current::read('Block.key'))); ?>
<?php echo $this->Form->hidden('BbsArticle.id'); ?>
<?php echo $this->Form->hidden('BbsArticle.key'); ?>
<?php echo $this->Form->hidden('BbsArticle.language_id'); ?>
<?php echo $this->Form->hidden('BbsArticleTree.id'); ?>
<?php echo $this->Form->hidden('BbsArticleTree.root_id'); ?>
<?php echo $this->NetCommonsForm->hidden('Frame.id', array('value' => Current::read('Frame.id'))); ?>
<?php echo $this->NetCommonsForm->hidden('Block.id', array('value' => Current::read('Block.id'))); ?>
<?php echo $this->NetCommonsForm->hidden('Block.key', array('value' => Current::read('Block.key'))); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticle.id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticle.key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticle.language_id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticleTree.id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticleTree.root_id'); ?>

<?php echo $this->Workflow->publishLinkButton('', array(
'tooltip' => true,
'iconSize' => 'btn-xs'
)); ?>
<?php echo $this->Form->end(); ?>
<?php echo $this->NetCommonsForm->end(); ?>
<?php endif;
20 changes: 10 additions & 10 deletions View/Elements/BbsArticles/delete_form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
'action' => 'delete/' . Current::read('Frame.id') . '/' . h($this->data['BbsArticle']['key'])
)); ?>

<?php echo $this->Form->hidden('Frame.id'); ?>
<?php echo $this->Form->hidden('Block.id'); ?>
<?php echo $this->Form->hidden('Block.key'); ?>
<?php echo $this->NetCommonsForm->hidden('Frame.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Block.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Block.key'); ?>

<?php echo $this->Form->hidden('Bbs.id'); ?>
<?php echo $this->Form->hidden('Bbs.key'); ?>
<?php echo $this->Form->hidden('BbsArticle.id'); ?>
<?php echo $this->Form->hidden('BbsArticle.key'); ?>
<?php echo $this->Form->hidden('BbsArticle.language_id'); ?>
<?php echo $this->Form->hidden('BbsArticleTree.root_id'); ?>
<?php echo $this->NetCommonsForm->hidden('Bbs.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Bbs.key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticle.id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticle.key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticle.language_id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticleTree.root_id'); ?>

<?php echo $this->Button->delete('',
sprintf(__d('net_commons', 'Deleting the %s. Are you sure to proceed?'), __d('bbses', 'article'))
); ?>
<?php echo $this->Form->end();
<?php echo $this->NetCommonsForm->end();
30 changes: 15 additions & 15 deletions View/Elements/BbsArticles/edit_form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
*/
?>

<?php echo $this->Form->hidden('Frame.id'); ?>
<?php echo $this->Form->hidden('Frame.block_id'); ?>
<?php echo $this->Form->hidden('Block.id'); ?>
<?php echo $this->Form->hidden('Block.key'); ?>
<?php echo $this->Form->hidden('Bbs.id'); ?>
<?php echo $this->Form->hidden('Bbs.key'); ?>
<?php echo $this->Form->hidden('BbsArticle.id'); ?>
<?php echo $this->Form->hidden('BbsArticle.key'); ?>
<?php echo $this->Form->hidden('BbsArticle.language_id'); ?>
<?php echo $this->Form->hidden('BbsArticle.bbs_id'); ?>
<?php echo $this->Form->hidden('BbsArticleTree.id'); ?>
<?php echo $this->Form->hidden('BbsArticleTree.bbs_key'); ?>
<?php echo $this->Form->hidden('BbsArticleTree.bbs_article_key'); ?>
<?php echo $this->Form->hidden('BbsArticleTree.root_id'); ?>
<?php echo $this->Form->hidden('BbsArticleTree.parent_id'); ?>
<?php echo $this->NetCommonsForm->hidden('Frame.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Frame.block_id'); ?>
<?php echo $this->NetCommonsForm->hidden('Block.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Block.key'); ?>
<?php echo $this->NetCommonsForm->hidden('Bbs.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Bbs.key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticle.id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticle.key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticle.language_id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticle.bbs_id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticleTree.id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticleTree.bbs_key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticleTree.bbs_article_key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticleTree.root_id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsArticleTree.parent_id'); ?>

<?php echo $this->NetCommonsForm->input('BbsArticle.title', array(
'type' => 'text',
Expand Down
9 changes: 7 additions & 2 deletions View/Elements/BbsArticles/reply_link.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@
'label' => __d('bbses', 'Quote this posts')
)); ?>

<?php echo $this->Form->button('<span class="glyphicon glyphicon-comment"></span>', array(
<?php echo $this->NetCommonsForm->button('<span class="glyphicon glyphicon-comment"></span>', array(
'class' => 'btn btn-success btn-xs bbs-write-comment-link',
'tooltip' => __d('bbses', 'Write comment')
)); ?>

<?php echo $this->Form->end(); ?>

<?php echo $this->NetCommonsForm->hidden('frame_id', array(
'value' => Current::read('Frame.id')
)); ?>

<?php echo $this->NetCommonsForm->end(); ?>
<?php endif;
12 changes: 8 additions & 4 deletions View/Elements/BbsArticles/select_sort.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
* @copyright Copyright 2014, NetCommons Project
*/

$url = Hash::merge(
array('controller' => 'bbs_articles', 'action' => 'index', Current::read('Frame.id')),
$this->Paginator->params['named']
);

$url = NetCommonsUrl::actionUrlAsArray(Hash::merge(array(
'plugin' => 'bbses',
'controller' => 'bbs_articles',
'action' => 'index',
'block_id' => Current::read('Block.id'),
'frame_id' => Current::read('Frame.id'),
), $this->Paginator->params['named']));

$curretSort = isset($this->Paginator->params['named']['sort']) ? $this->Paginator->params['named']['sort'] : 'BbsArticle.created';
$curretDirection = isset($this->Paginator->params['named']['direction']) ? $this->Paginator->params['named']['direction'] : 'desc';
Expand Down
8 changes: 4 additions & 4 deletions View/Elements/BbsBlockRolePermissions/edit_form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
*/
?>

<?php echo $this->Form->hidden('Block.id'); ?>
<?php echo $this->Form->hidden('Block.key'); ?>
<?php echo $this->Form->hidden('BbsSetting.bbs_key'); ?>
<?php echo $this->Form->hidden('BbsSetting.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Block.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Block.key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsSetting.bbs_key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsSetting.id'); ?>

<?php echo $this->element('Blocks.block_creatable_setting', array(
'settingPermissions' => array(
Expand Down
6 changes: 3 additions & 3 deletions View/Elements/BbsBlocks/delete_form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<div class="pull-left">
<?php echo sprintf(__d('net_commons', 'Delete all data associated with the %s.'), __d('bbses', 'BBS')); ?>
</div>
<?php echo $this->Form->hidden('Block.id'); ?>
<?php echo $this->Form->hidden('Block.key'); ?>
<?php echo $this->Form->hidden('Bbs.key'); ?>
<?php echo $this->NetCommonsForm->hidden('Block.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Block.key'); ?>
<?php echo $this->NetCommonsForm->hidden('Bbs.key'); ?>

<?php echo $this->Button->delete(
__d('net_commons', 'Delete'),
Expand Down
14 changes: 7 additions & 7 deletions View/Elements/BbsBlocks/edit_form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

<?php echo $this->element('Blocks.form_hidden'); ?>

<?php echo $this->Form->hidden('Bbs.id'); ?>
<?php echo $this->Form->hidden('Bbs.key'); ?>
<?php echo $this->Form->hidden('BbsSetting.id'); ?>
<?php echo $this->Form->hidden('BbsFrameSetting.id'); ?>
<?php echo $this->Form->hidden('BbsFrameSetting.frame_key'); ?>
<?php echo $this->Form->hidden('BbsFrameSetting.articles_per_page'); ?>
<?php echo $this->Form->hidden('BbsFrameSetting.comments_per_page'); ?>
<?php echo $this->NetCommonsForm->hidden('Bbs.id'); ?>
<?php echo $this->NetCommonsForm->hidden('Bbs.key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsSetting.id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsFrameSetting.id'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsFrameSetting.frame_key'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsFrameSetting.articles_per_page'); ?>
<?php echo $this->NetCommonsForm->hidden('BbsFrameSetting.comments_per_page'); ?>

<?php echo $this->NetCommonsForm->input('Bbs.name', array(
'type' => 'text',
Expand Down

0 comments on commit 8f06f0a

Please sign in to comment.