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/BackToHelper/LinkButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testLinkButtonWithTitle($title) {

//チェック
$expected = '<a href="/edit" class="btn btn-default">' .
'<span class="glyphicon glyphicon-remove"></span> ' . $title .
'<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> ' . $title .
'</a>';
$this->assertEquals($expected, $result);
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public function testLinkButtonWithIcon($icon) {

//チェック
if ($icon) {
$expected = '<a href="/edit" class="btn btn-default"><span class="glyphicon glyphicon-' . $icon . '"></span> </a>';
$expected = '<a href="/edit" class="btn btn-default"><span class="glyphicon glyphicon-' . $icon . '" aria-hidden="true"></span> </a>';
} else {
$expected = '<a href="/edit" class="btn btn-default"></a>';
}
Expand Down Expand Up @@ -172,9 +172,9 @@ public function testLinkButtonWithIconSize($iconSize) {
$expectedIconSize = '';
}
$expected = '<a href="/edit" class="btn btn-default' . $expectedIconSize . '">' .
'<span class="glyphicon glyphicon-remove"></span> ' .
'<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> ' .
'</a>';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}

/**
Expand Down Expand Up @@ -213,9 +213,9 @@ public function testLinkButtonWithEscapeTitle($title, $escapeTitle, $expectedTit

//チェック
$expected = '<a href="/edit" class="btn btn-default">' .
'<span class="glyphicon glyphicon-remove"></span> ' . $expectedTitle .
'<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> ' . $expectedTitle .
'</a>';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ public function testCancelAndSaveAndSaveTemp($status, $contentPublishable, $canc
private function __assertButtons($result, $cancelUrl, $backUrl, $disapproval, $approval) {
//キャンセルのチェック
$expected = '<a href="' . $cancelUrl . '" class="btn btn-default btn-workflow">' .
'<span class="glyphicon glyphicon-remove"></span> ' . __d('net_commons', 'Cancel') .
'<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> ' . __d('net_commons', 'Cancel') .
'</a>';
$this->assertTextContains($expected, $result);

//戻るのチェック
if ($backUrl) {
$expected = '<a href="' . $backUrl . '" class="btn btn-default btn-workflow" ng-class="{disabled: sending}">' .
'<span class="glyphicon glyphicon-chevron-left"></span> ' . __d('net_commons', 'BACK') .
'<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> ' . __d('net_commons', 'BACK') .
'</a>';
$this->assertTextContains($expected, $result);
} else {
Expand Down
6 changes: 4 additions & 2 deletions View/Helper/BackToHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public function button($title, $url, $options = array()) {
$options['icon'] = 'remove';
}
if ($options['icon'] !== '') {
$iconElement = '<span class="glyphicon glyphicon-' . h($options['icon']) . '"></span> ';
$iconElement = '<span class="glyphicon glyphicon-' . h($options['icon']) .
'" aria-hidden="true"></span> ';
unset($options['icon']);

$title = h($title);
Expand Down Expand Up @@ -108,7 +109,8 @@ public function linkButton($title, $url, $options = array()) {
$icon = Hash::get($options, 'icon', 'remove');
$options = Hash::remove($options, 'icon');
if ($icon) {
$iconElement = '<span class="glyphicon glyphicon-' . h($icon) . '"></span> ';
$iconElement = '<span class="glyphicon glyphicon-' . h($icon) .
'" aria-hidden="true"></span> ';
}

//ボタンサイズ
Expand Down
27 changes: 12 additions & 15 deletions View/Helper/ButtonHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getButtonSize() {
public function button($title, $options = array()) {
$icon = Hash::get($options, 'icon');
if ($icon) {
$title = '<span class="glyphicon ' . $icon . '"></span> ' . $title;
$title = '<span class="glyphicon ' . $icon . '" aria-hidden="true"></span> ' . $title;
$options = Hash::remove($options, 'icon');
$options = Hash::insert($options, 'escape', false);
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public function button($title, $options = array()) {
public function delete($title, $confirm, $options = array()) {
$output = '';

$title = '<span class="glyphicon glyphicon-trash"> </span> ' . $title;
$title = '<span class="glyphicon glyphicon-trash" aria-hidden="true"> </span> ' . $title;

$defaultOptions = array(
'name' => 'delete',
Expand Down Expand Up @@ -156,24 +156,18 @@ public function delete($title, $confirm, $options = array()) {
public function save($title, $options = array()) {
if (isset($options['icon'])) {
$title = h($title);
$title .= ' <span class="glyphicon glyphicon-' . $options['icon'] . '"></span>';
$title .= ' <span class="glyphicon glyphicon-' . $options['icon'] .
'" aria-hidden="true"></span>';
$options['escape'] = false;
}

$defaultOptions = array(
'name' => 'save',
'class' => 'btn btn-primary' . $this->getButtonSize() . ' btn-workflow',
'ng-disabled' => 'sending'
);
$inputOptions = Hash::merge($defaultOptions, $options);

if (Hash::get($options, 'url')) {
$options['url'] = $this->NetCommonsHtml->url(Hash::get($options, 'url'));

$inputOptions = Hash::merge(array(
'class' => 'btn btn-primary' . $this->getButtonSize() . ' btn-workflow',
'ng-disabled' => 'sending',
'ng-click' => 'sending=true',
'ng-click' => 'sending=true'
), $options);
$inputOptions = Hash::remove($inputOptions, 'url');

Expand Down Expand Up @@ -265,15 +259,16 @@ public function cancelAndSaveAndSaveTemp($cancelUrl = null, $cancelOptions = [],
$cancelOptions = Hash::remove($cancelOptions, 'label');

$output .= $this->Html->link(
'<span class="glyphicon glyphicon-remove"></span> ' . $label,
'<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> ' . $label,
$cancelUrl,
$cancelOptions
);

//前へボタン
if (isset($backUrl)) {
$output .= $this->Html->link(
'<span class="glyphicon glyphicon-chevron-left"></span> ' . __d('net_commons', 'BACK'),
'<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> ' .
__d('net_commons', 'BACK'),
$backUrl,
array(
'class' => 'btn btn-default' . $this->getButtonSize() . ' btn-workflow',
Expand Down Expand Up @@ -320,7 +315,8 @@ public function search($title, $options = array()) {

$options['icon'] = Hash::get($options, 'icon', 'search');
if ($options['icon'] !== '') {
$iconElement = '<span class="glyphicon glyphicon-' . h($options['icon']) . '"></span> ';
$iconElement = '<span class="glyphicon glyphicon-' . h($options['icon']) .
'" aria-hidden="true"></span> ';
unset($options['icon']);
} else {
$iconElement = '';
Expand Down Expand Up @@ -348,7 +344,8 @@ public function add($title, $options = array()) {

$options['icon'] = Hash::get($options, 'icon', 'plus');
if ($options['icon'] !== '') {
$iconElement = '<span class="glyphicon glyphicon-' . h($options['icon']) . '"></span> ';
$iconElement = '<span class="glyphicon glyphicon-' . h($options['icon']) .
'" aria-hidden="true"></span> ';
unset($options['icon']);
} else {
$iconElement = '';
Expand Down