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']) + * ``` + * ##### 出力結果 + * ``` + *

新しい掲示板 20160513074815

+ * ``` + * + * @param string $text タイトル + * @param array $options HTML属性オプション + * @return string `

`タグ + */ + public function blockTitle($text = '', $options = array()) { + $output = ''; + + $options = Hash::merge( + array('escape' => true), $options + ); + + $output .= $this->Html->tag('h1', $text, $options); + return $output; + } + /** * Creates a `` tag for add link. The type attribute defaults * 後で削除予定(現状、ブロック設定の一覧のリンクで使っている) diff --git a/View/Helper/TableListHelper.php b/View/Helper/TableListHelper.php index e0ca72cb..c142428d 100644 --- a/View/Helper/TableListHelper.php +++ b/View/Helper/TableListHelper.php @@ -217,9 +217,9 @@ public function tableData($fieldName, $value = '', $options = array()) { } if (Hash::get($options, 'editUrl', false)) { - $value .= ' ' . $this->LinkButton->edit('', + $value .= $this->LinkButton->edit('', Hash::get($options, 'editUrl', array()), - array('iconSize' => ' btn-xs nc-table-edit') + array('iconSize' => ' btn-xs') ); } diff --git a/webroot/css/style.css b/webroot/css/style.css index d459e9c7..ce3969b3 100644 --- a/webroot/css/style.css +++ b/webroot/css/style.css @@ -85,12 +85,16 @@ a.nc-page-refresh { } /** - * buttonタグ + * buttonの定義 */ .btn-workflow { margin-left: 6px; margin-right: 6px; } +table > tbody > tr > td .btn.btn-xs, +.btn-xs.nc-btn-style { + margin-left: 1.4em; +} /** * inputタグ @@ -261,6 +265,11 @@ ul.nav-pills { margin-top: 0px; margin-bottom: 16px; } +.frame.nc-content article h1, +.frame.nc-content article .h1 { + margin-top: 0px; + margin-bottom: 16px; +} .frame.nc-content-list article h1, .frame.nc-content-list article .h1, @@ -271,8 +280,8 @@ ul.nav-pills { margin-top: 16px; margin-bottom: 10px; } -.frame.nc-content article h1, -.frame.nc-content article .h1, +/*.frame.nc-content article h1,*/ +/*.frame.nc-content article .h1,*/ .frame.nc-content article h2, .frame.nc-content article .h2, .frame.nc-content article h3,