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
2d537704
Commit
2d537704
authored
Oct 28, 2013
by
Paul Klimov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:yiisoft/yii2 into email-swift-2
parents
73a8e77c
3b05e715
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
95 additions
and
8 deletions
+95
-8
site.css
apps/advanced/backend/web/css/site.css
+21
-0
site.css
apps/advanced/frontend/web/css/site.css
+21
-0
site.css
apps/basic/web/css/site.css
+21
-0
View.php
framework/yii/base/View.php
+2
-2
ButtonGroup.php
framework/yii/bootstrap/ButtonGroup.php
+2
-2
ActiveDataProvider.php
framework/yii/data/ActiveDataProvider.php
+1
-1
GridView.php
framework/yii/grid/GridView.php
+5
-0
FallbackMessageFormatter.php
framework/yii/i18n/FallbackMessageFormatter.php
+2
-2
BaseListView.php
framework/yii/widgets/BaseListView.php
+1
-1
Customer.php
tests/unit/data/ar/Customer.php
+10
-0
ActiveRecordTest.php
tests/unit/framework/db/ActiveRecordTest.php
+9
-0
No files found.
apps/advanced/backend/web/css/site.css
View file @
2d537704
...
@@ -17,3 +17,24 @@ body {
...
@@ -17,3 +17,24 @@ body {
font-size
:
21px
;
font-size
:
21px
;
padding
:
14px
24px
;
padding
:
14px
24px
;
}
}
/* add sorting icons to gridview sort links */
a
.asc
:after
,
a
.desc
:after
{
position
:
relative
;
top
:
1px
;
display
:
inline-block
;
font-family
:
'Glyphicons Halflings'
;
font-style
:
normal
;
font-weight
:
normal
;
line-height
:
1
;
padding-left
:
5px
;
}
a
.asc
:after
{
content
:
/*"\e113"*/
"\e151"
;
}
a
.desc
:after
{
content
:
/*"\e114"*/
"\e152"
;
}
.sort-numerical
a
.asc
:after
{
content
:
"\e153"
;
}
.sort-numerical
a
.desc
:after
{
content
:
"\e154"
;
}
.sort-ordinal
a
.asc
:after
{
content
:
"\e155"
;
}
.sort-ordinal
a
.desc
:after
{
content
:
"\e156"
;
}
apps/advanced/frontend/web/css/site.css
View file @
2d537704
...
@@ -17,3 +17,24 @@ body {
...
@@ -17,3 +17,24 @@ body {
font-size
:
21px
;
font-size
:
21px
;
padding
:
14px
24px
;
padding
:
14px
24px
;
}
}
/* add sorting icons to gridview sort links */
a
.asc
:after
,
a
.desc
:after
{
position
:
relative
;
top
:
1px
;
display
:
inline-block
;
font-family
:
'Glyphicons Halflings'
;
font-style
:
normal
;
font-weight
:
normal
;
line-height
:
1
;
padding-left
:
5px
;
}
a
.asc
:after
{
content
:
/*"\e113"*/
"\e151"
;
}
a
.desc
:after
{
content
:
/*"\e114"*/
"\e152"
;
}
.sort-numerical
a
.asc
:after
{
content
:
"\e153"
;
}
.sort-numerical
a
.desc
:after
{
content
:
"\e154"
;
}
.sort-ordinal
a
.asc
:after
{
content
:
"\e155"
;
}
.sort-ordinal
a
.desc
:after
{
content
:
"\e156"
;
}
apps/basic/web/css/site.css
View file @
2d537704
...
@@ -18,3 +18,24 @@ body {
...
@@ -18,3 +18,24 @@ body {
font-size
:
21px
;
font-size
:
21px
;
padding
:
14px
24px
;
padding
:
14px
24px
;
}
}
/* add sorting icons to gridview sort links */
a
.asc
:after
,
a
.desc
:after
{
position
:
relative
;
top
:
1px
;
display
:
inline-block
;
font-family
:
'Glyphicons Halflings'
;
font-style
:
normal
;
font-weight
:
normal
;
line-height
:
1
;
padding-left
:
5px
;
}
a
.asc
:after
{
content
:
/*"\e113"*/
"\e151"
;
}
a
.desc
:after
{
content
:
/*"\e114"*/
"\e152"
;
}
.sort-numerical
a
.asc
:after
{
content
:
"\e153"
;
}
.sort-numerical
a
.desc
:after
{
content
:
"\e154"
;
}
.sort-ordinal
a
.asc
:after
{
content
:
"\e155"
;
}
.sort-ordinal
a
.desc
:after
{
content
:
"\e156"
;
}
framework/yii/base/View.php
View file @
2d537704
...
@@ -259,16 +259,16 @@ class View extends Component
...
@@ -259,16 +259,16 @@ class View extends Component
$output
=
''
;
$output
=
''
;
if
(
$this
->
beforeRender
(
$viewFile
))
{
if
(
$this
->
beforeRender
(
$viewFile
))
{
Yii
::
trace
(
"Rendering view file:
$viewFile
"
,
__METHOD__
);
$ext
=
pathinfo
(
$viewFile
,
PATHINFO_EXTENSION
);
$ext
=
pathinfo
(
$viewFile
,
PATHINFO_EXTENSION
);
if
(
isset
(
$this
->
renderers
[
$ext
]))
{
if
(
isset
(
$this
->
renderers
[
$ext
]))
{
if
(
is_array
(
$this
->
renderers
[
$ext
]))
{
if
(
is_array
(
$this
->
renderers
[
$ext
])
||
is_string
(
$this
->
renderers
[
$ext
])
)
{
$this
->
renderers
[
$ext
]
=
Yii
::
createObject
(
$this
->
renderers
[
$ext
]);
$this
->
renderers
[
$ext
]
=
Yii
::
createObject
(
$this
->
renderers
[
$ext
]);
}
}
/** @var ViewRenderer $renderer */
/** @var ViewRenderer $renderer */
$renderer
=
$this
->
renderers
[
$ext
];
$renderer
=
$this
->
renderers
[
$ext
];
$output
=
$renderer
->
render
(
$this
,
$viewFile
,
$params
);
$output
=
$renderer
->
render
(
$this
,
$viewFile
,
$params
);
}
else
{
}
else
{
Yii
::
trace
(
"Rendering view file:
$viewFile
"
,
__METHOD__
);
$output
=
$this
->
renderPhpFile
(
$viewFile
,
$params
);
$output
=
$this
->
renderPhpFile
(
$viewFile
,
$params
);
}
}
$this
->
afterRender
(
$viewFile
,
$output
);
$this
->
afterRender
(
$viewFile
,
$output
);
...
...
framework/yii/bootstrap/ButtonGroup.php
View file @
2d537704
...
@@ -17,7 +17,7 @@ use yii\helpers\Html;
...
@@ -17,7 +17,7 @@ use yii\helpers\Html;
*
*
* ```php
* ```php
* // a button group with items configuration
* // a button group with items configuration
* echo ButtonGroup::
::
widget([
* echo ButtonGroup::widget([
* 'buttons' => [
* 'buttons' => [
* ['label' => 'A'],
* ['label' => 'A'],
* ['label' => 'B'],
* ['label' => 'B'],
...
@@ -25,7 +25,7 @@ use yii\helpers\Html;
...
@@ -25,7 +25,7 @@ use yii\helpers\Html;
* ]);
* ]);
*
*
* // button group with an item as a string
* // button group with an item as a string
* echo ButtonGroup::
::
widget([
* echo ButtonGroup::widget([
* 'buttons' => [
* 'buttons' => [
* Button::widget(['label' => 'A']),
* Button::widget(['label' => 'A']),
* ['label' => 'B'],
* ['label' => 'B'],
...
...
framework/yii/data/ActiveDataProvider.php
View file @
2d537704
...
@@ -158,7 +158,7 @@ class ActiveDataProvider extends BaseDataProvider
...
@@ -158,7 +158,7 @@ class ActiveDataProvider extends BaseDataProvider
throw
new
InvalidConfigException
(
'The "query" property must be an instance of Query or its subclass.'
);
throw
new
InvalidConfigException
(
'The "query" property must be an instance of Query or its subclass.'
);
}
}
$query
=
clone
$this
->
query
;
$query
=
clone
$this
->
query
;
return
$query
->
limit
(
-
1
)
->
offset
(
-
1
)
->
count
(
'*'
,
$this
->
db
);
return
(
int
)
$query
->
limit
(
-
1
)
->
offset
(
-
1
)
->
count
(
'*'
,
$this
->
db
);
}
}
/**
/**
...
...
framework/yii/grid/GridView.php
View file @
2d537704
...
@@ -89,6 +89,11 @@ class GridView extends BaseListView
...
@@ -89,6 +89,11 @@ class GridView extends BaseListView
*/
*/
public
$showFooter
=
false
;
public
$showFooter
=
false
;
/**
/**
* @var string|boolean the HTML content to be displayed when [[dataProvider]] does not have any data.
* If false, the grid view will still be displayed (without body content though).
*/
public
$empty
=
false
;
/**
* @var array|Formatter the formatter used to format model attribute values into displayable texts.
* @var array|Formatter the formatter used to format model attribute values into displayable texts.
* This can be either an instance of [[Formatter]] or an configuration array for creating the [[Formatter]]
* This can be either an instance of [[Formatter]] or an configuration array for creating the [[Formatter]]
* instance. If this property is not set, the "formatter" application component will be used.
* instance. If this property is not set, the "formatter" application component will be used.
...
...
framework/yii/i18n/FallbackMessageFormatter.php
View file @
2d537704
...
@@ -66,7 +66,7 @@ class FallbackMessageFormatter
...
@@ -66,7 +66,7 @@ class FallbackMessageFormatter
* @param array $args Arguments to insert into the format string
* @param array $args Arguments to insert into the format string
* @return string The formatted string, or `FALSE` if an error occurred
* @return string The formatted string, or `FALSE` if an error occurred
*/
*/
public
function
format
(
array
$args
)
public
function
format
(
$args
)
{
{
return
static
::
formatMessage
(
$this
->
_locale
,
$this
->
_pattern
,
$args
);
return
static
::
formatMessage
(
$this
->
_locale
,
$this
->
_pattern
,
$args
);
}
}
...
@@ -79,7 +79,7 @@ class FallbackMessageFormatter
...
@@ -79,7 +79,7 @@ class FallbackMessageFormatter
* @param array $args The array of values to insert into the format string
* @param array $args The array of values to insert into the format string
* @return string The formatted pattern string or `FALSE` if an error occurred
* @return string The formatted pattern string or `FALSE` if an error occurred
*/
*/
public
static
function
formatMessage
(
$locale
,
$pattern
,
array
$args
)
public
static
function
formatMessage
(
$locale
,
$pattern
,
$args
)
{
{
if
((
$tokens
=
static
::
tokenizePattern
(
$pattern
))
===
false
)
{
if
((
$tokens
=
static
::
tokenizePattern
(
$pattern
))
===
false
)
{
return
false
;
return
false
;
...
...
framework/yii/widgets/BaseListView.php
View file @
2d537704
...
@@ -139,7 +139,7 @@ abstract class BaseListView extends Widget
...
@@ -139,7 +139,7 @@ abstract class BaseListView extends Widget
$pageCount
=
$pagination
->
pageCount
;
$pageCount
=
$pagination
->
pageCount
;
if
((
$summaryContent
=
$this
->
summary
)
===
null
)
{
if
((
$summaryContent
=
$this
->
summary
)
===
null
)
{
$summaryContent
=
'<div class="summary">'
$summaryContent
=
'<div class="summary">'
.
Yii
::
t
(
'yii'
,
'Showing <b>{totalCount, plural, =0{0} other{{begin
}-{end}}}</b> of <b>{totalCount
}</b> {totalCount, plural, one{item} other{items}}.'
)
.
Yii
::
t
(
'yii'
,
'Showing <b>{totalCount, plural, =0{0} other{{begin
, number, integer}-{end, number, integer}}}</b> of <b>{totalCount, number, integer
}</b> {totalCount, plural, one{item} other{items}}.'
)
.
'</div>'
;
.
'</div>'
;
}
}
}
else
{
}
else
{
...
...
tests/unit/data/ar/Customer.php
View file @
2d537704
...
@@ -17,6 +17,9 @@ class Customer extends ActiveRecord
...
@@ -17,6 +17,9 @@ class Customer extends ActiveRecord
public
$status2
;
public
$status2
;
public
static
$afterSaveInsert
=
null
;
public
static
$afterSaveNewRecord
=
null
;
public
static
function
tableName
()
public
static
function
tableName
()
{
{
return
'tbl_customer'
;
return
'tbl_customer'
;
...
@@ -31,4 +34,11 @@ class Customer extends ActiveRecord
...
@@ -31,4 +34,11 @@ class Customer extends ActiveRecord
{
{
$query
->
andWhere
(
'status=1'
);
$query
->
andWhere
(
'status=1'
);
}
}
public
function
afterSave
(
$insert
)
{
static
::
$afterSaveInsert
=
$insert
;
static
::
$afterSaveNewRecord
=
$this
->
isNewRecord
;
parent
::
afterSave
(
$insert
);
}
}
}
tests/unit/framework/db/ActiveRecordTest.php
View file @
2d537704
...
@@ -295,10 +295,14 @@ class ActiveRecordTest extends DatabaseTestCase
...
@@ -295,10 +295,14 @@ class ActiveRecordTest extends DatabaseTestCase
$this
->
assertNull
(
$customer
->
id
);
$this
->
assertNull
(
$customer
->
id
);
$this
->
assertTrue
(
$customer
->
isNewRecord
);
$this
->
assertTrue
(
$customer
->
isNewRecord
);
Customer
::
$afterSaveNewRecord
=
null
;
Customer
::
$afterSaveInsert
=
null
;
$customer
->
save
();
$customer
->
save
();
$this
->
assertEquals
(
4
,
$customer
->
id
);
$this
->
assertEquals
(
4
,
$customer
->
id
);
$this
->
assertFalse
(
Customer
::
$afterSaveNewRecord
);
$this
->
assertTrue
(
Customer
::
$afterSaveInsert
);
$this
->
assertFalse
(
$customer
->
isNewRecord
);
$this
->
assertFalse
(
$customer
->
isNewRecord
);
}
}
...
@@ -309,10 +313,15 @@ class ActiveRecordTest extends DatabaseTestCase
...
@@ -309,10 +313,15 @@ class ActiveRecordTest extends DatabaseTestCase
$this
->
assertTrue
(
$customer
instanceof
Customer
);
$this
->
assertTrue
(
$customer
instanceof
Customer
);
$this
->
assertEquals
(
'user2'
,
$customer
->
name
);
$this
->
assertEquals
(
'user2'
,
$customer
->
name
);
$this
->
assertFalse
(
$customer
->
isNewRecord
);
$this
->
assertFalse
(
$customer
->
isNewRecord
);
Customer
::
$afterSaveNewRecord
=
null
;
Customer
::
$afterSaveInsert
=
null
;
$customer
->
name
=
'user2x'
;
$customer
->
name
=
'user2x'
;
$customer
->
save
();
$customer
->
save
();
$this
->
assertEquals
(
'user2x'
,
$customer
->
name
);
$this
->
assertEquals
(
'user2x'
,
$customer
->
name
);
$this
->
assertFalse
(
$customer
->
isNewRecord
);
$this
->
assertFalse
(
$customer
->
isNewRecord
);
$this
->
assertFalse
(
Customer
::
$afterSaveNewRecord
);
$this
->
assertFalse
(
Customer
::
$afterSaveInsert
);
$customer2
=
Customer
::
find
(
2
);
$customer2
=
Customer
::
find
(
2
);
$this
->
assertEquals
(
'user2x'
,
$customer2
->
name
);
$this
->
assertEquals
(
'user2x'
,
$customer2
->
name
);
...
...
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