gear.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * Note, depends on $.colorbox!
  3. */
  4. define(function (require) {
  5. var $ = require('jquery');
  6. var elgg = require('elgg');
  7. var spinner = require('elgg/spinner');
  8. $('<div class="developers-gear"><span class="elgg-icon-settings-alt elgg-icon"></span></div>')
  9. .appendTo('body')
  10. .find('.elgg-icon')
  11. .prop('title', elgg.echo('admin:developers:settings'))
  12. .on('click', function () {
  13. $.colorbox({
  14. href: elgg.get_site_url() + 'ajax/view/developers/gear_popup',
  15. initialWidth: '90%',
  16. width: '90%',
  17. speed: 0,
  18. onComplete: function () {
  19. $('#developer-settings-form')
  20. .on('submit', spinner.start)
  21. .find('fieldset > div')
  22. .each(function () {
  23. var $help = $('span.elgg-text-help', this),
  24. $label = $('label', this);
  25. if ($help.length != 1 || $label.length != 1) {
  26. return;
  27. }
  28. var $icon = $('<span class="elgg-icon-info elgg-icon" />'),
  29. $both = $([$icon[0], $help[0]])
  30. .appendTo($label)
  31. .on('click', function () {
  32. $both.toggle();
  33. $.colorbox.resize();
  34. return false;
  35. });
  36. });
  37. $.colorbox.resize();
  38. }
  39. });
  40. });
  41. $(document).on('click', '.developers-gear-popup a', function() {
  42. if ($(this).is('.elgg-menu-parent')) {
  43. return false;
  44. }
  45. spinner.start();
  46. });
  47. });