Commits

joberschweiber committed 2aa4732

Redo profile settings

Comments (0)

Files changed (5)

rhodecode/controllers/admin/settings.py

                 .all()
             c.user_repos = ScmModel().get_repos(all_repos)
 
+            print errors.error_dict
             return htmlfill.render(
                 render('admin/users/user_edit_my_account.html'),
                 defaults=errors.value,

rhodecode/model/forms.py

             password = All(UnicodeString(strip=True, min=6, not_empty=True))
             password_confirmation = All(UnicodeString(strip=True, min=6, not_empty=False))
             
-        active = StringBoolean(if_missing=False)
+        active = StringBoolean(if_missing=True)
         name = UnicodeString(strip=True, min=1, not_empty=True)
         lastname = UnicodeString(strip=True, min=1, not_empty=True)
         email = All(Email(not_empty=True), UniqSystemEmail(old_data))

rhodecode/public/css/style.css

 header {
     font-weight: bold;
 }
+
+.controls pre {
+    margin-top: 2px;
+    padding: 2px 5px;
+}

rhodecode/templates/admin/users/user_edit_my_account.html

 </%def>
 
 <%def name="main()">
+<h1>Edit Profile</h1>
+<br />
+
 ${h.form(url('admin_settings_my_account_update'),method='put', class_='form-horizontal')}
-<fieldset>
-    <legend>${_('Settings')}</legend>
-    <div class="control-group">
-       <div class="controls">
-           <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div>
-           <p>
-           <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong><br/> 
-           ${_('Using')} ${c.user.email}
-           </p>
-       </div>
-    </div>
-    <div class="control-group">
-        <label class="control-label">${_('API key')}</label>
-        <div class="controls">
-            ${c.user.api_key}
+<div class="tabbable tabs-left">
+    <ul class="nav nav-tabs">
+        <li class="active"><a href="#1" data-toggle="tab">Profile</a></li>
+        <li><a href="#2" data-toggle="tab">Settings</a></li>
+    </ul>
+    <div class="tab-content">
+        <div class="tab-pane active" id="1">
+            <fieldset>
+                <div class="control-group">
+                    <label class="control-label" for="username">${_('Username')}:</label>
+                    <div class="controls">
+                        ${h.text('username', class_='input-xlarge')}
+                    </div>
+                </div>
+
+                <div class="control-group">
+                    <label class="control-label" for="name">${_('First Name')}</label>
+                    <div class="controls">
+                        ${h.text('name', class_='input-xlarge')}
+                    </div>
+                </div>
+
+                <div class="control-group">
+                    <label class="control-label" for="lastname">${_('Last Name')}</label>
+                    <div class="controls">
+                        ${h.text('lastname', class_='input-xlarge')}
+                    </div>
+                </div>
+
+                <div class="control-group">
+                    <label class="control-label" for="email">${_('Email')}:</label>
+                    <div class="controls">
+                        ${h.text('email', class_='input-xlarge')}
+                    </div>
+                </div>
+                <div class="control-group">
+                    <div class="controls">
+                        <img alt="gravatar" src="${h.gravatar_url(c.user.email)}" style="vertical-align:middle" />
+                        <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong>
+                    </div>
+                </div>
+            </fieldset>
+        </div>
+        <div class="tab-pane" id="2">
+            <fieldset>
+                <div class="control-group">
+                    <label class="control-label">${_('API key:')}</label>
+                    <div class="controls">
+                        <pre>${c.user.api_key}</pre>
+                    </div>
+                </div>
+                <div class="control-group">
+                    <label class="control-label" for="new_password">${_('New password')}:</label>
+                    <div class="controls">
+                        ${h.password('new_password',autocomplete="off", class_='input-xlarge')}
+                    </div>
+                </div>
+                <div class="control-group">
+                    <label class="control-label" for="password_confirmation">${_('Confirm password')}:</label>
+                    <div class="controls">
+                        ${h.password('password_confirmation', autocomplete='off', class_='input-xlarge')}
+                    </div>
+                </div>
+            </fieldset>
         </div>
     </div>
-    <div class="control-group">
-        <label class="control-label" for="username">${_('Username')}:</label>
-        <div class="controls">
-            ${h.text('username')}
-        </div>
-    </div>
-    <div class="control-group">
-        <label class="control-label" for="ldap_dn">${_('LDAP DN')}:</label>
-        <div class="controls">
-            ${h.text('ldap_dn')}
-        </div>
-    </div>
-    <div class="control-group">
-        <label class="control-label" for="new_password">${_('New password')}:</label>
-        <div class="controls">
-            ${h.password('new_password',autocomplete="off")}
-        </div>
-    </div>
-    <div class="control-group">
-        <label class="control-label" for="name">${_('First Name')}:</label>
-        <div class="controls">
-            ${h.text('name')}
-        </div>
-    </div>
-    <div class="control-group">
-        <label class="control-label" for="lastname">${_('Last Name')}:</label>
-        <div class="controls">
-            ${h.text('lastname')}
-        </div>
-    </div>
-    <div class="control-group">
-        <label class="control-label" for="email">${_('Email')}:</label>
-        <div class="controls">
-            ${h.text('email')}
-        </div>
-    </div>
-    <div class="control-group">
-        <div class="controls">
-                    <label class="checkbox">
-                        ${h.checkbox('active',value=True)}
-                        ${_('Active')}
-                    </label>
-        </div>
-    </div>
-    <div class="control-group">
-        <div class="controls">
-                    <label class="checkbox">
-                        ${h.checkbox('admin',value=True)}
-                        ${_('Admin')}
-                    </label>
-        </div>
-    </div>             
-    <div class="form-actions">
-        ${h.submit('save',_('Save'),class_="btn btn-primary")}
-        ${h.reset('reset',_('Reset'),class_="btn")}
-    </div>             
-</fieldset>
+</div>
+<div class="form-actions">
+    ${h.submit('save',_('Save'),class_="btn btn-primary")}
+</div>             
 ${h.end_form()}
-
-<form>
-	<fieldset><legend>${_('My repositories')}</legend></fieldset>
-</form>
-<table>
-<thead>
-    <tr>
-    <th class="left">${_('Name')}</th>
-    <th class="left">${_('revision')}</th>
-    <th colspan="2" class="left">${_('action')}</th>            
-</thead>
- <tbody>
- %if c.user_repos:
-     %for repo in c.user_repos:
-        <tr>
-            <td>
-             %if repo['dbrepo']['repo_type'] =='hg':
-               <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url("/images/icons/hgicon.png")}"/>
-             %elif repo['dbrepo']['repo_type'] =='git':
-               <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url("/images/icons/giticon.png")}"/>
-             %else:
-               
-             %endif 		            
-             %if repo['dbrepo']['private']:
-                <img class="icon" alt="${_('private')}" src="${h.url("/images/icons/lock.png")}"/>
-             %else:
-                <img class="icon" alt="${_('public')}" src="${h.url("/images/icons/lock_open.png")}"/>
-             %endif
-                                             
-            ${h.link_to(repo['name'], h.url('summary_home',repo_name=repo['name']),class_="repo_name")}
-            %if repo['dbrepo_fork']:
-            	<a href="${h.url('files_home',repo_name=repo['dbrepo_fork']['repo_name'])}">
-            	<img class="icon" alt="${_('public')}"
-            	title="${_('Fork of')} ${repo['dbrepo_fork']['repo_name']}" 
-            	src="${h.url('/images/icons/arrow_divide.png')}"/></a>
-            %endif		            
-            </td> 
-            <td><span class="tooltip" title="${repo['last_change']}">${("r%s:%s") % (repo['rev'],h.short_id(repo['tip']))}</span></td>
-            <td><a href="${h.url('repo_settings_home',repo_name=repo['name'])}" title="${_('edit')}"><img class="icon" alt="${_('private')}" src="${h.url('/images/icons/application_form_edit.png')}"/></a></td>
-            <td>
-              ${h.form(url('repo_settings_delete', repo_name=repo['name']),method='delete')}
-                ${h.submit('remove_%s' % repo['name'],'Delete',class_="btn danger",onclick="return confirm('Confirm to delete this repository');")}
-              ${h.end_form()}	            
-            </td>
-        </tr>
-     %endfor
- %else:
- 	${_('No repositories yet')} 
- 	%if h.HasPermissionAny('hg.admin','hg.create.repository')():
- 		${h.link_to(_('create one now'),h.url('admin_settings_create_repository'))}
- 	%endif
- %endif
- </tbody>
- </table>
-    
-    <script type="text/javascript">
-     var D = YAHOO.util.Dom;
-     var E = YAHOO.util.Event;
-     var S = YAHOO.util.Selector;
-     
-     var q_filter = D.get('q_filter');
-     var F = YAHOO.namespace('q_filter'); 
-     
-     E.on(q_filter,'click',function(){
-        q_filter.value = '';
-     });
-
-     F.filterTimeout = null;
-     
-     F.updateFilter  = function() { 
-        // Reset timeout 
-        F.filterTimeout = null;
-        
-        var obsolete = [];
-        var nodes = S.query('div.table tr td a.repo_name');
-        var req = q_filter.value.toLowerCase();
-        for (n in nodes){
-            D.setStyle(nodes[n].parentNode.parentNode,'display','')
-        }
-        if (req){
-            for (n in nodes){
-                if (nodes[n].innerHTML.toLowerCase().indexOf(req) == -1) {
-                    obsolete.push(nodes[n]); 
-                }
-            }
-            if(obsolete){
-                for (n in obsolete){
-                    D.setStyle(obsolete[n].parentNode.parentNode,'display','none');
-                }
-            }
-        }
-     }
-     
-     E.on(q_filter,'keyup',function(e){
-         clearTimeout(F.filterTimeout); 
-         F.filterTimeout = setTimeout(F.updateFilter,600); 
-     });
-     
-    </script>
 </%def>  

rhodecode/templates/base/base.html

         <% messages = h.flash.pop_messages() %>
         % if messages:
           % for message in messages:
-          <div class="${message.category} alert-message">${message}</li>
+          <div class="alert-${message.category} alert">${message}</div>
           % endfor
         % endif
     </div>
 </div>
 <!-- END FOOTER -->
 
+<%def name="form_control(ctrl, class_='', label='')">
+<div class="control-group">
+    <label class="control-label" for="">${label}</label>
+    <div class="controls">
+    </div>
+</div>
+</%def>
+
 ### MAKO DEFS ###
 <%def name="page_nav()">
 lHEL