Changeset 2740 in products


Ignore:
Timestamp:
Aug 11, 2010 3:42:40 PM (14 years ago)
Author:
fenix
Message:
  • removed some unnecessary trailing white spaces;
  • fixed batch related labels;
  • made batch_size field disable when batching is not allowed
  • fixed navigation bug (removed unnecessary separator)
Location:
quintagroup.portlet.collection/trunk/quintagroup/portlet/collection
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/browser/configure.zcml

    r2704 r2740  
    1717      name="batch.js" 
    1818      file="resources/batch.js" /> 
     19 
     20  <browser:resource 
     21      name="batch_size_enable.js" 
     22      file="resources/batch_size_enable.js" /> 
     23 
    1924</configure> 
  • quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/browser/resources/batch.js

    r2726 r2740  
    2727          for (i=1;i<=batch_size;i++){ 
    2828            jq(nav_links[index-i]).show(); 
     29            if (i==batch_size) { 
     30              jq(nav_links[index-i]).find('.navlinkSeparator').hide(); 
     31            } 
    2932          } 
    3033        } 
     
    4346            if (i+index<nav_links.size()){ 
    4447              jq(nav_links[i+index]).show(); 
     48            } 
     49            if (i==batch_size) { 
     50              jq(nav_links[i+index]).find('.navlinkSeparator').hide(); 
    4551            } 
    4652          } 
     
    7884      for (i=0; i<batch_size;i++){ 
    7985          jq(nav_links[i]).show(); 
     86          if (i==batch_size-1) { 
     87            jq(nav_links[i]).find('.navlinkSeparator').hide(); 
     88          } 
    8089      } 
    8190      showPageByIndex(0); 
  • quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/browser/templates/navigation.pt

    r2704 r2740  
    33  <tal:block repeat="batch options/batches"> 
    44    <a class="navlink"> 
    5       <span tal:content="repeat/batch/number"/> 
    6       <span tal:condition="not:repeat/batch/end">|</span> 
     5      <span class="navlinkValue" tal:content="repeat/batch/number"/> 
     6      <span class="navlinkSeparator" tal:condition="not:repeat/batch/end">|</span> 
    77    </a> 
    88  </tal:block> 
  • quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/collection.pt

    r2704 r2740  
    77    <dt class="portletHeader"> 
    88        <span class="portletTopLeft"></span> 
    9         <a tal:attributes="href collection_url"  
     9        <a tal:attributes="href collection_url" 
    1010           tal:omit-tag="not:view/data/link_title"> 
    1111            <span tal:content="view/data/header" /> 
  • quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/collection.py

    r2704 r2740  
    2929class NotValidBatchSizeValue(ValidationError): 
    3030    """This is not valid batch size value. 
    31      
     31 
    3232    """ 
    3333 
     
    4747                                  default=[u"Title", u"Description"], 
    4848                                  value_type=schema.Choice(vocabulary='quintagroup.portlet.collection.vocabularies.PortletAttributesVocabulary')) 
    49                                    
     49 
    5050    styling = schema.Choice(title=_(u"Portlet style"), 
    5151                            description=_(u"description_styling", default=u"Choose a css style for the porlet."), 
     
    5555 
    5656 
    57     show_item_more = schema.Bool(title=_(u"Show more... link for collection items."), 
     57    show_item_more = schema.Bool(title=_(u"Show more... link for collection items"), 
    5858                                 description=_(u"If enabled, a more... link will appear in the bottom of the each collection item, " 
    5959                                                "linking to the corresponding item."), 
    6060                                 required=True, 
    6161                                 default=True) 
    62                         
    63     link_title = schema.Bool(title=_(u"Link title."), 
     62 
     63    link_title = schema.Bool(title=_(u"Link title"), 
    6464                                 description=_(u"If enabled, title will be shown as link to corresponding object. "), 
    6565                                 required=True, 
    6666                                 default=True) 
    6767 
    68     allow_batching = schema.Bool(title=_(u"Allow batching."), 
    69                                  description=_(u"If enabled, items will be splited into pages."), 
     68    allow_batching = schema.Bool(title=_(u"Allow batching"), 
     69                                 description=_(u"If enabled, items will be split into pages."), 
    7070                                 required=False, 
    7171                                 default=False) 
     
    7575                                          "(if not set 3 items will be displayed as default)."), 
    7676                            required=False, 
    77                             default=3,  
     77                            default=3, 
    7878                            constraint=validate_batch_size) 
    7979 
    8080class Assignment(base.Assignment): 
    8181    """ 
    82     Portlet assignment.     
     82    Portlet assignment. 
    8383    This is what is actually managed through the portlets UI and associated 
    8484    with columns. 
     
    108108        self.allow_batching = allow_batching 
    109109        self.batch_size = batch_size 
    110         
     110 
    111111    @property 
    112112    def title(self): 
     
    115115        """ 
    116116        return self.header 
    117      
     117 
    118118class Renderer(base.Renderer): 
    119119    """Portlet renderer. 
    120      
     120 
    121121    This is registered in configure.zcml. The referenced page template is 
    122122    rendered, and the implicit variable 'view' will refer to an instance 
     
    135135        delta = self.data.batch_size 
    136136        return [items[idx:idx + delta] for idx in range(0, len(items), delta)] 
    137      
     137 
    138138    def batch_navigation(self): 
    139139        return self.navigation(batches=self.batches()) 
     
    145145                            for index, batch in enumerate(self.batches())]) 
    146146        return self.items_listing(portlet_items=self.results()) 
    147          
     147 
    148148class AddForm(base.AddForm): 
    149149    """Portlet add form. 
    150      
     150 
    151151    This is registered in configure.zcml. The form_fields variable tells 
    152152    zope.formlib which fields to display. The create() method actually 
    153153    constructs the assignment that is being added. 
    154154    """ 
     155 
    155156    form_fields = form.Fields(IQCollectionPortlet) 
    156157    form_fields['target_collection'].custom_widget = UberSelectionWidget 
    157      
     158 
    158159    label = _(u"Add Collection Portlet") 
    159160    description = _(u"This portlet display a listing of items from a Collection.") 
     
    164165class EditForm(base.EditForm): 
    165166    """Portlet edit form. 
    166      
     167 
    167168    This is registered with configure.zcml. The form_fields variable tells 
    168169    zope.formlib which fields to display. 
  • quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/profiles/default/jsregistry.xml

    r2704 r2740  
    55    expression="" id="++resource++batch.js" inline="False"/>     
    66 
     7 <javascript cacheable="True" compression="safe" cookable="True" enabled="True" 
     8    expression="" id="++resource++batch_size_enable.js" inline="False"/>     
     9 
    710</object> 
Note: See TracChangeset for help on using the changeset viewer.