-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Plone 4.3 with p.a.widgets 1.x edit modals #720
Open
petschki
wants to merge
23
commits into
master
Choose a base branch
from
issue_719
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
fe0520e
Fix Plone 4.3 with p.a.widgets 1.x edit modals
petschki 22010e5
update CHANGES.rst
petschki fced329
Fix Plone 4.3 with p.a.widgets 1.x edit modals
petschki b47a472
Merge branch 'issue_719' of github.com:collective/collective.cover in…
petschki b34755b
add upgrade step (cook JS resources) and remove unused import check
petschki a57a70f
pep8
petschki 67258bf
add tests for Phone 4.3 + p.a.widgets 1.x
petschki 6600a39
remove tests for p.a.widgets
petschki a56519a
remove p.a.widgets test-egg
petschki fab5f8d
Merge branch 'master' into issue_719
petschki 1d814c4
fix HTML markup for modal
petschki 6443c05
merge latest master and add p.a.widgets testing environment
petschki 5670fcf
pin zc.buildout and setuptools for test
petschki 8fa0340
cleanup richtext widget
petschki 4b8b308
fix JS check for plone.app.widgets
petschki aa05c04
fix buildout
petschki e0f067f
fix conflicting bootstrap classes
petschki 5357699
restructure check for installed pat-plone-widgets
petschki 5c92132
edit link initialization when p.a.widgets is installed
petschki 668a7db
failsafe compose.js check for installed plone.app.widgets
petschki affa9e6
fix move icon in tile configure
petschki 9c6a17e
update tile_url to make "external rendered calls" possible
petschki 5ef1d4b
fix tile_url
petschki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,8 +96,18 @@ $(document).ready(function() { | |
|
||
TitleMarkupSetup(); | ||
|
||
if ($.fn.prepOverlay !== undefined) { | ||
$('a.edit-tile-link').prepOverlay({ | ||
$('body').on('click', 'a.edit-tile-link', function(e) { | ||
|
||
// XXX: need to check for body class here, because it might not been when document.ready() :( | ||
if($("body").hasClass("pat-plone-widgets")) { | ||
// XXX: reload tile content asynchronously here when destroying the modal | ||
// need to find the right event where to hook in | ||
return // exit here | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. miss semicolon here |
||
} | ||
|
||
e.preventDefault(); | ||
// prepare overlayhelper | ||
$(e.currentTarget).prepOverlay({ | ||
subtype: 'ajax', | ||
filter: '.tile-content', | ||
formselector: '#edit_tile', | ||
|
@@ -140,26 +150,7 @@ $(document).ready(function() { | |
}, | ||
config: { | ||
onLoad: function() { | ||
// With plone.app.widgets and Plone 4.3 | ||
if (typeof require !== 'undefined' && require.defined('pat-registry')) { | ||
// Remove old editors references to work with ajax | ||
if (typeof tinyMCE !== 'undefined' && tinyMCE !== null) { | ||
if (tinyMCE.EditorManager != null) { | ||
tinyMCE.EditorManager.editors = []; | ||
} | ||
} | ||
// Add tinymce | ||
$('.overlay textarea.mce_editable').addClass('pat-tinymce'); | ||
require('pat-registry').scan($('.overlay'), ['tinymce']); | ||
// Wire save buttom to save tinymce | ||
$( '.overlay input#buttons-save').on('click', function() { | ||
tinyMCE.triggerSave(); | ||
}); | ||
// Hack to make overlay work over overlay | ||
$('.overlay').on('mouseover', function() { | ||
$('div.plone-modal-wrapper').css('z-index', '10050'); | ||
}); | ||
} else if (typeof initTinyMCE !== 'undefined') { // Plone 4.3 | ||
if (typeof initTinyMCE !== 'undefined') { // Plone 4.3 | ||
// Remove old editors references to work with ajax | ||
if (typeof tinyMCE !== 'undefined' && tinyMCE !== null) { | ||
if (tinyMCE.EditorManager != null) { | ||
|
@@ -203,5 +194,7 @@ $(document).ready(function() { | |
} | ||
} | ||
}); | ||
} | ||
// and open the overlay | ||
$(e.currentTarget).click(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
<div class="cover-tileformlayout-tile tile-content"> | ||
<h1 class="documentFirstHeading" tal:content="view/form_instance/label | nothing" /> | ||
<html> | ||
<body> | ||
<div class="cover-tileformlayout-tile tile-content"> | ||
<h1 class="documentFirstHeading" tal:content="view/form_instance/label | nothing">Title</h1> | ||
|
||
<span tal:replace="structure view/contents" /> | ||
</div> | ||
<span tal:replace="structure view/contents" /> | ||
</div> | ||
</body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
src/collective/cover/tiles/templates/tilesconfigurationlayout.pt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
<html> | ||
<body> | ||
<div class="tiles-configuration"> | ||
<h1 class="documentFirstHeading" tal:content="view/form_instance/label | nothing" /> | ||
|
||
<span tal:replace="structure view/contents" /> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from collective.cover.tiles.richtext import IRichTextTile | ||
from plone.app.widgets.dx import RichTextWidget | ||
from z3c.form.interfaces import IFieldWidget | ||
from z3c.form.interfaces import IFormLayer | ||
from z3c.form.util import getSpecification | ||
from z3c.form.widget import FieldWidget | ||
from zope.component import adapter | ||
from zope.interface import implementer | ||
|
||
|
||
@adapter(getSpecification(IRichTextTile['text']), IFormLayer) | ||
@implementer(IFieldWidget) | ||
def TileRichTextFieldWidget(field, request): | ||
return FieldWidget(field, RichTextWidget(request)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[buildout] | ||
# XXX: https://github.com/plone/plone.app.testing/issues/39 | ||
extends = | ||
versions-4.3.x.cfg | ||
|
||
test-eggs += | ||
plone.app.widgets | ||
|
||
extensions += mr.developer | ||
|
||
sources-dir = external | ||
sources = sources | ||
auto-checkout = * | ||
|
||
[sources] | ||
plone.app.widgets = git https://github.com/plone/plone.app.widgets.git branch=1.x | ||
|
||
[versions] | ||
plone.app.z3cform = 1.0.1 | ||
|
||
# XXX: https://github.com/collective/collective.cover/pull/720#issuecomment-311383938 | ||
setuptools = 20.1.1 | ||
zc.buildout = 1.7.1 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes on JS usually require an upgrade step to cook the resources; do you mind to check if we already have one in place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done that