1
0

functioncall.js 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. import $ from 'jquery';
  2. import { Types } from '../types';
  3. import * as Models from '../ivprog_elements';
  4. import { LocalizedStrings } from '../../services/localizedStringsService';
  5. import * as GlobalsManagement from '../globals';
  6. import * as VariablesManagement from '../variables';
  7. import * as VariableValueMenu from './variable_value_menu';
  8. import * as CommandsManagement from '../commands';
  9. export function createFloatingCommand () {
  10. return $('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  11. }
  12. export function renderCommand (command, function_obj) {
  13. 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>');
  14. el.data('command', command);
  15. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  16. addHandlers(command, function_obj, el);
  17. return el;
  18. }
  19. function addHandlers (command, function_obj, functioncall_dom) {
  20. functioncall_dom.find('.button_remove_command').on('click', function() {
  21. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  22. functioncall_dom.fadeOut();
  23. }
  24. });
  25. }