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
 
@@ -4534,12 +4534,22 @@ ul.user_group_member li {
 

	
 
.popover.bottom {
 
    margin-top: 10px;
 
}
 
.popover.bottom > .arrow {
 
    top: -11px;
 
    left: 50%;
 
    margin-left: -11px;
 
    border-top-width: 0;
 
    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
 
@@ -50,29 +50,31 @@ ${h.form(url('admin_settings'), method='
 
                    ##    <label>
 
                    ##        ${h.checkbox('extensions_hggit','True')}
 
                    ##        ${_('Enable hg-git extension')}
 
                    ##    </label>
 
                    ##</div>
 
                    ##<span class="help-block">${_('Requires hg-git library to be installed. Enables cloning of remote Git repositories while converting them to Mercurial.')}</span>
 
                </div>
 
            </div>
 
            %if c.visual.allow_repo_location_change:
 
            <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>
 
            %else:
 
            ## form still requires this but we cannot internally change it anyway
 
            ${h.hidden('paths_root_path',size=30,readonly="readonly")}
 
            %endif
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('save',_('Save Settings'),class_="btn btn-default")}
 
                    ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
                </div>
kallithea/templates/summary/summary.html
Show inline comments
 
@@ -57,31 +57,36 @@
 
<%def name="main()">
 
${self.repo_context_bar('summary')}
 
<%
 
summary = lambda n:{False:'summary-short'}.get(n)
 
%>
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <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>
 

	
 
            <div class="form-group clearfix">
 
              <label>${_('Description')}:</label>
 
              <div class="${summary(c.show_stats)} desc">${h.urlify_text(c.db_repo.description, stylize=c.visual.stylify_metatags)}</div>
 
            </div>
 

	
 
            <div class="form-group clearfix">
 
              <label>${_('Trending files')}:</label>
 
              <div class="${summary(c.show_stats)}">
 
                %if c.show_stats:
 
@@ -194,55 +199,43 @@ summary = lambda n:{False:'summary-short
 
    </div>
 
    <div class="readme panel-body">
 
      <div class="readme_box">
 
        ${c.readme_data|n}
 
      </div>
 
    </div>
 
</div>
 
</div>
 
%endif
 

	
 
<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 = {}
 
    $("#download_options").select2({
 
        placeholder: _TM['Select changeset'],
 
        dropdownAutoWidth: true,
 
        query: function(query){
 
          var key = 'cache';
 
          var cached = cache[key] ;
 
          if(cached) {
 
            var data = {results: []};
 
            //filter results
kallithea/tests/functional/test_summary.py
Show inline comments
 
@@ -15,63 +15,74 @@
 
from kallithea.tests.base import *
 
from kallithea.tests.fixture import Fixture
 
from kallithea.model.db import Repository
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.meta import Session
 
from kallithea.model.scm import ScmModel
 

	
 
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',
 
                                    action='index',
 
                                    repo_name=HG_REPO))
 

	
 
        #repo type
 
        response.mustcontain(
 
            """<span class="repotag">hg"""
 
        )
 
        #public/private
 
        response.mustcontain(
 
            """<i class="icon-globe">"""
 
        )
 

	
 
        # 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()
 
        ID = Repository.get_by_repo_name(GIT_REPO).repo_id
 
        response = self.app.get(url(controller='summary',
 
                                    action='index',
 
                                    repo_name=GIT_REPO))
 

	
 
        #repo type
 
        response.mustcontain(
 
            """<span class="repotag">git"""
 
        )
 
        #public/private
 
        response.mustcontain(
 
            """<i class="icon-globe">"""
 
        )
 

	
 
        # 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()
 
        ID = Repository.get_by_repo_name(HG_REPO).repo_id
 
        response = self.app.get(url(controller='summary',
 
                                    action='index',
 
                                    repo_name='_%s' % ID))
 

	
 
        #repo type
 
        response.mustcontain(
 
            """<span class="repotag">hg"""
 
        )
0 comments (0 inline, 0 general)