Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Test/Case/View/Helper/LinkButtonHelper/AddTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testAddWithTitle($title) {
$result = $this->LinkButton->add($title, $url, $options);

//チェック
$expected = '<a href="/net_commons/net_commons_ctrl/add" class="btn btn-success">' .
$expected = '<a href="/net_commons/net_commons_ctrl/add" class="btn btn-success nc-btn-style">' .
'<span class="glyphicon glyphicon-plus"></span> ' . $title .
'</a>';
$this->assertEquals($expected, $result);
Expand Down Expand Up @@ -122,7 +122,7 @@ public function testAddWithEscapeTitle($title, $escapeTitle, $expectedTitle) {
$result = $this->LinkButton->add($title, $url, $options);

//チェック
$expected = '<a href="/net_commons/net_commons_ctrl/add" class="btn btn-success">' .
$expected = '<a href="/net_commons/net_commons_ctrl/add" class="btn btn-success nc-btn-style">' .
'<span class="glyphicon glyphicon-plus"></span> ' . $expectedTitle .
'</a>';
$this->assertEqual($expected, $result);
Expand All @@ -144,7 +144,7 @@ public function testAddWithIcon() {
$result = $this->LinkButton->add($title, $url, $options);

//チェック
$expected = '<a href="/net_commons/net_commons_ctrl/add" class="btn btn-success">' .
$expected = '<a href="/net_commons/net_commons_ctrl/add" class="btn btn-success nc-btn-style">' .
'<span class="glyphicon glyphicon-' . $icon . '"></span> ' .
'</a>';
$this->assertEquals($expected, $result);
Expand All @@ -171,7 +171,7 @@ public function testAddWithIconSize() {
} else {
$expectedIconSize = '';
}
$expected = '<a href="/net_commons/net_commons_ctrl/add" class="btn btn-success' . $expectedIconSize . '">' .
$expected = '<a href="/net_commons/net_commons_ctrl/add" class="btn btn-success nc-btn-style' . $expectedIconSize . '">' .
'<span class="glyphicon glyphicon-plus"></span> ' .
'</a>';
$this->assertEqual($expected, $result);
Expand Down Expand Up @@ -212,7 +212,7 @@ public function testAddWithTooltip($tooltip) {
$tooltip = __d('net_commons', 'Add');
}
$expected = '<span class="nc-tooltip" tooltip="' . $tooltip . '">' .
'<a href="/net_commons/net_commons_ctrl/add" class="btn btn-success">' .
'<a href="/net_commons/net_commons_ctrl/add" class="btn btn-success nc-btn-style">' .
'<span class="glyphicon glyphicon-plus"></span> ' . $title .
'</a>' .
'</span>';
Expand Down Expand Up @@ -242,7 +242,7 @@ public function testAddWithAddController() {
$result = $this->LinkButton->add($title, $url, $options);

//チェック
$expected = '<a href="/net_commons/add_net_commons_ctrl/add" class="btn btn-success">' .
$expected = '<a href="/net_commons/add_net_commons_ctrl/add" class="btn btn-success nc-btn-style">' .
'<span class="glyphicon glyphicon-plus"></span> ' . $title .
'</a>';
$this->assertEqual($expected, $result);
Expand Down
7 changes: 4 additions & 3 deletions View/Helper/ButtonHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down Expand Up @@ -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);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions View/Helper/LinkButtonHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)) {
Expand Down
4 changes: 4 additions & 0 deletions View/Helper/NetCommonsFormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
27 changes: 27 additions & 0 deletions View/Helper/NetCommonsHtmlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,33 @@ public function link($title = '', $url = null, $options = array()) {
return $output;
}

/**
* タイトル(ブロックタイトル)の出力
*
* #### サンプル
* ```
* echo $this->NetCommonsHtml->blockTitle($bbs['name'])
* ```
* ##### 出力結果
* ```
* <h1>新しい掲示板 20160513074815</h1>
* ```
*
* @param string $text タイトル
* @param array $options HTML属性オプション
* @return string `<h1>`タグ
*/
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 `<a>` tag for add link. The type attribute defaults
* 後で削除予定(現状、ブロック設定の一覧のリンクで使っている)
Expand Down
4 changes: 2 additions & 2 deletions View/Helper/TableListHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
);
}

Expand Down
15 changes: 12 additions & 3 deletions webroot/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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タグ
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down