Changeset - 4cd0709b6d4b
[Not reviewed]
beta
0 6 0
Marcin Kuzminski - 15 years ago 2010-11-15 18:38:54
marcin@python-works.com
fixes #65, Added reset buttons to edit forms
6 files changed with 28 insertions and 8 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/helpers.py
Show inline comments
 
@@ -16,24 +16,35 @@ from webhelpers.html.tags import auto_di
 
    link_to_unless, ol, required_legend, select, stylesheet_link, submit, text, \
 
    password, textarea, title, ul, xml_declaration, radio
 
from webhelpers.html.tools import auto_link, button_to, highlight, js_obfuscate, \
 
    mail_to, strip_links, strip_tags, tag_re
 
from webhelpers.number import format_byte_size, format_bit_size
 
from webhelpers.pylonslib import Flash as _Flash
 
from webhelpers.pylonslib.secure_form import secure_form
 
from webhelpers.text import chop_at, collapse, convert_accented_entities, \
 
    convert_misc_entities, lchop, plural, rchop, remove_formatting, \
 
    replace_whitespace, urlify, truncate, wrap_paragraphs
 
from webhelpers.date import time_ago_in_words
 

	
 
from webhelpers.html.tags import _set_input_attrs, _set_id_attr, \
 
    convert_boolean_attrs, NotGiven
 

	
 
def _reset(name, value=None, id=NotGiven, type="reset", **attrs):
 
    _set_input_attrs(attrs, type, name, value)
 
    _set_id_attr(attrs, id, name)
 
    convert_boolean_attrs(attrs, ["disabled"])
 
    return HTML.input(**attrs)
 

	
 
reset = _reset
 

	
 
#Custom helpers here :)
 
class _Link(object):
 
    '''
 
    Make a url based on label and url with help of url_for
 
    :param label:name of link    if not defined url is used
 
    :param url: the url for link
 
    '''
 

	
 
    def __call__(self, label='', *url_, **urlargs):
 
        if label is None or '':
 
            label = url
 
        link_fn = link_to(label, url(*url_, **urlargs))
rhodecode/templates/admin/repos/repo_edit.html
Show inline comments
 
@@ -140,25 +140,26 @@
 
                        </tr>
 
                        <tr>
 
                            <td colspan="6">
 
                                <span id="add_perm" class="add_icon" style="cursor: pointer;">
 
                                ${_('Add another user')}
 
                                </span>
 
                            </td>
 
                        </tr>
 
                    </table>             
 
             </div>
 
             
 
            <div class="buttons">
 
              ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
              ${h.submit('save','Save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
              ${h.reset('reset','Reset',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
            </div>                                                          
 
        </div>
 
    </div>
 
    </div>    
 
    ${h.end_form()}
 
        <script type="text/javascript">
 
            YAHOO.util.Event.onDOMReady(function(){
 
                var D = YAHOO.util.Dom;
 
                if(!D.hasClass('perm_new_user_name','error')){
 
                    D.setStyle('add_perm_input','display','none');
 
                }
 
                YAHOO.util.Event.addListener('add_perm','click',function(){
rhodecode/templates/admin/settings/settings.html
Show inline comments
 
@@ -33,50 +33,50 @@
 
		        </div>
 
		        <div class="checkboxes">
 
		            <div class="checkbox">
 
		                ${h.checkbox('destroy',True)}
 
		                <label for="checkbox-1">
 
		                <span class="tooltip" tooltip_title="${h.tooltip(_('In case a repository was deleted from filesystem and there are leftovers in the database check this option to scan obsolete data in database and remove it.'))}">
 
		                ${_('destroy old data')}</span> </label>
 
		            </div>
 
		        </div>
 
			</div>
 
                            
 
            <div class="buttons">
 
            ${h.submit('rescan','rescan repositories',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
            ${h.submit('rescan','Rescan repositories',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
            </div>                                                          
 
        </div>
 
    </div>  
 
    ${h.end_form()}
 
    
 
    <h3>${_('Whoosh indexing')}</h3>
 
    ${h.form(url('admin_setting', setting_id='whoosh'),method='put')}
 
    <div class="form">
 
        <!-- fields -->
 
        
 
        <div class="fields">
 
            <div class="field">
 
                <div class="label label-checkbox">
 
                    <label for="destroy">${_('index build option')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    <div class="checkbox">
 
                        ${h.checkbox('full_index',True)}
 
                        <label for="checkbox-1">${_('build from scratch')}</label>
 
                    </div>
 
                </div>
 
            </div>
 
                            
 
            <div class="buttons">
 
            ${h.submit('reindex','reindex',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
            ${h.submit('reindex','Reindex',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
            </div>                                                          
 
        </div>
 
    </div>  
 
    ${h.end_form()}
 
         
 
    <h3>${_('Global application settings')}</h3> 
 
    ${h.form(url('admin_setting', setting_id='global'),method='put')}
 
    <div class="form">
 
        <!-- fields -->
 
        
 
        <div class="fields">
 
             
 
@@ -90,25 +90,26 @@
 
             </div>
 
                          
 
            <div class="field">
 
                <div class="label">
 
                    <label for="rhodecode_realm">${_('Realm text')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('rhodecode_realm',size=30)}
 
                </div>
 
            </div>
 
                                     
 
            <div class="buttons">
 
                ${h.submit('save','save settings',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
                ${h.submit('save','Save settings',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
                ${h.reset('reset','Reset',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
           </div>                                                          
 
        </div>
 
    </div>      
 
    ${h.end_form()}
 

	
 
    <h3>${_('Mercurial settings')}</h3> 
 
    ${h.form(url('admin_setting', setting_id='mercurial'),method='put')}
 
    <div class="form">
 
        <!-- fields -->
 
        
 
        <div class="fields">
 
             
 
@@ -152,25 +153,26 @@
 
                <div class="label">
 
                    <label for="paths_root_path">${_('Repositories location')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('paths_root_path',size=30,readonly="readonly")}			                    
 
					<span id="path_unlock" class="tooltip" 
 
						tooltip_title="${h.tooltip(_('This a crucial application setting. If You really sure you need to change this, you must restart application in order to make this settings take effect. Click this label to unlock.'))}">
 
		                ${_('unlock')}</span>
 
                </div>
 
            </div>
 
                                     
 
            <div class="buttons">
 
                ${h.submit('save','save settings',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
                ${h.submit('save','Save settings',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
                ${h.reset('reset','Reset',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
           </div>                                                          
 
        </div>
 
    </div>      
 
    ${h.end_form()}
 
    
 
    <script type="text/javascript">
 
        YAHOO.util.Event.onDOMReady(function(){
 
            YAHOO.util.Event.addListener('path_unlock','click',function(){
 
                YAHOO.util.Dom.get('paths_root_path').removeAttribute('readonly');
 
            });
 
        });
 
    </script>
rhodecode/templates/admin/users/user_edit.html
Show inline comments
 
@@ -92,19 +92,20 @@
 
                </div>
 
             </div>
 
             
 
             <div class="field">
 
                <div class="label label-checkbox">
 
                    <label for="admin">${_('Admin')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    ${h.checkbox('admin',value=True)}
 
                </div>
 
             </div>             
 
            <div class="buttons">
 
              ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
              ${h.submit('save','Save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
              ${h.reset('reset','Reset',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
            </div>             
 
    	</div>    
 
    </div>
 
    ${h.end_form()}
 
</div>    
 
</%def>  
 
\ No newline at end of file
rhodecode/templates/admin/users/user_edit_my_account.html
Show inline comments
 
@@ -62,25 +62,29 @@
 
	             </div>
 
	            
 
	             <div class="field">
 
	                <div class="label">
 
	                    <label for="email">${_('Email')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.text('email')}
 
	                </div>
 
	             </div>
 
	            
 
	            <div class="buttons">
 
	              ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
	              ${h.submit('save','Save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
	              ${h.reset('reset','Reset',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
	              
 
	              
 
	              
 
	            </div>             
 
	    	</div>
 
	    </div>    	
 
    ${h.end_form()}
 
    </div>
 
</div>    
 

	
 
<div class="box box-right">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('My repositories')}
 
        <input class="top-right-rounded-corner top-left-rounded-corner bottom-left-rounded-corner bottom-right-rounded-corner" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}"/>
rhodecode/templates/settings/repo_settings.html
Show inline comments
 
@@ -119,25 +119,26 @@
 
                        </tr>
 
                        <tr>
 
                            <td colspan="6">
 
                                <span id="add_perm" class="add_icon" style="cursor: pointer;">
 
                                ${_('Add another user')}
 
                                </span>
 
                            </td>
 
                        </tr>
 
                    </table>             
 
             </div>
 
             
 
            <div class="buttons">
 
              ${h.submit('update','update',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
              ${h.submit('update','Update',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
              ${h.reset('reset','Reset',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
            </div>                                                          
 
        </div>
 
    </div>    
 
    ${h.end_form()}
 
        <script type="text/javascript">
 
            YAHOO.util.Event.onDOMReady(function(){
 
                var D = YAHOO.util.Dom;
 
                if(!D.hasClass('perm_new_user_name','error')){
 
                    D.setStyle('add_perm_input','display','none');
 
                }
 
                YAHOO.util.Event.addListener('add_perm','click',function(){
 
                    D.setStyle('add_perm_input','display','');
0 comments (0 inline, 0 general)