Skip to content

Commit

Permalink
Remove liveblog workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rodfersou committed May 23, 2016
1 parent 46b796d commit fe9ccc9
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 343 deletions.
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -41,6 +41,7 @@
include_package_data=True,
zip_safe=False,
install_requires=[
'ftw.upgrade',
'plone.api',
'plone.app.dexterity',
'plone.app.layout',
Expand Down
9 changes: 6 additions & 3 deletions src/collective/liveblog/browser/view.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from collective.liveblog.browser.base import BaseView
from plone import api
from datetime import datetime
from datetime import timedelta
from plone.memoize import ram
from time import time
from zope.publisher.browser import BrowserView
Expand Down Expand Up @@ -29,9 +30,11 @@ def has_updates(self):
@property
def automatic_updates_enabled(self):
"""Check if the Livelog must be updated automatically.
Automatic updates should be enabled in active state only.
Automatic updates are disabled if no updates in the last day.
"""
return api.content.get_state(self.context) == 'active'
timestamp = self.context.modified().timeTime()
modified = datetime.fromtimestamp(timestamp)
return datetime.now() - modified < timedelta(days=1)

@property
def now(self):
Expand Down
32 changes: 0 additions & 32 deletions src/collective/liveblog/locales/es/LC_MESSAGES/plone.po
Expand Up @@ -16,35 +16,3 @@ msgstr ""
"X-Generator: Poedit 1.5.4\n"
"Language: Spanish\n"
"X-Poedit-SourceCharset: UTF-8\n"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Inactivate"
msgstr "Desactivar"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Liveblog Workflow"
msgstr "Flujo de trabajo para blog en vivo"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Member retracts submission"
msgstr "El miembro retrae el blog en vivo al estado privado"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Publish and activate"
msgstr "Publicar y activar"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Retract"
msgstr "Retraer"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Reviewer makes the liveblog active"
msgstr "El revisor activa el blog en vivo"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Reviewer makes the liveblog inactive"
msgstr "El revisor inactiva el blog en vivo"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Simple workflow to be used with liveblogs. A liveblog starts on the private state and can be activated (published) to allow the addition of micro-updates. When the liveblog is no longer going to be updated, we just simply inactivate it."
msgstr "Un flujo de trabajo sencillo para ser usado con blogs en vivo. Un blog en vivo comienza en estado privado y puede ser publicado y activado para permitir la adición de actualizaciones. Cuando el blog en vivo ya no va a ser actualizado, simplemente lo desactivamos."
32 changes: 0 additions & 32 deletions src/collective/liveblog/locales/plone.pot
Expand Up @@ -16,35 +16,3 @@ msgstr ""
"Language-Name: English\n"
"Preferred-Encodings: utf-8 latin1\n"
"Domain: plone\n"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Inactivate"
msgstr ""

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Liveblog Workflow"
msgstr ""

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Member retracts submission"
msgstr ""

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Publish and activate"
msgstr ""

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Retract"
msgstr ""

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Reviewer makes the liveblog active"
msgstr ""

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Reviewer makes the liveblog inactive"
msgstr ""

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Simple workflow to be used with liveblogs. A liveblog starts on the private state and can be activated (published) to allow the addition of micro-updates. When the liveblog is no longer going to be updated, we just simply inactivate it."
msgstr ""
32 changes: 0 additions & 32 deletions src/collective/liveblog/locales/pt_BR/LC_MESSAGES/plone.po
Expand Up @@ -16,35 +16,3 @@ msgstr ""
"Language: Brazilian Portuguese\n"
"X-Generator: Poedit 1.5.4\n"
"X-Poedit-SourceCharset: UTF-8\n"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Inactivate"
msgstr "Desativar"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Liveblog Workflow"
msgstr "Workflow do Liveblog"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Member retracts submission"
msgstr "O membro retrai o liveblog para o estado privado"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Publish and activate"
msgstr "Publicar e ativar"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Retract"
msgstr "Retrair"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Reviewer makes the liveblog active"
msgstr "O revisor ativa o liveblog"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Reviewer makes the liveblog inactive"
msgstr "O revisor desativa o liveblog"

#: collective/liveblog/profiles/default/workflows/liveblog_workflow/definition.xml
msgid "Simple workflow to be used with liveblogs. A liveblog starts on the private state and can be activated (published) to allow the addition of micro-updates. When the liveblog is no longer going to be updated, we just simply inactivate it."
msgstr "Um workflow simples para ser usado con liveblogs. Um liveblog começa no estado privado e pode ser publicado y ativado para permitir a adição de atualizações. Cuando o liveblog não vai ser mais atualizado, simplesmente podemos desativá-lo."
2 changes: 1 addition & 1 deletion src/collective/liveblog/profiles/default/metadata.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
<version>1001</version>
<version>1002</version>
<dependencies>
<dependency>profile-plone.app.dexterity:default</dependency>
</dependencies>
Expand Down
9 changes: 0 additions & 9 deletions src/collective/liveblog/profiles/default/workflows.xml

This file was deleted.

This file was deleted.

15 changes: 8 additions & 7 deletions src/collective/liveblog/tests/test_views.py
Expand Up @@ -2,6 +2,7 @@
from collective.liveblog.interfaces import IBrowserLayer
from collective.liveblog.testing import INTEGRATION_TESTING
from collective.liveblog.tests.utils import _create_microupdates
from DateTime import DateTime
from datetime import datetime
from datetime import timedelta
from plone import api
Expand Down Expand Up @@ -37,19 +38,19 @@ def test_has_updates(self):
self.assertTrue(self.view.has_updates)

def test_automatic_updates_enabled(self):
self.assertFalse(self.view.automatic_updates_enabled)
api.content.transition(self.liveblog, 'activate')
self.assertTrue(self.view.automatic_updates_enabled)
api.content.transition(self.liveblog, 'inactivate')
self.liveblog.modification_date = DateTime() - 3
self.assertFalse(self.view.automatic_updates_enabled)
self.liveblog.modification_date = DateTime()
self.assertTrue(self.view.automatic_updates_enabled)

def test_date_is_shown_in_microupdates_older_than_today(self):
# comment inside the JS block that adds the dates
comment = '/* show dates for micro-updates older than today */'
self.assertIn(comment, self.view())
api.content.transition(self.liveblog, 'activate')
self.liveblog.modification_date = DateTime() - 3
self.assertIn(comment, self.view())
api.content.transition(self.liveblog, 'inactivate')
self.liveblog.modification_date = DateTime()
self.assertIn(comment, self.view())

def test_rendered(self):
Expand Down Expand Up @@ -104,9 +105,9 @@ def test_date_is_shown_in_microupdates_older_than_today(self):
# comment inside the JS block that adds the dates
comment = '/* show dates for micro-updates older than today */'
self.assertIn(comment, self.view())
api.content.transition(self.liveblog, 'activate')
self.liveblog.modification_date = DateTime() - 3
self.assertIn(comment, self.view())
api.content.transition(self.liveblog, 'inactivate')
self.liveblog.modification_date = DateTime()
self.assertIn(comment, self.view())


Expand Down

0 comments on commit fe9ccc9

Please sign in to comment.