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
74f97ce5
Commit
74f97ce5
authored
May 02, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored yii module.
parent
f6e34756
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
15 deletions
+50
-15
yii.js
framework/assets/yii.js
+49
-14
yii.validation.js
framework/assets/yii.validation.js
+1
-1
No files found.
framework/assets/yii.js
View file @
74f97ce5
...
...
@@ -7,24 +7,59 @@
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
/**
* yii is the root module for all Yii JavaScript modules.
* It implements a mechanism of organizing JavaScript code in modules through the function "yii.initModule()".
*
* Each module should be named as "x.y.z", where "x" stands for the root module (for the Yii core code, this is "yii").
*
* A module may be structured as follows:
*
* ~~~
* yii.sample = (function($) {
* var pub = {
* // whether this module is currently active. If false, init() will not be called for this module
* // it will also not be called for all its child modules. If this property is undefined, it means true.
* isActive: true,
* init: function() {
* // ... module initialization code go here ...
* },
*
* // ... other public functions and properties go here ...
* };
*
* // ... private functions and properties go here ...
*
* return pub;
* });
* ~~~
*
* Using this structure, you can define public and private functions/properties for a module.
* Private functions/properties are only visible within the module, while public functions/properties
* may be accessed outside of the module. For example, you can access "yii.sample.init()".
*
* You must call "yii.initModule()" once for the root module of all your modules.
*/
yii
=
(
function
(
$
)
{
var
pub
=
{
version
:
'2.0'
version
:
'2.0'
,
initModule
:
function
(
module
)
{
if
(
module
.
isActive
===
undefined
||
module
.
isActive
)
{
if
(
$
.
isFunction
(
module
.
init
))
{
module
.
init
();
}
$
.
each
(
module
,
function
()
{
if
(
$
.
isPlainObject
(
this
))
{
pub
.
initModule
(
this
);
}
});
}
}
};
return
pub
;
})(
jQuery
);
jQuery
(
document
).
ready
(
function
(
$
)
{
// call the init() method of every module
var
init
=
function
(
module
)
{
if
(
$
.
isFunction
(
module
.
init
)
&&
(
module
.
trigger
==
undefined
||
$
(
module
.
trigger
).
length
))
{
module
.
init
();
}
$
.
each
(
module
,
function
()
{
if
(
$
.
isPlainObject
(
this
))
{
init
(
this
);
}
});
};
init
(
yii
);
jQuery
(
document
).
ready
(
function
()
{
yii
.
initModule
(
yii
);
});
framework/assets/yii.validation.js
View file @
74f97ce5
/**
* Yii validation module.
*
* This
is the JavaScript widget used by the yii\widgets\ActiveForm widget
.
* This
JavaScript module provides the validation methods for the built-in validaotrs
.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
...
...
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