Changeset - 97ec8cf362c3
[Not reviewed]
default
0 4 0
Mads Kiilerich - 9 years ago 2017-02-16 02:42:37
mads@kiilerich.com
style: introduce Bootstrap input-group - especially for repo summary pages

Based on work by Dominik Ruf.
4 files changed with 53 insertions and 37 deletions:
0 comments (0 inline, 0 general)
kallithea/public/css/style.css
Show inline comments
 
@@ -4543,3 +4543,13 @@ ul.user_group_member li {
 
    border-bottom-color: #999;
 
    border-bottom-color: rgba(0,0,0,.25);
 
}
 

	
 
#clone_by_name.input-group > span,
 
#clone_by_id.input-group > span {
 
    display: inline-block;
 
}
 

	
 
#clone_by_name.input-group > input,
 
#clone_by_id.input-group > input {
 
    width: 80% !important;
 
}
kallithea/templates/admin/settings/settings_vcs.html
Show inline comments
 
@@ -59,11 +59,13 @@ ${h.form(url('admin_settings'), method='
 
            <div class="form-group">
 
                <label class="control-label" for="paths_root_path">${_('Location of repositories')}:</label>
 
                <div>
 
                    ${h.text('paths_root_path',size=60,readonly="readonly",class_='form-control')}
 
                    <span id="path_unlock" data-toggle="tooltip" style="cursor: pointer"
 
                    <div class="input-group">
 
                        ${h.text('paths_root_path',size=60,readonly="readonly",class_='form-control')}
 
                        <span id="path_unlock" data-toggle="tooltip" class="input-group-btn"
 
                            title="${_('Click to unlock. You must restart Kallithea in order to make this setting take effect.')}">
 
                        <span class="btn btn-default btn-sm"><i id="path_unlock_icon" class="icon-lock"></i></span>
 
                    </span>
 
                            <span class="btn btn-default btn-sm"><i id="path_unlock_icon" class="icon-lock"></i></span>
 
                        </span>
 
                    </div>
 
                    <span class="help-block">${_('Filesystem location where repositories are stored. After changing this value, a restart and rescan of the repository folder are both required.')}</span>
 
                </div>
 
            </div>
kallithea/templates/summary/summary.html
Show inline comments
 
@@ -66,13 +66,18 @@ summary = lambda n:{False:'summary-short
 
    <div id="summary-panel-body" class="form panel-body">
 
        <div id="summary" class="form-horizontal">
 
            <div class="form-group form-inline clearfix">
 
              <label>${_('Clone URL')}:</label>
 
                <div class="${summary(c.show_stats)}">
 
                  ${self.repotag(c.db_repo)}
 
                  <input style="width:80%" type="text" id="clone_url" readonly="readonly" value="${c.clone_repo_url}"/>
 
                  <input style="display:none;width:80%" type="text" id="clone_url_id" readonly="readonly" value="${c.clone_repo_url_id}"/>
 
                  <div style="display:none" id="clone_by_name" class="btn btn-default btn-sm">${_('Show by Name')}</div>
 
                  <div id="clone_by_id" class="btn btn-default btn-sm">${_('Show by ID')}</div>
 
                <label>${_('Clone URL')}:</label>
 
                <div id="clone-url">
 
                  <div id="clone_by_name" class="input-group">
 
                    <span class="input-group-addon">${self.repotag(c.db_repo)}</span>
 
                    <input class="form-control" size="80" readonly="readonly" value="${c.clone_repo_url}"/>
 
                    <span class="input-group-addon btn">${_('Show by ID')}</span>
 
                  </div>
 
                  <div id="clone_by_id" class="input-group" style="display:none">
 
                    <span class="input-group-addon">${self.repotag(c.db_repo)}</span>
 
                    <input class="form-control" size="80" readonly="readonly" value="${c.clone_repo_url_id}"/>
 
                    <span class="input-group-addon btn">${_('Show by Name')}</span>
 
                  </div>
 
                </div>
 
            </div>
 

	
 
@@ -203,37 +208,25 @@ summary = lambda n:{False:'summary-short
 

	
 
<script type="text/javascript">
 
$(document).ready(function(){
 
    var $clone_url = $('#clone_url');
 
    var $clone_url_id = $('#clone_url_id');
 
    var $clone_by_name = $('#clone_by_name');
 
    var $clone_by_id = $('#clone_by_id');
 
    $clone_url.click(function(e){
 
        if($clone_url.hasClass('selected')){
 
    $('#clone-url input').click(function(e){
 
        if($(this).hasClass('selected')){
 
            $(this).removeClass('selected');
 
            return ;
 
        }else{
 
            $clone_url.addClass('selected');
 
            $clone_url.select();
 
            $(this).addClass('selected');
 
            $(this).select();
 
        }
 
    });
 

	
 
    $clone_by_name.click(function(e){
 
        // show url by name and hide name button
 
        $clone_url.show();
 
    var $clone_by_name = $('#clone_by_name');
 
    var $clone_by_id = $('#clone_by_id');
 
    $clone_by_name.find('.btn').click(function(e){
 
        $clone_by_name.hide();
 

	
 
        // hide url by id and show name button
 
        $clone_by_id.show();
 
        $clone_url_id.hide();
 
    });
 

	
 
    $clone_by_id.click(function(e){
 
        // show url by id and hide id button
 
    $clone_by_id.find('.btn').click(function(e){
 
        $clone_by_id.hide();
 
        $clone_url_id.show();
 

	
 
        // hide url by name and show id button
 
        $clone_by_name.show();
 
        $clone_url.hide();
 
    });
 

	
 
    var cache = {}
kallithea/tests/functional/test_summary.py
Show inline comments
 
@@ -24,7 +24,7 @@ fixture = Fixture()
 

	
 
class TestSummaryController(TestController):
 

	
 
    def test_index(self):
 
    def test_index_hg(self):
 
        self.log_user()
 
        ID = Repository.get_by_repo_name(HG_REPO).repo_id
 
        response = self.app.get(url(controller='summary',
 
@@ -41,8 +41,14 @@ class TestSummaryController(TestControll
 
        )
 

	
 
        # clone url...
 
        response.mustcontain('''id="clone_url" readonly="readonly" value="http://%s@localhost:80/%s"''' % (TEST_USER_ADMIN_LOGIN, HG_REPO))
 
        response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://%s@localhost:80/_%s"''' % (TEST_USER_ADMIN_LOGIN, ID))
 
        response.mustcontain(
 
            '''<input class="form-control" size="80" readonly="readonly" value="http://%s@localhost:80/%s"/>''' %
 
            (TEST_USER_ADMIN_LOGIN, HG_REPO)
 
        )
 
        response.mustcontain(
 
            '''<input class="form-control" size="80" readonly="readonly" value="http://%s@localhost:80/_%s"/>''' %
 
            (TEST_USER_ADMIN_LOGIN, ID)
 
        )
 

	
 
    def test_index_git(self):
 
        self.log_user()
 
@@ -61,8 +67,13 @@ class TestSummaryController(TestControll
 
        )
 

	
 
        # clone url...
 
        response.mustcontain('''id="clone_url" readonly="readonly" value="http://%s@localhost:80/%s"''' % (TEST_USER_ADMIN_LOGIN, GIT_REPO))
 
        response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://%s@localhost:80/_%s"''' % (TEST_USER_ADMIN_LOGIN, ID))
 
        response.mustcontain(
 
            '''<input class="form-control" size="80" readonly="readonly" value="http://%s@localhost:80/%s"/>''' %
 
            (TEST_USER_ADMIN_LOGIN, GIT_REPO))
 
        response.mustcontain(
 
            '''<input class="form-control" size="80" readonly="readonly" value="http://%s@localhost:80/_%s"/>''' %
 
            (TEST_USER_ADMIN_LOGIN, ID)
 
        )
 

	
 
    def test_index_by_id_hg(self):
 
        self.log_user()
0 comments (0 inline, 0 general)