/* SPIN */
// use spin() to get our default spin settings (called presets)
// use spin(true) to get spin's builtin defaults
- // you can also call spin_presets() yourself and tweak what you need to, like validatebutton does
+ // you can also call spin_presets() yourself and tweak what you need to, like topmenuvalidation does
spin: function (presets) {
var presets = ( presets === undefined ) ? spin_presets() : presets;
try { this.$element.spin(presets); }
from unfold.plugin import Plugin
-class ValidateButton (Plugin):
+class TopmenuValidation (Plugin):
"""This plugin is designed to work together with topmenu.
It will check to see if user has PI rights at least on one authority,
-and if so will enable corresponding button in topmenu.
+and if so will enable corresponding validation button in topmenu.
A realistic example would have incoming query as
return ""
def requirements (self):
- return { 'js_files': [ 'js/validatebutton.js', 'js/manifold-query.js',
+ return { 'js_files': [ 'js/topmenuvalidation.js', 'js/manifold-query.js',
"js/spin-presets.js", "js/spin.min.js", "js/jquery.spin.js",
], }
var debug=false;
// debug=true
- var ValidateButton = Plugin.extend({
+ var TopmenuValidation = Plugin.extend({
init: function(options, element) {
this._super(options, element);
},
});
- $.plugin('ValidateButton', ValidateButton);
+ $.plugin('TopmenuValidation', TopmenuValidation);
})(jQuery);
from ui.topmenu import topmenu_items, the_user
-from plugins.validatebutton import ValidateButton
+from plugins.topmenuvalidation import TopmenuValidation
from plugins.raw import Raw
from plugins.stack import Stack
from plugins.tabs import Tabs
# even though this plugin does not have any html materialization, the corresponding domid
# must exist because it is searched at init-time to create the JS plugin
# so we simply piggy-back the target button here
- validatebutton = ValidateButton (page=page,
- # see above
- domid='topmenu-validation',
- query=query_pi_auths,
- # this one is the target for a $.show() when the query comes back
- button_domid="topmenu-validation")
+ topmenuvalidation = TopmenuValidation (
+ page=page,
+ # see above
+ domid='topmenu-validation',
+ query=query_pi_auths,
+ # this one is the target for a $.show() when the query comes back
+ button_domid="topmenu-validation")
# although the result does not matter, rendering is required for the JS init code to make it in the page
- validatebutton.render(request)
+ topmenuvalidation.render(request)
# end topmenu addition
# variables that will get passed to the view-unfold1.html template
from ui.topmenu import topmenu_items, the_user
-from plugins.validatebutton import ValidateButton
+from plugins.topmenuvalidation import TopmenuValidation
-class ValidateButtonView (TemplateView):
+class TopmenuValidationView (TemplateView):
- # mention a user name in the URL as .../trash/simplevalidatebutton/ple.inria.thierry_parmentelat
+ # mention a user name in the URL as .../trash/simpletopmenuvalidation/ple.inria.thierry_parmentelat
def get (self, request, username='ple.inria.thierry_parmentelat'):
if username=='logged': username='$user_hrn'
# even though this plugin does not have any html materialization, the corresponding domid
# must exist because it is searched at init-time to create the JS plugin
# so we simply piggy-back the target button here
- validatebutton = ValidateButton (page=page,
- # see above
- domid='topmenu-validation',
- query=query_pi_auths,
- # this one is the target for enabling when the query comes back
- button_domid="topmenu-validation")
+ topmenuvalidation = TopmenuValidation (
+ page=page,
+ # see above
+ domid='topmenu-validation',
+ query=query_pi_auths,
+ # this one is the target for enabling when the query comes back
+ button_domid="topmenu-validation")
# there is a need to call render() for exposing the query and creating the js plugin
# even though this returns an empty string
- validatebutton.render(request)
+ topmenuvalidation.render(request)
# variables that will get passed to the view-unfold1.html template
template_env ['unfold_main'] = '<h1>Some title </h1>'
# more general variables expected in the template
- template_env [ 'title' ] = 'simple validatebutton %(username)s'%locals()
+ template_env [ 'title' ] = 'simple topmenuvalidation %(username)s'%locals()
# the menu items on the top
template_env [ 'topmenu_items' ] = topmenu_items('Slice', request)
# so we can see who is logged
import sample.querytableview
import sample.querygridview
-import sample.validatebuttonview
+import sample.topmenuvalidationview
urlpatterns = patterns(
'',
url(r'^dashboard/?$', 'sample.dashboardview.dashboard_view'),
url(r'^querytable/(?P<slicename>[\w\.]+)/?$', sample.querytableview.QueryTableView.as_view()),
url(r'^querygrid/(?P<slicename>[\w\.]+)/?$', sample.querygridview.QueryGridView.as_view()),
- url(r'^validatebutton/(?P<username>[\w\._]+)/?$', sample.validatebuttonview.ValidateButtonView.as_view()),
+ url(r'^topmenuvalidation/(?P<username>[\w\._]+)/?$', sample.topmenuvalidationview.TopmenuValidationView.as_view()),
)
# , ..]
# see also templates/widget-topmenu.html for how these items are put together
-# and plugins/validatebutton for how this hident button is turned on when necessary
+# and plugins/topmenuvalidation for how this hident button is turned on when necessary
# current: the beginning of the label in the menu that you want to outline
def topmenu_items (current,request=None):
#### result.append({'label':'Validation', 'href': '/portal/validate/'})
### result.append({'label':'Validation', 'href': '/portal/validate/'})
# always create a disabled button for validation, and let the
- # validatebutton plugin handle that asynchroneously, based on this domid
+ # topmenuvalidation plugin handle that asynchroneously, based on this domid
result.append({'label':'Validation', 'href': '/portal/validate/', 'domid':'topmenu-validation', 'disabled':True})
dropdown = []
dropdown.append({'label':'Platforms', 'href': '/portal/platforms/'})