From f6ad297549551df0c56f42aff2c33cd2eff89fb6 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 13 May 2016 18:24:26 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E3=83=96=E3=83=AD=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB=E3=80=81=E3=83=9C=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=81=AE=E4=BD=99=E7=99=BD=E3=81=AE=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E3=80=81mobile=E3=81=8B=E3=81=A9=E3=81=86=E3=81=8B=E3=82=92Con?= =?UTF-8?q?figure=E3=82=92=E4=BD=BF=E3=81=86=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/Helper/ButtonHelper.php | 5 +++-- View/Helper/LinkButtonHelper.php | 8 ++++---- View/Helper/NetCommonsHtmlHelper.php | 27 +++++++++++++++++++++++++++ View/Helper/TableListHelper.php | 4 ++-- webroot/css/style.css | 15 ++++++++++++--- 5 files changed, 48 insertions(+), 11 deletions(-) diff --git a/View/Helper/ButtonHelper.php b/View/Helper/ButtonHelper.php index bd441531..e4229533 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,7 +81,8 @@ 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)); } 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/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, From cd0148d0379822cdc7672a511881fb40e262055d Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 13 May 2016 18:47:33 +0900 Subject: [PATCH 2/3] =?UTF-8?q?NetCommonsForm->button=E3=82=92=E5=91=BC?= =?UTF-8?q?=E3=81=B0=E3=82=8C=E3=81=9F=E3=82=89=E3=80=81Button->button?= =?UTF-8?q?=E3=82=92=E3=82=B3=E3=83=BC=E3=83=AB=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/Helper/ButtonHelper.php | 2 +- View/Helper/NetCommonsFormHelper.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/View/Helper/ButtonHelper.php b/View/Helper/ButtonHelper.php index e4229533..3c4b8291 100644 --- a/View/Helper/ButtonHelper.php +++ b/View/Helper/ButtonHelper.php @@ -89,7 +89,7 @@ public function button($title, $options = array()) { } $options = Hash::insert($options, 'class', $class); } - return $this->NetCommonsForm->button($title, $options); + return $this->Form->button($title, $options); } /** 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; From 6016a19c2660460cddcefd0cc3e6d61b2be93edc Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 13 May 2016 19:12:16 +0900 Subject: [PATCH 3/3] =?UTF-8?q?phpunit=E3=82=A8=E3=83=A9=E3=83=BC=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Case/View/Helper/LinkButtonHelper/AddTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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);