Changeset 3034 for trunk


Ignore:
Timestamp:
05/27/10 16:37:22 (10 years ago)
Author:
jukka
Message:

Added an ajaxy way to add tags to resource, if it has none.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Resource.py

    r3029 r3034  
    10411041        return self.REQUEST.RESPONSE.redirect(self.absolute_url()+'/base_view') 
    10421042 
     1043    security.declareProtected(MODIFY_CONTENT, 'updateTags') 
     1044    def updateTags(self, tags): 
     1045        """ Just add tags, called from javascript """ 
     1046        self.setTags(tags) 
     1047        self.at_post_edit_script() 
     1048        lt=getToolByName(self, 'lemill_tool') 
     1049        lt.addPortalMessage(_('Thank you!')) 
     1050        return self.REQUEST.RESPONSE.redirect(self.absolute_url()+'/base_view') 
     1051 
     1052 
    10431053InitializeClass(Resource) 
  • trunk/skins/lemill/portlet_macros.pt

    r3018 r3034  
    104104    <div class="tb-portlet" tal:define="url_base python:context.getSectionFolder(bottom=True).absolute_url()"> 
    105105        <ul> 
    106            <tal:loopy repeat="tag d/tags"><a href="" tal:attributes="href python:url_base+'/tags?tag='+tag" tal:content="tag" /><span tal:condition="not:repeat/tag/end" tal:omit-tag="">, </span></tal:loopy><span tal:condition="not:d/tags"><span i18n:translate="no_tags">No tags</span> <a href="base_metadata" tal:condition="d/canEdit" tal:attributes="href string:${here_url}/base_metadata" i18n:translate="add">(add)</a></span> 
     106           <tal:loopy repeat="tag d/tags"><a href="" tal:attributes="href python:url_base+'/tags?tag='+tag" tal:content="tag" /><span tal:condition="not:repeat/tag/end" tal:omit-tag="">, </span></tal:loopy> 
     107           <span tal:condition="not:d/tags"><span i18n:translate="no_tags">No tags</span> <a href="javascript:void(0)" tal:condition="d/canEdit" i18n:translate="add" onclick="$('div#tagform').toggle('fast');$('input#tags').focus();" >(add)</a> 
     108           <div id="tagform" style="display:none"><form tal:attributes="action string:${here_url}/updateTags" id="tagsUpdater" method="post"> 
     109           <input name="tags" id="tags" type="text" width="20" /><br> 
     110           <span class="discreet" i18n:translate="help_tags_separation">Please separate tags with ','</span></form></div></span> 
    107111        </ul> 
     112         
    108113    </div>     
    109114</tal:tags_div> 
Note: See TracChangeset for help on using the changeset viewer.