You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

5 years ago
  1. odoo.define('pwste_epub.iframe_widget', function(require) {
  2. var AbstractField = require('web.AbstractField');
  3. var fieldRegistry = require('web.field_registry');
  4. var core = require('web.core');
  5. var Widget= require('web.Widget');
  6. var widgetRegistry = require('web.widget_registry');
  7. var FieldManagerMixin = require('web.FieldManagerMixin');
  8. var IFrameWidget = AbstractField.extend({
  9. init: function () {
  10. this._super.apply(this, arguments);
  11. // this.set("value", "");
  12. },
  13. _renderReadonly: function() {
  14. window.widget=this;
  15. this.$el.html(
  16. $('<iframe>', {
  17. src: this.value || 'about:blank',
  18. style: this.attrs.iframe_style
  19. })
  20. );
  21. if (this.attrs.new_window_label && this.value) {
  22. this.$el.prepend(
  23. $('<a>', {
  24. href: this.value,
  25. target: '_blank',
  26. style: 'float:right; margin-bottom: 10px',
  27. 'class': 'btn btn-primary',
  28. }).html('<i class="fa fa-external-link-square" aria-hidden="true"></i> Otwórz w nowym oknie')
  29. )
  30. }
  31. },
  32. });
  33. fieldRegistry.add(
  34. 'iframe', IFrameWidget
  35. );
  36. return {
  37. IFrameWidget: IFrameWidget,
  38. };
  39. });