Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
8daf3716
Commit
8daf3716
authored
Dec 06, 2015
by
LE GAC Renaud
Browse files
Polish the class Wizard.
parent
a82a0481
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
23 deletions
+30
-23
static/track_publications/src/wizard/Wizard.js
static/track_publications/src/wizard/Wizard.js
+30
-23
No files found.
static/track_publications/src/wizard/Wizard.js
View file @
8daf3716
...
...
@@ -5,8 +5,7 @@
* Each page contains text and fields to collect data.
*
* Buttons allow to move from one page to the next one and vice-versa.
* At the end, when all fields are field, the button Finish trigger the
* data transfer to the server.
* At the end, the button Finish triggers the data transfer to the server.
*
* The action executes on the server side is defined by an hyperlinks.
* The data are transfered as a JSON dictionary.
...
...
@@ -15,6 +14,15 @@
* send the data to the server. The pages and their configurations has to be
* created for the inherited classes and added via the add method.
*
* Two mechanism are in placed to ease the navigation logic. They are base on
* the field property allowBlank and on the panel property disabled.
* The first one allow to enable/disable the button finish while the second
* allow to skip page.
*
* The button Finish is linked to the fields via the allowBlank and
* formBind properties. The button Finish is enabled when all the field, with
* property allowBlank equal to false, are filled.
*
* @since 0.9.3
*
*/
...
...
@@ -52,12 +60,6 @@ Ext.define('Trp.wizard.Wizard', {
*/
burronPrev
:
null
,
/**
* @property {Number}
* The number of the current page, starting at 0.
*/
currentPage
:
0
,
/**
* @property {Number}
* The number of pages.
...
...
@@ -67,6 +69,7 @@ Ext.define('Trp.wizard.Wizard', {
// shortcuts
cardLayout
:
null
,
mask
:
null
,
window
:
null
,
// private properties for internationalisation
textAttention
:
"
Attention
"
,
...
...
@@ -137,18 +140,18 @@ Ext.define('Trp.wizard.Wizard', {
me
.
cardLayout
=
me
.
getLayout
();
},
// insert the protection mechanism when the parent window is closed.
// private methods of the Ext JS component model.
// Insert the protection mechanism when the parent window is closed.
onRender
:
function
()
{
var
me
=
this
,
window
;
var
me
=
this
;
me
.
callParent
(
arguments
);
window
=
me
.
up
(
"
window
"
);
me
.
window
=
me
.
up
(
'
window
'
);
if
(
window
!==
undefined
)
{
window
.
on
(
'
beforeclose
'
,
me
.
onClose
,
me
);
if
(
me
.
window
)
{
me
.
window
.
on
(
'
beforeclose
'
,
me
.
onClose
,
me
);
}
},
...
...
@@ -174,7 +177,7 @@ Ext.define('Trp.wizard.Wizard', {
}
});
//
pause
the event propagation waiting user answer
//
stop
the event propagation waiting user answer
return
false
;
},
...
...
@@ -196,14 +199,15 @@ Ext.define('Trp.wizard.Wizard', {
if
(
explain
!==
""
)
{
msg
+=
"
<br>
"
+
explain
;
}
Ext
.
Msg
.
alert
(
me
.
textError
,
msg
);
me
.
mask
.
hide
();
},
/**
* Handler call when the data collection is finished.
* It
mainly
send the collect data to the server for the final processing.
* The data are encapsulated in a JSON string
* It send
s
the collect data to the server for the final processing.
* The data are encapsulated in a JSON string
.
*
*/
onFinish
:
function
()
{
...
...
@@ -241,7 +245,7 @@ Ext.define('Trp.wizard.Wizard', {
card
=
me
.
cardLayout
.
next
();
if
(
card
.
isDisabled
())
{
if
(
card
&&
card
.
isDisabled
())
{
me
.
onNext
();
return
;
}
...
...
@@ -261,7 +265,7 @@ Ext.define('Trp.wizard.Wizard', {
card
=
me
.
cardLayout
.
prev
();
if
(
card
.
isDisabled
())
{
if
(
card
&&
card
.
isDisabled
())
{
me
.
onPrevious
();
return
;
}
...
...
@@ -284,7 +288,9 @@ Ext.define('Trp.wizard.Wizard', {
// use the private method doclose instead of close
// to avoid the protection
me
.
up
(
"
window
"
).
doClose
();
if
(
me
.
window
)
{
me
.
window
.
doClose
();
}
},
// private
...
...
@@ -293,12 +299,13 @@ Ext.define('Trp.wizard.Wizard', {
"
use strict
"
;
var
me
=
this
,
cards
=
me
.
cardLayout
.
getLayoutItems
(),
currentPage
=
Ext
.
Array
.
indexOf
(
cards
,
me
.
cardLayout
.
getActiveItem
());
layout
=
me
.
cardLayout
,
cards
=
layout
.
getLayoutItems
(),
currentPage
=
Ext
.
Array
.
indexOf
(
cards
,
layout
.
getActiveItem
());
// compute the number of pages once
if
(
me
.
lastPage
===
0
)
{
me
.
lastPage
=
me
.
item
s
.
length
-
1
;
me
.
lastPage
=
card
s
.
length
-
1
;
}
// inhibit buttons
...
...
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