Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrehault committed Feb 26, 2015
2 parents c458d71 + d37d552 commit 4062104
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Changelog
- Make fieldset creation optional
[ebrehault]

- Add CSRF protection token
[ebrehault]


2.0.1 (2014-10-23)
------------------
Expand Down
1 change: 1 addition & 0 deletions plone/schemaeditor/browser/schema/schema_listing.pt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<metal:form metal:use-macro="context/@@ploneform-macros/form">
<metal:top-slot metal:fill-slot="formtop">
<input tal:replace="structure context/@@authenticator/authenticator" />
<script type="text/javascript"
tal:attributes="src context/++resource++schemaeditor.js"></script>
<style type="text/css">
Expand Down
10 changes: 8 additions & 2 deletions plone/schemaeditor/browser/schema/schemaeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,26 @@
if (!confirm(trigger.attr('data-confirm_msg'))) {
return;
}
$.post(trigger.attr('href'), null, function (data) {
$.post(trigger.attr('href'), {
_authenticator: $('input[name="_authenticator"]').val(),
}, function (data) {
trigger.closest('.fieldPreview').detach();
}, 'text');
});
// reorder fields and change fieldsets
$('.fieldPreview.orderable').plone_schemaeditor_html5_sortable(function (position, fieldset_index) {
var url = window.location.href.replace('/@@fields', '') + '/' + this.attr('data-field_id') + '/@@order';
$.post(url, {
_authenticator: $('input[name="_authenticator"]').val(),
pos: position,
fieldset_index: fieldset_index
});
}, function (fieldset_index) {
var url = window.location.href.replace('/@@fields', '') + '/' + this.attr('data-field_id') + '/@@changefieldset';
$.post(url, { fieldset_index: fieldset_index });
$.post(url, {
_authenticator: $('input[name="_authenticator"]').val(),
fieldset_index: fieldset_index
});
});
set_id_from_title = function () {
var id = $.plone_schemaeditor_normalize_string($(this).val());
Expand Down
3 changes: 3 additions & 0 deletions plone/schemaeditor/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def editable(self, field):

def FieldsVocabularyFactory(context):
field_factories = getUtilitiesFor(IFieldFactory)
if context.allowedFields is not None:
field_factories = [(id, factory) for id, factory in field_factories
if id in context.allowedFields]
terms = []
for (field_id, factory) in field_factories:
terms.append(SimpleVocabulary.createTerm(factory,
Expand Down

0 comments on commit 4062104

Please sign in to comment.