changeset 5178:221d6a002601

repos: cleanup of stuff related to clone_uri
author Mads Kiilerich <madski@unity3d.com>
date Tue, 09 Jun 2015 22:53:24 +0200
parents f47d6187095f
children 6e1bd83552d8
files kallithea/model/validators.py kallithea/templates/admin/repos/repo_add_base.html kallithea/templates/admin/repos/repo_edit_settings.html kallithea/tests/functional/test_admin_repos.py
diffstat 4 files changed, 8 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/validators.py	Tue Jun 09 22:51:01 2015 +0200
+++ b/kallithea/model/validators.py	Tue Jun 09 22:53:24 2015 +0200
@@ -471,9 +471,9 @@
 
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'clone_uri': _(u'invalid clone URL'),
-            'invalid_clone_uri': _(u'Invalid clone URL, provide a '
-                                    'valid clone http(s)/svn+http(s)/ssh URL')
+            'clone_uri': _(u'Invalid repository URL'),
+            'invalid_clone_uri': _(u'Invalid repository URL. It must be a '
+                                    'valid http, https, ssh, svn+http or svn+https URL'),
         }
 
         def validate_python(self, value, state):
--- a/kallithea/templates/admin/repos/repo_add_base.html	Tue Jun 09 22:51:01 2015 +0200
+++ b/kallithea/templates/admin/repos/repo_add_base.html	Tue Jun 09 22:53:24 2015 +0200
@@ -10,18 +10,9 @@
             </div>
             <div class="input">
                 ${h.text('repo_name',class_="small")}
-                <div style="margin: 6px 0px 0px 0px">
-                    <a id="remote_clone_toggle" href="#">
-                        <i class="icon-download-cloud"></i>
-                        ${_('Import existing repository ?')}
-                    </a>
-                </div>
-                %if not c.authuser.is_admin:
-                    ${h.hidden('user_created',True)}
-                %endif
             </div>
          </div>
-        <div id="remote_clone" class="field" style="display: none">
+        <div id="remote_clone" class="field">
             <div class="label">
                 <label for="clone_uri">${_('Clone from')}:</label>
             </div>
@@ -102,16 +93,6 @@
             }
         }
 
-        $('#remote_clone_toggle').on('click', function(e){
-            $('#remote_clone').show();
-            e.preventDefault();
-        });
-        if($('#remote_clone input').hasClass('error')){
-            $('#remote_clone').show();
-        }
-        if($('#remote_clone input').val()){
-            $('#remote_clone').show();
-        }
         $("#repo_group").select2({
             'dropdownAutoWidth': true
         });
--- a/kallithea/templates/admin/repos/repo_edit_settings.html	Tue Jun 09 22:51:01 2015 +0200
+++ b/kallithea/templates/admin/repos/repo_edit_settings.html	Tue Jun 09 22:53:24 2015 +0200
@@ -27,7 +27,7 @@
                         <span style="cursor: pointer; padding: 0px 0px 5px 0px" id="edit_clone_uri"><i class="icon-edit"></i>${_('Edit')}</span>
                     </div>
                     <div id="alter_clone_uri" style="display: none">
-                        ${h.text('clone_uri',class_="medium",  placeholder=_('new value'))}
+                        ${h.text('clone_uri',class_="medium", placeholder=_('New URL'))}
                     </div>
                   %else:
                     ## not set yet, display form to set it
@@ -151,7 +151,7 @@
           $('#edit_clone_uri').hide();
           $('#clone_uri_hidden').hide();
           ## store hash of old value for change detection
-          var uri_change =  '<input id="clone_uri_change" name="clone_uri_change" type="hidden" value="${h.md5(c.repo_info.clone_uri or "").hexdigest()}" />';
+          var uri_change = '<input id="clone_uri_change" name="clone_uri_change" type="hidden" value="${h.md5(c.repo_info.clone_uri or "").hexdigest()}" />';
           $('#alter_clone_uri_help_block').html($('#alter_clone_uri_help_block').html()+" ("+$('#clone_uri_hidden_value').html()+")");
         });
 
--- a/kallithea/tests/functional/test_admin_repos.py	Tue Jun 09 22:51:01 2015 +0200
+++ b/kallithea/tests/functional/test_admin_repos.py	Tue Jun 09 22:53:24 2015 +0200
@@ -348,7 +348,7 @@
                                                 repo_description=description,
                                                 clone_uri='http://127.0.0.1/repo',
                                                 _authentication_token=self.authentication_token()))
-        response.mustcontain('invalid clone URL')
+        response.mustcontain('Invalid repository URL')
 
 
     def test_create_remote_repo_wrong_clone_uri_hg_svn(self):
@@ -362,7 +362,7 @@
                                                 repo_description=description,
                                                 clone_uri='svn+http://127.0.0.1/repo',
                                                 _authentication_token=self.authentication_token()))
-        response.mustcontain('invalid clone URL')
+        response.mustcontain('Invalid repository URL')
 
 
     def test_delete(self):