Skip to content
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

[WIP] form layout is error prone and intimidating (dnd fields) #750

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fde0b3f
initial checkin of fields being inserted visually into tinymce
djay Jul 11, 2016
35d23b7
Merge remote-tracking branch 'origin/missing-tinymce-buttons' into ti…
djay Jul 11, 2016
28ee077
store layout without example widgets
djay Jul 15, 2016
5037fb1
fix formatting of html on save stripping html widgets
djay Jul 16, 2016
fce2bb0
cache,label and hidewhen should now work as noneditable dragable elem…
djay Aug 19, 2016
3b73857
Merge branch 'master' into tinymcevisualfields
djay Aug 19, 2016
ddd99ff
allow adding a field without typing the id first
djay Aug 23, 2016
b629fef
fix up popups for hidewhen and actions
djay Aug 24, 2016
bc57a05
clean up css for visual elements in tinymce
djay Aug 24, 2016
d912880
dnd subforms now work
djay Aug 25, 2016
5b49943
handle inserting dnd datagrids using very basic progressive table. Ca…
djay Aug 26, 2016
b0661e8
fix bug in creating empty form
djay Aug 29, 2016
af4fc27
fix for display fields with no content
djay Aug 29, 2016
a107993
Fix typo in registry
Sep 13, 2016
6ed5535
Fix typo in template
Sep 13, 2016
a631269
Merge latest master
Sep 13, 2016
e03de26
Fix splitting bug
Sep 13, 2016
dc125e9
Don't change plominoLabels, and handle hidewhens if they haven't been…
Sep 6, 2016
33d0134
Stop handling labels for the moment
Sep 13, 2016
68035cf
Merge branch 'master' into tinymcevisualfields
Sep 14, 2016
d3923b4
Add a span before a hidden field so it can be dragged
Sep 14, 2016
25222de
Number fields should use the appropriate input type
Sep 14, 2016
020daa0
Add test for the rendering of number fields
Sep 14, 2016
d3c5ddc
Merge in Dylan's label grouping code
Sep 14, 2016
ffada38
Update tests for modified label handling code
Sep 14, 2016
4fe1d28
Add label support to tinymce visualfields
Sep 19, 2016
98f894a
Re-parse the HTML before replacing elements with nothing inside
Sep 19, 2016
03dbd63
Add some tests for visual fields
Sep 19, 2016
dbe9753
Merge branch 'master' into tinymcevisualfields
Sep 19, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ setuptools = 8.3
zc.buildout = 2.2.5
zc.recipe.egg = 2.0.1

flake8 = 2.3.0
flake8 = 2.4.0

robotframework = 2.8.4
robotframework-ride = 1.3
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'plone.app.dexterity',
'jsonutil',
'collective.instancebehavior',
'pyquery',
'plone.restapi',
],
extras_require={
Expand Down
15 changes: 4 additions & 11 deletions src/Products/CMFPlomino/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -162,43 +162,36 @@
<browser:page
name="tinyform"
for="Products.CMFPlomino.contents.form.IPlominoForm"
class=".tinymce.PlominoForm"
class=".tinymce.PlominoFormSettings"
permission="zope.Public"
allowed_attributes="getField addField addLabel addAction addHidewhen addCache addSubForm action_template"
/>

<browser:page
name="tinyfield"
for="Products.CMFPlomino.contents.field.IPlominoField"
class=".tinymce.PlominoField"
class=".tinymce.PlominoFieldSettings"
permission="zope.Public"
allowed_attributes="setFieldProperties"
/>

<browser:page
name="tinyhidewhen"
for="Products.CMFPlomino.contents.hidewhen.IPlominoHidewhen"
class=".tinymce.PlominoHidewhen"
class=".tinymce.PlominoHidewhenSettings"
permission="zope.Public"
allowed_attributes="setHidewhenProperties"
/>

<browser:page
name="tinyaction"
for="Products.CMFPlomino.contents.action.IPlominoAction"
class=".tinymce.PlominoAction"
class=".tinymce.PlominoActionSettings"
permission="zope.Public"
allowed_attributes="setActionProperties"
/>

<!--
<browser:page
name="tinyhidewhen"
for="Products.CMFPlomino.contents..IPlominoHidewhen"
class=".hidewhen.PlominoHidewhen"
permission="zope.Public"
allowed_attributes="setHidewhenProperties"
/>

<browser:page
name="tinycache"
Expand Down
224 changes: 194 additions & 30 deletions src/Products/CMFPlomino/browser/static/css/tinymce.css
Original file line number Diff line number Diff line change
@@ -1,40 +1,204 @@
span.plominoFieldClass,
span.plominoLabelClass,
span.plominoHidewhenClass,
span.plominoActionClass,
span.plominoSubformClass{
position:relative;
display: inline-block;
}
div.plominoFieldClass,
div.plominoLabelClass,
div.plominoHidewhenClass,
div.plominoActionClass,
div.plominoSubformClass{
position:relative;
display:block;
}



.plominoFieldClass:hover:before,
.plominoLabelClass:hover:before,
.plominoHidewhenClass:hover:before,
.plominoActionClass:hover:before,
.plominoSubformClass:hover:before{
background: rgba(0,0,0,.8);
border-radius: 5px 5px 0px 0px;
color: #fff;
bottom:100%;
left: 0%;
content: attr(data-plominoid);
padding: 2px 5px;
position: absolute;
z-index: 98;
font-size: 10px;
}

div.plominoLabelClass:hover:before {
position: absolute;
top: -16px;
}
div.plominoLabelClass {
width: 80%;
margin-bottom: 10px;
}


.plominoFieldClass {
padding: 2px 10px;
color: #1b6899;
background-color: #ffffff;
border: 1px solid #1b6899;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
outline: 1px dashed #1b6899;
}
.plominoFieldClass:hover:before {
color: #ffffff;
background-color: #1b6899;
}

.plominoLabelClass {
padding: 2px 10px;
color: #aaaaFF;
background-color: #ffffff;
border: 1px solid #aaaaFF;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
outline: 1px dashed #03632C;
padding-left: 25px;
min-width: 100px;
background-image: url('++resource++Products.CMFPlomino/img/PlominoLabel.png');
background-position: 0 0;
background-repeat: no-repeat;

}
.plominoActionClass {
padding: 2px 10px;
.plominoLabelClass:hover:before {
color: #ffffff;
background-color: #1b6899;
border: 1px solid #124465;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
background-color: #03632C;
}

.plominoActionClass {
outline: 1px dashed #124465;
}
.plominoActionClass:hover:before {
color: #ffffff;
background-color:#124465;
}
.plominoHidewhenClass {

.plominoSubformClass {
outline: 1px dashed #cccccc;
/*padding: 2px 10px;*/
/*color: #ffffff;*/
/*background-color: #cccccc;*/
/*border: 1px solid #cccccc;*/
/*border-radius: 4px;*/
/*box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);*/

}
.plominoSubformClass:hover:before {
color: #ffffff;
background-color:#cccccc;
}


.plominoEditWidgetTab{
background: #333;
background: rgba(0,0,0,.8);
border-radius: 5px 5px 0px 0px;
color: #fff;
left: 90%;
top:-50%;
padding: 2px 5px;
position: absolute;
z-index: 98;
font-size: 10px;
}

.mce-content-body *[contentEditable=false][data-mce-selected] select,
.mce-content-body *[contentEditable=false][data-mce-selected] input,
.mce-content-body *[contentEditable=false][data-mce-selected] button,
.mce-content-body *[contentEditable=false][data-mce-selected] a,
.mce-content-body *[contentEditable=false][data-mce-selected] textarea
{
/*outline: 2px solid #2d8ac7;*/
/*padding: 3px;*/
pointer-events: none;
cursor: default;
}
*[data-plomino-position="start"] {
padding: 2px 10px;
color: #cccccc;
background-color: #ffffff;
border: 1px dashed #cccccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
background-color: #cccccc;
background-repeat: no-repeat;
margin-right:0.7em;
display:inline;
}
.plominoSubformClass {

*[data-plomino-position="end"] {
padding: 2px 10px;
color: #ffffff;
background-color: #cccccc;
border: 1px solid #cccccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
color: #cccccc;
background-color: #cccccc;
background-repeat: no-repeat;
margin-left:0.7em;
display:inline-block;
}

.plominoLabelClass[data-plomino-position] {
min-width: 10px !important;
outline: none;

}


.plominoHidewhenClass[data-plomino-position] {
background-image: url('++resource++Products.CMFPlomino/img/PlominoHideWhen.png');
}
.plominoLabelClass[data-plomino-position] {
background-image: url('++resource++Products.CMFPlomino/img/PlominoLabel.png');
}
.plominoCacheClass[data-plomino-position] {
background-image: url('++resource++Products.CMFPlomino/img/PlominoCache.png');
}

*[data-plomino-position]:after {
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(187,0,0,0);
border-width: 0.7em;
margin-top: -0.7em;
z-index: 1;
top: 50%;
}

*[data-plomino-position="start"]:after {
left: 100%;
border-left-width: 8px;
border-left-color: #cccccc;
}

*[data-plomino-position="end"]:after {
right: 100%;
border-right-width: 8px;
border-right-color: #cccccc;
}



/*.plominoActionClass {*/
/*padding: 2px 10px;*/
/*color: #ffffff;*/
/*background-color: #1b6899;*/
/*border: 1px solid #124465;*/
/*border-radius: 4px;*/
/*box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);*/
/*}*/

/*.plominoFieldClass {*/
/*padding: 2px 10px;*/
/*color: #1b6899;*/
/*background-color: #ffffff;*/
/*border: 1px solid #1b6899;*/
/*border-radius: 4px;*/
/*box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);*/
/*}*/
/*.plominoSubformClass {*/
/*padding: 2px 10px;*/
/*color: #ffffff;*/
/*background-color: #cccccc;*/
/*border: 1px solid #cccccc;*/
/*border-radius: 4px;*/
/*box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);*/
/*}*/
30 changes: 22 additions & 8 deletions src/Products/CMFPlomino/browser/static/js/tinymce.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,29 @@
// Find the element id
// Select the parent node of the selection
var selection = ed.selection.getNode();
var customText = false;
if (elementType === "label") {
if (tinymce.DOM.hasClass(selection, 'plominoLabelContent')) {
selection = selection.parentNode;
var customText = true;
} else if (selection.tagName === "DIV" && tinymce.DOM.hasClass(selection, "plominoLabelClass")) {
var customText = true;
}
}
// If the node is a <span class="plominoFieldClass"/>, select all its content
if (tinymce.DOM.hasClass(selection, elementClass))
{
ed.selection.select(selection);
var elementId = selection.firstChild.nodeValue;

// hide-when and cache zones start with start:id and finish with end:id
if (elementType === "hidewhen" || elementType === "cache")
{
var splittedId = elementId.split(':');
if (splittedId.length > 1)
elementId = splittedId[1];
var elementId = selection.getAttribute('data-plominoid');
if (elementId == null) {
elementId = selection.firstChild.nodeValue;
// hide-when and cache zones start with start:id and finish with end:id
if (elementType === "hidewhen" || elementType === "cache")
{
var splittedId = elementId.split(':');
if (splittedId.length > 1)
elementId = splittedId[1];
}
}
}
else if (elementType !== "hidewhen" && elementType !== "cache")
Expand Down Expand Up @@ -128,6 +139,9 @@
var elementId = '';
}

if (customText) {
elementId = elementId + ':1'
}
var base_url = $('body').attr('data-base-url');

ed.windowManager.open({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function toggleLabelText(field) {
if (field.checked) {
console.log('Label text: enabled');
} else {
console.log('Label text: disabled');
};
}
Loading