break.js 1.1 KB

1234567891011121314151617181920212223242526272829
  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 CommandsManagement from '../commands';
  6. export function createFloatingCommand () {
  7. return $('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> '+LocalizedStrings.getUI('text_break')+' </span></div>');
  8. }
  9. export function renderCommand (command, function_obj) {
  10. var el = $('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <span>'+LocalizedStrings.getUI('text_break')+'</span> </div>');
  11. el.data('command', command);
  12. addHandlers(command, function_obj, el);
  13. return el;
  14. }
  15. function addHandlers (command, function_obj, break_dom) {
  16. break_dom.find('.button_remove_command').on('click', function() {
  17. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  18. break_dom.fadeOut(400, function() {
  19. break_dom.remove();
  20. });
  21. }
  22. });
  23. }