Skip to content

Commit

Permalink
update built resources for logged in again
Browse files Browse the repository at this point in the history
  • Loading branch information
vangheem committed May 14, 2015
1 parent fcba179 commit c8bc9e7
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 40 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Changelog
5.0b2 (unreleased)
------------------

- fix manage content type portlets link to have authenticator
- fix manage content type and group portlets link to have authenticator
[vangheem]

- Convert manage-portlets.js into a pattern and make improvements on
Expand Down
89 changes: 52 additions & 37 deletions Products/CMFPlone/static/plone-logged-in-compiled.js
Original file line number Diff line number Diff line change
Expand Up @@ -90912,8 +90912,6 @@ define('plone-patterns-portletmanager',[
dirty: false,
init: function(){
var that = this;
that.setupAddDropdown();
that.setupSavePortletsSettings();
var $modal = that.$el.parents('.plone-modal');
if($modal.size() === 1){
this.isModal = true;
Expand All @@ -90925,11 +90923,18 @@ define('plone-patterns-portletmanager',[
}
});
}
that.bind();
},
bind: function(){
var that = this;
that.setupAddDropdown();
that.setupSavePortletsSettings();
that.setupPortletEdit();
},
rebind: function($el){
this.$el.replaceWith($el);
this.$el = $el;
this.init();
this.bind();
this.statusMessage();
this.dirty = true;
},
Expand Down Expand Up @@ -90957,6 +90962,49 @@ define('plone-patterns-portletmanager',[
$message.fadeOut();
}, 3000);
},
showEditPortlet: function(url){
var that = this;
var $a = $('<a/>');
$('body').append($a);
var pattern = new Modal($a, {
ajaxUrl: url,
actionOptions: {
displayInModal: false,
reloadWindowOnClose: false,
isForm: true,
onSuccess: function(modal, html){
pattern.hide();
var $body = $(utils.parseBodyTag(html));
that.rebind($('#' + that.$el.attr('id'), $body));
that.statusMessage(_t('Portlet added'));
}
}
});
pattern.on('after-render', function(){
var $el = $('#' + that.$el.attr('id'), pattern.$raw);
/* this is a check that the add form doesn't just automatically
create the portlet without an actual form.
If element is found here, we can short circuit and
continue on. */
if($el.size() === 1){
/* hacky, trying to prevent modal parts from flickering here */
$el = $el.clone();
pattern.on('shown', function(){
pattern.hide();
});
that.rebind($el);
that.statusMessage(_t('Portlet added'));
}
});
pattern.show();
},
setupPortletEdit: function(){
var that = this;
$('.managedPortlet .portletHeader > a', that.$el).click(function(e){
e.preventDefault();
that.showEditPortlet($(this).attr('href'));
});
},
setupAddDropdown: function(){
var that = this;
$('.add-portlet', that.$el).change(function(e){
Expand All @@ -90967,40 +91015,7 @@ define('plone-patterns-portletmanager',[
var url = contextUrl + $select.val() +
'?_authenticator=' + $('[name="_authenticator"]').val() +
'&referer=' + $('[name="referer"]', $form).val();
/* create model */
var $a = $('<a/>');
$('body').append($a);
var pattern = new Modal($a, {
ajaxUrl: url,
actionOptions: {
displayInModal: false,
reloadWindowOnClose: false,
isForm: true,
onSuccess: function(modal, html){
pattern.hide();
var $body = $(utils.parseBodyTag(html));
that.rebind($('#' + that.$el.attr('id'), $body));
that.statusMessage(_t('Portlet added'));
}
}
});
pattern.on('after-render', function(){
var $el = $('#' + that.$el.attr('id'), pattern.$raw);
/* this is a check that the add form doesn't just automatically
create the portlet without an actual form.
If element is found here, we can short circuit and
continue on. */
if($el.size() === 1){
/* hacky, trying to prevent modal parts from flickering here */
$el = $el.clone();
pattern.on('shown', function(){
pattern.hide();
});
that.rebind($el);
that.statusMessage(_t('Portlet added'));
}
});
pattern.show();
that.showEditPortlet(url);
});
},
setupSavePortletsSettings: function(){
Expand Down
2 changes: 1 addition & 1 deletion Products/CMFPlone/static/plone-logged-in-compiled.min.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit c8bc9e7

Please sign in to comment.