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

Add Liveblog to the list of linkable objects in TinyMCE at installation time #34

Merged
merged 1 commit into from May 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -4,6 +4,9 @@ Changelog
1.1b3 (unreleased)
------------------

- Liveblogs are now added to the list of linkable objects in TinyMCE at installation time.
[hvelarde]

- Fix URL of AJAX call to get latest updates of a Liveblog (fixes `#32`_).
[rodfersou]

Expand Down
8 changes: 8 additions & 0 deletions src/collective/liveblog/profiles/default/tinymce.xml
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<object>
<resourcetypes>
<linkable purge="False">
<element value="Liveblog"/>
</linkable>
</resourcetypes>
</object>
5 changes: 5 additions & 0 deletions src/collective/liveblog/tests/test_setup.py
Expand Up @@ -48,6 +48,11 @@ def test_add_permissions(self):
roles = [r['name'] for r in roles if r['selected']]
self.assertListEqual(roles, permission['expected'])

@unittest.skipIf(IS_PLONE_5, 'Not needed in Plone 5')
def test_tinymce_is_linkable(self):
tinymce = self.portal['portal_tinymce']
self.assertIn('Liveblog', tinymce.linkable.split('\n'))


class UninstallTestCase(unittest.TestCase):

Expand Down
21 changes: 20 additions & 1 deletion src/collective/liveblog/tests/test_upgrades.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from collective.liveblog.testing import INTEGRATION_TESTING
from collective.liveblog.testing import IS_PLONE_5
from plone import api

import unittest
Expand Down Expand Up @@ -55,7 +56,7 @@ def test_profile_version(self):

def test_registered_steps(self):
steps = len(self.setup.listUpgrades(self.profile_id)[0])
self.assertEqual(steps, 1)
self.assertEqual(steps, 2)

def test_remove_workflow(self):
title = u'Migrate liveblog workflow'
Expand All @@ -74,3 +75,21 @@ def test_remove_workflow(self):
wtool.getChainForPortalType('Liveblog'),
('simple_publication_workflow',)
)

@unittest.skipIf(IS_PLONE_5, 'Not needed in Plone 5')
def test_make_liveblog_linkable(self):
title = u'Make Liveblog linkable on TinyMCE'
step = self._get_upgrade_step_by_title(title)
assert step is not None

# simulate state on previous version
tinymce = api.portal.get_tool('portal_tinymce')
linkable = tinymce.linkable.split('\n')
linkable.remove('Liveblog')
tinymce.linkable = '\n'.join(linkable)
assert 'Liveblog' not in tinymce.linkable.split('\n')

# execute upgrade step and verify changes were applied
self._do_upgrade(step)

self.assertIn('Liveblog', tinymce.linkable.split('\n'))
7 changes: 7 additions & 0 deletions src/collective/liveblog/upgrades/v1002/configure.zcml
Expand Up @@ -14,6 +14,13 @@
handler=".migrate_liveblog_workflow"
/>

<genericsetup:upgradeDepends
title="Make Liveblog linkable on TinyMCE"
description=""
import_steps="tinymce_settings"
run_deps="false"
/>

</genericsetup:upgradeSteps>

</configure>