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 27, 2016
1 parent fc131da commit f0d6b32
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
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]

- Liveblogs use now standard `simple_publication_workflow`;
automatic updates in liveblogs are now turned off if there have been no new micro-updates in the last 24 hours;
`liveblog_workflow` was removed (closes `#31`_).
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>
4 changes: 4 additions & 0 deletions src/collective/liveblog/tests/test_setup.py
Expand Up @@ -48,6 +48,10 @@ def test_add_permissions(self):
roles = [r['name'] for r in roles if r['selected']]
self.assertListEqual(roles, permission['expected'])

def test_tinymce_is_linkable(self):
tinymce = self.portal['portal_tinymce']
self.assertIn('Liveblog', tinymce.linkable.split('\n'))


class UninstallTestCase(unittest.TestCase):

Expand Down
19 changes: 18 additions & 1 deletion src/collective/liveblog/tests/test_upgrades.py
Expand Up @@ -55,7 +55,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 +74,20 @@ def test_remove_workflow(self):
wtool.getChainForPortalType('Liveblog'),
('simple_publication_workflow',)
)

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>

0 comments on commit f0d6b32

Please sign in to comment.