diff --git a/Test/Case/View/Helper/LinkButtonHelper/AddTest.php b/Test/Case/View/Helper/LinkButtonHelper/AddTest.php index 478f9776..14a60160 100644 --- a/Test/Case/View/Helper/LinkButtonHelper/AddTest.php +++ b/Test/Case/View/Helper/LinkButtonHelper/AddTest.php @@ -81,7 +81,7 @@ public function testAddWithTitle($title) { $result = $this->LinkButton->add($title, $url, $options); //チェック - $expected = '' . + $expected = '' . ' ' . $title . ''; $this->assertEquals($expected, $result); @@ -122,7 +122,7 @@ public function testAddWithEscapeTitle($title, $escapeTitle, $expectedTitle) { $result = $this->LinkButton->add($title, $url, $options); //チェック - $expected = '' . + $expected = '' . ' ' . $expectedTitle . ''; $this->assertEqual($expected, $result); @@ -144,7 +144,7 @@ public function testAddWithIcon() { $result = $this->LinkButton->add($title, $url, $options); //チェック - $expected = '' . + $expected = '' . ' ' . ''; $this->assertEquals($expected, $result); @@ -171,7 +171,7 @@ public function testAddWithIconSize() { } else { $expectedIconSize = ''; } - $expected = '' . + $expected = '' . ' ' . ''; $this->assertEqual($expected, $result); @@ -212,7 +212,7 @@ public function testAddWithTooltip($tooltip) { $tooltip = __d('net_commons', 'Add'); } $expected = '' . - '' . + '' . ' ' . $title . '' . ''; @@ -242,7 +242,7 @@ public function testAddWithAddController() { $result = $this->LinkButton->add($title, $url, $options); //チェック - $expected = '' . + $expected = '' . ' ' . $title . ''; $this->assertEqual($expected, $result); diff --git a/View/Helper/ButtonHelper.php b/View/Helper/ButtonHelper.php index bd441531..3c4b8291 100644 --- a/View/Helper/ButtonHelper.php +++ b/View/Helper/ButtonHelper.php @@ -52,7 +52,7 @@ public function __call($method, $params) { * @return string A HTML button tag. */ public function getButtonSize() { - if ($this->_View->request->is('mobile')) { + if (Configure::read('isMobile')) { $btnSize = ' btn-sm'; } else { $btnSize = ''; @@ -81,14 +81,15 @@ public function button($title, $options = array()) { $class = Hash::get($options, 'class', array()); } if (in_array('btn', $class, true)) { - if ($this->_View->request->is('mobile')) { + $class[] = 'nc-btn-style'; + if (Configure::read('isMobile')) { $btnSize = 'btn-sm'; $class = array_merge($class, array($btnSize)); } } $options = Hash::insert($options, 'class', $class); } - return $this->NetCommonsForm->button($title, $options); + return $this->Form->button($title, $options); } /** diff --git a/View/Helper/LinkButtonHelper.php b/View/Helper/LinkButtonHelper.php index 91cb616a..fe1ae937 100644 --- a/View/Helper/LinkButtonHelper.php +++ b/View/Helper/LinkButtonHelper.php @@ -64,7 +64,7 @@ public function add($title = '', $url = null, $options = array()) { $inputOptions = Hash::merge(array( 'icon' => 'plus', 'iconSize' => $this->Button->getButtonSize(), - 'class' => 'btn btn-success', + 'class' => 'btn btn-success nc-btn-style', ), $options, array('escapeTitle' => false)); if (Hash::get($options, 'escapeTitle', true)) { $title = h($title); @@ -111,7 +111,7 @@ public function edit($title = '', $url = null, $options = array()) { $inputOptions = Hash::merge(array( 'icon' => 'edit', 'iconSize' => $this->Button->getButtonSize(), - 'class' => 'btn btn-primary' + 'class' => 'btn btn-primary nc-btn-style' ), $options, array('escapeTitle' => false)); if (Hash::get($options, 'escapeTitle', true)) { @@ -174,7 +174,7 @@ public function search($title = '', $url = null, $options = array()) { $inputOptions = Hash::merge(array( 'icon' => 'search', 'iconSize' => $this->Button->getButtonSize(), - 'class' => 'btn btn-info', + 'class' => 'btn btn-info nc-btn-style', ), $options, array('escapeTitle' => false)); if (Hash::get($options, 'escapeTitle', true)) { @@ -232,7 +232,7 @@ public function sort($title = '', $url = null, $options = array()) { $inputOptions = Hash::merge(array( 'icon' => 'sort', 'iconSize' => $this->Button->getButtonSize(), - 'class' => 'btn btn-default', + 'class' => 'btn btn-default nc-btn-style', ), $options, array('escapeTitle' => false)); if (Hash::get($options, 'escapeTitle', true)) { diff --git a/View/Helper/NetCommonsFormHelper.php b/View/Helper/NetCommonsFormHelper.php index 22489c84..73e5e2ce 100644 --- a/View/Helper/NetCommonsFormHelper.php +++ b/View/Helper/NetCommonsFormHelper.php @@ -145,6 +145,10 @@ public function __call($method, $params) { $helper = $this->_View->loadHelper('NetCommons.DisplayNumber'); $method = 'selectDays'; + } elseif ($method === 'button') { + //ボタン + $helper = $this->_View->loadHelper('NetCommons.Button'); + } else { //それ以外 $helper = $this->Form; diff --git a/View/Helper/NetCommonsHtmlHelper.php b/View/Helper/NetCommonsHtmlHelper.php index b66ee5c4..caf0f125 100644 --- a/View/Helper/NetCommonsHtmlHelper.php +++ b/View/Helper/NetCommonsHtmlHelper.php @@ -186,6 +186,33 @@ public function link($title = '', $url = null, $options = array()) { return $output; } +/** + * タイトル(ブロックタイトル)の出力 + * + * #### サンプル + * ``` + * echo $this->NetCommonsHtml->blockTitle($bbs['name']) + * ``` + * ##### 出力結果 + * ``` + *