Skip to content

Commit

Permalink
Merge pull request #61 from s-nakajima/master
Browse files Browse the repository at this point in the history
タイトルアイコン機能追加
  • Loading branch information
s-nakajima committed May 20, 2016
2 parents ce4b5d8 + 161ecff commit 9fff28f
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 121 deletions.
1 change: 1 addition & 0 deletions Test/Case/Model/BbsArticle/SaveBbsArticleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ private function __getData($bbsArticleKey = 'bbs_article_1') {
'language_id' => '2',
'bbs_id' => $bbsId,
'title' => 'BBS ARTICLE TITLE',
'title_icon' => null,
'content' => '<p>CONTENT</p>',
'status' => WorkflowComponent::STATUS_PUBLISHED,
),
Expand Down
36 changes: 11 additions & 25 deletions Test/Fixture/BbsArticleFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,6 @@
*/
class BbsArticleFixture extends CakeTestFixture {

/**
* Fields
*
* @var array
*/
public $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary', 'comment' => 'ID | | | '),
'bbs_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'comment' => 'bbsPosts.id | 記事のID | | '),
'language_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 6, 'comment' => 'language id | 言語ID | languages.id | '),
'status' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 4, 'comment' => 'public status, 1: public, 2: public pending, 3: draft during 4: remand | 公開状況 1:公開中、2:公開申請中、3:下書き中、4:差し戻し | | '),
'is_active' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'Is active, 0:deactive 1:acive | アクティブなコンテンツかどうか 0:アクティブでない 1:アクティブ | | '),
'is_latest' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'Is latest, 0:not latest 1:latest | 最新コンテンツかどうか 0:最新でない 1:最新 | | '),
'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'key | キー | | ', 'charset' => 'utf8'),
'title' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'title | タイトル | |', 'charset' => 'utf8'),
'content' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'content | 本文 | |', 'charset' => 'utf8'),
'created_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'comment' => 'created user | 作成者 | users.id | '),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'created datetime | 作成日時 | | '),
'modified_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'comment' => 'modified user | 更新者 | users.id | '),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'modified datetime | 更新日時 | | '),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

/**
* Records
*
Expand Down Expand Up @@ -255,4 +230,15 @@ class BbsArticleFixture extends CakeTestFixture {
),
);

/**
* Initialize the fixture.
*
* @return void
*/
public function init() {
require_once App::pluginPath('Bbses') . 'Config' . DS . 'Schema' . DS . 'schema.php';
$this->fields = (new BbsesSchema())->tables['bbs_articles'];
parent::init();
}

}
36 changes: 11 additions & 25 deletions Test/Fixture/BbsArticleTreeFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,6 @@
*/
class BbsArticleTreeFixture extends CakeTestFixture {

/**
* Fields
*
* @var array
*/
public $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary', 'comment' => 'ID | | | '),
'bbs_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'bbs key | 掲示板キー | Hash値 | ', 'charset' => 'utf8'),
'bbs_article_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'bbs articles key | 記事キー | Hash値 | ', 'charset' => 'utf8'),
'root_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'comment' => 'root post id | 根記事ID | | '),
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'comment' => 'parent id | 親記事のID treeビヘイビア必須カラム | | '),
'lft' => array('type' => 'integer', 'null' => false, 'default' => null, 'comment' => 'lft | treeビヘイビア必須カラム | | '),
'rght' => array('type' => 'integer', 'null' => false, 'default' => null, 'comment' => 'rght | treeビヘイビア必須カラム | | '),
'article_no' => array('type' => 'integer', 'null' => false, 'default' => '1', 'comment' => 'comment index | 記事毎の採番 | | '),
'bbs_article_child_count' => array('type' => 'integer', 'null' => false, 'default' => '0', 'comment' => 'Published comment counts | 公開されたコメント数 | | '),
'created_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'comment' => 'created user | 作成者 | users.id | '),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'created datetime | 作成日時 | | '),
'modified_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'comment' => 'modified user | 更新者 | users.id | '),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'modified datetime | 更新日時 | | '),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

/**
* Records
*
Expand Down Expand Up @@ -245,4 +220,15 @@ class BbsArticleTreeFixture extends CakeTestFixture {
),
);

/**
* Initialize the fixture.
*
* @return void
*/
public function init() {
require_once App::pluginPath('Bbses') . 'Config' . DS . 'Schema' . DS . 'schema.php';
$this->fields = (new BbsesSchema())->tables['bbs_article_trees'];
parent::init();
}

}
34 changes: 12 additions & 22 deletions Test/Fixture/BbsFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,6 @@ class BbsFixture extends CakeTestFixture {
*/
public $table = 'bbses';

/**
* Fields
*
* @var array
*/
public $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary', 'comment' => 'ID | | | '),
'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'bbs key | 掲示板キー | Hash値 | ', 'charset' => 'utf8'),
'block_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'bbs name | 掲示板名称 | | ', 'charset' => 'utf8'),
'bbs_article_count' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false, 'comment' => 'Article count | 記事数 | | '),
'bbs_article_modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'Article modified datetime | 記事の最終更新日時 | | '),
'created_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'comment' => 'created user | 作成者 | users.id | '),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'created datetime | 作成日時 | | '),
'modified_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'comment' => 'modified user | 更新者 | users.id | '),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'modified datetime | 更新日時 | | '),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

/**
* Records
*
Expand Down Expand Up @@ -137,4 +115,16 @@ class BbsFixture extends CakeTestFixture {
'bbs_article_modified' => 1,
),
);

/**
* Initialize the fixture.
*
* @return void
*/
public function init() {
require_once App::pluginPath('Bbses') . 'Config' . DS . 'Schema' . DS . 'schema.php';
$this->fields = (new BbsesSchema())->tables['bbses'];
parent::init();
}

}
31 changes: 11 additions & 20 deletions Test/Fixture/BbsFrameSettingFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,6 @@
*/
class BbsFrameSettingFixture extends CakeTestFixture {

/**
* Fields
*
* @var array
*/
public $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary', 'comment' => 'ID | | | '),
'frame_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'frame key | フレームKey | frames.key | ', 'charset' => 'utf8'),
'articles_per_page' => array('type' => 'integer', 'null' => false, 'default' => '10', 'unsigned' => false, 'comment' => 'artcles visible row, 1, 5, 10, 20, 50, 100 | 表示記事数 1件、5件、10件、20件、50件、100件 | | '),
'comments_per_page' => array('type' => 'integer', 'null' => false, 'default' => '10', 'unsigned' => false, 'comment' => 'comments visible row, 1 post or 5, 10, 20, 50, 100 | 表示記事数 1件、5件、10件、20件、50件、100件 | | '),
'created_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'comment' => 'created user | 作成者 | users.id | '),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'created datetime | 作成日時 | | '),
'modified_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'comment' => 'modified user | 更新者 | users.id | '),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'modified datetime | 更新日時 | | '),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'),
);

/**
* Records
*
Expand All @@ -55,4 +35,15 @@ class BbsFrameSettingFixture extends CakeTestFixture {
)
);

/**
* Initialize the fixture.
*
* @return void
*/
public function init() {
require_once App::pluginPath('Bbses') . 'Config' . DS . 'Schema' . DS . 'schema.php';
$this->fields = (new BbsesSchema())->tables['bbs_frame_settings'];
parent::init();
}

}
34 changes: 11 additions & 23 deletions Test/Fixture/BbsSettingFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,6 @@
*/
class BbsSettingFixture extends CakeTestFixture {

/**
* Fields
*
* @var array
*/
public $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary', 'comment' => 'ID | | | '),
'bbs_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'bbs key | 掲示板キー | Hash値 | ', 'charset' => 'utf8'),
'use_workflow' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of the post approval, 0:Unused 1:Use | 記事の承認機能 0:使わない 1:使う | | '),
'use_comment' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of comments, 0:Unused 1:Use | コメント機能 0:使わない 1:使う | | '),
'use_comment_approval' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of comments approval, 0:Unused 1:Use | コメントの承認機能 0:使わない 1:使う | | '),
'use_like' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of like button, 0:Unused 1:Use | 高い評価ボタンの使用 0:使わない 1:使う | | '),
'use_unlike' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of unlike button, 0:Unused 1:Use | 低い評価ボタンの使用 0:使わない 1:使う | | '),
'created_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'comment' => 'created user | 作成者 | users.id | '),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'created datetime | 作成日時 | | '),
'modified_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'comment' => 'modified user | 更新者 | users.id | '),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'modified datetime | 更新日時 | | '),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'),
);

/**
* Records
*
Expand Down Expand Up @@ -128,4 +105,15 @@ class BbsSettingFixture extends CakeTestFixture {
),
);

/**
* Initialize the fixture.
*
* @return void
*/
public function init() {
require_once App::pluginPath('Bbses') . 'Config' . DS . 'Schema' . DS . 'schema.php';
$this->fields = (new BbsesSchema())->tables['bbs_settings'];
parent::init();
}

}
3 changes: 1 addition & 2 deletions View/Elements/BbsArticles/edit_form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
<?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',
<?php echo $this->NetCommonsForm->inputWithTitleIcon('BbsArticle.title', 'BbsArticle.title_icon', array(
'label' => __d('bbses', 'Title'),
'required' => true,
)); ?>
Expand Down
11 changes: 8 additions & 3 deletions View/Elements/BbsArticles/index_bbs_article.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@

<article>
<h2 class="clearfix">
<?php echo $this->NetCommonsHtml->link(
CakeText::truncate($bbsArticle['BbsArticle']['title'], BbsArticle::LIST_TITLE_LENGTH),
array('action' => 'view', 'key' => $bbsArticle['BbsArticle']['key'])
<?php
$title = $this->NetCommonsHtml->titleIcon($bbsArticle['BbsArticle']['title_icon']) . ' ' .
h(CakeText::truncate($bbsArticle['BbsArticle']['title'], BbsArticle::LIST_TITLE_LENGTH));

echo $this->NetCommonsHtml->link(
$title,
array('action' => 'view', 'key' => $bbsArticle['BbsArticle']['key']),
array('escape' => false)
); ?>
<small>
<?php echo $this->Workflow->label($bbsArticle['BbsArticle']['status']); ?>
Expand Down
3 changes: 2 additions & 1 deletion View/Elements/BbsArticles/view_bbs_article.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ if ($currentBbsArticle['BbsArticle']['key'] === $bbsArticle['BbsArticle']['key']
<?php endif; ?>

<?php
$title = h($bbsArticle['BbsArticle']['title']);
$title = $this->NetCommonsHtml->titleIcon($bbsArticle['BbsArticle']['title_icon']) . ' ' . h($bbsArticle['BbsArticle']['title']);

echo $this->NetCommonsHtml->link($title, array('key' => $bbsArticle['BbsArticle']['key']), array('escape' => false));
?>

Expand Down

0 comments on commit 9fff28f

Please sign in to comment.