Skip to content

Instantly share code, notes, and snippets.

@graceman9
Last active August 29, 2015 14:05
Show Gist options
  • Save graceman9/971566439b25f702223e to your computer and use it in GitHub Desktop.
Save graceman9/971566439b25f702223e to your computer and use it in GitHub Desktop.
Onpay (my custom module) with jquery.ui.dialog integration for node view page
(function($) {
$(function(){
// jquery.ui.dialog init
$('.onpay-form').dialog({
autoOpen: false,
show: {
effect: 'slideDown',
duration: 100
},
hide: {
effect: 'slideUp',
duration: 100
}
});
// jquery.ui.dialog on click
$('.onpay-contribute').click(function(){
$('.onpay-form').dialog('open');
return false;
});
});
})(jQuery);
<?php
// add dialog library
drupal_add_library('system', 'ui.dialog');
// use dialog
drupal_add_js(path_to_theme() .'/js/node--gift.js');
?>
<?php
/* somewhere in node template */
global $user;
print l('Поддержать<span></span>', 'onpay-contribute', array(
'html' => TRUE,
'attributes' => array(
'class' => array(
'onpay-contribute',
),
'data-nid' => $node->nid,
'data-uid' => $user->uid,
),
));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment