Skip to content

Commit

Permalink
added a way to invalidate JS cache. this close #1
Browse files Browse the repository at this point in the history
  • Loading branch information
keul committed Jan 11, 2013
1 parent 4b9cb63 commit 6251543
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 17 deletions.
14 changes: 13 additions & 1 deletion README.rst
Expand Up @@ -176,6 +176,14 @@ Dependencies
__ http://pypi.python.org/pypi/simplejson
__ http://pypi.python.org/pypi/plone.app.registry

Cache controls
==============

Toggle configuration are stored in a JavaScript file that your browser and Plone *portal_javascript* tool
will probably cache.

When changing configuration you can use the "*Save and invalidate JS cache*" button.

TODO
====

Expand All @@ -185,9 +193,13 @@ Other products
==============

If you need a complete expand/collapse navigation feature this product is not for you; so take a
look to `collective.portlet.explore`__.
look at:

* `collective.portlet.explore`__
* `Solgema.NavigationPortlet`__

__ http://pypi.python.org/pypi/collective.portlet.explore
__ http://plone.org/products/solgema.navigationportlet

Credits
=======
Expand Down
9 changes: 9 additions & 0 deletions collective/navigationtoggle/browser/controlpanel.py
Expand Up @@ -2,6 +2,7 @@

#from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile

from Products.CMFCore.utils import getToolByName
from Products.statusmessages.interfaces import IStatusMessage

from plone.app.registry.browser import controlpanel
Expand Down Expand Up @@ -39,6 +40,14 @@ def handleCancel(self, action):
self.request.response.redirect("%s/%s" % (self.context.absolute_url(),
self.control_panel_view))

@button.buttonAndHandler(_('Save and invalidate JS cache'), name='save_and_invalidate')
def handleSaveAndInvalidate(self, action):
NavigationToggleEditForm.handleSave(self, action)
portal_js = getToolByName(self.context, 'portal_javascripts')
portal_js.cookResources()
IStatusMessage(self.request).addStatusMessage(_(u"JavaScript registry invalidated"),
"info")

def updateWidgets(self):
super(NavigationToggleEditForm, self).updateWidgets()
self.widgets['selectors'].style = u'width: 100%';
Expand Down
Expand Up @@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2012-11-14 09:20+0000\n"
"POT-Creation-Date: 2013-01-11 13:51+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -25,15 +25,15 @@ msgstr ""
msgid "Cache"
msgstr ""

#: ../browser/controlpanel.py:35
#: ../browser/controlpanel.py:36
msgid "Cancel"
msgstr ""

#: ../browser/controlpanel.py:31
#: ../browser/controlpanel.py:32
msgid "Changes saved"
msgstr ""

#: ../browser/controlpanel.py:37
#: ../browser/controlpanel.py:38
msgid "Edit cancelled"
msgstr ""

Expand All @@ -45,22 +45,30 @@ msgstr ""
msgid "HTML list type"
msgstr ""

#: ../browser/controlpanel.py:48
msgid "JavaScript registry invalidated"
msgstr ""

#: ../interfaces.py:16
msgid "Link selectors"
msgstr ""

msgid "Make specific Plone navigation portlet elements to be expandable/collapsible"
msgstr ""

#: ../browser/controlpanel.py:20
#: ../browser/controlpanel.py:21
#: ../profiles/default/controlpanel.xml
msgid "Navigation Toggle settings"
msgstr ""

#: ../browser/controlpanel.py:24
#: ../browser/controlpanel.py:25
msgid "Save"
msgstr ""

#: ../browser/controlpanel.py:43
msgid "Save and invalidate JS cache"
msgstr ""

#: ../interfaces.py:50
msgid "Toggle container classes"
msgstr ""
Expand Down Expand Up @@ -91,7 +99,7 @@ msgid "help_list_type"
msgstr ""

#. Default: "Manage on which elements the navigation toggle must be activated"
#: ../browser/controlpanel.py:21
#: ../browser/controlpanel.py:22
msgid "help_navigationtoggle_settings_editform"
msgstr ""

Expand Down
Expand Up @@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2012-11-14 09:20+0000\n"
"POT-Creation-Date: 2013-01-11 13:51+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: Luca Fabbri <keul@redturtle.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -25,15 +25,15 @@ msgstr "Ritardo nell'animazione"
msgid "Cache"
msgstr ""

#: ../browser/controlpanel.py:35
#: ../browser/controlpanel.py:36
msgid "Cancel"
msgstr "Annulla"

#: ../browser/controlpanel.py:31
#: ../browser/controlpanel.py:32
msgid "Changes saved"
msgstr "Modifiche salvate"

#: ../browser/controlpanel.py:37
#: ../browser/controlpanel.py:38
msgid "Edit cancelled"
msgstr "Modifiche annullate"

Expand All @@ -45,22 +45,30 @@ msgstr "Elemento lista HTML"
msgid "HTML list type"
msgstr "Tipo di lista HTML"

#: ../browser/controlpanel.py:48
msgid "JavaScript registry invalidated"
msgstr "Registro JavaScript invalidato"

#: ../interfaces.py:16
msgid "Link selectors"
msgstr "Selettori dei link"

msgid "Make specific Plone navigation portlet elements to be expandable/collapsible"
msgstr "Rende specifici elementi delle portlet di navigazione Plone espandibili/collassabili"

#: ../browser/controlpanel.py:20
#: ../browser/controlpanel.py:21
#: ../profiles/default/controlpanel.xml
msgid "Navigation Toggle settings"
msgstr "Impostazioni Navigation Toggle"

#: ../browser/controlpanel.py:24
#: ../browser/controlpanel.py:25
msgid "Save"
msgstr "Salva"

#: ../browser/controlpanel.py:43
msgid "Save and invalidate JS cache"
msgstr "Salva e invalida cache JS"

#: ../interfaces.py:50
msgid "Toggle container classes"
msgstr "Classi dei contenitori per elementi toggle"
Expand Down Expand Up @@ -101,7 +109,7 @@ msgstr ""
"Questo è l'elemento che la funzionalità di toggle tenterà di clonare."

#. Default: "Manage on which elements the navigation toggle must be activated"
#: ../browser/controlpanel.py:21
#: ../browser/controlpanel.py:22
msgid "help_navigationtoggle_settings_editform"
msgstr "Gestisci su quali elementi il navigation toggle deve essere attivato"

Expand Down
5 changes: 4 additions & 1 deletion docs/HISTORY.txt
@@ -1,16 +1,19 @@
Changelog
=========

0.4.1 (unreleased)
1.0.0 (unreleased)
------------------

- fixed a bug when used with containers with spaces inside the id
(close `#2`__) [keul]
- file icon of generated elements where not handled in the right way
(close `#3`__) [keul]
- added a way to invalidate JS cache
(close `#1`__) [keul]

__ https://github.com/RedTurtle/collective.navigationtoggle/issues/2
__ https://github.com/RedTurtle/collective.navigationtoggle/issues/3
__ https://github.com/RedTurtle/collective.navigationtoggle/issues/1

0.4.0 (2012-11-15)
------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -4,7 +4,7 @@
import os
import sys

version = '0.4.1.dev0'
version = '1.0.0.dev0'

install_requires = ['setuptools',
'Plone',
Expand Down

0 comments on commit 6251543

Please sign in to comment.