Skip to content

Commit

Permalink
Add Liveblog to the list of linkable objects in TinyMCE at installati…
Browse files Browse the repository at this point in the history
…on time
  • Loading branch information
hvelarde committed May 31, 2016
1 parent 8ad216a commit e314314
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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>

0 comments on commit e314314

Please sign in to comment.