Skip to content

Commit

Permalink
Merge branch 'master' into pep-3101
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Aug 9, 2013
2 parents b423d64 + 2b9a33e commit 52f4da5
Show file tree
Hide file tree
Showing 19 changed files with 226 additions and 132 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ Mostly Harmless
banner tiles. Image and link tiles will be completely removed on next
release 1.0a5 (see issue `#218`_ for more information).

.. image:: https://secure.travis-ci.org/collective/collective.cover.png
.. image:: https://secure.travis-ci.org/collective/collective.cover.png?branch=master
:target: http://travis-ci.org/collective/collective.cover

.. image:: https://coveralls.io/repos/collective/collective.cover/badge.png
:target: https://coveralls.io/r/collective/collective.cover?branch=master
.. image:: https://coveralls.io/repos/collective/collective.cover/badge.png?branch=master
:target: https://coveralls.io/r/collective/collective.cover

Got an idea? Found a bug? Let us know by `opening a support ticket`_.

Expand Down
Binary file modified cover6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion docs/CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ There's a frood who really knows where his towel is
1.0a5 (unreleased)
^^^^^^^^^^^^^^^^^^

- Nothing changed yet.
- Refactor collection tile to have a more sane page template (closes `#249`_).
[rodfersou]

- Move CSS to registry_css (closes `#244`_). [agnogueira]

- Collection tile now fulfills the configured image size (fixes `#239`_).
[cleberjsantos]

- Friendly layout for tile configuration (closes `#133`_). [agnogueira]


1.0a4 (2013-07-27)
Expand Down Expand Up @@ -190,6 +198,7 @@ There's a frood who really knows where his towel is
.. _`#124`: https://github.com/collective/collective.cover/issues/124
.. _`#128`: https://github.com/collective/collective.cover/issues/128
.. _`#129`: https://github.com/collective/collective.cover/issues/129
.. _`#133`: https://github.com/collective/collective.cover/issues/133
.. _`#137`: https://github.com/collective/collective.cover/issues/137
.. _`#138`: https://github.com/collective/collective.cover/issues/138
.. _`#142`: https://github.com/collective/collective.cover/issues/142
Expand All @@ -211,3 +220,5 @@ There's a frood who really knows where his towel is
.. _`#203`: https://github.com/collective/collective.cover/issues/203
.. _`#206`: https://github.com/collective/collective.cover/issues/206
.. _`#218`: https://github.com/collective/collective.cover/issues/218
.. _`#239`: https://github.com/collective/collective.cover/issues/239
.. _`#249`: https://github.com/collective/collective.cover/issues/249
13 changes: 13 additions & 0 deletions src/collective/cover/profiles.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,17 @@

</genericsetup:upgradeSteps>

<genericsetup:upgradeSteps
source="4"
destination="5"
profile="collective.cover:default">

<genericsetup:upgradeStep
title="Solves issue 244"
description="Add cover.css to css_registry"
handler=".upgrades.issue_244"
/>

</genericsetup:upgradeSteps>

</configure>
3 changes: 3 additions & 0 deletions src/collective/cover/profiles/default/cssregistry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
<stylesheet title="" cacheable="True" compression="safe" cookable="True"
enabled="1" expression="" id="++resource++collective.cover/bootstrap.min.css" media="screen"
rel="stylesheet" rendering="link"/>
<stylesheet title="" cacheable="True" compression="safe" cookable="True"
enabled="1" expression="" id="++resource++collective.cover/cover.css" media="screen"
rel="stylesheet" rendering="link"/>
</object>
12 changes: 6 additions & 6 deletions src/collective/cover/static/contentchooser.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
background: #fff;
position: relative;
right: 0;
top: 0px;
top: 0;
z-index: 999;
font-weight: bold;
float: right;
Expand All @@ -62,16 +62,16 @@

.current {
background: #fff;
border-top-right-radius: 0.5em;
border-top-left-radius: 0.5em;
-webkit-border-top-right-radius: 0.5em;
-webkit-border-top-left-radius: 0.5em;
-webkit-border-top-right-radius: 0.5em;
-moz-border-radius-topleft: 0.5em;
-moz-border-radius-topright: 0.5em;
border-top-left-radius: 0.5em;
border-top-right-radius: 0.5em;
}

div.input {
margin: 10px 0px;
margin: 10px 0;
width: 200px;
padding: 3px 15px;
border-radius: 36px;
Expand All @@ -82,7 +82,7 @@ div.input {

input[type="text"].contentchooser-content-trees,
input[type="text"]#contentchooser-content-trees {
border: 0px solid;
border: 0 solid;
width: 100%;
height: 16px;
background: transparent;
Expand Down
21 changes: 16 additions & 5 deletions src/collective/cover/static/layout_edit.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
position: relative;
}

}

/* SIDEBAR */

#sidebar .btn {
Expand Down Expand Up @@ -151,8 +149,8 @@
position:absolute;
width:100%;
height:100%;
top:0px;
left:0px;
top:0;
left:0;
visibility:hidden;
}
.layout .row-guide {
Expand Down Expand Up @@ -330,4 +328,17 @@

#export-layout {
padding:20px;
}
}

/* tiles config */
#configure_tile>div {border-bottom: 1px solid #d1d1d1; padding-bottom: 8px; position: relative;min-height: 2em;}
#configure_tile>div>label {margin-left: 20px; margin-right: 8px; float: left;}
#tile-configure .formControls {border-bottom: none;}
#configure_tile input[type=radio] {display:none;}
#configure_tile input[type=radio] + label {display:inline-block; text-indent: -2000px;padding: 0 10px;}
#configure_tile input[type=radio]:checked + label {display:none;}
.order-box {position: absolute;top: 0;right: 0;}
.visibility-box {position: absolute; top: 0; left: 0;}
.visibility-box>span {display: none;}
.visibility-no {background: url('visibility.png') no-repeat 0 4px;}
.visibility-yes {background: url('visibility.png') no-repeat -22px 4px;}
Binary file added src/collective/cover/static/visibility.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 1 addition & 11 deletions src/collective/cover/templates/view.pt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@
metal:use-macro="context/main_template/macros/master"
i18n:domain="collective.cover">

<metal:js fill-slot="javascript_head_slot">

</metal:js>

<metal:styles fill-slot="style_slot">
<link rel="stylesheet" type="text/css" media="screen" href=""
tal:define="navroot context/@@plone_portal_state/navigation_root_url"
tal:attributes="href string:${navroot}/++resource++collective.cover/cover.css"
/>
</metal:styles>
<body>

<metal:main fill-slot="main">
<div tal:define="layout nocall:context/@@layout"
tal:replace="structure layout/render_view" />
tal:replace="structure layout/render_view" />
</metal:main>

</body>
Expand Down
18 changes: 18 additions & 0 deletions src/collective/cover/tests/test_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from collective.cover.upgrades import register_available_tiles_record
from collective.cover.upgrades import register_styles_record
from collective.cover.upgrades import rename_content_chooser_resources
from collective.cover.upgrades import issue_244
from plone.registry.interfaces import IRecordAddedEvent
from plone.registry.interfaces import IRegistry
from zope.component import eventtesting
Expand Down Expand Up @@ -107,3 +108,20 @@ def test_issue_218(self):
self.assertIn(u'collective.cover.banner', registry[record])
self.assertNotIn(u'collective.cover.image', registry[record])
self.assertNotIn(u'collective.cover.link', registry[record])


class Upgrade4to5TestCase(unittest.TestCase):

layer = INTEGRATION_TESTING

def setUp(self):
self.portal = self.layer['portal']

def test_issue_244(self):
css_tool = self.portal['portal_css']
id = '++resource++collective.cover/cover.css'
# remove the resource so simulate status of profile version 4
css_tool.unregisterResource(id)
self.assertNotIn(id, css_tool.getResourceIds())
issue_244(self.portal)
self.assertIn(id, css_tool.getResourceIds())
1 change: 0 additions & 1 deletion src/collective/cover/tiles/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class IBasicTile(IPersistentCoverTile):
form.widget(subjects='z3c.form.browser.textarea.TextAreaFieldWidget')
subjects = schema.Tuple(
title=_(u'label_categories', default=u'Categories'),
description=_(u'help_categories'),
required=False,
value_type=schema.TextLine(),
missing_value=(),
Expand Down
27 changes: 15 additions & 12 deletions src/collective/cover/tiles/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,18 @@ class CollectionTile(PersistentCoverTile):

is_configurable = True
is_editable = True
configured_fields = []
configured_fields = {}

def get_title(self):
return self.data['title']

def results(self):
self.configured_fields = self.get_configured_fields()
size_conf = [i for i in self.configured_fields if i['id'] == 'number_to_show']

if size_conf and 'size' in size_conf[0].keys():
size = int(size_conf[0]['size'])
size_conf = self.configured_fields['number_to_show']

if size_conf and 'size' in size_conf.keys():
size = int(size_conf['size'])
else:
size = 4

Expand Down Expand Up @@ -131,10 +132,9 @@ def get_configured_fields(self):

fields = getFieldsInOrder(tileType.schema)

results = []
results = {}
for name, obj in fields:
field = {'id': name,
'title': obj.title}
field = {'title': obj.title}
if name in conf:
field_conf = conf[name]
if ('visibility' in field_conf and field_conf['visibility'] == u'off'):
Expand All @@ -153,16 +153,19 @@ def get_configured_fields(self):
if 'size' in field_conf:
field['size'] = field_conf['size']

results.append(field)
results[name] = field

return results

def thumbnail(self, item):
tile_conf = self.get_tile_configuration()
image_conf = tile_conf.get('image', None)
scales = item.restrictedTraverse('@@images')
try:
return scales.scale('image', 'mini')
except:
return None
if image_conf:
scaleconf = image_conf['imgsize']
# scale string is something like: 'mini 200:200'
scale = scaleconf.split(' ')[0] # we need the name only: 'mini'
return scales.scale('image', scale)

def remove_relation(self):
data_mgr = ITileDataManager(self)
Expand Down
16 changes: 12 additions & 4 deletions src/collective/cover/tiles/configuration_widgets/basewidget.pt
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,33 @@

<tal:stored_data define="stored_data python:view.form.getFieldConfiguration(view)">

<div class="visibility-box">
<span i18n:translate="">Visible</span>
<input type="radio" id="" name="" class=""
tabindex="" accesskey="" value="on"
tal:attributes="id string:${view/id}-visibility;
tal:attributes="id string:${view/id}-visibility-yes;
name string:${view/name}.visibility;
class view/klass;
tabindex view/tabindex;
checked python:not stored_data.get('visibility', None) and 'checked' or stored_data.get('visibility', None) == 'on' and 'checked';
accesskey view/accesskey|nothing;"/>
<span i18n:translate="">Yes</span>
<label i18n:translate=""
tal:attributes="for string:${view/id}-visibility-yes;"
class="visibility-yes">Yes</label>
<input type="radio" id="" name="" class=""
tabindex="" accesskey="" value="off"
tal:attributes="id string:${view/id}-visibility;
tal:attributes="id string:${view/id}-visibility-no;
name string:${view/name}.visibility;
class view/klass;
tabindex view/tabindex;
checked python:stored_data.get('visibility', None) == 'off' and 'checked';
accesskey view/accesskey|nothing;"/>
<span i18n:translate="">No</span>
<label i18n:translate=""
tal:attributes="for string:${view/id}-visibility-no;"
class="visibility-no">No</label>
</div>

<div class="order-box">
<span i18n:translate="">Order</span>
<input type="text" id="" name="" class="" size="2"
tabindex="" accesskey=""
Expand All @@ -38,5 +45,6 @@
tabindex view/tabindex;
value python:stored_data.get('order', None);
accesskey view/accesskey|nothing;"/>
</div>
</tal:stored_data>
</html>
12 changes: 9 additions & 3 deletions src/collective/cover/tiles/configuration_widgets/list.pt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
value python:stored_data.get('size', 5);
accesskey view/accesskey|nothing;"/>

<div class="visibility-box">
<span i18n:translate="">Visible</span>
<input type="radio" id="" name="" class=""
tabindex="" accesskey="" value="on"
tal:attributes="id string:${view/id}-visibility;
tal:attributes="id string:${view/id}-visibility-yes;
name string:${view/name}.visibility;
class view/klass;
tabindex view/tabindex;
Expand All @@ -31,14 +32,18 @@
<span i18n:translate="">Yes</span>
<input type="radio" id="" name="" class=""
tabindex="" accesskey="" value="off"
tal:attributes="id string:${view/id}-visibility;
tal:attributes="id string:${view/id}-visibility-no;
name string:${view/name}.visibility;
class view/klass;
tabindex view/tabindex;
checked python:stored_data.get('visibility', None) == 'off' and 'checked';
accesskey view/accesskey|nothing;"/>
<span i18n:translate="">No</span>
<label i18n:translate=""
tal:attributes="for string:${view/id}-visibility-no;"
class="visibility-no">No</label>
</div>

<div class="order-box">
<span i18n:translate="">Order</span>
<input type="text" id="" name="" class="" size="2"
tabindex="" accesskey=""
Expand All @@ -48,6 +53,7 @@
tabindex view/tabindex;
value python:stored_data.get('order', None);
accesskey view/accesskey|nothing;"/>
</div>

</tal:stored_data>
</html>
Loading

0 comments on commit 52f4da5

Please sign in to comment.