Changeset - eaf600434cf5
[Not reviewed]
default
0 3 0
Mads Kiilerich - 8 years ago 2017-11-27 02:55:44
mads@kiilerich.com
less: change markup and styling for the logo shown in the top left corner

Based on work by Dominik Ruf, but in this changeset, the goal is just to
improve markup and styling while keeping exactly the same look and feel. In
that process, it also fixes some browser specific issues that gave odd
spacing/positioning.

All styling (especially the logo image URL) is moved to CSS/LESS, using
background-image styling instead of an img tag.

The logo image is made a :before on the site branding text and will usually
have to align with this text, so we use inline-block to align to the baseline.

We set the right amount of negative margin-bottom so the image can go below the
baseline.

We use a "big enough" negative margin-top to allow the image to bleed outside
the line height and into the 12px top padding.

We assume the background image doesn't need cropping or panning and do thus not
set background-size, background-position, or background-repeat.
3 files changed with 24 insertions and 10 deletions:
0 comments (0 inline, 0 general)
kallithea/public/css/style.css
Show inline comments
 
@@ -53,99 +53,106 @@ div.formatted-fixed,
 
i[class^='icon-empty'],
 
i[class^='icon-gravatar'] {
 
  background-repeat: no-repeat;
 
  background-position: center;
 
  display: inline-block;
 
  min-width: 16px;
 
  min-height: 16px;
 
  margin: -2px 0 -4px 0;
 
}
 
.inline-comments-general.show-general-status .hidden.general-only {
 
  display: block !important;
 
}
 
.truncate {
 
  white-space: nowrap;
 
  overflow: hidden;
 
  text-overflow: ellipsis;
 
  -o-text-overflow: ellipsis;
 
  -ms-text-overflow: ellipsis;
 
}
 
.truncate.autoexpand:hover {
 
  overflow: visible;
 
}
 
/* show comment anchors when hovering over panel-heading */
 
a.permalink {
 
  visibility: hidden;
 
}
 
.panel-heading:hover .permalink {
 
  visibility: visible;
 
}
 
.navbar-inverse {
 
  border: none;
 
}
 
.navbar-inverse .navbar-nav > .active > a,
 
.navbar-inverse .navbar-nav > .active > a:hover,
 
.navbar-inverse .navbar-nav > .active > a:focus {
 
  background-color: inherit;
 
}
 
nav.navbar .navbar-brand:hover,
 
nav.navbar .navbar-brand {
 
  font-size: 20px;
 
  padding-top: 12px;
 
  color: white !important;
 
  height: 44px;
 
}
 
nav.navbar {
 
  min-height: 44px;
 
  background-color: #577632;
 
}
 
nav.navbar #logo > .navbar-brand > img {
 
  margin-top: -9px;
 
  margin-right: 5px;
 
/* logo */
 
.navbar-brand .branding:before {
 
  content: "";
 
  display: inline-block;
 
  margin-right: .2em;
 
  background-image: url("../images/kallithea-logo.svg");
 
  width: 140px;
 
  height: 30px;
 
  margin-bottom: -4px;
 
  margin-top: -12px;
 
}
 
/* every direct child of a panel, that is not .panel-heading, should auto
 
 * overflow to prevent overflowing of elements like text boxes and tables */
 
.panel > :not(.panel-heading) {
 
  overflow-x: auto;
 
  min-height: 0.01%;
 
}
 
/* language bars (summary page) */
 
#lang_stats .progress-bar {
 
  min-width: 15px;
 
  border-top-right-radius: 8px;
 
  border-bottom-right-radius: 8px;
 
}
 
#lang_stats td {
 
  padding: 1px 0 !important;
 
}
 
/* every direct child of a main panel, that is not .panel-heading, should auto
 
 * overflow to prevent overflowing of elements like text boxes and tables */
 
#main > .panel > :not(.panel-heading) {
 
  overflow-x: auto;
 
  min-height: 0.01%;
 
}
 
/* use pointer cursor for expand_commit */
 
.expand_commit .icon-align-left {
 
  cursor: pointer;
 
  color: #999;
 
}
 
/* don't break author, date and comment cells into multiple lines in changeset table */
 
table.changesets .author,
 
table.changesets .date,
 
table.changesets .comments {
 
  white-space: nowrap;
 
}
 
/* textareas should be at least 100px high and 400px wide */
 
textarea.form-control {
 
  min-height: 100px;
 
  min-width: 400px;
 
}
 
/* add some space between the code-browser icons and the file names */
 
.browser-dir > i[class^='icon-'],
 
.submodule-dir > i[class^='icon-'],
 
.browser-file > i[class^='icon-'] {
 
  padding-right: 0.3em;
 
}
 
.form-group > label {
 
  float: left;
 
}
 
.dt_repo_pending {
kallithea/public/less/style.less
Show inline comments
 
@@ -61,99 +61,109 @@ i[class^='icon-gravatar'] {
 
  background-position: center;
 
  display: inline-block;
 
  min-width: 16px;
 
  min-height: 16px;
 
  margin: -2px 0 -4px 0;
 
}
 

	
 
.inline-comments-general.show-general-status .hidden.general-only {
 
  display: block !important;
 
}
 
.truncate {
 
  white-space: nowrap;
 
  overflow: hidden;
 
  text-overflow: ellipsis;
 
  -o-text-overflow: ellipsis;
 
  -ms-text-overflow: ellipsis;
 
}
 
.truncate.autoexpand:hover {
 
  overflow: visible;
 
}
 

	
 
/* show comment anchors when hovering over panel-heading */
 
a.permalink {
 
  visibility: hidden;
 
}
 
.panel-heading:hover .permalink {
 
  visibility: visible;
 
}
 

	
 
.navbar-inverse {
 
  border: none;
 
}
 
.navbar-inverse .navbar-nav > .active > a,
 
.navbar-inverse .navbar-nav > .active > a:hover,
 
.navbar-inverse .navbar-nav > .active > a:focus {
 
  background-color: inherit;
 
}
 
nav.navbar .navbar-brand:hover,
 
nav.navbar .navbar-brand {
 
  font-size: 20px;
 
  padding-top: 12px;
 
  color: white !important;
 
  height: 44px;
 
}
 
nav.navbar {
 
  min-height: 44px;
 
  background-color: #577632;
 
}
 
nav.navbar #logo > .navbar-brand > img {
 
  margin-top: -9px;
 
  margin-right: 5px;
 

	
 
/* logo */
 
.navbar-brand .branding {
 
  &:before {
 
    content: "";
 
    display: inline-block;
 
    margin-right: .2em;
 
    background-image: url("../images/kallithea-logo.svg");
 
    width: 140px;
 
    height: 30px;
 
    margin-bottom: -4px;
 
    margin-top: -12px;
 
  }
 
}
 

	
 
/* every direct child of a panel, that is not .panel-heading, should auto
 
 * overflow to prevent overflowing of elements like text boxes and tables */
 
.panel > :not(.panel-heading){
 
  overflow-x: auto;
 
  min-height: 0.01%;
 
}
 

	
 
/* language bars (summary page) */
 
#lang_stats {
 
  .progress-bar {
 
    min-width: 15px;
 
    border-top-right-radius: 8px;
 
    border-bottom-right-radius: 8px;
 
  }
 
  td {
 
    padding: 1px 0 !important;
 
  }
 
}
 

	
 
/* every direct child of a main panel, that is not .panel-heading, should auto
 
 * overflow to prevent overflowing of elements like text boxes and tables */
 
#main > .panel > :not(.panel-heading) {
 
  overflow-x: auto;
 
  min-height: 0.01%;
 
}
 

	
 
/* use pointer cursor for expand_commit */
 
.expand_commit .icon-align-left {
 
  cursor: pointer;
 
  color: #999;
 
}
 

	
 
/* don't break author, date and comment cells into multiple lines in changeset table */
 
table.changesets {
 
  .author,
 
  .date,
 
  .comments {
 
    white-space: nowrap;
 
  }
 
}
 

	
 
/* textareas should be at least 100px high and 400px wide */
 
textarea.form-control {
 
  min-height: 100px;
 
  min-width: 400px;
 
}
kallithea/templates/base/root.html
Show inline comments
 
@@ -71,72 +71,69 @@
 
        <script type="text/javascript" src="${h.url('/js/jquery.dataTables.min.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript" src="${h.url('/js/bootstrap.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript" src="${h.url('/js/select2/select2.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript" src="${h.url('/js/native.history.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript" src="${h.url('/js/base.js', ver=c.kallithea_version)}"></script>
 
        ## EXTRA FOR JS
 
        <%block name="js_extra"/>
 
        <script type="text/javascript">
 
            (function(window,undefined){
 
                var History = window.History; // Note: We are using a capital H instead of a lower h
 
                if ( !History.enabled ) {
 
                     // History.js is disabled for this browser.
 
                     // This is because we can optionally choose to support HTML4 browsers or not.
 
                    return false;
 
                }
 
            })(window);
 

	
 
            $(document).ready(function(){
 
              tooltip_activate();
 
              show_more_event();
 
              // routes registration
 
              pyroutes.register('home', ${h.js(h.url('home'))}, []);
 
              pyroutes.register('new_gist', ${h.js(h.url('new_gist'))}, []);
 
              pyroutes.register('gists', ${h.js(h.url('gists'))}, []);
 
              pyroutes.register('new_repo', ${h.js(h.url('new_repo'))}, []);
 

	
 
              pyroutes.register('summary_home', ${h.js(h.url('summary_home', repo_name='%(repo_name)s'))}, ['repo_name']);
 
              pyroutes.register('changelog_home', ${h.js(h.url('changelog_home', repo_name='%(repo_name)s'))}, ['repo_name']);
 
              pyroutes.register('files_home', ${h.js(h.url('files_home', repo_name='%(repo_name)s',revision='%(revision)s',f_path='%(f_path)s'))}, ['repo_name', 'revision', 'f_path']);
 
              pyroutes.register('edit_repo', ${h.js(h.url('edit_repo', repo_name='%(repo_name)s'))}, ['repo_name']);
 
              pyroutes.register('edit_repo_perms', ${h.js(h.url('edit_repo_perms', repo_name='%(repo_name)s'))}, ['repo_name']);
 
              pyroutes.register('pullrequest_home', ${h.js(h.url('pullrequest_home', repo_name='%(repo_name)s'))}, ['repo_name']);
 

	
 
              pyroutes.register('toggle_following', ${h.js(h.url('toggle_following'))});
 
              pyroutes.register('changeset_info', ${h.js(h.url('changeset_info', repo_name='%(repo_name)s', revision='%(revision)s'))}, ['repo_name', 'revision']);
 
              pyroutes.register('changeset_home', ${h.js(h.url('changeset_home', repo_name='%(repo_name)s', revision='%(revision)s'))}, ['repo_name', 'revision']);
 
              pyroutes.register('repo_size', ${h.js(h.url('repo_size', repo_name='%(repo_name)s'))}, ['repo_name']);
 
              pyroutes.register('repo_refs_data', ${h.js(h.url('repo_refs_data', repo_name='%(repo_name)s'))}, ['repo_name']);
 
              pyroutes.register('users_and_groups_data', ${h.js(h.url('users_and_groups_data'))}, []);
 
             });
 
        </script>
 

	
 
        <%block name="head_extra"/>
 
    </head>
 
    <body>
 
      <nav class="navbar navbar-inverse mainmenu">
 
          <div class="navbar-header" id="logo">
 
            <a class="navbar-brand" href="${h.url('home')}">
 
                <img class="pull-left" src="${h.url('/images/kallithea-logo.svg')}" alt="Kallithea"/>
 
                  %if c.site_name:
 
                    <span class="branding">${c.site_name}</span>
 
                  %endif
 
              <span class="branding">${c.site_name}</span>
 
            </a>
 
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
 
              <span class="sr-only">Toggle navigation</span>
 
              <span class="icon-bar"></span>
 
              <span class="icon-bar"></span>
 
              <span class="icon-bar"></span>
 
            </button>
 
          </div>
 
          <div id="navbar" class="navbar-collapse collapse">
 
            <%block name="header_menu"/>
 
          </div>
 
      </nav>
 

	
 
      ${next.body()}
 

	
 
      %if c.ga_code:
 
      ${h.literal(c.ga_code)}
 
      %endif
 
    </body>
 
</html>
0 comments (0 inline, 0 general)