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
16f2acb6
Commit
16f2acb6
authored
Dec 06, 2015
by
LE GAC Renaud
Browse files
The logic to add a wizard in the grid context menu.
parent
f34114df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
0 deletions
+115
-0
models/ui_harvesters.py
models/ui_harvesters.py
+3
-0
static/app.js
static/app.js
+2
-0
static/track_publications/src/grid/plugin/RowEditorAddWizard.js
.../track_publications/src/grid/plugin/RowEditorAddWizard.js
+110
-0
No files found.
models/ui_harvesters.py
View file @
16f2acb6
...
...
@@ -54,6 +54,9 @@ gridModifier.append_filter(('id_categories', '==', T('is equal to')))
gridModifier
.
configure_filters
(
plugins
=
[
'pFormToolTip'
],
width
=
300
)
gridModifier
.
configure_gridWithFilter
(
selectorTitle
=
T
(
'Filter'
))
gridModifier
.
configure
(
plugins
=
[{
'ptype'
:
'pGridRowEditorAddWizard'
,
'wizard'
:{
'xtype'
:
'xwizardharvester'
}}])
#-------------------------------------------------------------------------------
#
# STORE CONFIGURATiON
...
...
static/app.js
View file @
16f2acb6
...
...
@@ -22,7 +22,9 @@ Ext.require('Ext.direct.Manager');
Ext
.
require
(
'
Ext.direct.RemotingProvider
'
);
Ext
.
require
(
'
Ext.EventManager
'
);
Ext
.
require
(
'
Ext.tip.QuickTipManager
'
);
Ext
.
require
(
'
Trp.wizard.Harvester
'
);
Ext
.
require
(
'
Trp.grid.plugin.RowEditorAddWizard
'
);
Ext
.
onReady
(
function
(){
...
...
static/track_publications/src/grid/plugin/RowEditorAddWizard.js
0 → 100644
View file @
16f2acb6
/**
* Add a wizard to the RowEditor context menu.
*
* @since 0.9.3
*
*/
Ext
.
define
(
'
Trp.grid.plugin.RowEditorAddWizard
'
,
{
extend
:
'
Ext.AbstractPlugin
'
,
alias
:
'
plugin.pGridRowEditorAddWizard
'
,
uses
:
[
'
Ext.menu.Menu
'
],
/**
* @cfg {String}
* The title of the window containing the wizard
*/
title
:
"
Wizard...
"
,
/**
* @cfg {String}
* The width of the window containing the wizard
*/
width
:
350
,
/**
* @cfg {Object}
* The wizard object
*/
wizard
:
null
,
// private properties for internationalization
textExpert
:
'
mode expert
'
,
textSimplify
:
'
mode simplified
'
,
/**
* Initialize the plugin.
*
* @param {App.grid.Panel} grid
*/
init
:
function
(
grid
)
{
"
use strict
"
;
var
me
=
this
,
rowEditor
=
grid
.
getPlugin
(
'
rowEditor
'
),
contextMenu
,
newAddItem
,
oldAddItem
;
me
.
setCmp
(
grid
);
// protection
if
(
!
rowEditor
)
{
throw
new
Error
(
'
no grid plugin RowEditor !!!
'
);
}
contextMenu
=
grid
.
findPlugin
(
'
pGridRowEditorContextMenu
'
);
if
(
!
contextMenu
)
{
throw
new
Error
(
'
no grid plugin RowEditorContextMenu !!!
'
);
}
contextMenu
=
contextMenu
.
menu
;
oldAddItem
=
contextMenu
.
items
.
first
();
// the new Add item
newAddItem
=
{
text
:
oldAddItem
.
text
+
'
...
'
,
menu
:
{
items
:
[{
text
:
me
.
textSimplify
,
iconCls
:
'
xaction-wizard
'
,
handler
:
me
.
onRunWizard
,
scope
:
me
},
{
text
:
me
.
textExpert
,
iconCls
:
'
xaction-create
'
,
handler
:
rowEditor
.
onAddRow
,
scope
:
rowEditor
}]
}
};
// replace the add item
contextMenu
.
remove
(
oldAddItem
,
true
);
contextMenu
.
insert
(
0
,
newAddItem
);
},
/**
* Hnadler creating and running the wizard
*
*/
onRunWizard
:
function
()
{
"
use strict
"
;
var
me
=
this
,
window
;
window
=
Ext
.
create
(
'
Ext.window.Window
'
,
{
closable
:
true
,
items
:
me
.
wizard
,
layout
:
'
fit
'
,
modal
:
true
,
title
:
me
.
title
,
width
:
me
.
width
});
window
.
show
();
}
});
\ No newline at end of file
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