iftrue.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. export function createFloatingCommand () {
  8. return $('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  9. }
  10. export function renderCommand (command) {
  11. var ret = '';
  12. ret += '<div class="ui iftrue"> <i class="ui icon small random command_drag"></i> <span> if (x < 1) { </span>';
  13. ret += '<div class="ui block_commands" data-if="true">';
  14. /*if ((writer_obj.commands_block == null)
  15. || (writer_obj.commands_block.length == 0)) {
  16. } else {
  17. for (ki = 0; ki < writer_obj.commands_block.length; ki ++) {
  18. ret += renderElementCommandGeneric(writer_obj.commands_block[ki], function_index, ki, iftrue_index, (fullpath + ',' + ki));
  19. }
  20. }*/
  21. ret += '</div>';
  22. ret += '<span> } else { </span>';
  23. ret += '<div class="ui block_commands" data-else="true">';
  24. /*if ((writer_obj.commands_else == null)
  25. || (writer_obj.commands_else.length == 0)) {
  26. } else {
  27. for (ki = 0; ki < writer_obj.commands_else.length; ki ++) {
  28. ret += renderElementCommandGeneric(writer_obj.commands_else[ki], function_index, ki, iftrue_index, (fullpath + ',' + ki));
  29. }
  30. }*/
  31. ret += '</div>';
  32. ret += '<span> }</span>';
  33. ret += '</div>';
  34. var el = $(ret);
  35. $(el).data('command', command);
  36. return el;
  37. }