Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
138 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
41 changes: 41 additions & 0 deletions
41
cms/test_utils/project/pluginapp/plugins/multiwrap/cms_plugins.py
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,41 @@ | ||
from cms.models import CMSPlugin | ||
from cms.plugin_base import CMSPluginBase | ||
from cms.plugin_pool import plugin_pool | ||
|
||
from .forms import MultiWrapForm | ||
|
||
|
||
class MultiWrapPlugin(CMSPluginBase): | ||
module = "Multi Wraps" | ||
name = "Multi Wrap" | ||
render_template = 'pluginapp/multiwrap/multiwrap.html' | ||
allow_children = True | ||
child_classes = ["WrapPlugin"] | ||
form = MultiWrapForm | ||
|
||
def save_model(self, request, obj, form, change): | ||
response = super(MultiWrapPlugin, self).save_model( | ||
request, obj, form, change | ||
) | ||
for x in range(int(form.cleaned_data['create'])): | ||
col = CMSPlugin( | ||
parent=obj, | ||
placeholder=obj.placeholder, | ||
language=obj.language, | ||
position=CMSPlugin.objects.filter(parent=obj).count(), | ||
plugin_type=WrapPlugin.__name__ | ||
) | ||
col.save() | ||
return response | ||
|
||
|
||
class WrapPlugin(CMSPluginBase): | ||
module = "Multi Wraps" | ||
name = "Wrap" | ||
render_template = 'pluginapp/multiwrap/wrap.html' | ||
parent_classes = ["MultiWrapPlugin"] | ||
allow_children = True | ||
|
||
|
||
plugin_pool.register_plugin(MultiWrapPlugin) | ||
plugin_pool.register_plugin(WrapPlugin) |
29 changes: 29 additions & 0 deletions
29
cms/test_utils/project/pluginapp/plugins/multiwrap/forms.py
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,29 @@ | ||
from django import forms | ||
|
||
from cms.models import CMSPlugin | ||
|
||
|
||
class MultiWrapForm(forms.ModelForm): | ||
NUM_WRAPS = ( | ||
(0, "0"), | ||
(1, "1"), | ||
(2, "2"), | ||
(3, "3"), | ||
(4, "4"), | ||
(5, "5"), | ||
(6, "6"), | ||
(7, "7"), | ||
(8, "8"), | ||
(9, "9"), | ||
(10, "10"), | ||
) | ||
|
||
create = forms.ChoiceField( | ||
choices=NUM_WRAPS, | ||
label="Create Wraps", | ||
help_text="Create this number of wraps" | ||
) | ||
|
||
class Meta: | ||
model = CMSPlugin | ||
exclude = ('page', 'position', 'placeholder', 'language', 'plugin_type') |
Empty file.
4 changes: 4 additions & 0 deletions
4
cms/test_utils/project/templates/integration/pluginapp/multiwrap/multiwrap.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,4 @@ | ||
{% load cms_tags %} | ||
{% for plugin in instance.child_plugin_instances %} | ||
{% render_plugin plugin %} | ||
{% endfor %} |
7 changes: 7 additions & 0 deletions
7
cms/test_utils/project/templates/integration/pluginapp/multiwrap/wrap.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,7 @@ | ||
{% load cms_tags %} | ||
<div class="inner-wrap" style="padding: 40px;"> | ||
inner-wrap | ||
{% for plugin in instance.child_plugin_instances %} | ||
{% render_plugin plugin %} | ||
{% endfor %} | ||
</div> |
4 changes: 4 additions & 0 deletions
4
cms/test_utils/project/templates/pluginapp/multiwrap/multiwrap.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,4 @@ | ||
{% load cms_tags %} | ||
{% for plugin in instance.child_plugin_instances %} | ||
{% render_plugin plugin %} | ||
{% endfor %} |
6 changes: 6 additions & 0 deletions
6
cms/test_utils/project/templates/pluginapp/multiwrap/wrap.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,6 @@ | ||
{% load cms_tags %} | ||
<div class="inner-wrap"> | ||
{% for plugin in instance.child_plugin_instances %} | ||
{% render_plugin plugin %} | ||
{% endfor %} | ||
</div> |
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,42 @@ | ||
var helpers = require('djangocms-casper-helpers'); | ||
var globals = helpers.settings; | ||
var casperjs = require('casper'); | ||
var cms = helpers(casperjs); | ||
|
||
casper.test.setUp(function(done) { | ||
casper | ||
.start() | ||
.then(cms.login()) | ||
.then(cms.addPage({ title: 'First page' })) | ||
.run(done); | ||
}); | ||
|
||
casper.test.tearDown(function(done) { | ||
casper.start().then(cms.removePage()).then(cms.logout()).run(done); | ||
}); | ||
|
||
casper.test.begin('Tooltip is correct after adding multiple plugins', function(test) { | ||
casper | ||
.start(globals.editUrl) | ||
.then(cms.addPlugin({ | ||
type: 'MultiWrapPlugin', | ||
content: { | ||
id_create: 1 | ||
} | ||
})) | ||
.wait(1000, function () { | ||
var plugin = this.getElementBounds('.inner-wrap'); | ||
|
||
this.mouse.move(plugin.left + plugin.width / 2, plugin.top + plugin.height / 2); | ||
}) | ||
.then(function () { | ||
test.assertVisible('.cms-tooltip'); | ||
test.assertSelectorHasText( | ||
'.cms-tooltip span', | ||
'Placeholder_Content_1: Wrap' | ||
); | ||
}) | ||
.run(function() { | ||
test.done(); | ||
}); | ||
}); |
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