Permalink
Browse files

try to get the position of the event currentTarget if there is no pag…

…eX or pageY property, useful when dealing with popups called by keyup event

git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1261 0cfe37f9-358a-4d5e-be75-b63607b5c754
  • Loading branch information...
1 parent f58a11f commit 141cd657f2d6a583113b84978215f29ad97bb70d jordan committed May 9, 2012
View
@@ -135,7 +135,11 @@ def save(self, data=None, threaded=True, *args, **kwargs):
if isnew:
if (self.node is None) or (not self.node.nis.wiki):
self.repute_users()
+
+ if isnew:
self.process_action()
+
+ if isnew:
self.trigger_hooks(threaded, True)
return self
@@ -197,8 +197,15 @@ function show_dialog (extern) {
copy_id = ' id="copy_clip_button"'
}
- if (options.event != undefined) {
+ if (options.event != undefined && options.event.pageX != undefined && options.event.pageY != undefined) {
options.pos = {x: options.event.pageX, y: options.event.pageY};
+ } else if (options.event.currentTarget != undefined) {
+ var el = jQuery("#" + options.event.currentTarget.id);
+ var position = el.offset();
+ options.pos = {
+ x: position.left,
+ y: position.top
+ }
}
var html = '<div class="dialog ' + options.extra_class + '" style="display: none; z-index: 999;">'
@@ -41,7 +41,7 @@
show_no: true,
no_callback: function() {
$(".dialog").fadeOut("fast", function() {
- $('.dialog').remove();
+ $('.dialog').remove();
})
},
@@ -55,19 +55,21 @@
$('.award_points_slider').slider({
min: 1, max: user_reputation,
- slide: function(evt, ui) {
- $('#points_input').val(ui.value);
- points_award_confirm(Number(ui.value), evt)
- }
+ slide: function(evt, ui) {
+ $('#points_input').val(ui.value);
+ points_award_confirm(Number(ui.value), evt)
+ }
});
- $('#points_input').bind('change keydown', function(evt) {
+ $('#points_input').live('change keyup', function(evt) {
if ($(this).val() > user_reputation) {
- $(this).attr('value', user_reputation);
- }
- $('.award_points_slider').slider('option', 'value', $(this).val())
+ $(this).attr('value', user_reputation);
+ }
+
+ points_award_confirm(Number($(this).val()), evt);
+
+ $('.award_points_slider').slider('option', 'value', $(this).val());
- points_award_confirm(Number($(this).val()), evt);
});
</script>
View
@@ -1,18 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="PYTHON_MODULE" version="4">
- <component name="FacetManager">
- <facet type="django" name="Django">
- <configuration>
- <option name="rootFolder" value="$MODULE_DIR$" />
- <option name="settingsModule" value="settings.py" />
- <option name="manageScript" value="manage.py" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="false">
- <content url="file://$MODULE_DIR$" />
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- </component>
-</module>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="django" name="Django">
+ <configuration>
+ <option name="rootFolder" value="$MODULE_DIR$" />
+ <option name="settingsModule" value="settings.py" />
+ <option name="manageScript" value="manage.py" />
+ </configuration>
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$" />
+ <orderEntry type="jdk" jdkName="Python 2.7.1 (/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)" jdkType="Python SDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+ <component name="TemplatesService">
+ <option name="templateLanguage" value="Django" />
+ <option name="TEMPLATE_CONFIGURATION" value="Django" />
+ <option name="TEMPLATE_FOLDERS">
+ <list>
+ <option value="$MODULE_DIR$/templates" />
+ </list>
+ </option>
+ </component>
+</module>
+

0 comments on commit 141cd65

Please sign in to comment.