Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
e23eaaed
Commit
e23eaaed
authored
Jan 09, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1820: Update Progress to use bootstrap 3 markup
parent
1f47d94e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
12 deletions
+28
-12
CHANGELOG.md
extensions/yii/bootstrap/CHANGELOG.md
+2
-1
Progress.php
extensions/yii/bootstrap/Progress.php
+26
-11
No files found.
extensions/yii/bootstrap/CHANGELOG.md
View file @
e23eaaed
...
...
@@ -7,7 +7,8 @@ Yii Framework 2 bootstrap extension Change Log
-
Enh #1474: Added option to make NavBar 100% width (cebe)
-
Enh #1553: Only add navbar-default class to NavBar when no other class is specified (cebe)
-
Enh #1601: Added support for tagName and encodeLabel parameters in ButtonDropdown (omnilight)
-
Bug #1459: Update Collapse to use bootstrap 3 classes (tonydspaniard)
-
Chg #1459: Update Collapse to use bootstrap 3 classes (tonydspaniard)
-
Chg #1820: Update Progress to use bootstrap 3 markup (samdark)
2.
0.0 alpha, December 1, 2013
-----------------------------
...
...
extensions/yii/bootstrap/Progress.php
View file @
e23eaaed
...
...
@@ -26,34 +26,35 @@ use yii\helpers\Html;
* // styled
* echo Progress::widget([
* 'percent' => 65,
* 'barOptions' => ['class' => 'bar-danger']
* 'barOptions' => ['class' => '
progress-
bar-danger']
* ]);
*
* // striped
* echo Progress::widget([
* 'percent' => 70,
* 'barOptions' => ['class' => 'bar-warning'],
* 'barOptions' => ['class' => '
progress-
bar-warning'],
* 'options' => ['class' => 'progress-striped']
* ]);
*
* // striped animated
* echo Progress::widget([
* 'percent' => 70,
* 'barOptions' => ['class' => 'bar-success'],
* 'barOptions' => ['class' => '
progress-
bar-success'],
* 'options' => ['class' => 'active progress-striped']
* ]);
*
* // stacked bars
* echo Progress::widget([
* 'bars' => [
* ['percent' => 30, 'options' => ['class' => 'bar-danger']],
* ['percent' => 30, 'label' => 'test', 'options' => ['class' => 'bar-success']],
* ['percent' => 35, 'options' => ['class' => 'bar-warning']],
* ['percent' => 30, 'options' => ['class' => '
progress-
bar-danger']],
* ['percent' => 30, 'label' => 'test', 'options' => ['class' => '
progress-
bar-success']],
* ['percent' => 35, 'options' => ['class' => '
progress-
bar-warning']],
* ]
* ]);
* ```
* @see http://
twitter.github.io/bootstrap/components.html
#progress
* @see http://
getbootstrap.com/components/
#progress
* @author Antonio Ramirez <amigo.cobos@gmail.com>
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class
Progress
extends
Widget
...
...
@@ -67,7 +68,7 @@ class Progress extends Widget
*/
public
$percent
=
0
;
/**
* @var array the HTML attributes of the
* @var array the HTML attributes of the
bar
*/
public
$barOptions
=
[];
/**
...
...
@@ -139,8 +140,22 @@ class Progress extends Widget
*/
protected
function
renderBar
(
$percent
,
$label
=
''
,
$options
=
[])
{
Html
::
addCssClass
(
$options
,
'bar'
);
$options
[
'style'
]
=
"width:
{
$percent
}
%"
;
return
Html
::
tag
(
'div'
,
$label
,
$options
);
$defaultOptions
=
[
'role'
=>
'progressbar'
,
'aria-valuenow'
=>
$percent
,
'aria-valuemin'
=>
0
,
'aria-valuemax'
=>
100
,
'style'
=>
"width:
{
$percent
}
%"
,
];
$options
=
array_merge
(
$defaultOptions
,
$options
);
Html
::
addCssClass
(
$options
,
'progress-bar'
);
$out
=
Html
::
beginTag
(
'div'
,
$options
);
$out
.=
$label
;
$out
.=
Html
::
tag
(
'span'
,
\Yii
::
t
(
'yii'
,
'{percent}% Complete'
,
[
'percent'
=>
$percent
]),
[
'class'
=>
'sr-only'
]);
$out
.=
Html
::
endTag
(
'div'
);
return
$out
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment