1
0

functioncall.js 1.1 KB

12345678910111213141516171819202122232425262728
  1. import * as VariableValueMenu from './variable_value_menu';
  2. import * as CommandsManagement from '../commands';
  3. export function createFloatingCommand () {
  4. return $('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  5. }
  6. export function renderCommand (command, function_obj) {
  7. var el = $('<div class="ui functioncall command_container"> <i class="hand point right icon command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> </div>');
  8. el.data('command', command);
  9. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  10. addHandlers(command, function_obj, el);
  11. return el;
  12. }
  13. function addHandlers (command, function_obj, functioncall_dom) {
  14. functioncall_dom.find('.button_remove_command').on('click', function() {
  15. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  16. functioncall_dom.fadeOut(400, function() {
  17. functioncall_dom.remove();
  18. });
  19. }
  20. });
  21. }