-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(js): adds elgg/popup AMD module
Converts JS popup to an AMD module subsequently giving more freedom to plugins to manipulate popups programmatically. Popup target module can now be defined with data-href attribute in addition to href attribute (suitable for use with non-anchor elements). Popup positioning details can be passed with data-position of the trigger (which is simpler than using the triggered plugin hook). jQuery "open" and "close" events are now triggered when the popup is shown and closed, allowing plugins to manipulate popup module and its contents
- Loading branch information
1 parent
ea80be2
commit fd75da6
Showing
7 changed files
with
334 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
mod/developers/views/default/theme_sandbox/javascript/popup.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
define(function (require) { | |||
|
|||
var elgg = require('elgg'); | |||
var $ = require('jquery'); | |||
|
|||
$('#elgg-popup-test2').on('open', function () { | |||
var $module = $(this); | |||
var $trigger = $module.data('trigger'); | |||
|
|||
elgg.ajax('ajax/view/developers/ajax', { | |||
beforeSend: function () { | |||
$trigger.addClass('elgg-state-disabled').prop('disabled', true); | |||
$module.html('').addClass('elgg-ajax-loader'); | |||
}, | |||
success: function (output) { | |||
$module.removeClass('elgg-ajax-loader').html(output); | |||
} | |||
}); | |||
}).on('close', function () { | |||
var $trigger = $(this).data('trigger'); | |||
$trigger.removeClass('elgg-state-disabled').prop('disabled', false); | |||
}); | |||
|
|||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.