Sha256: 8d3d5c8a46a8c375150699839a37f29b987f69afbec6db1cfee6e883f5a46415

Contents?: true

Size: 1.77 KB

Versions: 87

Compression:

Stored size: 1.77 KB

Contents

(function() {
  if (this.RedactorPlugins == null) {
    this.RedactorPlugins = {};
  }

  RedactorPlugins.scrivito_editors_link_manager = function() {
    var self;
    return self = {
      init: function() {
        this.modal.addTemplate('scrivito_link_manager_browse', self.browseButtonHtml);
        this.modal.addCallback('imageEdit', self.addBrowseToModal);
        return this.modal.addCallback('link', self.addBrowseToModal);
      },
      browseButtonHtml: "<button class=\"editing-button editing-green\">\n  <i class=\"editing-icon editing-icon-search\"></i>\n  Browse\n</button>",
      urlInput: function() {
        return this.modal.getModal().find('#redactor-link-url, #redactor-image-link');
      },
      addBrowseToModal: function() {
        return self.urlInput().wrap('<div id="scrivito-link-manager-url"></div>').after(this.modal.getTemplate('scrivito_link_manager_browse')).siblings('button').on('click', self.browse);
      },
      browse: function() {
        return scrivito.content_browser.open({
          filter: this.$element.data('scrivitoEditorsFilter'),
          filter_context: this.$element.data('scrivitoEditorsFilterContext'),
          selection: self.getObjIds(),
          selection_mode: 'single'
        }).done((function(_this) {
          return function(selection) {
            var id;
            id = selection[0];
            if (id != null) {
              return self.setObjId(id);
            }
          };
        })(this));
      },
      getObjIds: function() {
        var id;
        if (id = scrivito.id_from_path(self.urlInput().val())) {
          return [id];
        } else {
          return [];
        }
      },
      setObjId: function(id) {
        return self.urlInput().val(scrivito.path_for_id(id));
      }
    };
  };

}).call(this);

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
scrivito_editors-1.5.1 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.5.1.rc2 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.5.1.rc1 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.5.0 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.5.0.rc2 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.5.0.rc1 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.4.2 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.4.1 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.4.1.rc1 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.4.0 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.4.0.rc2 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.4.0.rc1 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.3.1 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.3.1.rc1 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.3.0 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.3.0.rc3 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.3.0.rc2 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.3.0.rc1 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.2.0 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js
scrivito_editors-1.2.0.rc3 app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js