Mercurial > kallithea
changeset 6501:97ec8cf362c3
style: introduce Bootstrap input-group - especially for repo summary pages
Based on work by Dominik Ruf.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 16 Feb 2017 02:42:37 +0100 |
parents | 78f08233a28c |
children | 03746b8cd5c9 |
files | kallithea/public/css/style.css kallithea/templates/admin/settings/settings_vcs.html kallithea/templates/summary/summary.html kallithea/tests/functional/test_summary.py |
diffstat | 4 files changed, 53 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/public/css/style.css Thu Feb 16 01:54:36 2017 +0100 +++ b/kallithea/public/css/style.css Thu Feb 16 02:42:37 2017 +0100 @@ -4543,3 +4543,13 @@ 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; +}
--- a/kallithea/templates/admin/settings/settings_vcs.html Thu Feb 16 01:54:36 2017 +0100 +++ b/kallithea/templates/admin/settings/settings_vcs.html Thu Feb 16 02:42:37 2017 +0100 @@ -59,11 +59,13 @@ <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>
--- a/kallithea/templates/summary/summary.html Thu Feb 16 01:54:36 2017 +0100 +++ b/kallithea/templates/summary/summary.html Thu Feb 16 02:42:37 2017 +0100 @@ -66,13 +66,18 @@ <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 @@ <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 = {}
--- a/kallithea/tests/functional/test_summary.py Thu Feb 16 01:54:36 2017 +0100 +++ b/kallithea/tests/functional/test_summary.py Thu Feb 16 02:42:37 2017 +0100 @@ -24,7 +24,7 @@ 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 @@ ) # 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 @@ ) # 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()