Changeset - fb9550946c26
[Not reviewed]
default
0 58 0
Mads Kiilerich - 6 years ago 2020-02-17 17:49:45
mads@kiilerich.com
Grafted from: edc09f90d6f0
js: use strict ... and fix the problems it points out

"use strict" gives stricter checks, both statically and at runtime. The
strictness tightens up the code and prevents some kinds of problems.

The <script> tag addition might not be pretty, but has consistently been added
with:

sed -i 's,<script>$,&'"'"'use strict'"'"';,g' `hg loc '*.html'`
58 files changed with 105 insertions and 101 deletions:
0 comments (0 inline, 0 general)
kallithea/public/fontello/demo.html
Show inline comments
 
@@ -87,373 +87,373 @@ a:hover {
 
  float: left;
 
  min-height: 1px;
 
  margin-left: 20px;
 
}
 
.container,
 
.navbar-static-top .container,
 
.navbar-fixed-top .container,
 
.navbar-fixed-bottom .container {
 
  width: 940px;
 
}
 
.span12 {
 
  width: 940px;
 
}
 
.span11 {
 
  width: 860px;
 
}
 
.span10 {
 
  width: 780px;
 
}
 
.span9 {
 
  width: 700px;
 
}
 
.span8 {
 
  width: 620px;
 
}
 
.span7 {
 
  width: 540px;
 
}
 
.span6 {
 
  width: 460px;
 
}
 
.span5 {
 
  width: 380px;
 
}
 
.span4 {
 
  width: 300px;
 
}
 
.span3 {
 
  width: 220px;
 
}
 
.span2 {
 
  width: 140px;
 
}
 
.span1 {
 
  width: 60px;
 
}
 
[class*="span"].pull-right,
 
.row-fluid [class*="span"].pull-right {
 
  float: right;
 
}
 
.container {
 
  margin-right: auto;
 
  margin-left: auto;
 
  *zoom: 1;
 
}
 
.container:before,
 
.container:after {
 
  display: table;
 
  content: "";
 
  line-height: 0;
 
}
 
.container:after {
 
  clear: both;
 
}
 
p {
 
  margin: 0 0 10px;
 
}
 
.lead {
 
  margin-bottom: 20px;
 
  font-size: 21px;
 
  font-weight: 200;
 
  line-height: 30px;
 
}
 
small {
 
  font-size: 85%;
 
}
 
h1 {
 
  margin: 10px 0;
 
  font-family: inherit;
 
  font-weight: bold;
 
  line-height: 20px;
 
  color: inherit;
 
  text-rendering: optimizelegibility;
 
}
 
h1 small {
 
  font-weight: normal;
 
  line-height: 1;
 
  color: #999;
 
}
 
h1 {
 
  line-height: 40px;
 
}
 
h1 {
 
  font-size: 38.5px;
 
}
 
h1 small {
 
  font-size: 24.5px;
 
}
 
body {
 
  margin-top: 90px;
 
}
 
.header {
 
  position: fixed;
 
  top: 0;
 
  left: 50%;
 
  margin-left: -480px;
 
  background-color: #fff;
 
  border-bottom: 1px solid #ddd;
 
  padding-top: 10px;
 
  z-index: 10;
 
}
 
.footer {
 
  color: #ddd;
 
  font-size: 12px;
 
  text-align: center;
 
  margin-top: 20px;
 
}
 
.footer a {
 
  color: #ccc;
 
  text-decoration: underline;
 
}
 
.the-icons {
 
  font-size: 14px;
 
  line-height: 24px;
 
}
 
.switch {
 
  position: absolute;
 
  right: 0;
 
  bottom: 10px;
 
  color: #666;
 
}
 
.switch input {
 
  margin-right: 0.3em;
 
}
 
.codesOn .i-name {
 
  display: none;
 
}
 
.codesOn .i-code {
 
  display: inline;
 
}
 
.i-code {
 
  display: none;
 
}
 
@font-face {
 
      font-family: 'kallithea';
 
      src: url('./font/kallithea.eot?61441093');
 
      src: url('./font/kallithea.eot?61441093#iefix') format('embedded-opentype'),
 
           url('./font/kallithea.woff?61441093') format('woff'),
 
           url('./font/kallithea.ttf?61441093') format('truetype'),
 
           url('./font/kallithea.svg?61441093#kallithea') format('svg');
 
      font-weight: normal;
 
      font-style: normal;
 
    }
 
     
 
     
 
    .demo-icon
 
    {
 
      font-family: "kallithea";
 
      font-style: normal;
 
      font-weight: normal;
 
      speak: none;
 
     
 
      display: inline-block;
 
      text-decoration: inherit;
 
      width: 1em;
 
      margin-right: .2em;
 
      text-align: center;
 
      /* opacity: .8; */
 
     
 
      /* For safety - reset parent styles, that can break glyph codes*/
 
      font-variant: normal;
 
      text-transform: none;
 
     
 
      /* fix buttons height, for twitter bootstrap */
 
      line-height: 1em;
 
     
 
      /* Animation center compensation - margins should be symmetric */
 
      /* remove if not needed */
 
      margin-left: .2em;
 
     
 
      /* You can be more comfortable with increased icons size */
 
      /* font-size: 120%; */
 
     
 
      /* Font smoothing. That was taken from TWBS */
 
      -webkit-font-smoothing: antialiased;
 
      -moz-osx-font-smoothing: grayscale;
 
     
 
      /* Uncomment for 3D effect */
 
      /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
 
    }
 
     </style>
 
    <link rel="stylesheet" href="css/animation.css"><!--[if IE 7]><link rel="stylesheet" href="css/kallithea-ie7.css"><![endif]-->
 
    <script>
 
    <script>'use strict';
 
      function toggleCodes(on) {
 
        var obj = document.getElementById('icons');
 
      
 
        if (on) {
 
          obj.className += ' codesOn';
 
        } else {
 
          obj.className = obj.className.replace(' codesOn', '');
 
        }
 
      }
 
      
 
    </script>
 
  </head>
 
  <body>
 
    <div class="container header">
 
      <h1>
 
        kallithea
 
         <small>font demo</small>
 
      </h1>
 
      <label class="switch">
 
        <input type="checkbox" onclick="toggleCodes(this.checked)">show codes
 
      </label>
 
    </div>
 
    <div id="icons" class="container">
 
      <div class="row">
 
        <div title="Code: 0x2022" class="the-icons span3"><i class="demo-icon icon-circle">&#x2022;</i> <span class="i-name">icon-circle</span><span class="i-code">0x2022</span></div>
 
        <div title="Code: 0x2190" class="the-icons span3"><i class="demo-icon icon-right-open">&#x2190;</i> <span class="i-name">icon-right-open</span><span class="i-code">0x2190</span></div>
 
        <div title="Code: 0x2191" class="the-icons span3"><i class="demo-icon icon-up-open">&#x2191;</i> <span class="i-name">icon-up-open</span><span class="i-code">0x2191</span></div>
 
        <div title="Code: 0x2192" class="the-icons span3"><i class="demo-icon icon-left-open">&#x2192;</i> <span class="i-name">icon-left-open</span><span class="i-code">0x2192</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x2193" class="the-icons span3"><i class="demo-icon icon-down-open">&#x2193;</i> <span class="i-name">icon-down-open</span><span class="i-code">0x2193</span></div>
 
        <div title="Code: 0x2194" class="the-icons span3"><i class="demo-icon icon-code">&#x2194;</i> <span class="i-name">icon-code</span><span class="i-code">0x2194</span></div>
 
        <div title="Code: 0x2195" class="the-icons span3"><i class="demo-icon icon-sort">&#x2195;</i> <span class="i-name">icon-sort</span><span class="i-code">0x2195</span></div>
 
        <div title="Code: 0x21c4" class="the-icons span3"><i class="demo-icon icon-exchange">&#x21c4;</i> <span class="i-name">icon-exchange</span><span class="i-code">0x21c4</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x2295" class="the-icons span3"><i class="demo-icon icon-plus-circled">&#x2295;</i> <span class="i-name">icon-plus-circled</span><span class="i-code">0x2295</span></div>
 
        <div title="Code: 0x2296" class="the-icons span3"><i class="demo-icon icon-minus-circled">&#x2296;</i> <span class="i-name">icon-minus-circled</span><span class="i-code">0x2296</span></div>
 
        <div title="Code: 0x229e" class="the-icons span3"><i class="demo-icon icon-diff-added">&#x229e;</i> <span class="i-name">icon-diff-added</span><span class="i-code">0x229e</span></div>
 
        <div title="Code: 0x229f" class="the-icons span3"><i class="demo-icon icon-diff-removed">&#x229f;</i> <span class="i-name">icon-diff-removed</span><span class="i-code">0x229f</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x22a1" class="the-icons span3"><i class="demo-icon icon-diff-modified">&#x22a1;</i> <span class="i-name">icon-diff-modified</span><span class="i-code">0x22a1</span></div>
 
        <div title="Code: 0x231a" class="the-icons span3"><i class="demo-icon icon-clock">&#x231a;</i> <span class="i-name">icon-clock</span><span class="i-code">0x231a</span></div>
 
        <div title="Code: 0x23f4" class="the-icons span3"><i class="demo-icon icon-triangle-left">&#x23f4;</i> <span class="i-name">icon-triangle-left</span><span class="i-code">0x23f4</span></div>
 
        <div title="Code: 0x23f5" class="the-icons span3"><i class="demo-icon icon-triangle-right">&#x23f5;</i> <span class="i-name">icon-triangle-right</span><span class="i-code">0x23f5</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x23f6" class="the-icons span3"><i class="demo-icon icon-triangle-up">&#x23f6;</i> <span class="i-name">icon-triangle-up</span><span class="i-code">0x23f6</span></div>
 
        <div title="Code: 0x23f7" class="the-icons span3"><i class="demo-icon icon-triangle-down">&#x23f7;</i> <span class="i-name">icon-triangle-down</span><span class="i-code">0x23f7</span></div>
 
        <div title="Code: 0x25e6" class="the-icons span3"><i class="demo-icon icon-circle-empty">&#x25e6;</i> <span class="i-name">icon-circle-empty</span><span class="i-code">0x25e6</span></div>
 
        <div title="Code: 0x2661" class="the-icons span3"><i class="demo-icon icon-heart-empty">&#x2661;</i> <span class="i-name">icon-heart-empty</span><span class="i-code">0x2661</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x2665" class="the-icons span3"><i class="demo-icon icon-heart">&#x2665;</i> <span class="i-name">icon-heart</span><span class="i-code">0x2665</span></div>
 
        <div title="Code: 0x2699" class="the-icons span3"><i class="demo-icon icon-cog-alt">&#x2699;</i> <span class="i-name">icon-cog-alt</span><span class="i-code">0x2699</span></div>
 
        <div title="Code: 0x26c3" class="the-icons span3"><i class="demo-icon icon-database">&#x26c3;</i> <span class="i-name">icon-database</span><span class="i-code">0x26c3</span></div>
 
        <div title="Code: 0x26ed" class="the-icons span3"><i class="demo-icon icon-gear">&#x26ed;</i> <span class="i-name">icon-gear</span><span class="i-code">0x26ed</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x2795" class="the-icons span3"><i class="demo-icon icon-plus">&#x2795;</i> <span class="i-name">icon-plus</span><span class="i-code">0x2795</span></div>
 
        <div title="Code: 0x2796" class="the-icons span3"><i class="demo-icon icon-minus">&#x2796;</i> <span class="i-name">icon-minus</span><span class="i-code">0x2796</span></div>
 
        <div title="Code: 0x2b65" class="the-icons span3"><i class="demo-icon icon-resize-vertical">&#x2b65;</i> <span class="i-name">icon-resize-vertical</span><span class="i-code">0x2b65</span></div>
 
        <div title="Code: 0x2b71" class="the-icons span3"><i class="demo-icon icon-move-up">&#x2b71;</i> <span class="i-name">icon-move-up</span><span class="i-code">0x2b71</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x2b73" class="the-icons span3"><i class="demo-icon icon-move-down">&#x2b73;</i> <span class="i-name">icon-move-down</span><span class="i-code">0x2b73</span></div>
 
        <div title="Code: 0xe801" class="the-icons span3"><i class="demo-icon icon-file-submodule">&#xe801;</i> <span class="i-name">icon-file-submodule</span><span class="i-code">0xe801</span></div>
 
        <div title="Code: 0xe802" class="the-icons span3"><i class="demo-icon icon-git-merge">&#xe802;</i> <span class="i-name">icon-git-merge</span><span class="i-code">0xe802</span></div>
 
        <div title="Code: 0xe811" class="the-icons span3"><i class="demo-icon icon-ruler">&#xe811;</i> <span class="i-name">icon-ruler</span><span class="i-code">0xe811</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0xe813" class="the-icons span3"><i class="demo-icon icon-download-cloud">&#xe813;</i> <span class="i-name">icon-download-cloud</span><span class="i-code">0xe813</span></div>
 
        <div title="Code: 0xe814" class="the-icons span3"><i class="demo-icon icon-upload-cloud">&#xe814;</i> <span class="i-name">icon-upload-cloud</span><span class="i-code">0xe814</span></div>
 
        <div title="Code: 0xe815" class="the-icons span3"><i class="demo-icon icon-graph">&#xe815;</i> <span class="i-name">icon-graph</span><span class="i-code">0xe815</span></div>
 
        <div title="Code: 0xe816" class="the-icons span3"><i class="demo-icon icon-file-zip">&#xe816;</i> <span class="i-name">icon-file-zip</span><span class="i-code">0xe816</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0xe81a" class="the-icons span3"><i class="demo-icon icon-file-code">&#xe81a;</i> <span class="i-name">icon-file-code</span><span class="i-code">0xe81a</span></div>
 
        <div title="Code: 0xe81c" class="the-icons span3"><i class="demo-icon icon-doc-text-inv">&#xe81c;</i> <span class="i-name">icon-doc-text-inv</span><span class="i-code">0xe81c</span></div>
 
        <div title="Code: 0xe81d" class="the-icons span3"><i class="demo-icon icon-diff">&#xe81d;</i> <span class="i-name">icon-diff</span><span class="i-code">0xe81d</span></div>
 
        <div title="Code: 0xe81e" class="the-icons span3"><i class="demo-icon icon-diff-ignored">&#xe81e;</i> <span class="i-name">icon-diff-ignored</span><span class="i-code">0xe81e</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0xe81f" class="the-icons span3"><i class="demo-icon icon-diff-renamed">&#xe81f;</i> <span class="i-name">icon-diff-renamed</span><span class="i-code">0xe81f</span></div>
 
        <div title="Code: 0xe820" class="the-icons span3"><i class="demo-icon icon-paste">&#xe820;</i> <span class="i-name">icon-paste</span><span class="i-code">0xe820</span></div>
 
        <div title="Code: 0xe823" class="the-icons span3"><i class="demo-icon icon-file-directory">&#xe823;</i> <span class="i-name">icon-file-directory</span><span class="i-code">0xe823</span></div>
 
        <div title="Code: 0xe824" class="the-icons span3"><i class="demo-icon icon-git-compare">&#xe824;</i> <span class="i-name">icon-git-compare</span><span class="i-code">0xe824</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0xe825" class="the-icons span3"><i class="demo-icon icon-git-pull-request">&#xe825;</i> <span class="i-name">icon-git-pull-request</span><span class="i-code">0xe825</span></div>
 
        <div title="Code: 0xe827" class="the-icons span3"><i class="demo-icon icon-repo-forked">&#xe827;</i> <span class="i-name">icon-repo-forked</span><span class="i-code">0xe827</span></div>
 
        <div title="Code: 0xe828" class="the-icons span3"><i class="demo-icon icon-fork">&#xe828;</i> <span class="i-name">icon-fork</span><span class="i-code">0xe828</span></div>
 
        <div title="Code: 0xe834" class="the-icons span3"><i class="demo-icon icon-docs">&#xe834;</i> <span class="i-name">icon-docs</span><span class="i-code">0xe834</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0xe836" class="the-icons span3"><i class="demo-icon icon-doc-inv">&#xe836;</i> <span class="i-name">icon-doc-inv</span><span class="i-code">0xe836</span></div>
 
        <div title="Code: 0xe837" class="the-icons span3"><i class="demo-icon icon-file-powerpoint">&#xe837;</i> <span class="i-name">icon-file-powerpoint</span><span class="i-code">0xe837</span></div>
 
        <div title="Code: 0xe83d" class="the-icons span3"><i class="demo-icon icon-tags">&#xe83d;</i> <span class="i-name">icon-tags</span><span class="i-code">0xe83d</span></div>
 
        <div title="Code: 0xe83f" class="the-icons span3"><i class="demo-icon icon-bookmark-empty">&#xe83f;</i> <span class="i-name">icon-bookmark-empty</span><span class="i-code">0xe83f</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0xe840" class="the-icons span3"><i class="demo-icon icon-bookmark">&#xe840;</i> <span class="i-name">icon-bookmark</span><span class="i-code">0xe840</span></div>
 
        <div title="Code: 0xe841" class="the-icons span3"><i class="demo-icon icon-align-left">&#xe841;</i> <span class="i-name">icon-align-left</span><span class="i-code">0xe841</span></div>
 
        <div title="Code: 0xe843" class="the-icons span3"><i class="demo-icon icon-sliders">&#xe843;</i> <span class="i-name">icon-sliders</span><span class="i-code">0xe843</span></div>
 
        <div title="Code: 0xe851" class="the-icons span3"><i class="demo-icon icon-eye-off">&#xe851;</i> <span class="i-name">icon-eye-off</span><span class="i-code">0xe851</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0xe855" class="the-icons span3"><i class="demo-icon icon-rss">&#xe855;</i> <span class="i-name">icon-rss</span><span class="i-code">0xe855</span></div>
 
        <div title="Code: 0xe856" class="the-icons span3"><i class="demo-icon icon-rss-squared">&#xe856;</i> <span class="i-name">icon-rss-squared</span><span class="i-code">0xe856</span></div>
 
        <div title="Code: 0xe859" class="the-icons span3"><i class="demo-icon icon-strike">&#xe859;</i> <span class="i-name">icon-strike</span><span class="i-code">0xe859</span></div>
 
        <div title="Code: 0xe85e" class="the-icons span3"><i class="demo-icon icon-box">&#xe85e;</i> <span class="i-name">icon-box</span><span class="i-code">0xe85e</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0xe85f" class="the-icons span3"><i class="demo-icon icon-right">&#xe85f;</i> <span class="i-name">icon-right</span><span class="i-code">0xe85f</span></div>
 
        <div title="Code: 0xe860" class="the-icons span3"><i class="demo-icon icon-left">&#xe860;</i> <span class="i-name">icon-left</span><span class="i-code">0xe860</span></div>
 
        <div title="Code: 0xe861" class="the-icons span3"><i class="demo-icon icon-left-circled">&#xe861;</i> <span class="i-name">icon-left-circled</span><span class="i-code">0xe861</span></div>
 
        <div title="Code: 0xe862" class="the-icons span3"><i class="demo-icon icon-right-circled">&#xe862;</i> <span class="i-name">icon-right-circled</span><span class="i-code">0xe862</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0xe863" class="the-icons span3"><i class="demo-icon icon-up-circled">&#xe863;</i> <span class="i-name">icon-up-circled</span><span class="i-code">0xe863</span></div>
 
        <div title="Code: 0xe864" class="the-icons span3"><i class="demo-icon icon-up">&#xe864;</i> <span class="i-name">icon-up</span><span class="i-code">0xe864</span></div>
 
        <div title="Code: 0xe865" class="the-icons span3"><i class="demo-icon icon-down">&#xe865;</i> <span class="i-name">icon-down</span><span class="i-code">0xe865</span></div>
 
        <div title="Code: 0xe866" class="the-icons span3"><i class="demo-icon icon-down-circled">&#xe866;</i> <span class="i-name">icon-down-circled</span><span class="i-code">0xe866</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x1f30e" class="the-icons span3"><i class="demo-icon icon-globe">&#x1f30e;</i> <span class="i-name">icon-globe</span><span class="i-code">0x1f30e</span></div>
 
        <div title="Code: 0x1f441" class="the-icons span3"><i class="demo-icon icon-eye">&#x1f441;</i> <span class="i-name">icon-eye</span><span class="i-code">0x1f441</span></div>
 
        <div title="Code: 0x1f464" class="the-icons span3"><i class="demo-icon icon-user">&#x1f464;</i> <span class="i-name">icon-user</span><span class="i-code">0x1f464</span></div>
 
        <div title="Code: 0x1f465" class="the-icons span3"><i class="demo-icon icon-users">&#x1f465;</i> <span class="i-name">icon-users</span><span class="i-code">0x1f465</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x1f4be" class="the-icons span3"><i class="demo-icon icon-floppy">&#x1f4be;</i> <span class="i-name">icon-floppy</span><span class="i-code">0x1f4be</span></div>
 
        <div title="Code: 0x1f4c1" class="the-icons span3"><i class="demo-icon icon-folder-empty">&#x1f4c1;</i> <span class="i-name">icon-folder-empty</span><span class="i-code">0x1f4c1</span></div>
 
        <div title="Code: 0x1f4c2" class="the-icons span3"><i class="demo-icon icon-folder-open-empty">&#x1f4c2;</i> <span class="i-name">icon-folder-open-empty</span><span class="i-code">0x1f4c2</span></div>
 
        <div title="Code: 0x1f4cb" class="the-icons span3"><i class="demo-icon icon-clippy">&#x1f4cb;</i> <span class="i-name">icon-clippy</span><span class="i-code">0x1f4cb</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x1f4d2" class="the-icons span3"><i class="demo-icon icon-book">&#x1f4d2;</i> <span class="i-name">icon-book</span><span class="i-code">0x1f4d2</span></div>
 
        <div title="Code: 0x1f50d" class="the-icons span3"><i class="demo-icon icon-search">&#x1f50d;</i> <span class="i-name">icon-search</span><span class="i-code">0x1f50d</span></div>
 
        <div title="Code: 0x1f510" class="the-icons span3"><i class="demo-icon icon-keyhole-circled">&#x1f510;</i> <span class="i-name">icon-keyhole-circled</span><span class="i-code">0x1f510</span></div>
 
        <div title="Code: 0x1f511" class="the-icons span3"><i class="demo-icon icon-key">&#x1f511;</i> <span class="i-name">icon-key</span><span class="i-code">0x1f511</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x1f512" class="the-icons span3"><i class="demo-icon icon-lock">&#x1f512;</i> <span class="i-name">icon-lock</span><span class="i-code">0x1f512</span></div>
 
        <div title="Code: 0x1f513" class="the-icons span3"><i class="demo-icon icon-lock-open-alt">&#x1f513;</i> <span class="i-name">icon-lock-open-alt</span><span class="i-code">0x1f513</span></div>
 
        <div title="Code: 0x1f516" class="the-icons span3"><i class="demo-icon icon-tag">&#x1f516;</i> <span class="i-name">icon-tag</span><span class="i-code">0x1f516</span></div>
 
        <div title="Code: 0x1f527" class="the-icons span3"><i class="demo-icon icon-wrench">&#x1f527;</i> <span class="i-name">icon-wrench</span><span class="i-code">0x1f527</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x1f589" class="the-icons span3"><i class="demo-icon icon-pencil">&#x1f589;</i> <span class="i-name">icon-pencil</span><span class="i-code">0x1f589</span></div>
 
        <div title="Code: 0x1f58a" class="the-icons span3"><i class="demo-icon icon-pencil-squared">&#x1f58a;</i> <span class="i-name">icon-pencil-squared</span><span class="i-code">0x1f58a</span></div>
 
        <div title="Code: 0x1f58b" class="the-icons span3"><i class="demo-icon icon-edit">&#x1f58b;</i> <span class="i-name">icon-edit</span><span class="i-code">0x1f58b</span></div>
 
        <div title="Code: 0x1f5c0" class="the-icons span3"><i class="demo-icon icon-folder">&#x1f5c0;</i> <span class="i-name">icon-folder</span><span class="i-code">0x1f5c0</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x1f5c1" class="the-icons span3"><i class="demo-icon icon-folder-open">&#x1f5c1;</i> <span class="i-name">icon-folder-open</span><span class="i-code">0x1f5c1</span></div>
 
        <div title="Code: 0x1f5c5" class="the-icons span3"><i class="demo-icon icon-doc">&#x1f5c5;</i> <span class="i-name">icon-doc</span><span class="i-code">0x1f5c5</span></div>
 
        <div title="Code: 0x1f5c8" class="the-icons span3"><i class="demo-icon icon-doc-text">&#x1f5c8;</i> <span class="i-name">icon-doc-text</span><span class="i-code">0x1f5c8</span></div>
 
        <div title="Code: 0x1f5d1" class="the-icons span3"><i class="demo-icon icon-trashcan">&#x1f5d1;</i> <span class="i-name">icon-trashcan</span><span class="i-code">0x1f5d1</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x1f5d8" class="the-icons span3"><i class="demo-icon icon-arrows-cw">&#x1f5d8;</i> <span class="i-name">icon-arrows-cw</span><span class="i-code">0x1f5d8</span></div>
 
        <div title="Code: 0x1f5e9" class="the-icons span3"><i class="demo-icon icon-comment">&#x1f5e9;</i> <span class="i-name">icon-comment</span><span class="i-code">0x1f5e9</span></div>
 
        <div title="Code: 0x1f5ea" class="the-icons span3"><i class="demo-icon icon-comment-discussion">&#x1f5ea;</i> <span class="i-name">icon-comment-discussion</span><span class="i-code">0x1f5ea</span></div>
 
        <div title="Code: 0x1f5f4" class="the-icons span3"><i class="demo-icon icon-cancel">&#x1f5f4;</i> <span class="i-name">icon-cancel</span><span class="i-code">0x1f5f4</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x1f5f5" class="the-icons span3"><i class="demo-icon icon-cancel-circled">&#x1f5f5;</i> <span class="i-name">icon-cancel-circled</span><span class="i-code">0x1f5f5</span></div>
 
        <div title="Code: 0x1f5f8" class="the-icons span3"><i class="demo-icon icon-ok">&#x1f5f8;</i> <span class="i-name">icon-ok</span><span class="i-code">0x1f5f8</span></div>
 
        <div title="Code: 0x1f5f9" class="the-icons span3"><i class="demo-icon icon-ok-circled">&#x1f5f9;</i> <span class="i-name">icon-ok-circled</span><span class="i-code">0x1f5f9</span></div>
 
        <div title="Code: 0x1f6ab" class="the-icons span3"><i class="demo-icon icon-block">&#x1f6ab;</i> <span class="i-name">icon-block</span><span class="i-code">0x1f6ab</span></div>
 
      </div>
 
      <div class="row">
 
        <div title="Code: 0x1f6e0" class="the-icons span3"><i class="demo-icon icon-tools">&#x1f6e0;</i> <span class="i-name">icon-tools</span><span class="i-code">0x1f6e0</span></div>
 
      </div>
 
    </div>
 
    <div class="container footer">Generated by <a href="http://fontello.com">fontello.com</a></div>
 
  </body>
 
</html>
 
\ No newline at end of file
kallithea/public/js/codemirror_loadmode.js
Show inline comments
 
'use strict';
 

	
 
(function() {
 
  var loading = {};
 
  function splitCallback(cont, n) {
 
    var countDown = n;
 
    return function() { if (--countDown == 0) cont(); };
 
  }
 
  function ensureDeps(mode, cont) {
 
    var deps = CodeMirror.modes[mode].dependencies;
 
    if (!deps) return cont();
 
    var missing = [];
 
    for (var i = 0; i < deps.length; ++i) {
 
      if (!CodeMirror.modes.hasOwnProperty(deps[i]))
 
        missing.push(deps[i]);
 
    }
 
    if (!missing.length) return cont();
 
    var split = splitCallback(cont, missing.length);
 
    for (var i = 0; i < missing.length; ++i)
 
      CodeMirror.requireMode(missing[i], split);
 
  }
 

	
 
  CodeMirror.requireMode = function(mode, cont) {
 
    if (typeof mode != "string") mode = mode.mode;
 
    if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
 
    if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
 

	
 
    var script = document.createElement("script");
 
    script.src = CodeMirror.modeURL.replace(/%N/g, mode);
 
    var others = document.getElementsByTagName("script")[0];
 
    others.parentNode.insertBefore(script, others);
 
    var list = loading[mode] = [cont];
 
    var count = 0, poll = setInterval(function() {
 
      if (++count > 100) return clearInterval(poll);
 
      if (CodeMirror.modes.hasOwnProperty(mode)) {
 
        clearInterval(poll);
 
        loading[mode] = null;
 
        ensureDeps(mode, function() {
 
          for (var i = 0; i < list.length; ++i) list[i]();
 
        });
 
      }
 
    }, 200);
 
  };
 

	
 
  CodeMirror.autoLoadMode = function(instance, mode) {
 
    if (!CodeMirror.modes.hasOwnProperty(mode))
 
      CodeMirror.requireMode(mode, function() {
 
        instance.setOption("mode", instance.getOption("mode"));
 
      });
 
    instance.setOption("mode", mode.mime);
 
  };
 

	
 
  CodeMirror.findExtensionByMode = function(modeInfo) {
 
    if (modeInfo.ext) {
 
      return modeInfo.ext[0];
 
    } else if (modeInfo.mode) {
 
      return modeInfo.mode;
 
    } else {
 
      return "txt";
 
    }
 
  };
 

	
 
  CodeMirror.getFilenameAndExt = function(filename){
 
    var parts = filename.split('.');
 

	
 
    if (parts.length > 1){
 
        var ext = parts.pop();
 
        var filename = parts.join("");
 
    }
 
    return {"filename": filename, "ext": ext};
 
  };
 

	
 
}());
 

	
 

	
 
//overlay plugin
 

	
 
// Utility function that allows modes to be combined. The mode given
 
// as the base argument takes care of most of the normal mode
 
// functionality, but a second (typically simple) mode is used, which
 
// can override the style of text. Both modes get to parse all of the
 
// text, but when both assign a non-null style to a piece of code, the
 
// overlay wins, unless the combine argument was true, in which case
 
// the styles are combined.
 

	
 
// overlayParser is the old, deprecated name
 
CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) {
 
  return {
 
    startState: function() {
 
      return {
 
        base: CodeMirror.startState(base),
 
        overlay: CodeMirror.startState(overlay),
 
        basePos: 0, baseCur: null,
 
        overlayPos: 0, overlayCur: null
 
      };
 
    },
 
    copyState: function(state) {
 
      return {
 
        base: CodeMirror.copyState(base, state.base),
 
        overlay: CodeMirror.copyState(overlay, state.overlay),
 
        basePos: state.basePos, baseCur: null,
 
        overlayPos: state.overlayPos, overlayCur: null
 
      };
 
    },
 

	
 
    token: function(stream, state) {
 
      if (stream.start == state.basePos) {
 
        state.baseCur = base.token(stream, state.base);
 
        state.basePos = stream.pos;
 
      }
 
      if (stream.start == state.overlayPos) {
 
        stream.pos = stream.start;
 
        state.overlayCur = overlay.token(stream, state.overlay);
 
        state.overlayPos = stream.pos;
 
      }
 
      stream.pos = Math.min(state.basePos, state.overlayPos);
 
      if (stream.eol()) state.basePos = state.overlayPos = 0;
 

	
 
      if (state.overlayCur == null) return state.baseCur;
 
      if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
 
      else return state.overlayCur;
 
    },
 

	
 
    indent: base.indent && function(state, textAfter) {
 
      return base.indent(state.base, textAfter);
 
    },
 
    electricChars: base.electricChars,
 

	
 
    innerMode: function(state) { return {state: state.base, mode: base}; },
 

	
 
    blankLine: function(state) {
 
      if (base.blankLine) base.blankLine(state.base);
 
      if (overlay.blankLine) overlay.blankLine(state.overlay);
 
    }
 
  };
 
};
kallithea/public/js/graph.js
Show inline comments
 
'use strict';
 

	
 
// branch_renderer.js - Rendering of branch DAGs on the client side
 
//
 
// Copyright 2010 Marcin Kuzminski <marcin AT python-works DOT com>
 
// Copyright 2008 Jesper Noehr <jesper AT noehr DOT org>
 
// Copyright 2008 Dirkjan Ochtman <dirkjan AT ochtman DOT nl>
 
// Copyright 2006 Alexander Schremmer <alex AT alexanderweb DOT de>
 
//
 
// derived from code written by Scott James Remnant <scott@ubuntu.com>
 
// Copyright 2005 Canonical Ltd.
 
//
 
// This software may be used and distributed according to the terms
 
// of the GNU General Public License, incorporated herein by reference.
 

	
 
var colors = [
 
	[ 1.0, 0.0, 0.0 ],
 
	[ 1.0, 1.0, 0.0 ],
 
	[ 0.0, 1.0, 0.0 ],
 
	[ 0.0, 1.0, 1.0 ],
 
	[ 0.0, 0.0, 1.0 ],
 
	[ 1.0, 0.0, 1.0 ],
 
	[ 1.0, 1.0, 0.0 ],
 
	[ 0.0, 0.0, 0.0 ]
 
];
 

	
 
function BranchRenderer(canvas_id, content_id, row_id_prefix) {
 
	// canvas_id is canvas to render into
 
	// content_id's height is applied to canvas
 
	// row_id_prefix is prefix that is applied to get row id's
 
	this.canvas = document.getElementById(canvas_id);
 
	var content = document.getElementById(content_id);
 

	
 
	if (!document.createElement("canvas").getContext)
 
		this.canvas = window.G_vmlCanvasManager.initElement(this.canvas);
 
	if (!this.canvas) { // canvas creation did for some reason fail - fail silently
 
		this.render = function(data) {};
 
		return;
 
	}
 
	this.ctx = this.canvas.getContext('2d');
 
	this.ctx.strokeStyle = 'rgb(0, 0, 0)';
 
	this.ctx.fillStyle = 'rgb(0, 0, 0)';
 
	this.cur = [0, 0];
 
	this.line_width = 2.0;
 
	this.dot_radius = 3.5;
 
	this.close_x = 1.5 * this.dot_radius;
 
	this.close_y = 0.5 * this.dot_radius;
 

	
 
	this.calcColor = function(color, bg, fg) {
 
		color %= colors.length;
 
		var red = (colors[color][0] * fg) || bg;
 
		var green = (colors[color][1] * fg) || bg;
 
		var blue = (colors[color][2] * fg) || bg;
 
		red = Math.round(red * 255);
 
		green = Math.round(green * 255);
 
		blue = Math.round(blue * 255);
 
		var s = 'rgb(' + red + ', ' + green + ', ' + blue + ')';
 
		return s;
 
	}
 

	
 
	this.setColor = function(color, bg, fg) {
 
		var s = this.calcColor(color, bg, fg);
 
		this.ctx.strokeStyle = s;
 
		this.ctx.fillStyle = s;
 
	}
 

	
 
	this.render = function(data) {
 
		var idx = 1;
 
		var canvasWidth = $(this.canvas).parent().width();
 

	
 
		this.canvas.setAttribute('width',canvasWidth);
 
		this.canvas.setAttribute('height',content.clientHeight);
 

	
 
		// HiDPI version needs to be scaled by 2x then halved via css
 
		// Note: Firefox on OS X fails scaling if the canvas height is more than 32k
 
		if (window.devicePixelRatio && content.clientHeight * window.devicePixelRatio < 32768) {
 
			this.canvas.setAttribute('width', canvasWidth * window.devicePixelRatio);
 
			this.canvas.setAttribute('height', content.clientHeight * window.devicePixelRatio);
 
			this.canvas.style.width = canvasWidth + "px";
 
			this.canvas.style.height = content.clientHeight + "px";
 
			this.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
 
		}
 

	
 
		var lineCount = 1;
 
		for (var i=0;i<data.length;i++) {
 
			var in_l = data[i][1];
 
			for (var j in in_l) {
 
				var m = in_l[j][0];
 
				if (m > lineCount)
 
					lineCount = m;
 
			}
 
		}
 

	
 
		var edge_pad = this.dot_radius + 2;
 
		var box_size = Math.min(18, (canvasWidth - edge_pad * 2) / lineCount);
 
		var base_x = canvasWidth - edge_pad;
 

	
 
		for (var i=0; i < data.length; ++i) {
 
			var row = document.getElementById(row_id_prefix+idx);
 
			if (row == null) {
 
				console.log("error: row "+row_id_prefix+idx+" not found");
 
				continue;
 
			}
 
			var next = document.getElementById(row_id_prefix+(idx+1));
 
			var extra = 0;
 

	
 
			cur = data[i];
 
			node = cur[0];
 
			in_l = cur[1];
 
			closing = cur[2];
 
			obsolete_node = cur[3];
 
			bumped_node = cur[4];
 
			divergent_node = cur[5];
 
			extinct_node = cur[6];
 
			unstable_node = cur[7];
 
			const cur = data[i];
 
			const node = cur[0];
 
			const in_l = cur[1];
 
			const closing = cur[2];
 
			const obsolete_node = cur[3];
 
			const bumped_node = cur[4];
 
			const divergent_node = cur[5];
 
			const extinct_node = cur[6];
 
			const unstable_node = cur[7];
 

	
 
			// center dots on the first element in a td (not necessarily the first one, but there must be one)
 
			var firstincell = $(row).find('td>*:visible')[0];
 
			var nextFirstincell = $(next).find('td>*:visible')[0];
 
			var rowY = Math.floor(row.offsetTop + firstincell.offsetTop + firstincell.offsetHeight/2);
 
			var nextY = Math.floor((next == null) ? rowY + row.offsetHeight/2 : next.offsetTop + nextFirstincell.offsetTop + nextFirstincell.offsetHeight/2);
 

	
 
			for (var j in in_l) {
 
				line = in_l[j];
 
				start = line[0];
 
				end = line[1];
 
				color = line[2];
 
				obsolete_line = line[3];
 
				const line = in_l[j];
 
				const start = line[0];
 
				const end = line[1];
 
				const color = line[2];
 
				const obsolete_line = line[3];
 

	
 
				x = Math.floor(base_x - box_size * start);
 
				const x = Math.floor(base_x - box_size * start);
 

	
 
				// figure out if this is a dead-end;
 
				// we want to fade away this line
 
				var dead_end = true;
 
				if (next != null) {
 
					nextdata = data[i+1];
 
					next_l = nextdata[1];
 
					const nextdata = data[i+1];
 
					const next_l = nextdata[1];
 
					for (var k=0; k < next_l.length; ++k) {
 
						if (next_l[k][0] == end) {
 
							dead_end = false;
 
							break;
 
						}
 
					}
 
					if (nextdata[0][0] == end) // this is a root - not a dead end
 
						dead_end = false;
 
				}
 

	
 
				if (dead_end) {
 
					var gradient = this.ctx.createLinearGradient(x,rowY,x,nextY);
 
					gradient.addColorStop(0,this.calcColor(color, 0.0, 0.65));
 
					gradient.addColorStop(1,this.calcColor(color, 1.0, 0.0));
 
					this.ctx.strokeStyle = gradient;
 
					this.ctx.fillStyle = gradient;
 
				}
 
				// if this is a merge of differently
 
				// colored line, make it a gradient towards
 
				// the merged color
 
				else if (color != node[1] && start == node[0])
 
				{
 
					var gradient = this.ctx.createLinearGradient(x,rowY,x,nextY);
 
					gradient.addColorStop(0,this.calcColor(node[1], 0.0, 0.65));
 
					gradient.addColorStop(1,this.calcColor(color, 0.0, 0.65));
 
					this.ctx.strokeStyle = gradient;
 
					this.ctx.fillStyle = gradient;
 
				}
 
				else
 
				{
 
					this.setColor(color, 0.0, 0.65);
 
				}
 

	
 
				this.ctx.lineWidth=this.line_width;
 
				this.ctx.beginPath();
 
				if (obsolete_line)
 
				{
 
					this.ctx.setLineDash([5]);
 
				}
 
				this.ctx.beginPath();
 
				this.ctx.moveTo(x, rowY);
 
				if (start == end)
 
				{
 
					this.ctx.lineTo(x,nextY+extra,3);
 
				}
 
				else
 
				{
 
					var x2 = Math.floor(base_x - box_size * end);
 
					var ymid = (rowY+nextY) / 2;
 
					if (obsolete_node)
 
					{
 
						this.ctx.setLineDash([5]);
 
					}
 
					this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY);
 
				}
 
				this.ctx.stroke();
 
				this.ctx.setLineDash([]); // reset the dashed line, if any
 
			}
 

	
 
			column = node[0];
 
			color = node[1];
 
			const column = node[0];
 
			const color = node[1];
 

	
 
			x = Math.floor(base_x - box_size * column);
 
			const x = Math.floor(base_x - box_size * column);
 

	
 
			this.setColor(color, 0.25, 0.75);
 
			if(unstable_node)
 
			{
 
				this.ctx.fillStyle = 'rgb(255, 0, 0)';
 
			}
 

	
 
			r = this.dot_radius
 
			let r = this.dot_radius
 
			if (obsolete_node)
 
			{
 
				this.ctx.beginPath();
 
				this.ctx.moveTo(x - this.close_x, rowY - this.close_y - 3);
 
				this.ctx.lineTo(x - this.close_x + 2*this.close_x, rowY - this.close_y + 4*this.close_y - 1);
 
				this.ctx.moveTo(x - this.close_x, rowY - this.close_y + 4*this.close_y - 1);
 
				this.ctx.lineTo(x - this.close_x + 2*this.close_x, rowY - this.close_y - 3);
 
				this.ctx.stroke();
 
				r -= 0.5
 
			}
 
			if (closing)
 
			{
 
				this.ctx.fillRect(x - this.close_x, rowY - this.close_y, 2*this.close_x, 2*this.close_y);
 
			}
 
			else
 
			{
 
				this.ctx.beginPath();
 
				this.ctx.arc(x, rowY, r, 0, Math.PI * 2, true);
 
				this.ctx.fill();
 
			}
 

	
 
			idx++;
 
		}
 

	
 
	}
 

	
 
}
kallithea/templates/admin/admin.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Admin Journal')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    <form id="filter_form" class="pull-left form-inline input-group-sm">
 
        <input class="form-control q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or _('journal filter...')}"/>
 
        <span data-toggle="popover" data-content="${h.journal_filter_help()}">?</span>
 
        <input type='submit' value="${_('Filter')}" class="btn btn-default btn-xs"/>
 
        ${_('Admin Journal')} - ${ungettext('%s Entry', '%s Entries', c.users_log.item_count) % (c.users_log.item_count)}
 
    </form>
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('admin')}
 
</%block>
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div id="user_log" class="panel-body">
 
            <%include file='admin_log.html'/>
 
    </div>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
$(document).ready(function() {
 
  $('#j_filter').click(function(){
 
    var $jfilter = $('#j_filter');
 
    if($jfilter.hasClass('initial')){
 
        $jfilter.val('');
 
    }
 
  });
 
  var fix_j_filter_width = function(len){
 
      $('#j_filter').css('width', Math.max(80, len*6.50)+'px');
 
  };
 
  $('#j_filter').keyup(function () {
 
    fix_j_filter_width($('#j_filter').val().length);
 
  });
 
  $('#filter_form').submit(function (e) {
 
      e.preventDefault();
 
      var val = $('#j_filter').val();
 
      window.location = ${h.js(url.current(filter='__FILTER__'))}.replace('__FILTER__',val);
 
  });
 
  fix_j_filter_width($('#j_filter').val().length);
 
});
 
</script>
 
</%def>
kallithea/templates/admin/admin_log.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
%if c.users_log:
 
<table class="table">
 
    <tr>
 
        <th class="left">${_('Username')}</th>
 
        <th class="left">${_('Action')}</th>
 
        <th class="left">${_('Repository')}</th>
 
        <th class="left">${_('Date')}</th>
 
        <th class="left">${_('From IP')}</th>
 
    </tr>
 

	
 
    %for cnt,l in enumerate(c.users_log):
 
    <tr class="parity${cnt%2}">
 
        <td>
 
        %if l.user is not None:
 
          ${h.link_to(l.user.username,h.url('edit_user', id=l.user.user_id))}
 
        %else:
 
          ${l.username}
 
        %endif
 
        </td>
 
        <td>${h.action_parser(l)[0]()}
 
            <div class="journal_action_params">
 
                ${h.literal(h.action_parser(l)[1]())}
 
            </div>
 
        </td>
 
        <td>
 
            %if l.repository is not None:
 
              ${h.link_to(l.repository.repo_name,h.url('summary_home',repo_name=l.repository.repo_name))}
 
            %else:
 
              ${l.repository_name}
 
            %endif
 
        </td>
 

	
 
        <td>${h.fmt_date(l.action_date)}</td>
 
        <td>${l.user_ip}</td>
 
    </tr>
 
    %endfor
 
</table>
 

	
 
<script>
 
<script>'use strict';
 
  $(document).ready(function(){
 
    var $user_log = $('#user_log');
 
    $user_log.on('click','.pager_link',function(e){
 
      asynchtml(e.target.href, $user_log, function(){
 
        show_more_event();
 
        tooltip_activate();
 
      });
 
      e.preventDefault();
 
    });
 
    $user_log.on('click','.show_more',function(e){
 
      var el = e.target;
 
      $('#'+el.id.substring(1)).show();
 
      $(el.parentNode).hide();
 
    });
 
  });
 
</script>
 

	
 
${c.users_log.pager()}
 

	
 
%else:
 
    ${_('No actions yet')}
 
%endif
kallithea/templates/admin/auth/auth_settings.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Authentication Settings')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(_('Admin'),h.url('admin_home'))}
 
    &raquo;
 
    ${_('Authentication')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('admin')}
 
</%block>
 

	
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div class="form panel-body settings">
 
    ${h.form(url('auth_settings'))}
 

	
 
    ## enabled auth plugins
 
    <h1>${_('Authentication Plugins')}</h1>
 
        <div class="form-group">
 
            <label class="control-label" for="auth_plugins">${_("Enabled Plugins")}</label>
 
            <div>
 
                ${h.text("auth_plugins", class_='form-control')}
 
                <span class="help-block">${_('Comma-separated list of plugins; Kallithea will try user authentication in plugin order')}</span>
 
            </div>
 
        </div>
 
        <div class="form-group">
 
            <label class="control-label">${_('Available built-in plugins')}</label>
 
            <div>
 
                <ul class="list-group">
 
                %for plugin_path in c.available_plugins:
 
                    <li class="list-group-item">
 
                        <button type="button" data-plugin_id="${plugin_path}" class="toggle-plugin btn btn-default btn-xs ${'active' if plugin_path in c.enabled_plugin_names else ''}">
 
                            ${_('Enabled') if plugin_path in c.enabled_plugin_names else _('Disabled')}
 
                        </button>
 
                        ${plugin_path}
 
                    </li>
 
                %endfor
 
                </ul>
 
            </div>
 
        </div>
 

	
 
    %for cnt, module in enumerate(c.enabled_plugin_names):
 
        <% pluginName = c.plugin_shortnames[module] %>
 
        <h1>${_('Plugin')}: ${pluginName}</h1>
 
        ## autoform generation, based on plugin definition from it's settings
 
        %for setting in c.plugin_settings[module]:
 
            <% fullsetting = "auth_%s_%s" % (pluginName, setting["name"]) %>
 
            <% displayname = (setting["formname"] if ("formname" in setting) else setting["name"]) %>
 
            %if setting["type"] == "password":
 
            <div class="form-group">
 
                <label class="control-label" for="${fullsetting}">${_(displayname)}</label>
 
                <div>
 
                    ${h.password(fullsetting,class_='form-control')}
 
                    <span class="help-block">${setting["description"]}</span>
 
                </div>
 
            </div>
 
            %elif setting["type"] in ["string", "int"]:
 
            <div class="form-group">
 
                <label class="control-label" for="${fullsetting}">${_(displayname)}</label>
 
                <div>
 
                    ${h.text(fullsetting,class_='form-control')}
 
                    <span class="help-block">${setting["description"]}</span>
 
                </div>
 
            </div>
 
            %elif setting["type"] == "bool":
 
            <div class="form-group">
 
                <label class="control-label" for="${fullsetting}">${_(displayname)}</label>
 
                <div>
 
                    ${h.checkbox(fullsetting,True)}
 
                    <span class="help-block">${setting["description"]}</span>
 
                </div>
 
            </div>
 
            %elif setting["type"] == "select":
 
            <div class="form-group">
 
                <label class="control-label" for="${fullsetting}">${_(displayname)}</label>
 
                <div>
 
                    ${h.select(fullsetting,setting['values'][0],setting['values'],class_='form-control')}
 
                    <span class="help-block">${setting["description"]}</span>
 
                </div>
 
            </div>
 
            %else:
 
            <div class="form-group">
 
                <label class="control-label" for="${fullsetting}">${_(displayname)}</label>
 
                <div>This field is of type ${setting['type']}, which cannot be displayed. Must be one of [string|int|bool|select].</div>
 
                <span class="help-block">${setting["description"]}</span>
 
            </div>
 
            %endif
 
        %endfor
 
    %endfor
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('save',_('Save'),class_="btn btn-default")}
 
                </div>
 
            </div>
 
    ${h.end_form()}
 
    </div>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
    $('.toggle-plugin').click(function(e){
 
        var $auth_plugins_input = $('#auth_plugins');
 
        var notEmpty = function(element, index, array) {
 
            return (element != "");
 
        }
 
        var elems = $auth_plugins_input.val().split(',').filter(notEmpty);
 
        var $cur_button = $(e.currentTarget);
 
        var plugin_id = $cur_button.data('plugin_id');
 

	
 
        if($cur_button.hasClass('active')){
 
            elems.splice(elems.indexOf(plugin_id), 1);
 
            $auth_plugins_input.val(elems.join(','));
 
            $cur_button.removeClass('active');
 
            $cur_button.html(_TM['Disabled']);
 
        }
 
        else{
 
            if(elems.indexOf(plugin_id) == -1){
 
                elems.push(plugin_id);
 
            }
 
            $auth_plugins_input.val(elems.join(','));
 
            $cur_button.addClass('active');
 
            $cur_button.html(_TM['Enabled']);
 
        }
 
    });
 
</script>
 
</%def>
kallithea/templates/admin/gists/edit.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
 
</%block>
 

	
 
<%block name="js_extra">
 
  <script src="${h.url('/codemirror/lib/codemirror.js')}"></script>
 
  <script src="${h.url('/js/codemirror_loadmode.js')}"></script>
 
  <script src="${h.url('/codemirror/mode/meta.js')}"></script>
 
</%block>
 
<%block name="css_extra">
 
  <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('gists')}
 
</%block>
 

	
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 

	
 
    <div class="panel-body">
 
        <div id="edit_error" style="display: none" class="flash_msg">
 
            <div class="alert alert-dismissable alert-warning">
 
              <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><i class="icon-cancel-circled"></i></button>
 
              ${(h.HTML(_('Gist was updated since you started editing. Copy your changes and click %(here)s to reload new version.'))
 
                             % {'here': h.link_to(_('here'),h.url('edit_gist', gist_id=c.gist.gist_access_id))})}
 
            </div>
 
            <script>
 
            <script>'use strict';
 
            if (typeof jQuery != 'undefined') {
 
                $(".alert").alert();
 
            }
 
            </script>
 
        </div>
 

	
 
        <div id="files_data">
 
          ${h.form(h.url('edit_gist', gist_id=c.gist.gist_access_id), method='post', id='eform')}
 
            <div>
 
                <input type="hidden" value="${c.file_changeset.raw_id}" name="parent_hash">
 
                <textarea class="form-control"
 
                          id="description" name="description"
 
                          placeholder="${_('Gist description ...')}">${c.gist.gist_description}</textarea>
 
                <div>
 
                    <label>
 
                        ${_('Gist lifetime')}
 
                        ${h.select('lifetime', '0', c.lifetime_options)}
 
                    </label>
 
                    <span class="text-muted">
 
                     %if c.gist.gist_expires == -1:
 
                      ${_('Expires')}: ${_('Never')}
 
                     %else:
 
                      ${_('Expires')}: ${h.age(h.time_to_datetime(c.gist.gist_expires))}
 
                     %endif
 
                   </span>
 
                </div>
 
            </div>
 

	
 
            % for cnt, file in enumerate(c.files):
 
                <div id="body" class="panel panel-default form-inline">
 
                    <div class="panel-heading">
 
                        <input type="hidden" value="${file.path}" name="org_files">
 
                        <input class="form-control" id="filename_${h.FID('f',file.path)}" name="files" size="30" type="text" value="${file.path}">
 
                        <select class="form-control" id="mimetype_${h.FID('f',file.path)}" name="mimetypes"></select>
 
                    </div>
 
                    <div class="panel-body no-padding">
 
                        <div id="editor_container">
 
                            <textarea id="editor_${h.FID('f',file.path)}" name="contents" style="display:none">${safe_str(file.content)}</textarea>
 
                        </div>
 
                    </div>
 
                </div>
 

	
 
                ## dynamic edit box.
 
                <script>
 
                <script>'use strict';
 
                    $(document).ready(function(){
 
                        var myCodeMirror = initCodeMirror(${h.js('editor_' + h.FID('f',file.path))}, ${h.jshtml(request.script_name)}, '');
 

	
 
                        //inject new modes
 
                        var $mimetype_select = $(${h.js('#mimetype_' + h.FID('f',file.path))});
 
                        $mimetype_select.each(function(){
 
                            var modes_select = this;
 
                            var index = 1;
 
                            for(var i=0;i<CodeMirror.modeInfo.length;i++) {
 
                                var m = CodeMirror.modeInfo[i];
 
                                var opt = new Option(m.name, m.mime);
 
                                $(opt).attr('mode', m.mode);
 
                                if (m.mime == 'text/plain') {
 
                                    // default plain text
 
                                    $(opt).prop('selected', true);
 
                                    modes_select.options[0] = opt;
 
                                } else {
 
                                    modes_select.options[index++] = opt;
 
                                }
 
                            }
 
                        });
 

	
 
                        var $filename_input = $(${h.js('#filename_' + h.FID('f',file.path))});
 
                        // on select change set new mode
 
                        $mimetype_select.change(function(e){
 
                            var selected = e.currentTarget;
 
                            var node = selected.options[selected.selectedIndex];
 
                            var detected_mode = CodeMirror.findModeByMIME(node.value);
 
                            setCodeMirrorMode(myCodeMirror, detected_mode);
 

	
 
                            var proposed_ext = CodeMirror.findExtensionByMode(detected_mode);
 
                            var file_data = CodeMirror.getFilenameAndExt($filename_input.val());
 
                            var filename = file_data['filename'] || 'filename1';
 
                            $filename_input.val(filename + '.' + proposed_ext);
 
                        });
 

	
 
                        // on type the new filename set mode
 
                        $filename_input.keyup(function(e){
 
                            var file_data = CodeMirror.getFilenameAndExt(this.value);
 
                            if(file_data['ext'] != null){
 
                                var detected_mode = CodeMirror.findModeByExtension(file_data['ext']) || CodeMirror.findModeByMIME('text/plain');
 

	
 
                                if (detected_mode){
 
                                    setCodeMirrorMode(myCodeMirror, detected_mode);
 
                                    $mimetype_select.val(detected_mode.mime);
 
                                }
 
                            }
 
                        });
 

	
 
                        // set mode on page load
 
                        var detected_mode = CodeMirror.findModeByExtension(${h.js(file.extension)});
 

	
 
                        if (detected_mode){
 
                            setCodeMirrorMode(myCodeMirror, detected_mode);
 
                            $mimetype_select.val(detected_mode.mime);
 
                        }
 
                    });
 
                </script>
 

	
 
            %endfor
 

	
 
            <div>
 
            ${h.submit('update',_('Update Gist'),class_="btn btn-success")}
 
            <a class="btn btn-default" href="${h.url('gist', gist_id=c.gist.gist_access_id)}">${_('Cancel')}</a>
 
            </div>
 
          ${h.end_form()}
 
          <script>
 
          <script>'use strict';
 
              $('#update').on('click', function(e){
 
                  e.preventDefault();
 

	
 
                  // check for newer version.
 
                  $.ajax({
 
                    url: ${h.js(h.url('edit_gist_check_revision', gist_id=c.gist.gist_access_id))},
 
                    data: {'revision': ${h.js(c.file_changeset.raw_id)}, '_session_csrf_secret_token': _session_csrf_secret_token},
 
                    dataType: 'json',
 
                    type: 'POST',
 
                    success: function(data) {
 
                      if(data.success == false){
 
                          $('#edit_error').show();
 
                      }
 
                      else{
 
                        $('#eform').submit();
 
                      }
 
                    }
 
                  });
 
              });
 
          </script>
 
        </div>
 
    </div>
 

	
 
</div>
 
</%def>
kallithea/templates/admin/gists/new.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('New Gist')}
 
</%block>
 

	
 
<%block name="js_extra">
 
  <script src="${h.url('/codemirror/lib/codemirror.js')}"></script>
 
  <script src="${h.url('/js/codemirror_loadmode.js')}"></script>
 
  <script src="${h.url('/codemirror/mode/meta.js')}"></script>
 
</%block>
 
<%block name="css_extra">
 
  <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('New Gist')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('gists')}
 
</%block>
 

	
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 

	
 
    <div class="panel-body">
 
        <div id="files_data">
 
          ${h.form(h.url('gists'), method='post',id='eform')}
 
            <div>
 
                <textarea class="form-control" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
 
                <div>
 
                    <label>
 
                        ${_('Gist lifetime')}
 
                        ${h.select('lifetime', '', c.lifetime_options)}
 
                    </label>
 
                </div>
 
            </div>
 
            <div id="body" class="panel panel-default form-inline">
 
                <div class="panel-heading">
 
                    ${h.text('filename', size=30, placeholder=_('Name this gist ...'), class_='form-control')}
 
                    <select class="form-control" id="mimetype" name="mimetype"></select>
 
                </div>
 
                <div class="panel-body no-padding">
 
                        <textarea id="editor" name="content"></textarea>
 
                </div>
 
            </div>
 
            <div>
 
            ${h.submit('private',_('Create Private Gist'),class_="btn btn-success btn-xs")}
 
            ${h.submit('public',_('Create Public Gist'),class_="btn btn-default btn-xs")}
 
            ${h.reset('reset',_('Reset'),class_="btn btn-default btn-xs")}
 
            </div>
 
          ${h.end_form()}
 
          <script>
 
          <script>'use strict';
 
            $(document).ready(function(){
 
                var myCodeMirror = initCodeMirror('editor', ${h.jshtml(request.script_name)}, '');
 

	
 
                //inject new modes
 
                var $mimetype_select = $('#mimetype');
 
                $mimetype_select.each(function(){
 
                    var modes_select = this;
 
                    var index = 1;
 
                    for(var i=0;i<CodeMirror.modeInfo.length;i++) {
 
                        var m = CodeMirror.modeInfo[i];
 
                        var opt = new Option(m.name, m.mime);
 
                        $(opt).attr('mode', m.mode);
 
                        if (m.mime == 'text/plain') {
 
                            // default plain text
 
                            $(opt).prop('selected', true);
 
                            modes_select.options[0] = opt;
 
                        } else {
 
                            modes_select.options[index++] = opt;
 
                        }
 
                    }
 
                });
 

	
 
                var $filename_input = $('#filename');
 
                // on select change set new mode
 
                $mimetype_select.change(function(e){
 
                    var selected = e.currentTarget;
 
                    var node = selected.options[selected.selectedIndex];
 
                    var detected_mode = CodeMirror.findModeByMIME(node.value);
 
                    setCodeMirrorMode(myCodeMirror, detected_mode);
 

	
 
                    var proposed_ext = CodeMirror.findExtensionByMode(detected_mode);
 
                    var file_data = CodeMirror.getFilenameAndExt($filename_input.val());
 
                    var filename = file_data['filename'] || 'filename1';
 
                    $filename_input.val(filename + '.' + proposed_ext);
 
                });
 

	
 
                // on type the new filename set mode
 
                $filename_input.keyup(function(e){
 
                    var file_data = CodeMirror.getFilenameAndExt(this.value);
 
                    if(file_data['ext'] != null){
 
                        var detected_mode = CodeMirror.findModeByExtension(file_data['ext']) || CodeMirror.findModeByMIME('text/plain');
 
                        if (detected_mode){
 
                            setCodeMirrorMode(myCodeMirror, detected_mode);
 
                            $mimetype_select.val(detected_mode.mime);
 
                        }
 
                    }
 
                });
 
            });
 
          </script>
 
        </div>
 
    </div>
 

	
 
</div>
 
</%def>
kallithea/templates/admin/my_account/my_account_api_keys.html
Show inline comments
 
<table class="table">
 
    <tr>
 
        <td><div class="truncate autoexpand">${c.user.api_key}</div></td>
 
        <td>
 
            <span class="label label-success">${_('Built-in')}</span>
 
        </td>
 
        <td>${_('Expires')}: ${_('Never')}</td>
 
        <td>
 
            ${h.form(url('my_account_api_keys_delete'))}
 
                ${h.hidden('del_api_key',c.user.api_key)}
 
                ${h.hidden('del_api_key_builtin',1)}
 
                <button class="btn btn-danger btn-xs" type="submit"
 
                        onclick="return confirm('${_('Confirm to reset this API key: %s') % c.user.api_key}');">
 
                    ${_('Reset')}
 
                </button>
 
            ${h.end_form()}
 
        </td>
 
    </tr>
 
    %if c.user_api_keys:
 
        %for api_key in c.user_api_keys:
 
          <tr class="${'expired' if api_key.is_expired else ''}">
 
            <td><div class="truncate autoexpand">${api_key.api_key}</div></td>
 
            <td>${api_key.description}</td>
 
            <td>
 
                 %if api_key.expires == -1:
 
                  ${_('Expires')}: ${_('Never')}
 
                 %else:
 
                    %if api_key.is_expired:
 
                        ${_('Expired')}: ${h.age(h.time_to_datetime(api_key.expires))}
 
                    %else:
 
                        ${_('Expires')}: ${h.age(h.time_to_datetime(api_key.expires))}
 
                    %endif
 
                 %endif
 
            </td>
 
            <td>
 
                ${h.form(url('my_account_api_keys_delete'))}
 
                    ${h.hidden('del_api_key',api_key.api_key)}
 
                    <button class="btn btn-danger btn-xs" type="submit"
 
                            onclick="return confirm('${_('Confirm to remove this API key: %s') % api_key.api_key}');">
 
                        <i class="icon-trashcan"></i>
 
                        ${_('Remove')}
 
                    </button>
 
                ${h.end_form()}
 
            </td>
 
          </tr>
 
        %endfor
 
    %else:
 
    <tr><td><div class="ip">${_('No additional API keys specified')}</div></td></tr>
 
    %endif
 
</table>
 

	
 
<div>
 
    ${h.form(url('my_account_api_keys'), method='post')}
 
    <div class="form">
 
            <div class="form-group">
 
                <label class="control-label">${_('New API key')}</label>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="description">${_('Description')}:</label>
 
                <div>
 
                    ${h.text('description', class_='form-control', placeholder=_('Description'))}
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="lifetime">${_('Lifetime')}:</label>
 
                <div>
 
                    ${h.select('lifetime', '', c.lifetime_options)}
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('save',_('Add'),class_="btn btn-default")}
 
                    ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
                </div>
 
            </div>
 
    </div>
 
    ${h.end_form()}
 
</div>
 

	
 
<div class="alert alert-warning">
 
<p>${_('''
 
API keys are used to let scripts or services access %s using your
 
account, as if you had provided the script or service with your actual
 
password.
 
''') % (c.site_name or 'Kallithea')}</p>
 
<p>${_('''
 
Like passwords, API keys should therefore never be shared with others,
 
nor passed to untrusted scripts or services. If such sharing should
 
happen anyway, reset the API key on this page to prevent further use.
 
''')}</p>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        $("#lifetime").select2({
 
            'dropdownAutoWidth': true
 
        });
 
    });
 
</script>
kallithea/templates/admin/my_account/my_account_repos.html
Show inline comments
 
<h4>${_('Repositories You Own')}</h4>
 

	
 
<div>
 
    <table class="table" id="datatable_list_wrap" width="100%"></table>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
  var data = ${h.js(c.data)};
 
  var myDataTable = $("#datatable_list_wrap").DataTable({
 
        data: data.records,
 
        columns: [
 
            {data: "raw_name", "visible": false, searchable: false},
 
            {data: "name", "orderData": 1, title: ${h.jshtml(_('Name'))}},
 
            {data: "last_rev_raw", "visible": false, searchable: false},
 
            {data: "last_changeset", "orderData": 3, title: ${h.jshtml(_('Tip'))}, searchable: false},
 
            {data: "action", title: ${h.jshtml(_('Action'))}, sortable: false, searchable: false}
 
        ],
 
        order: [[2, "asc"]],
 
        dom: '<"dataTables_left"f><"dataTables_right"ip>t',
 
        pageLength: 100
 
    });
 
</script>
kallithea/templates/admin/my_account/my_account_watched.html
Show inline comments
 
<h4>${_('Repositories You are Watching')}</h4>
 

	
 
<div>
 
    <table class="table" id="datatable_list_wrap" width="100%"></table>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
  var data = ${h.js(c.data)};
 
  var myDataTable = $("#datatable_list_wrap").DataTable({
 
        data: data.records,
 
        columns: [
 
            {data: "raw_name", "visible": false, searchable: false},
 
            {data: "name", "orderData": 1, title: ${h.jshtml(_('Name'))}},
 
            {data: "last_rev_raw", "visible": false, searchable: false},
 
            {data: "last_changeset", "orderData": 3, title: ${h.jshtml(_('Tip'))}, searchable: false},
 
        ],
 
        order: [[2, "asc"]],
 
        dom: '<"dataTables_left"f><"dataTables_right"ip>t',
 
        pageLength: 100
 
    });
 
</script>
kallithea/templates/admin/repo_groups/repo_group_add.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Add Repository Group')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(_('Admin'),h.url('admin_home'))}
 
    &raquo;
 
    ${h.link_to(_('Repository Groups'),h.url('repos_groups'))}
 
    &raquo;
 
    ${_('Add Repository Group')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('admin')}
 
</%block>
 

	
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    ${h.form(url('repos_groups'))}
 
    <div class="form panel-body settings">
 
            <div class="form-group">
 
                <label class="control-label" for="group_name">${_('Group name')}:</label>
 
                <div>
 
                    ${h.text('group_name',class_='form-control')}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="group_description">${_('Description')}:</label>
 
                <div>
 
                    ${h.textarea('group_description',cols=23,rows=5,class_='form-control')}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="parent_group_id">${_('Group parent')}:</label>
 
                <div>
 
                    ${h.select('parent_group_id',request.GET.get('parent_group'),c.repo_groups,class_='form-control')}
 
                </div>
 
            </div>
 

	
 
            <div id="copy_perms" class="form-group">
 
                <label class="control-label" for="group_copy_permissions">${_('Copy parent group permissions')}:</label>
 
                <div>
 
                    ${h.checkbox('group_copy_permissions',value="True")}
 
                    <span class="help-block">${_('Copy permission set from parent repository group.')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('save',_('Save'),class_="btn btn-default")}
 
                </div>
 
            </div>
 
    </div>
 
    ${h.end_form()}
 
</div>
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        var setCopyPermsOption = function(group_val){
 
            if(group_val != "-1"){
 
                $('#copy_perms').show();
 
            }
 
            else{
 
                $('#copy_perms').hide();
 
            }
 
        }
 
        $("#parent_group_id").select2({
 
            'dropdownAutoWidth': true
 
        });
 
        setCopyPermsOption($('#parent_group_id').val());
 
        $("#parent_group_id").on("change", function(e) {
 
            setCopyPermsOption(e.val);
 
        });
 
        $('#group_name').focus();
 
    });
 
</script>
 
</%def>
kallithea/templates/admin/repo_groups/repo_group_edit_perms.html
Show inline comments
 
${h.form(url('edit_repo_group_perms', group_name=c.repo_group.group_name))}
 
<div class="form">
 
    <div>
 
        <div>
 
            <table id="permissions_manage" class="table">
 
                <tr>
 
                    <td>${_('None')}<br />(${_('Not visible')})</td>
 
                    <td>${_('Read')}<br />(${_('Visible')})</td>
 
                    <td>${_('Write')}<br />(${_('Add repos')})</td>
 
                    <td>${_('Admin')}<br />(${_('Add/Edit groups')})</td>
 
                    <td>${_('User/User Group')}</td>
 
                    <td></td>
 
                </tr>
 
                ## USERS
 
                %for r2p in c.repo_group.repo_group_to_perm:
 
                    ##forbid revoking permission from yourself, except if you're an super admin
 
                    <tr id="id${id(r2p.user.username)}">
 
                      %if request.authuser.user_id != r2p.user.user_id or request.authuser.is_admin:
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.none')}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.read')}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.write')}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.admin')}</td>
 
                        <td>
 
                            ${h.gravatar(r2p.user.email, cls="perm-gravatar", size=14)}
 
                            %if h.HasPermissionAny('hg.admin')() and r2p.user.username != 'default':
 
                             <a href="${h.url('edit_user',id=r2p.user.user_id)}">${r2p.user.username}</a>
 
                            %else:
 
                             ${r2p.user.username if r2p.user.username != 'default' else _('Default')}
 
                            %endif
 
                        </td>
 
                        <td>
 
                          %if r2p.user.username !='default':
 
                            <button type="button" class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${r2p.user.user_id}, 'user', '${'id%s'%id(r2p.user.username)}', '${r2p.user.username}')">
 
                             <i class="icon-minus-circled"></i>${_('Revoke')}
 
                            </button>
 
                          %endif
 
                        </td>
 
                      %else:
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.none', disabled="disabled")}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.read', disabled="disabled")}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.write', disabled="disabled")}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.admin', disabled="disabled")}</td>
 
                        <td>
 
                            ${h.gravatar(r2p.user.email, cls="perm-gravatar", size=14)}
 
                            ${r2p.user.username if r2p.user.username != 'default' else _('Default')}
 
                        </td>
 
                        <td><i class="icon-user"></i>${_('Admin')}</td>
 
                      %endif
 
                    </tr>
 
                %endfor
 

	
 
                ## USER GROUPS
 
                %for g2p in c.repo_group.users_group_to_perm:
 
                    <tr id="id${id(g2p.users_group.users_group_name)}">
 
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.none')}</td>
 
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.read')}</td>
 
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.write')}</td>
 
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.admin')}</td>
 
                        <td>
 
                            <i class="icon-users"></i>
 
                            %if h.HasPermissionAny('hg.admin')():
 
                             <a href="${h.url('edit_users_group',id=g2p.users_group.users_group_id)}">
 
                                 ${g2p.users_group.users_group_name}
 
                             </a>
 
                            %else:
 
                             ${g2p.users_group.users_group_name}
 
                            %endif
 
                        </td>
 
                        <td>
 
                            <button type="button" class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${g2p.users_group.users_group_id}, 'user_group', '${'id%s'%id(g2p.users_group.users_group_name)}', '${g2p.users_group.users_group_name}')">
 
                            <i class="icon-minus-circled"></i>${_('Revoke')}
 
                            </button>
 
                        </td>
 
                    </tr>
 
                %endfor
 
                ## New entries added by addPermAction here.
 
                <tr class="new_members last_new_member" id="add_perm_input"><td colspan="6"></td></tr>
 
                <tr>
 
                    <td colspan="6">
 
                        <button type="button" id="add_perm" class="btn btn-link btn-xs">
 
                            <i class="icon-plus"></i>${_('Add new')}
 
                        </button>
 
                    </td>
 
                </tr>
 
                <tr>
 
                    <td colspan="6">
 
                       ${_('Apply to children')}:
 
                       ${h.radio('recursive', 'none', label=_('None'), checked="checked")}
 
                       ${h.radio('recursive', 'groups', label=_('Repository Groups'))}
 
                       ${h.radio('recursive', 'repos', label=_('Repositories'))}
 
                       ${h.radio('recursive', 'all', label=_('Both'))}
 
                       <span class="help-block">${_('Set or revoke permission to all children of that group, including non-private repositories and other groups if selected.')}</span>
 
                    </td>
 
                </tr>
 
            </table>
 
        </div>
 
        <div class="buttons">
 
            ${h.submit('save',_('Save'),class_="btn btn-default")}
 
            ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
        </div>
 
    </div>
 
</div>
 
${h.end_form()}
 

	
 
<script>
 
<script>'use strict';
 
    function ajaxActionRevoke(obj_id, obj_type, field_id, obj_name) {
 
        url = ${h.jshtml(h.url('edit_repo_group_perms_delete', group_name=c.repo_group.group_name))};
 
        let url = ${h.jshtml(h.url('edit_repo_group_perms_delete', group_name=c.repo_group.group_name))};
 
        var revoke_msg = _TM['Confirm to revoke permission for {0}: {1} ?'].format(obj_type.replace('_', ' '), obj_name);
 
        if (confirm(revoke_msg)){
 
            var recursive = $('input[name=recursive]:checked').val();
 
            ajaxActionRevokePermission(url, obj_id, obj_type, field_id, {recursive:recursive});
 
        }
 
    };
 

	
 
    $(document).ready(function () {
 
        if (!$('#perm_new_member_name').hasClass('error')) {
 
            $('#add_perm_input').hide();
 
        }
 
        $('#add_perm').click(function () {
 
            addPermAction('group');
 
        });
 
    });
 
</script>
kallithea/templates/admin/repo_groups/repo_group_edit_settings.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
${h.form(url('update_repos_group',group_name=c.repo_group.group_name))}
 
<div class="form">
 
        <div class="form-group">
 
            <label class="control-label" for="group_name">${_('Group name')}:</label>
 
            <div>
 
                ${h.text('group_name',class_='form-control')}
 
            </div>
 
        </div>
 

	
 
        <div class="form-group">
 
            <label class="control-label" for="group_description">${_('Description')}:</label>
 
            <div>
 
                ${h.textarea('group_description',cols=23,rows=5,class_='form-control')}
 
            </div>
 
        </div>
 

	
 
        <div class="form-group">
 
            <label class="control-label" for="parent_group_id">${_('Group parent')}:</label>
 
            <div>
 
                ${h.select('parent_group_id','',c.repo_groups,class_='form-control')}
 
            </div>
 
        </div>
 

	
 
        <div class="form-group">
 
            <div class="buttons">
 
                ${h.submit('save',_('Save'),class_="btn btn-default")}
 
                ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
            </div>
 
        </div>
 
</div>
 
${h.end_form()}
 

	
 
${h.form(url('delete_repo_group', group_name=c.repo_group.group_name))}
 
<div class="form">
 
        <div class="form-group">
 
            <div class="buttons">
 
                ${h.submit('remove_%s' % c.repo_group.group_name,_('Remove this group'),class_="btn btn-danger",onclick="return confirm('"+_('Confirm to delete this group')+"');")}
 
            </div>
 
        </div>
 
</div>
 
${h.end_form()}
 

	
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        $("#parent_group_id").select2({
 
            'dropdownAutoWidth': true
 
        });
 
    });
 
</script>
kallithea/templates/admin/repo_groups/repo_groups.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Repository Groups Administration')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="repo_group_count">0</span> ${_('Repository Groups')}
 
</%def>
 

	
 

	
 
<%block name="header_menu">
 
    ${self.menu('admin')}
 
</%block>
 

	
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        <div class="pull-left">
 
            ${self.breadcrumbs()}
 
        </div>
 
        <div class="pull-right">
 
            %if h.HasPermissionAny('hg.admin')():
 
               <a href="${h.url('new_repos_group')}" class="btn btn-success btn-xs"><i class="icon-plus"></i>${_('Add Repository Group')}</a>
 
            %endif
 
        </div>
 
    </div>
 
    <div class="panel-body">
 
        <table class="table" id="datatable_list_wrap" width="100%"></table>
 
    </div>
 
</div>
 
<script>
 
<script>'use strict';
 
  var data = ${h.js(c.data)};
 
  var myDataTable = $("#datatable_list_wrap").DataTable({
 
        data: data.records,
 
        columns: [
 
            {data: "raw_name", visible: false, searchable: false},
 
            {data: "group_name", orderData: 0, title: ${h.jshtml(_('Name'))}},
 
            {data: "desc", title: ${h.jshtml(_('Description'))}, searchable: false},
 
            {data: "repos", title: ${h.jshtml(_('Number of Top-level Repositories'))}, searchable: false},
 
            {data: "owner", title: ${h.jshtml(_('Owner'))}, searchable: false},
 
            {data: "action", title: ${h.jshtml(_('Action'))}, sortable: false, searchable: false}
 
        ],
 
        drawCallback: updateRowCountCallback($("#repo_group_count")),
 
        dom: '<"dataTables_left"f><"dataTables_right"ip>t',
 
        pageLength: 100
 
    });
 

	
 
</script>
 
</%def>
kallithea/templates/admin/repos/repo_add_base.html
Show inline comments
 
## -*- coding: utf-8 -*-
 

	
 
${h.form(url('repos'))}
 
<div class="form">
 
        <div class="form-group">
 
            <label class="control-label" for="repo_name">${_('Name')}:</label>
 
            <div>
 
                ${h.text('repo_name',class_='form-control')}
 
            </div>
 
         </div>
 
        <div id="remote_clone" class="form-group">
 
            <label class="control-label" for="clone_uri">${_('Clone remote repository')}:</label>
 
            <div>
 
                ${h.text('clone_uri',class_='form-control')}
 
                <span class="help-block">
 
                    ${_('Optional: URL of a remote repository. If set, the repository will be created as a clone from this URL.')}
 
                </span>
 
            </div>
 
        </div>
 
        <div class="form-group">
 
            <label class="control-label" for="repo_description">${_('Description')}:</label>
 
            <div>
 
                ${h.textarea('repo_description',class_='form-control')}
 
                <span class="help-block">${_('Keep it short and to the point. Use a README file for longer descriptions.')}</span>
 
            </div>
 
        </div>
 
        <div class="form-group">
 
            <label class="control-label" for="repo_group">${_('Repository group')}:</label>
 
            <div>
 
                ${h.select('repo_group',request.GET.get('parent_group'),c.repo_groups,class_='form-control')}
 
                <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
 
            </div>
 
        </div>
 
        <div id="copy_perms" class="form-group">
 
            <label class="control-label" for="repo_copy_permissions">${_('Copy parent group permissions')}:</label>
 
            <div>
 
                ${h.checkbox('repo_copy_permissions',value="True")}
 
                <span class="help-block">${_('Copy permission set from parent repository group.')}</span>
 
            </div>
 
        </div>
 
        <div class="form-group">
 
            <label class="control-label" for="repo_type">${_('Type')}:</label>
 
            <div>
 
                ${h.select('repo_type','hg',c.backends,class_='form-control')}
 
                <span class="help-block">${_('Type of repository to create.')}</span>
 
            </div>
 
        </div>
 
        <div class="form-group">
 
            <label class="control-label" for="repo_landing_rev">${_('Landing revision')}:</label>
 
            <div>
 
                ${h.select('repo_landing_rev','',c.landing_revs,class_='form-control')}
 
                <span class="help-block">${_('Default revision for files page, downloads, full text search index and readme generation')}</span>
 
            </div>
 
        </div>
 
        <div class="form-group">
 
            <label class="control-label" for="repo_private">${_('Private repository')}:</label>
 
            <div>
 
                ${h.checkbox('repo_private',value="True")}
 
                <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
 
            </div>
 
        </div>
 
        <div class="form-group">
 
            <div class="buttons">
 
                ${h.submit('add',_('Add'),class_="btn btn-default")}
 
            </div>
 
        </div>
 
</div>
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        var setCopyPermsOption = function(group_val){
 
            if(group_val != "-1"){
 
                $('#copy_perms').show();
 
            }
 
            else{
 
                $('#copy_perms').hide();
 
            }
 
        }
 

	
 
        $("#repo_group").select2({
 
            'dropdownAutoWidth': true
 
        });
 

	
 
        setCopyPermsOption($('#repo_group').val());
 
        $("#repo_group").on("change", function(e) {
 
            setCopyPermsOption(e.val);
 
        });
 

	
 
        $("#repo_type").select2({
 
            'minimumResultsForSearch': -1
 
        });
 
        $("#repo_landing_rev").select2({
 
            'minimumResultsForSearch': -1
 
        });
 
        $('#repo_name').focus();
 
    });
 
</script>
 
${h.end_form()}
kallithea/templates/admin/repos/repo_creating.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
## don't trigger flash messages on this page
 
<%def name="flash_msg()">
 
</%def>
 

	
 
<%block name="title">
 
    ${_('%s Creating Repository') % c.repo_name}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Creating repository')} ${c.repo}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 

	
 
    <div class="panel-body">
 
            <h4 class="text-center">
 
                ${_('Repository "%(repo_name)s" is being created, you will be redirected when this process is finished.' % {'repo_name':c.repo_name})}
 
            </h4>
 

	
 
        <div id="progress">
 
            <div class="progress progress-striped active">
 
                <div class="progress-bar" role="progressbar"
 
                    aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
 
                </div>
 
            </div>
 
        </div>
 
        <div id="progress_error" style="display: none;">
 
            <div class="alert alert-danger">
 
                ${_("We're sorry but error occurred during this operation. Please check your Kallithea server logs, or contact administrator.")}
 
            </div>
 
        </div>
 
    </div>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
(function worker() {
 
  $.ajax({
 
    url: ${h.js(h.url('repo_check_home', repo_name=c.repo_name, repo=c.repo, task_id=c.task_id))},
 
    success: function(data) {
 
      if(data.result === true){
 
          //redirect to created fork if our ajax loop tells us to do so.
 
          window.location = ${h.js(h.url('summary_home', repo_name = c.repo))};
 
      }
 
    },
 
    complete: function(resp, status) {
 
      if (resp.status == 200){
 
          // Schedule the next request when the current one's complete
 
          setTimeout(worker, 1000);
 
      }
 
      else{
 
          $("#progress").html($('#progress_error').html());
 
      }
 
    }
 
  });
 
})();
 
</script>
 
</%def>
kallithea/templates/admin/repos/repo_edit_advanced.html
Show inline comments
 
<h3>${_('Parent')}</h3>
 
${h.form(url('edit_repo_advanced_fork', repo_name=c.repo_info.repo_name))}
 
<div class="form">
 
       ${h.select('id_fork_of','',c.repos_list)}
 
       ${h.submit('set_as_fork_%s' % c.repo_info.repo_name,_('Set'),class_="btn btn-default btn-sm")}
 
       <div class="text-muted">
 
       ${_('''Manually set this repository as a fork of another from the list.''')}
 
       </div>
 
</div>
 
${h.end_form()}
 

	
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        $("#id_fork_of").select2({
 
            'dropdownAutoWidth': true
 
        });
 
    });
 
</script>
 

	
 
<h3>${_('Public Journal Visibility')}</h3>
 
${h.form(url('edit_repo_advanced_journal', repo_name=c.repo_info.repo_name))}
 
<div class="form">
 
  <div>
 
  %if c.in_public_journal:
 
    <button class="btn btn-default btn-sm" type="submit">
 
        <i class="icon-minus"></i>
 
        ${_('Remove from public journal')}
 
    </button>
 
  %else:
 
    <button class="btn btn-default btn-sm" type="submit">
 
        <i class="icon-plus"></i>
 
        ${_('Add to Public Journal')}
 
    </button>
 
  %endif
 
  </div>
 
 <div class="text-muted">
 
 ${_('All actions done in this repository will be visible to everyone in the public journal.')}
 
 </div>
 
</div>
 
${h.end_form()}
 

	
 
<h3>${_('Delete')}</h3>
 
${h.form(url('delete_repo', repo_name=c.repo_name))}
 
<div class="form">
 
    <button class="btn btn-danger btn-sm" type="submit"
 
            onclick="return confirm('${_('Confirm to delete this repository: %s') % c.repo_name}');">
 
        <i class="icon-trashcan"></i>
 
        ${_('Delete this Repository')}
 
    </button>
 
    %if c.repo_info.forks.count():
 
        ${ungettext('This repository has %s fork', 'This repository has %s forks', c.repo_info.forks.count()) % c.repo_info.forks.count()}
 
        <label>
 
            <input type="radio" name="forks" value="detach_forks" checked="checked"/>
 
            ${_('Detach forks')}
 
        </label>
 
        <label>
 
            <input type="radio" name="forks" value="delete_forks" />
 
            ${_('Delete forks')}
 
        </label>
 
    %endif
 
    <div class="text-muted">
 
        ${_('The deleted repository will be moved away and hidden until the administrator expires it. The administrator can both permanently delete it or restore it.')}
 
    </div>
 
</div>
 
${h.end_form()}
kallithea/templates/admin/repos/repo_edit_permissions.html
Show inline comments
 
${h.form(url('edit_repo_perms_update', repo_name=c.repo_name))}
 
<div class="form">
 
        <div class="form-group">
 
            ${h.hidden('repo_private')}
 
            <table id="permissions_manage" class="table table-condensed">
 
                <tr>
 
                    <td>${_('None')}</td>
 
                    <td>${_('Read')}</td>
 
                    <td>${_('Write')}</td>
 
                    <td>${_('Admin')}</td>
 
                    <td>${_('User/User Group')}</td>
 
                    <td></td>
 
                </tr>
 
                ## USERS
 
                %for r2p in sorted(c.repo_info.repo_to_perm, key=lambda x: x.user.username != 'default' and x.user.username):
 
                    %if r2p.user.username =='default' and c.repo_info.private:
 
                        <tr>
 
                            <td colspan="4">
 
                                <span class="private_repo_msg">
 
                                ${_('Private Repository')}
 
                                </span>
 
                            </td>
 
                            <td class="private_repo_msg"><i class="icon-user"></i>${_('Default')}</td>
 
                        </tr>
 
                    %else:
 
                    <tr id="id${id(r2p.user.username)}">
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.none')}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.read')}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.write')}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.admin')}</td>
 
                        <td>
 
                            ${h.gravatar(r2p.user.email, size=14)}
 
                            %if h.HasPermissionAny('hg.admin')() and r2p.user.username != 'default':
 
                             <a href="${h.url('edit_user',id=r2p.user.user_id)}">${r2p.user.username}</a>
 
                            %else:
 
                             ${r2p.user.username if r2p.user.username != 'default' else _('Default')}
 
                            %endif
 
                        </td>
 
                        <td>
 
                          %if r2p.user.username !='default':
 
                            <button type="button" class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${r2p.user.user_id}, 'user', '${'id%s'%id(r2p.user.username)}', '${r2p.user.username}')">
 
                            <i class="icon-minus-circled"></i>${_('Revoke')}
 
                            </button>
 
                          %endif
 
                        </td>
 
                    </tr>
 
                    %endif
 
                %endfor
 

	
 
                ## USER GROUPS
 
                %for g2p in sorted(c.repo_info.users_group_to_perm, key=lambda x:x.users_group.users_group_name):
 
                    <tr id="id${id(g2p.users_group.users_group_name)}">
 
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.none')}</td>
 
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.read')}</td>
 
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.write')}</td>
 
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.admin')}</td>
 
                        <td>
 
                            <i class="icon-users"></i>
 
                            %if h.HasPermissionAny('hg.admin')():
 
                             <a href="${h.url('edit_users_group',id=g2p.users_group.users_group_id)}">${g2p.users_group.users_group_name}</a>
 
                            %else:
 
                             ${g2p.users_group.users_group_name}
 
                            %endif
 
                        </td>
 
                        <td>
 
                            <button type="button" class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${g2p.users_group.users_group_id}, 'user_group', '${'id%s'%id(g2p.users_group.users_group_name)}', '${g2p.users_group.users_group_name}')">
 
                            <i class="icon-minus-circled"></i>${_('Revoke')}
 
                            </button>
 
                        </td>
 
                    </tr>
 
                %endfor
 
                ## New entries added by addPermAction here.
 
                <tr class="new_members last_new_member" id="add_perm_input"><td colspan="6"></td></tr>
 
                <tr>
 
                    <td colspan="6">
 
                        <button type="button" id="add_perm" class="btn btn-link btn-xs">
 
                            <i class="icon-plus"></i>${_('Add new')}
 
                        </button>
 
                    </td>
 
                </tr>
 
            </table>
 
        </div>
 
        <div class="form-group">
 
            ${h.submit('save',_('Save'),class_="btn btn-default")}
 
            ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
        </div>
 
</div>
 
${h.end_form()}
 

	
 
<script>
 
<script>'use strict';
 
    function ajaxActionRevoke(obj_id, obj_type, field_id, obj_name) {
 
        url = ${h.js(h.url('edit_repo_perms_revoke',repo_name=c.repo_name))};
 
        let url = ${h.js(h.url('edit_repo_perms_revoke',repo_name=c.repo_name))};
 
        var revoke_msg = _TM['Confirm to revoke permission for {0}: {1} ?'].format(obj_type.replace('_', ' '), obj_name);
 
        if (confirm(revoke_msg)){
 
            ajaxActionRevokePermission(url, obj_id, obj_type, field_id);
 
        }
 
    };
 

	
 
    $(document).ready(function () {
 
        if (!$('#perm_new_member_name').hasClass('error')) {
 
            $('#add_perm_input').hide();
 
        }
 
        $('#add_perm').click(function () {
 
            addPermAction('repository');
 
        });
 
    });
 
</script>
kallithea/templates/admin/repos/repo_edit_settings.html
Show inline comments
 
${h.form(url('update_repo', repo_name=c.repo_info.repo_name))}
 
    <div class="form">
 
            <div class="form-group">
 
                <label class="control-label" for="repo_name">${_('Name')}:</label>
 
                <div>
 
                    ${h.text('repo_name',class_='form-control')}
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="permanent_url">${_('Permanent URL')}:</label>
 
                <div>
 
                    ${h.text('permanent_url',class_='form-control', readonly='1')}
 
                    <span class="help-block">
 
                        ${_('''In case this repository is renamed or moved into another group the repository URL changes.
 
                               Using the above permanent URL guarantees that this repository always will be accessible on that URL.
 
                               This is useful for CI systems, or any other cases that you need to hardcode the URL into a 3rd party service.''')}
 
                    </span>
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="clone_uri">${_('Remote repository')}:</label>
 
                <div>
 
                  <div id="alter_clone_uri">
 
                        ${h.text('clone_uri',class_='form-control', placeholder=_('Repository URL'))}
 
                        ${h.hidden('clone_uri_hidden', c.repo_info.clone_uri_hidden)}
 
                  </div>
 
                  <span id="alter_clone_uri_help_block" class="help-block">
 
                    ${_('Optional: URL of a remote repository. If set, the repository can be pulled from this URL.')}
 
                  </span>
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="repo_group">${_('Repository group')}:</label>
 
                <div>
 
                    ${h.select('repo_group','',c.repo_groups,class_='form-control')}
 
                    <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="repo_landing_rev">${_('Landing revision')}:</label>
 
                <div>
 
                    ${h.select('repo_landing_rev','',c.landing_revs,class_='form-control')}
 
                    <span class="help-block">${_('Default revision for files page, downloads, whoosh and readme')}</span>
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="owner">${_('Owner')}:</label>
 
                <div>
 
                   ${h.text('owner',class_='form-control', placeholder=_('Type name of user'))}
 
                   <span class="help-block">${_('Change owner of this repository.')}</span>
 
                </div>
 
             </div>
 
            <div class="form-group">
 
                <label class="control-label" for="repo_description">${_('Description')}:</label>
 
                <div>
 
                    ${h.textarea('repo_description',class_='form-control')}
 
                    <span class="help-block">${_('Keep it short and to the point. Use a README file for longer descriptions.')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="repo_private">${_('Private repository')}:</label>
 
                <div>
 
                    ${h.checkbox('repo_private',value="True")}
 
                    <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="repo_enable_statistics">${_('Enable statistics')}:</label>
 
                <div>
 
                    ${h.checkbox('repo_enable_statistics',value="True")}
 
                    <span class="help-block">${_('Enable statistics window on summary page.')}</span>
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="repo_enable_downloads">${_('Enable downloads')}:</label>
 
                <div>
 
                    ${h.checkbox('repo_enable_downloads',value="True")}
 
                    <span class="help-block">${_('Enable download menu on summary page.')}</span>
 
                </div>
 
            </div>
 

	
 
            %if c.visual.repository_fields:
 
              ## EXTRA FIELDS
 
              %for field in c.repo_fields:
 
                <div class="form-group">
 
                    <label class="control-label" for="${field.field_key_prefixed}">${field.field_label} (${field.field_key}):</label>
 
                    <div>
 
                        ${h.text(field.field_key_prefixed, field.field_value, class_='form-control')}
 
                        %if field.field_desc:
 
                          <span class="help-block">${field.field_desc}</span>
 
                        %endif
 
                    </div>
 
                 </div>
 
              %endfor
 
            %endif
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('save',_('Save'),class_="btn btn-default")}
 
                    ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
                </div>
 
            </div>
 
    </div>
 
    ${h.end_form()}
 

	
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        $('#repo_landing_rev').select2({
 
            'dropdownAutoWidth': true
 
        });
 
        $('#repo_group').select2({
 
            'dropdownAutoWidth': true
 
        });
 

	
 
        // autocomplete
 
        SimpleUserAutoComplete($('#owner'));
 
    });
 
</script>
kallithea/templates/admin/repos/repos.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Repositories Administration')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    <span id="repo_count">0</span> ${_('Repositories')}
 
</%def>
 
<%block name="header_menu">
 
    ${self.menu('admin')}
 
</%block>
 
<%def name="main()">
 
<div class="panel panel-primary">
 

	
 
    <div class="panel-heading clearfix">
 
        <div class="pull-left">
 
            ${self.breadcrumbs()}
 
        </div>
 
        <div class="pull-right">
 
         %if h.HasPermissionAny('hg.admin','hg.create.repository')():
 
            <a href="${h.url('new_repo')}" class="btn btn-success btn-xs"><i class="icon-plus"></i>${_('Add Repository')}</a>
 
         %endif
 
        </div>
 
    </div>
 
    <div class="panel-body">
 
        <table class="table" id="datatable_list_wrap" width="100%"></table>
 
    </div>
 

	
 
</div>
 
<script>
 
<script>'use strict';
 
  var data = ${h.js(c.data)};
 
  var myDataTable = $("#datatable_list_wrap").DataTable({
 
        data: data.records,
 
        columns: [
 
            {data: "raw_name", visible: false, searchable: false},
 
            {data: "name", orderData: 1, title: ${h.jshtml(_('Name'))}},
 
            {data: "desc", title: ${h.jshtml(_('Description'))}, searchable: false},
 
            {data: "last_rev_raw", visible: false, searchable: false},
 
            {data: "last_changeset", orderData: 4, title: ${h.jshtml(_('Tip'))}, searchable: false},
 
            {data: "owner", title: ${h.jshtml(_('Owner'))}, searchable: false},
 
            {data: "state", title: ${h.jshtml(_('State'))}, searchable: false},
 
            {data: "action", title: ${h.jshtml(_('Action'))}, sortable: false, searchable: false}
 
        ],
 
        drawCallback: updateRowCountCallback($("#repo_count")),
 
        dom: '<"dataTables_left"f><"dataTables_right"ip>t',
 
        pageLength: 100
 
    });
 
</script>
 

	
 
</%def>
kallithea/templates/admin/settings/settings_hooks.html
Show inline comments
 
<div class="form">
 
      <div class="form-group">
 
      <h4>${_('Built-in Mercurial Hooks (Read-Only)')}</h4>
 
      % for hook in c.hooks:
 
        <% input_id = hook.ui_key.replace('.', '_') %>
 
            <label class="control-label" for="${input_id}" title="${hook.ui_key}">${hook.ui_key}</label>
 
            <div>
 
              ${h.text(hook.ui_key,hook.ui_value,id=input_id,size=60,readonly="readonly",class_='form-control')}
 
            </div>
 
      % endfor
 
      </div>
 
</div>
 

	
 
% if c.visual.allow_custom_hooks_settings:
 
${h.form(url('admin_settings_hooks'), method='post')}
 
<div class="form">
 
        <h4>${_('Custom Hooks')}</h4>
 
        <span class="help-block">${_('Hooks can be used to trigger actions on certain events such as push / pull. They can trigger Python functions or external applications.')}</span>
 
        %for hook in c.custom_hooks:
 
            <div class="form-group form-inline" id="${'id%s' % hook.ui_id }">
 
                <% input_id = hook.ui_key.replace('.', '_') %>
 
                    <label class="control-label" for="${input_id}" title="${hook.ui_key}">${hook.ui_key}</label>
 
                    <div>
 
                        ${h.hidden('hook_ui_key',hook.ui_key,id='hook_ui_key_'+input_id)}
 
                        ${h.hidden('hook_ui_value',hook.ui_value,id='hook_ui_value_'+input_id)}
 
                        ${h.text('hook_ui_value_new',hook.ui_value,id=input_id,size=50,class_='form-control')}
 
                        <button type="button" class="btn btn-default btn-xs"
 
                            onclick="delete_hook(${hook.ui_id},'${'id%s' % hook.ui_id }')">
 
                            <i class="icon-trashcan"></i>
 
                            ${_('Delete')}
 
                        </button>
 
                    </div>
 
            </div>
 
        %endfor
 

	
 
        <div class="form-group form-inline">
 
            <label>
 
                ${h.text('new_hook_ui_key',size=15,class_='form-control')}
 
            </label>
 
            <div>
 
                ${h.text('new_hook_ui_value',size=50,class_='form-control')}
 
            </div>
 
        </div>
 
        <div class="form-group">
 
            <div class="buttons">
 
                ${h.submit('save',_('Save'),class_="btn btn-default")}
 
            </div>
 
        </div>
 
</div>
 
${h.end_form()}
 
% endif
 

	
 
<script>
 
<script>'use strict';
 
function delete_hook(hook_id, field_id) {
 
    var sUrl = ${h.js(h.url('admin_settings_hooks_delete'))};
 
    var success = function (o) {
 
            $('#' + field_id).remove();
 
        };
 
    var failure = function (o) {
 
            alert(${h.js(_('Failed to remove hook'))});
 
        };
 
    var postData = {'hook_id': hook_id};
 
    ajaxPOST(sUrl, postData, success, failure);
 
};
 
</script>
kallithea/templates/admin/settings/settings_vcs.html
Show inline comments
 
${h.form(url('admin_settings'), method='post')}
 
    <div class="form">
 
            <div class="form-group">
 
                <label class="control-label">${_('Hooks')}:</label>
 
                <div>
 
                    <div class="checkbox">
 
                        <label>
 
                            ${h.checkbox('hooks_changegroup_repo_size','True')}
 
                            ${_('Show repository size after push')}
 
                        </label>
 
                    </div>
 
                    <div class="checkbox">
 
                        <label>
 
                            ${h.checkbox('hooks_changegroup_update','True')}
 
                            ${_('Update repository after push (hg update)')}
 
                        </label>
 
                    </div>
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label">${_('Mercurial extensions')}:</label>
 
                <div>
 
                    <div class="checkbox">
 
                        <label>
 
                            ${h.checkbox('extensions_largefiles','True')}
 
                            ${_('Enable largefiles extension')}
 
                        </label>
 
                    </div>
 
                    <div class="checkbox">
 
                        <label>
 
                            ${h.checkbox('extensions_hgsubversion','True')}
 
                            ${_('Enable hgsubversion extension')}
 
                        </label>
 
                    </div>
 
                    <span class="help-block">${_('Requires hgsubversion library to be installed. Enables cloning of remote Subversion repositories while converting them to Mercurial.')}</span>
 
                    ##<div class="checkbox">
 
                    ##    <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>
 
                    <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.')}">
 
                            <button type="button" class="btn btn-default btn-sm"><i id="path_unlock_icon" class="icon-lock"></i></button>
 
                        </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>
 
           </div>
 
    </div>
 
    ${h.end_form()}
 

	
 
    <script>
 
    <script>'use strict';
 
        $(document).ready(function(){
 
            $('#path_unlock').on('click', function(e){
 
                $('#path_unlock_icon').removeClass('icon-lock');
 
                $('#path_unlock_icon').addClass('icon-lock-open-alt');
 
                $('#paths_root_path').removeAttr('readonly');
 
            });
 
        });
 
    </script>
kallithea/templates/admin/user_groups/user_group_add.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Add user group')}
 
</%block>
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(_('Admin'),h.url('admin_home'))}
 
    &raquo;
 
    ${h.link_to(_('User Groups'),h.url('users_groups'))}
 
    &raquo;
 
    ${_('Add User Group')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('admin')}
 
</%block>
 

	
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    ${h.form(url('users_groups'))}
 
    <div class="form panel-body settings">
 
            <div class="form-group">
 
                <label class="control-label" for="users_group_name">${_('Group name')}:</label>
 
                <div>
 
                    ${h.text('users_group_name',class_='form-control')}
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="user_group_description">${_('Description')}:</label>
 
                <div>
 
                    ${h.textarea('user_group_description',class_='form-control')}
 
                    <span class="help-block">${_('Short, optional description for this user group.')}</span>
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="users_group_active">${_('Active')}:</label>
 
                <div>
 
                    ${h.checkbox('users_group_active',value=True, checked='checked')}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('save',_('Save'),class_="btn btn-default")}
 
                </div>
 
            </div>
 
    </div>
 
    ${h.end_form()}
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        $('#users_group_name').focus();
 
    });
 
</script>
 
</%def>
kallithea/templates/admin/user_groups/user_group_edit_perms.html
Show inline comments
 
${h.form(url('edit_user_group_perms_update', id=c.user_group.users_group_id))}
 
<div class="form">
 
   <div>
 
        <div>
 
            <table id="permissions_manage" class="table">
 
                <tr>
 
                    <td>${_('None')}</td>
 
                    <td>${_('Read')}</td>
 
                    <td>${_('Write')}</td>
 
                    <td>${_('Admin')}</td>
 
                    <td>${_('User/User Group')}</td>
 
                    <td></td>
 
                </tr>
 
                ## USERS
 
                %for r2p in c.user_group.user_user_group_to_perm:
 
                    ##forbid revoking permission from yourself, except if you're an super admin
 
                    <tr id="id${id(r2p.user.username)}">
 
                      %if request.authuser.user_id != r2p.user.user_id or request.authuser.is_admin:
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'usergroup.none')}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'usergroup.read')}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'usergroup.write')}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'usergroup.admin')}</td>
 
                        <td>
 
                            ${h.gravatar(r2p.user.email, cls="perm-gravatar", size=14)}
 
                            %if h.HasPermissionAny('hg.admin')() and r2p.user.username != 'default':
 
                             <a href="${h.url('edit_user',id=r2p.user.user_id)}">${r2p.user.username}</a>
 
                            %else:
 
                             ${r2p.user.username if r2p.user.username != 'default' else _('Default')}
 
                            %endif
 
                        </td>
 
                        <td>
 
                          %if r2p.user.username !='default':
 
                            <button type="button" class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${r2p.user.user_id}, 'user', '${'id%s'%id(r2p.user.username)}', '${r2p.user.username}')">
 
                             <i class="icon-minus-circled"></i>${_('Revoke')}
 
                            </button>
 
                          %endif
 
                        </td>
 
                      %else:
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'usergroup.none', disabled="disabled")}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'usergroup.read', disabled="disabled")}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'usergroup.write', disabled="disabled")}</td>
 
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'usergroup.admin', disabled="disabled")}</td>
 
                        <td>
 
                            ${h.gravatar(r2p.user.email, cls="perm-gravatar", size=14)}
 
                            ${r2p.user.username if r2p.user.username != 'default' else _('Default')}
 
                        </td>
 
                        <td><i class="icon-user"></i>${_('Admin')}</td>
 
                      %endif
 
                    </tr>
 
                %endfor
 

	
 
                ## USER GROUPS
 
                %for g2p in c.user_group.user_group_user_group_to_perm:
 
                    <tr id="id${id(g2p.user_group.users_group_name)}">
 
                        <td>${h.radio('g_perm_%s' % g2p.user_group.users_group_name,'usergroup.none')}</td>
 
                        <td>${h.radio('g_perm_%s' % g2p.user_group.users_group_name,'usergroup.read')}</td>
 
                        <td>${h.radio('g_perm_%s' % g2p.user_group.users_group_name,'usergroup.write')}</td>
 
                        <td>${h.radio('g_perm_%s' % g2p.user_group.users_group_name,'usergroup.admin')}</td>
 
                        <td>
 
                            <i class="icon-users"></i>
 
                            %if h.HasPermissionAny('hg.admin')():
 
                             <a href="${h.url('edit_users_group',id=g2p.user_group.users_group_id)}">
 
                                 ${g2p.user_group.users_group_name}
 
                             </a>
 
                            %else:
 
                             ${g2p.user_group.users_group_name}
 
                            %endif
 
                        </td>
 
                        <td>
 
                            <button class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${g2p.user_group.users_group_id}, 'user_group', '${'id%s'%id(g2p.user_group.users_group_name)}', '${g2p.user_group.users_group_name}')">
 
                            <i class="icon-minus-circled"></i>${_('Revoke')}
 
                            </button>
 
                        </td>
 
                    </tr>
 
                %endfor
 
                ## New entries added by addPermAction here.
 
                <tr class="new_members last_new_member" id="add_perm_input"><td colspan="6"></td></tr>
 
                <tr>
 
                    <td colspan="6">
 
                        <button id="add_perm" class="btn btn-link btn-xs">
 
                            <i class="icon-plus"></i>${_('Add new')}
 
                        </button>
 
                    </td>
 
                </tr>
 
            </table>
 
        </div>
 
        <div class="buttons">
 
            ${h.submit('save',_('Save'),class_="btn btn-default")}
 
            ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
        </div>
 
   </div>
 
</div>
 
${h.end_form()}
 

	
 
<script>
 
<script>'use strict';
 
    function ajaxActionRevoke(obj_id, obj_type, field_id, obj_name) {
 
        url = ${h.js(h.url('edit_user_group_perms_delete', id=c.user_group.users_group_id))};
 
        let url = ${h.js(h.url('edit_user_group_perms_delete', id=c.user_group.users_group_id))};
 
        var revoke_msg = _TM['Confirm to revoke permission for {0}: {1} ?'].format(obj_type.replace('_', ' '), obj_name);
 
        if (confirm(revoke_msg)){
 
            ajaxActionRevokePermission(url, obj_id, obj_type, field_id);
 
        }
 
    };
 

	
 
    $(document).ready(function () {
 
        if (!$('#perm_new_member_name').hasClass('error')) {
 
            $('#add_perm_input').hide();
 
        }
 
        $('#add_perm').click(function () {
 
            addPermAction('usergroup');
 
        });
 
    });
 
</script>
kallithea/templates/admin/user_groups/user_group_edit_settings.html
Show inline comments
 
${h.form(url('update_users_group', id=c.user_group.users_group_id), id='edit_users_group')}
 
    <div class="form">
 
                <div class="form-group">
 
                    <label class="control-label" for="users_group_name">${_('Group name')}:</label>
 
                    <div>
 
                        ${h.text('users_group_name',class_='form-control')}
 
                    </div>
 
                </div>
 
                <div class="form-group">
 
                    <label class="control-label" for="user_group_description">${_('Description')}:</label>
 
                    <div>
 
                        ${h.textarea('user_group_description',class_='form-control')}
 
                        <span class="help-block">${_('Short, optional description for this user group.')}</span>
 
                    </div>
 
                </div>
 
                <div class="form-group">
 
                    <label class="control-label" for="users_group_active">${_('Active')}:</label>
 
                    <div>
 
                        ${h.checkbox('users_group_active',value=True)}
 
                    </div>
 
                </div>
 
                <div class="form-group">
 
                    <label class="control-label">${_('Members')}:</label>
 
                    <div>
 
                        <div class="pull-left">
 
                            <div class="text">${_('Chosen group members')}</div>
 
                            ${h.select('users_group_members',[],c.group_members,multiple=True,size=8,style="width:210px",class_='form-control')}
 
                        </div>
 
                        <div class="pull-left">
 
                          <div class="text">&nbsp;</div>
 
                          <div>
 
                            <i id="add_element" class="icon-left-open" title="Choose selected available"></i>
 
                          </div>
 
                          <div>
 
                            <i id="remove_element" class="icon-right-open" title="Remove selected chosen"></i>
 
                          </div>
 
                        </div>
 
                        <div class="pull-left">
 
                            <div class="text">${_('Available members')}</div>
 
                            ${h.select('available_members',[],c.available_members,multiple=True,size=8,style="width:210px",class_='form-control')}
 
                        </div>
 
                    </div>
 
                </div>
 
                <div class="form-group">
 
                    <div class="buttons">
 
                        ${h.submit('Save',_('Save'),class_="btn btn-default")}
 
                    </div>
 
                </div>
 
    </div>
 
${h.end_form()}
 
<script>
 
<script>'use strict';
 
  MultiSelectWidget('users_group_members','available_members','edit_users_group');
 
</script>
kallithea/templates/admin/user_groups/user_groups.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('User Groups Administration')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; ${_('User Groups')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('admin')}
 
</%block>
 

	
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        <div class="pull-left">
 
            ${self.breadcrumbs()}
 
        </div>
 
        <div class="pull-right">
 
        %if h.HasPermissionAny('hg.admin', 'hg.usergroup.create.true')():
 
            <a href="${h.url('new_users_group')}" class="btn btn-success btn-xs"><i class="icon-plus"></i>${_('Add User Group')}</a>
 
        %endif
 
        </div>
 
    </div>
 
    <div class="panel-body">
 
        <table class="table" id="datatable_list_wrap" width="100%"></table>
 
    </div>
 
</div>
 
<script>
 
<script>'use strict';
 
    var data = ${h.js(c.data)};
 
    var $dataTable = $("#datatable_list_wrap").DataTable({
 
        data: data.records,
 
        columns: [
 
            {data: "raw_name", visible: false, searchable: false},
 
            {data: "group_name", title: ${h.jshtml(_('Name'))}, orderData: 0},
 
            {data: "desc", title: ${h.jshtml(_('Description'))}, searchable: false},
 
            {data: "members", title: ${h.jshtml(_('Members'))}, searchable: false},
 
            {data: "active", title: ${h.jshtml(_('Active'))}, searchable: false, 'sType': 'str'},
 
            {data: "owner", title: ${h.jshtml(_('Owner'))}, searchable: false},
 
            {data: "action", title: ${h.jshtml(_('Action'))}, searchable: false, sortable: false}
 
        ],
 
        order: [[1, "asc"]],
 
        dom: '<"dataTables_left"f><"dataTables_right"ip>t',
 
        pageLength: 100
 
    });
 
</script>
 
</%def>
kallithea/templates/admin/users/user_add.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Add user')}
 
</%block>
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(_('Admin'),h.url('admin_home'))}
 
    &raquo;
 
    ${h.link_to(_('Users'),h.url('users'))}
 
    &raquo;
 
    ${_('Add User')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('admin')}
 
</%block>
 

	
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    ${h.form(url('new_user'))}
 
    <div class="form panel-body settings">
 
            <div class="form-group">
 
                <label class="control-label" for="username">${_('Username')}:</label>
 
                <div>
 
                    ${h.text('username',class_='form-control')}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="password">${_('Password')}:</label>
 
                <div>
 
                    ${h.password('password',class_='form-control')}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="password_confirmation">${_('Password confirmation')}:</label>
 
                <div>
 
                    ${h.password('password_confirmation',class_='form-control')}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="firstname">${_('First Name')}:</label>
 
                <div>
 
                    ${h.text('firstname',class_='form-control')}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="lastname">${_('Last Name')}:</label>
 
                <div>
 
                    ${h.text('lastname',class_='form-control')}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="email">${_('Email')}:</label>
 
                <div>
 
                    ${h.text('email',class_='form-control')}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="active">${_('Active')}:</label>
 
                <div>
 
                    ${h.checkbox('active',value=True,checked='checked')}
 
                </div>
 
            </div>
 

	
 
            ${h.hidden('extern_type', c.default_extern_type)}
 
            ${h.hidden('extern_name', c.default_extern_name)}
 

	
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('save',_('Save'),class_="btn btn-default")}
 
                </div>
 
            </div>
 
    </div>
 
    ${h.end_form()}
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        $('#username').focus();
 
    });
 
</script>
 
</%def>
kallithea/templates/admin/users/user_edit_api_keys.html
Show inline comments
 
<table class="table">
 
    <tr>
 
        <td><div class="truncate autoexpand">${c.user.api_key}</div></td>
 
        <td>
 
            <span class="label label-success">${_('Built-in')}</span>
 
        </td>
 
        <td>${_('Expires')}: ${_('Never')}</td>
 
        <td>
 
            ${h.form(url('edit_user_api_keys_delete', id=c.user.user_id))}
 
                ${h.hidden('del_api_key',c.user.api_key)}
 
                ${h.hidden('del_api_key_builtin',1)}
 
                <button class="btn btn-danger btn-xs" type="submit"
 
                        onclick="return confirm('${_('Confirm to reset this API key: %s') % c.user.api_key}');">
 
                    ${_('Reset')}
 
                </button>
 
            ${h.end_form()}
 
        </td>
 
    </tr>
 
    %if c.user_api_keys:
 
        %for api_key in c.user_api_keys:
 
          <tr class="${'expired' if api_key.is_expired else ''}">
 
            <td><div class="truncate autoexpand">${api_key.api_key}</div></td>
 
            <td>${api_key.description}</td>
 
            <td>
 
                 %if api_key.expires == -1:
 
                  ${_('Expires')}: ${_('Never')}
 
                 %else:
 
                    %if api_key.is_expired:
 
                        ${_('Expired')}: ${h.age(h.time_to_datetime(api_key.expires))}
 
                    %else:
 
                        ${_('Expires')}: ${h.age(h.time_to_datetime(api_key.expires))}
 
                    %endif
 
                 %endif
 
            </td>
 
            <td>
 
                ${h.form(url('edit_user_api_keys_delete', id=c.user.user_id))}
 
                    ${h.hidden('del_api_key',api_key.api_key)}
 
                    <button class="btn btn-danger btn-xs" type="submit"
 
                            onclick="return confirm('${_('Confirm to remove this API key: %s') % api_key.api_key}');">
 
                        <i class="icon-trashcan"></i>
 
                        ${_('Remove')}
 
                    </button>
 
                ${h.end_form()}
 
            </td>
 
          </tr>
 
        %endfor
 
    %else:
 
    <tr><td><div class="ip">${_('No additional API keys specified')}</div></td></tr>
 
    %endif
 
</table>
 

	
 
<div>
 
    ${h.form(url('edit_user_api_keys_update', id=c.user.user_id))}
 
    <div class="form">
 
            <div class="form-group">
 
                <label class="control-label">${_('New API key')}</label>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="description">${_('Description')}:</label>
 
                <div>
 
                    ${h.text('description', class_='form-control', placeholder=_('Description'))}
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <label class="control-label" for="lifetime">${_('Lifetime')}:</label>
 
                <div>
 
                    ${h.select('lifetime', '', c.lifetime_options)}
 
                </div>
 
            </div>
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('save',_('Add'),class_="btn btn-default")}
 
                    ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
                </div>
 
            </div>
 
    </div>
 
    ${h.end_form()}
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        $("#lifetime").select2({
 
            'dropdownAutoWidth': true
 
        });
 
    });
 
</script>
kallithea/templates/admin/users/users.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Users Administration')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="user_count">0</span> ${_('Users')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('admin')}
 
</%block>
 

	
 
<%def name="main()">
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        <div class="pull-left">
 
            ${self.breadcrumbs()}
 
        </div>
 
        <div class="pull-right">
 
            <a href="${h.url('new_user')}" class="btn btn-success btn-xs"><i class="icon-plus"></i>${_('Add User')}</a>
 
        </div>
 
    </div>
 
    <div class="panel-body">
 
        <table class="table" id="datatable_list_wrap" width="100%"></table>
 
    </div>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
    var data = ${h.js(c.data)};
 
    var $dataTable = $("#datatable_list_wrap").DataTable({
 
        data: data.records,
 
        columns: [
 
            {data: "gravatar", sortable: false, searchable: false},
 
            {data: "username", title: ${h.jshtml(_('Username'))}},
 
            {data: "firstname", title: ${h.jshtml(_('First Name'))}},
 
            {data: "lastname", title: ${h.jshtml(_('Last Name'))}},
 
            {data: "last_login_raw", visible: false, searchable: false},
 
            {data: "last_login", title: ${h.jshtml(_('Last Login'))}, orderData: 4, searchable: false},
 
            {data: "active", title: ${h.jshtml(_('Active'))}, searchable: false, 'sType': 'str'},
 
            {data: "admin", title: ${h.jshtml(_('Admin'))}, searchable: false, 'sType': 'str'},
 
            {data: "extern_type", title: ${h.jshtml(_('Auth Type'))}, searchable: false},
 
            {data: "action", title: ${h.jshtml(_('Action'))}, searchable: false, sortable: false}
 
        ],
 
        order: [[1, "asc"]],
 
        drawCallback: updateRowCountCallback($("#user_count")),
 
        dom: '<"dataTables_left"f><"dataTables_right"ip>t',
 
        pageLength: 100
 
    });
 
</script>
 

	
 
</%def>
kallithea/templates/base/base.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="root.html"/>
 

	
 
<!-- CONTENT -->
 
<div id="content" class="container-fluid">
 
    ${self.flash_msg()}
 
    <div id="main">
 
        ${next.main()}
 
    </div>
 
</div>
 
<!-- END CONTENT -->
 

	
 
<!-- FOOTER -->
 
<div class="footer navbar navbar-inverse">
 
    <span class="navbar-text pull-left">
 
        ${_('Server instance: %s') % c.instance_id if c.instance_id else ''}
 
    </span>
 
    <span class="navbar-text pull-right">
 
        This site is powered by
 
        %if c.visual.show_version:
 
            <a class="navbar-link" href="${h.url('kallithea_project_url')}" target="_blank">Kallithea</a> ${c.kallithea_version},
 
        %else:
 
            <a class="navbar-link" href="${h.url('kallithea_project_url')}" target="_blank">Kallithea</a>,
 
        %endif
 
        which is
 
        <a class="navbar-link" href="${h.canonical_url('about')}#copyright">&copy; 2010&ndash;2020 by various authors &amp; licensed under GPLv3</a>.
 
        %if c.issues_url:
 
            &ndash; <a class="navbar-link" href="${c.issues_url}" target="_blank">${_('Support')}</a>
 
        %endif
 
    </span>
 
</div>
 

	
 
<!-- END FOOTER -->
 

	
 
### MAKO DEFS ###
 

	
 
<%block name="branding_title">
 
    %if c.site_name:
 
    &middot; ${c.site_name}
 
    %endif
 
</%block>
 

	
 
<%def name="flash_msg()">
 
    <%include file="/base/flash_msg.html"/>
 
</%def>
 

	
 
<%def name="breadcrumbs()">
 
    <div class="panel-title">
 
    ${self.breadcrumbs_links()}
 
    </div>
 
</%def>
 

	
 
<%def name="admin_menu()">
 
  <ul class="dropdown-menu" role="menu">
 
      <li><a href="${h.url('admin_home')}"><i class="icon-book"></i>${_('Admin Journal')}</a></li>
 
      <li><a href="${h.url('repos')}"><i class="icon-database"></i>${_('Repositories')}</a></li>
 
      <li><a href="${h.url('repos_groups')}"><i class="icon-folder"></i>${_('Repository Groups')}</a></li>
 
      <li><a href="${h.url('users')}"><i class="icon-user"></i>${_('Users')}</a></li>
 
      <li><a href="${h.url('users_groups')}"><i class="icon-users"></i>${_('User Groups')}</a></li>
 
      <li><a href="${h.url('admin_permissions')}"><i class="icon-block"></i>${_('Default Permissions')}</a></li>
 
      <li><a href="${h.url('auth_home')}"><i class="icon-key"></i>${_('Authentication')}</a></li>
 
      <li><a href="${h.url('defaults')}"><i class="icon-wrench"></i>${_('Repository Defaults')}</a></li>
 
      <li class="last"><a href="${h.url('admin_settings')}"><i class="icon-gear"></i>${_('Settings')}</a></li>
 
  </ul>
 

	
 
</%def>
 

	
 

	
 
## admin menu used for people that have some admin resources
 
<%def name="admin_menu_simple(repositories=None, repository_groups=None, user_groups=None)">
 
  <ul class="dropdown-menu" role="menu">
 
   %if repositories:
 
      <li><a href="${h.url('repos')}"><i class="icon-database"></i>${_('Repositories')}</a></li>
 
   %endif
 
   %if repository_groups:
 
      <li><a href="${h.url('repos_groups')}"><i class="icon-folder"></i>${_('Repository Groups')}</a></li>
 
   %endif
 
   %if user_groups:
 
      <li><a href="${h.url('users_groups')}"><i class="icon-users"></i>${_('User Groups')}</a></li>
 
   %endif
 
  </ul>
 
</%def>
 

	
 
<%def name="repolabel(repo)">
 
  %if h.is_hg(repo):
 
    <span class="label label-repo" title="${_('Mercurial repository')}">hg</span>
 
  %endif
 
  %if h.is_git(repo):
 
    <span class="label label-repo" title="${_('Git repository')}">git</span>
 
  %endif
 
</%def>
 

	
 
<%def name="repo_context_bar(current=None, rev=None)">
 
  <% rev = None if rev == 'tip' else rev %>
 
  <!--- CONTEXT BAR -->
 
  <nav id="context-bar" class="navbar navbar-inverse">
 
    <div class="container-fluid">
 
    <div class="navbar-header">
 
      <div class="navbar-brand">
 
        ${repolabel(c.db_repo)}
 

	
 
        ## public/private
 
        %if c.db_repo.private:
 
          <i class="icon-lock"></i>
 
        %else:
 
          <i class="icon-globe"></i>
 
        %endif
 
        %for group in c.db_repo.groups_with_parents:
 
          ${h.link_to(group.name, url('repos_group_home', group_name=group.group_name), class_='navbar-link')}
 
          &raquo;
 
        %endfor
 
        ${h.link_to(c.db_repo.just_name, url('summary_home', repo_name=c.db_repo.repo_name), class_='navbar-link')}
 

	
 
        %if current == 'createfork':
 
         - ${_('Create Fork')}
 
        %endif
 
      </div>
 
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#context-pages" 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="context-pages" class="navbar-collapse collapse">
 
    <ul class="nav navbar-nav navbar-right">
 
        <li class="${'active' if current == 'summary' else ''}" data-context="summary"><a href="${h.url('summary_home', repo_name=c.repo_name)}"><i class="icon-doc-text"></i>${_('Summary')}</a></li>
 
        %if rev:
 
        <li class="${'active' if current == 'changelog' else ''}" data-context="changelog"><a href="${h.url('changelog_file_home', repo_name=c.repo_name, revision=rev, f_path='')}"><i class="icon-clock"></i>${_('Changelog')}</a></li>
 
        %else:
 
        <li class="${'active' if current == 'changelog' else ''}" data-context="changelog"><a href="${h.url('changelog_home', repo_name=c.repo_name)}"><i class="icon-clock"></i>${_('Changelog')}</a></li>
 
        %endif
 
        <li class="${'active' if current == 'files' else ''}" data-context="files"><a href="${h.url('files_home', repo_name=c.repo_name, revision=rev or 'tip')}"><i class="icon-doc-inv"></i>${_('Files')}</a></li>
 
        <li class="${'active' if current == 'showpullrequest' else ''}" data-context="showpullrequest">
 
          <a href="${h.url('pullrequest_show_all',repo_name=c.repo_name)}" title="${_('Show Pull Requests for %s') % c.repo_name}"> <i class="icon-git-pull-request"></i>${_('Pull Requests')}
 
            %if c.repository_pull_requests:
 
              <span class="badge">${c.repository_pull_requests}</span>
 
            %endif
 
          </a>
 
        </li>
 
        <li class="${'active' if current == 'switch-to' else ''}" data-context="switch-to">
 
          <input id="branch_switcher" name="branch_switcher" type="hidden">
 
        </li>
 
        <li class="${'active' if current == 'options' else ''} dropdown" data-context="options">
 
             %if h.HasRepoPermissionLevel('admin')(c.repo_name):
 
               <a href="${h.url('edit_repo',repo_name=c.repo_name)}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true"><i class="icon-wrench"></i>${_('Options')} <i class="caret"></i></a>
 
             %else:
 
               <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true"><i class="icon-wrench"></i>${_('Options')} <i class="caret"></i></a>
 
             %endif
 
          <ul class="dropdown-menu" role="menu" aria-hidden="true">
 
             %if h.HasRepoPermissionLevel('admin')(c.repo_name):
 
                   <li><a href="${h.url('edit_repo',repo_name=c.repo_name)}"><i class="icon-gear"></i>${_('Settings')}</a></li>
 
             %endif
 
              %if c.db_repo.fork:
 
               <li><a href="${h.url('compare_url',repo_name=c.db_repo.fork.repo_name,org_ref_type=c.db_repo.landing_rev[0],org_ref_name=c.db_repo.landing_rev[1], other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.db_repo.landing_rev[0],other_ref_name=request.GET.get('branch') or c.db_repo.landing_rev[1], merge=1)}">
 
                   <i class="icon-git-compare"></i>${_('Compare Fork')}</a></li>
 
              %endif
 
              <li><a href="${h.url('compare_home',repo_name=c.repo_name)}"><i class="icon-git-compare"></i>${_('Compare')}</a></li>
 

	
 
              <li><a href="${h.url('search_repo',repo_name=c.repo_name)}"><i class="icon-search"></i>${_('Search')}</a></li>
 

	
 
              ## TODO: this check feels wrong, it would be better to have a check for permissions
 
              ## also it feels like a job for the controller
 
              %if request.authuser.username != 'default':
 
                  <li>
 
                   <a href="#" class="${'following' if c.repository_following else 'follow'}" onclick="return toggleFollowingRepo(this, ${c.db_repo.repo_id});">
 
                    <span class="show-follow"><i class="icon-heart-empty"></i>${_('Follow')}</span>
 
                    <span class="show-following"><i class="icon-heart"></i>${_('Unfollow')}</span>
 
                   </a>
 
                  </li>
 
                  <li><a href="${h.url('repo_fork_home',repo_name=c.repo_name)}"><i class="icon-fork"></i>${_('Fork')}</a></li>
 
                  <li><a href="${h.url('pullrequest_home',repo_name=c.repo_name)}"><i class="icon-git-pull-request"></i>${_('Create Pull Request')}</a></li>
 
              %endif
 
             </ul>
 
        </li>
 
    </ul>
 
    </div>
 
    </div>
 
  </nav>
 
  <script>
 
  <script>'use strict';
 
    $(document).ready(function() {
 
      var bcache = {};
 

	
 
      var branch_switcher_placeholder = '<i class="icon-exchange"></i>' + ${h.jshtml(_('Switch To'))} + ' <span class="caret"></span>';
 
      $("#branch_switcher").select2({
 
          placeholder: branch_switcher_placeholder,
 
          dropdownAutoWidth: true,
 
          sortResults: prefixFirstSort,
 
          formatResult: function(obj) {
 
              return obj.text.html_escape();
 
          },
 
          formatSelection: function(obj) {
 
              return obj.text.html_escape();
 
          },
 
          formatNoMatches: function(term) {
 
              return ${h.jshtml(_('No matches found'))};
 
          },
 
          escapeMarkup: function(m) {
 
              if (m == branch_switcher_placeholder)
 
                  return branch_switcher_placeholder;
 
              return Select2.util.escapeMarkup(m);
 
          },
 
          containerCssClass: "branch-switcher",
 
          dropdownCssClass: "repo-switcher-dropdown",
 
          query: function(query) {
 
              var key = 'cache';
 
              var cached = bcache[key];
 
              if (cached) {
 
                  var data = {
 
                      results: []
 
                  };
 
                  // filter results
 
                  $.each(cached.results, function() {
 
                      var section = this.text;
 
                      var children = [];
 
                      $.each(this.children, function() {
 
                          if (query.term.length === 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) {
 
                              children.push({
 
                                  'id': this.id,
 
                                  'text': this.text,
 
                                  'type': this.type,
 
                                  'obj': this.obj
 
                              });
 
                          }
 
                      });
 
                      if (children.length !== 0) {
 
                          data.results.push({
 
                              'text': section,
 
                              'children': children
 
                          });
 
                      }
 

	
 
                  });
 
                  query.callback(data);
 
              } else {
 
                  $.ajax({
 
                      url: pyroutes.url('repo_refs_data', {
 
                          'repo_name': ${h.js(c.repo_name)}
 
                      }),
 
                      data: {},
 
                      dataType: 'json',
 
                      type: 'GET',
 
                      success: function(data) {
 
                          bcache[key] = data;
 
                          query.callback(data);
 
                      }
 
                  });
 
              }
 
          }
 
      });
 

	
 
      $("#branch_switcher").on('select2-selecting', function(e) {
 
          e.preventDefault();
 
          var context = $('#context-bar .active').data('context');
 
          if (context == 'files') {
 
              window.location = pyroutes.url('files_home', {
 
                  'repo_name': REPO_NAME,
 
                  'revision': e.choice.id,
 
                  'f_path': '',
 
                  'at': e.choice.text
 
              });
 
          } else if (context == 'changelog') {
 
              if (e.choice.type == 'tag' || e.choice.type == 'book') {
 
                  $("#branch_filter").append($('<'+'option/>').val(e.choice.text));
 
              }
 
              $("#branch_filter").val(e.choice.text).change();
 
          } else {
 
              window.location = pyroutes.url('changelog_home', {
 
                  'repo_name': ${h.js(c.repo_name)},
 
                  'branch': e.choice.text
 
              });
 
          }
 
      });
 
    });
 
  </script>
 
  <!--- END CONTEXT BAR -->
 
</%def>
 

	
 
<%def name="menu(current=None)">
 
  <ul id="quick" class="nav navbar-nav navbar-right">
 
    <!-- repo switcher -->
 
    <li class="${'active' if current == 'repositories' else ''}">
 
      <input id="repo_switcher" name="repo_switcher" type="hidden">
 
    </li>
 

	
 
    ##ROOT MENU
 
    %if request.authuser.username != 'default':
 
      <li class="${'active' if current == 'journal' else ''}">
 
        <a class="menu_link" title="${_('Show recent activity')}"  href="${h.url('journal')}">
 
          <i class="icon-book"></i>${_('Journal')}
 
        </a>
 
      </li>
 
    %else:
 
      <li class="${'active' if current == 'journal' else ''}">
 
        <a class="menu_link" title="${_('Public journal')}"  href="${h.url('public_journal')}">
 
          <i class="icon-book"></i>${_('Public journal')}
 
        </a>
 
      </li>
 
    %endif
 
      <li class="${'active' if current == 'gists' else ''} dropdown">
 
        <a class="menu_link dropdown-toggle" data-toggle="dropdown" role="button" title="${_('Show public gists')}"  href="${h.url('gists')}">
 
          <i class="icon-clippy"></i>${_('Gists')} <span class="caret"></span>
 
        </a>
 
          <ul class="dropdown-menu" role="menu">
 
            <li><a href="${h.url('new_gist', public=1)}"><i class="icon-paste"></i>${_('Create New Gist')}</a></li>
 
            <li><a href="${h.url('gists')}"><i class="icon-globe"></i>${_('All Public Gists')}</a></li>
 
            %if request.authuser.username != 'default':
 
              <li><a href="${h.url('gists', public=1)}"><i class="icon-user"></i>${_('My Public Gists')}</a></li>
 
              <li><a href="${h.url('gists', private=1)}"><i class="icon-lock"></i>${_('My Private Gists')}</a></li>
 
            %endif
 
          </ul>
 
      </li>
 
    <li class="${'active' if current == 'search' else ''}">
 
        <a class="menu_link" title="${_('Search in repositories')}"  href="${h.url('search')}">
 
          <i class="icon-search"></i>${_('Search')}
 
        </a>
 
    </li>
 
    % if h.HasPermissionAny('hg.admin')('access admin main page'):
 
      <li class="${'active' if current == 'admin' else ''} dropdown">
 
        <a class="menu_link dropdown-toggle" data-toggle="dropdown" role="button" title="${_('Admin')}" href="${h.url('admin_home')}">
 
          <i class="icon-gear"></i>${_('Admin')} <span class="caret"></span>
 
        </a>
 
        ${admin_menu()}
 
      </li>
 
    % elif request.authuser.repositories_admin or request.authuser.repository_groups_admin or request.authuser.user_groups_admin:
 
    <li class="${'active' if current == 'admin' else ''} dropdown">
 
        <a class="menu_link dropdown-toggle" data-toggle="dropdown" role="button" title="${_('Admin')}" href="">
 
          <i class="icon-gear"></i>${_('Admin')}
 
        </a>
 
        ${admin_menu_simple(request.authuser.repositories_admin,
 
                            request.authuser.repository_groups_admin,
 
                            request.authuser.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())}
 
    </li>
 
    % endif
 

	
 
    <li class="${'active' if current == 'my_pullrequests' else ''}">
 
      <a class="menu_link" title="${_('My Pull Requests')}" href="${h.url('my_pullrequests')}">
 
        <i class="icon-git-pull-request"></i>${_('My Pull Requests')}
 
        %if c.my_pr_count != 0:
 
          <span class="badge">${c.my_pr_count}</span>
 
        %endif
 
      </a>
 
    </li>
 

	
 
    ## USER MENU
 
    <li class="dropdown">
 
      <a class="menu_link dropdown-toggle" data-toggle="dropdown" role="button" id="quick_login_link"
 
        aria-expanded="false" aria-controls="quick_login" href="#">
 
          ${h.gravatar_div(request.authuser.email, size=20, div_class="icon")}
 
          %if request.authuser.username != 'default':
 
            <span class="menu_link_user">${request.authuser.username}</span>
 
          %else:
 
              <span>${_('Not Logged In')}</span>
 
          %endif
 
          <i class="caret"></i>
 
      </a>
 

	
 
      <div class="dropdown-menu user-menu" role="menu">
 
        <div id="quick_login" role="form" aria-describedby="quick_login_h" aria-hidden="true" class="container-fluid">
 
          %if request.authuser.username == 'default' or request.authuser.user_id is None:
 
            ${h.form(h.url('login_home', came_from=request.path_qs), class_='form clearfix')}
 
                <h4 id="quick_login_h">${_('Login to Your Account')}</h4>
 
                <label>
 
                    ${_('Username')}:
 
                    ${h.text('username',class_='form-control')}
 
                </label>
 
                <label>
 
                    ${_('Password')}:
 
                    ${h.password('password',class_='form-control')}
 
                </label>
 
                <div class="password_forgotten">
 
                    ${h.link_to(_('Forgot password?'),h.url('reset_password'))}
 
                </div>
 
                <div class="register">
 
                    %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
 
                        ${h.link_to(_("Don't have an account?"),h.url('register'))}
 
                    %endif
 
                </div>
 
                <div class="submit">
 
                    ${h.submit('sign_in',_('Log In'),class_="btn btn-default btn-xs")}
 
                </div>
 
            ${h.end_form()}
 
          %else:
 
            <div class="pull-left">
 
                ${h.gravatar_div(request.authuser.email, size=48, div_class="big_gravatar")}
 
                <b class="full_name">${request.authuser.full_name_or_username}</b>
 
                <div class="email">${request.authuser.email}</div>
 
            </div>
 
            <div id="quick_login_h" class="pull-right list-group text-right">
 
              ${h.link_to(_('My Account'),h.url('my_account'),class_='list-group-item')}
 
              %if not request.authuser.is_external_auth:
 
                ## Cannot log out if using external (container) authentication.
 
                ${h.link_to(_('Log Out'), h.url('logout_home'),class_='list-group-item')}
 
              %endif
 
            </div>
 
          %endif
 
        </div>
 
      </div>
 
    </li>
 
  </ul>
 

	
 
    <script>
 
    <script>'use strict';
 
        $(document).ready(function(){
 
            var visual_show_public_icon = ${h.js(c.visual.show_public_icon)};
 
            var cache = {}
 
            /*format the look of items in the list*/
 
            var format = function(state){
 
                if (!state.id){
 
                  return state.text.html_escape(); // optgroup
 
                }
 
                var obj_dict = state.obj;
 
                var tmpl = '';
 

	
 
                if(obj_dict && state.type == 'repo'){
 
                    tmpl += '<span class="repo-icons">';
 
                    if(obj_dict['repo_type'] === 'hg'){
 
                        tmpl += '<span class="label label-repo" title="${_('Mercurial repository')}">hg</span> ';
 
                    }
 
                    else if(obj_dict['repo_type'] === 'git'){
 
                        tmpl += '<span class="label label-repo" title="${_('Git repository')}">git</span> ';
 
                    }
 
                    if(obj_dict['private']){
 
                        tmpl += '<i class="icon-lock"></i>';
 
                    }
 
                    else if(visual_show_public_icon){
 
                        tmpl += '<i class="icon-globe"></i>';
 
                    }
 
                    tmpl += '</span>';
 
                }
 
                if(obj_dict && state.type == 'group'){
 
                        tmpl += '<i class="icon-folder"></i>';
 
                }
 
                tmpl += state.text.html_escape();
 
                return tmpl;
 
            }
 

	
 
            var repo_switcher_placeholder = '<i class="icon-database"></i>' + ${h.jshtml(_('Repositories'))} + ' <span class="caret"></span>';
 
            $("#repo_switcher").select2({
 
                placeholder: repo_switcher_placeholder,
 
                dropdownAutoWidth: true,
 
                sortResults: prefixFirstSort,
 
                formatResult: format,
 
                formatSelection: format,
 
                formatNoMatches: function(term){
 
                    return ${h.jshtml(_('No matches found'))};
 
                },
 
                containerCssClass: "repo-switcher",
 
                dropdownCssClass: "repo-switcher-dropdown",
 
                escapeMarkup: function(m){
 
                    if (m == repo_switcher_placeholder)
 
                        return repo_switcher_placeholder;
 
                    return Select2.util.escapeMarkup(m);
 
                },
 
                query: function(query){
 
                  var key = 'cache';
 
                  var cached = cache[key] ;
 
                  if(cached) {
 
                    var data = {results: []};
 
                    //filter results
 
                    $.each(cached.results, function(){
 
                        var section = this.text;
 
                        var children = [];
 
                        $.each(this.children, function(){
 
                            if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){
 
                                children.push({'id': this.id, 'text': this.text, 'type': this.type, 'obj': this.obj});
 
                            }
 
                        });
 
                        if(children.length !== 0){
 
                            data.results.push({'text': section, 'children': children});
 
                        }
 

	
 
                    });
 
                    query.callback(data);
 
                  }else{
 
                      $.ajax({
 
                        url: ${h.js(h.url('repo_switcher_data'))},
 
                        data: {},
 
                        dataType: 'json',
 
                        type: 'GET',
 
                        success: function(data) {
 
                          cache[key] = data;
 
                          query.callback({results: data.results});
 
                        }
 
                      });
 
                  }
 
                }
 
            });
 

	
 
            $("#repo_switcher").on('select2-selecting', function(e){
 
                e.preventDefault();
 
                window.location = pyroutes.url('summary_home', {'repo_name': e.val});
 
            });
 

	
 
            $(document).on('shown.bs.dropdown', function(event) {
 
                var dropdown = $(event.target);
 

	
 
                dropdown.attr('aria-expanded', true);
 
                dropdown.find('.dropdown-menu').attr('aria-hidden', false);
 
            });
 

	
 
            $(document).on('hidden.bs.dropdown', function(event) {
 
                var dropdown = $(event.target);
 

	
 
                dropdown.attr('aria-expanded', false);
 
                dropdown.find('.dropdown-menu').attr('aria-hidden', true);
 
            });
 
        });
 
    </script>
 
</%def>
 

	
 
<%def name="parent_child_navigation()">
 
    <div class="pull-left">
 
        <div class="parent-child-link"
 
             data-ajax-url="${h.url('changeset_parents',repo_name=c.repo_name, revision=c.changeset.raw_id)}"
 
             data-linktype="parent"
 
             data-reponame="${c.repo_name}">
 
            <i class="icon-left-open"></i><a href="#">${_('Parent rev.')}</a>
 
        </div>
 
    </div>
 

	
 
    <div class="pull-right">
 
        <div class="parent-child-link"
 
             data-ajax-url="${h.url('changeset_children',repo_name=c.repo_name, revision=c.changeset.raw_id)}"
 
             data-linktype="child"
 
             data-reponame="${c.repo_name}">
 
            <a href="#">${_('Child rev.')}</a><i class="icon-right-open"></i>
 
        </div>
 
    </div>
 

	
 
    <script>
 
    <script>'use strict';
 
      $(document).ready(function(){
 
          activate_parent_child_links();
 
      });
 
    </script>
 
</%def>
kallithea/templates/base/flash_msg.html
Show inline comments
 
<div class="flash_msg">
 
    <% messages = h.pop_flash_messages() %>
 
    % if messages:
 
        <% alert_categories = {'warning': 'alert-warning', 'notice': 'alert-info', 'error': 'alert-danger', 'success': 'alert-success'} %>
 
        % for message in messages:
 
            <div class="alert alert-dismissable ${alert_categories[message.category]}" role="alert">
 
              <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><i class="icon-cancel-circled"></i></button>
 
              ${message.message|n}
 
            </div>
 
        % endfor
 
    % endif
 
    <script>
 
    <script>'use strict';
 
    if (typeof jQuery != 'undefined') {
 
        $(".alert").alert();
 
    }
 
    </script>
 
</div>
kallithea/templates/base/perms_summary.html
Show inline comments
 
## snippet for displaying permissions overview for users
 
## usage:
 
##    <%namespace name="p" file="/base/perms_summary.html"/>
 
##    ${p.perms_summary(c.perm_user.permissions)}
 

	
 
<%def name="perms_summary(permissions, show_all=False, actions=True)">
 
<div id="perms">
 
     %for section in sorted(permissions):
 
        <div class="perms_section_head">
 
            <h4>${section.replace("_"," ").capitalize()}</h4>
 
            %if section != 'global':
 
              <div class="pull-right checkbox">
 
                ${_('Show')}:
 
                <label>${h.checkbox('perms_filter_none_%s' % section, 'none', 'checked', class_='perm_filter filter_%s' % section, **{'data-section':section, 'data-perm_type':'none'})}<span class="label label-none">${_('None')}</span></label>
 
                <label>${h.checkbox('perms_filter_read_%s' % section, 'read', 'checked', class_='perm_filter filter_%s' % section, **{'data-section':section, 'data-perm_type':'read'})}<span class="label label-read">${_('Read')}</span></label>
 
                <label>${h.checkbox('perms_filter_write_%s' % section, 'write', 'checked', class_='perm_filter filter_%s' % section, **{'data-section':section, 'data-perm_type':'write'})}<span class="label label-write">${_('Write')}</span></label>
 
                <label>${h.checkbox('perms_filter_admin_%s' % section, 'admin', 'checked', class_='perm_filter filter_%s' % section, **{'data-section':section, 'data-perm_type':'admin'})}<span class="label label-admin">${_('Admin')}</span></label>
 
              </div>
 
            %endif
 
        </div>
 
        %if not permissions[section]:
 
            <span class="text-muted">${_('No permissions defined yet')}</span>
 
        %else:
 
        <div id='tbl_list_wrap_${section}'>
 
         <table id="tbl_list_${section}" class="table">
 
          ## global permission box
 
          %if section == 'global':
 
              <thead>
 
                <tr>
 
                  <th class="left col-xs-9">${_('Permission')}</th>
 
                  %if actions:
 
                  <th class="left col-xs-3">${_('Edit Permission')}</th>
 
                  %endif
 
                </tr>
 
              </thead>
 
              <tbody>
 
              %for k in permissions[section]:
 
                  <tr>
 
                      <td>
 
                          ${h.get_permission_name(k)}
 
                      </td>
 
                      %if actions:
 
                      <td>
 
                           <a href="${h.url('admin_permissions')}">${_('Edit')}</a>
 
                      </td>
 
                      %endif
 
                  </tr>
 
              %endfor
 
              </tbody>
 
          %else:
 
             ## none/read/write/admin permissions on groups/repos etc
 
              <thead>
 
                <tr>
 
                  <th class="left col-xs-7">${_('Name')}</th>
 
                  <th class="left col-xs-2">${_('Permission')}</th>
 
                  %if actions:
 
                  <th class="left col-xs-3">${_('Edit Permission')}</th>
 
                  %endif
 
                </tr>
 
              </thead>
 
              <tbody class="section_${section}">
 
              %for k, section_perm in sorted(permissions[section].items(), key=lambda s: {'none':0, 'read':1,'write':2,'admin':3}.get(s[1].split('.')[-1])):
 
                  %if section_perm.split('.')[-1] != 'none' or show_all:
 
                  <tr class="perm_row ${'%s_%s' % (section, section_perm.split('.')[-1])}">
 
                      <td>
 
                          %if section == 'repositories':
 
                              <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
 
                          %elif section == 'repositories_groups':
 
                              <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
 
                          %elif section == 'user_groups':
 
                              ##<a href="${h.url('edit_users_group',id=k)}">${k}</a>
 
                              ${k}
 
                          %endif
 
                      </td>
 
                      <td>
 
                           <span class="label label-${section_perm.split('.')[-1]}">${section_perm}</span>
 
                      </td>
 
                      %if actions:
 
                      <td>
 
                          %if section == 'repositories':
 
                              <a href="${h.url('edit_repo_perms',repo_name=k,anchor='permissions_manage')}">${_('Edit')}</a>
 
                          %elif section == 'repositories_groups':
 
                              <a href="${h.url('edit_repo_group_perms',group_name=k,anchor='permissions_manage')}">${_('Edit')}</a>
 
                          %elif section == 'user_groups':
 
                              ##<a href="${h.url('edit_users_group',id=k)}">${_('Edit')}</a>
 
                          %endif
 
                      </td>
 
                      %endif
 
                  </tr>
 
                  %endif
 
              %endfor
 
              <tr id="empty_${section}" style="display: none"><td colspan="${3 if actions else 2}">${_('No permission defined')}</td></tr>
 
              </tbody>
 
          %endif
 
         </table>
 
        </div>
 
        %endif
 
     %endfor
 
</div>
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        var show_empty = function(section){
 
            var visible = $('.section_{0} tr.perm_row:visible'.format(section)).length;
 
            if(visible == 0){
 
                $('#empty_{0}'.format(section)).show();
 
            }
 
            else{
 
                $('#empty_{0}'.format(section)).hide();
 
            }
 
        }
 
        var update_show = function($checkbox){
 
            var section = $checkbox.data('section');
 

	
 
            var elems = $('.filter_' + section).each(function(el){
 
                var perm_type = $checkbox.data('perm_type');
 
                var checked = $checkbox.prop('checked');
 
                if(checked){
 
                    $('.'+section+'_'+perm_type).show();
 
                }
 
                else{
 
                    $('.'+section+'_'+perm_type).hide();
 
                }
 
            });
 
            show_empty(section);
 
        }
 
        $('.perm_filter').on('change', function(){update_show($(this));});
 
        $('.perm_filter[value=none]').each(function(){this.checked = false; update_show($(this));});
 
    });
 
</script>
 
</%def>
kallithea/templates/base/root.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
    <head>
 
        <title><%block name="title"/><%block name="branding_title"/></title>
 
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 
        <meta http-equiv="X-UA-Compatible" content="IE=10"/>
 
        <meta name="robots" content="index, nofollow"/>
 
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 
        <link rel="shortcut icon" href="${h.url('/images/favicon.ico')}" type="image/x-icon" />
 
        <link rel="icon" type="image/png" href="${h.url('/images/favicon-32x32.png')}" sizes="32x32">
 
        <link rel="icon" type="image/png" href="${h.url('/images/favicon-16x16.png')}" sizes="16x16">
 
        <link rel="apple-touch-icon" sizes="180x180" href="${h.url('/images/apple-touch-icon.png')}">
 
        <link rel="manifest" href="${h.url('/images/manifest.json')}">
 
        <link rel="mask-icon" href="${h.url('/images/safari-pinned-tab.svg')}" color="#b1d579">
 
        <meta name="msapplication-config" content="${h.url('/images/browserconfig.xml')}">
 
        <meta name="theme-color" content="#ffffff">
 

	
 
        ## CSS ###
 
        <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css', ver=c.kallithea_version)}" media="screen"/>
 
        <%block name="css_extra"/>
 

	
 
        ## JAVASCRIPT ##
 
        <script>
 
        <script>'use strict';
 
            ## JS translations map
 
            var TRANSLATION_MAP = {
 
                'Cancel': ${h.jshtml(_("Cancel"))},
 
                'Retry': ${h.jshtml(_("Retry"))},
 
                'Submitting ...': ${h.jshtml(_("Submitting ..."))},
 
                'Unable to post': ${h.jshtml(_("Unable to post"))},
 
                'Add Another Comment': ${h.jshtml(_("Add Another Comment"))},
 
                'Stop following this repository': ${h.jshtml(_('Stop following this repository'))},
 
                'Start following this repository': ${h.jshtml(_('Start following this repository'))},
 
                'Group': ${h.jshtml(_('Group'))},
 
                'Loading ...': ${h.jshtml(_('Loading ...'))},
 
                'loading ...': ${h.jshtml(_('loading ...'))},
 
                'Search truncated': ${h.jshtml(_('Search truncated'))},
 
                'No matching files': ${h.jshtml(_('No matching files'))},
 
                'Open New Pull Request from {0}': ${h.jshtml(_('Open New Pull Request from {0}'))},
 
                'Open New Pull Request for {0} &rarr; {1}': ${h.js(_('Open New Pull Request for {0} &rarr; {1}'))},
 
                'Show Selected Changesets {0} &rarr; {1}': ${h.js(_('Show Selected Changesets {0} &rarr; {1}'))},
 
                'Selection Link': ${h.jshtml(_('Selection Link'))},
 
                'Collapse Diff': ${h.jshtml(_('Collapse Diff'))},
 
                'Expand Diff': ${h.jshtml(_('Expand Diff'))},
 
                'No revisions': ${h.jshtml(_('No revisions'))},
 
                'Type name of user or member to grant permission': ${h.jshtml(_('Type name of user or member to grant permission'))},
 
                'Failed to revoke permission': ${h.jshtml(_('Failed to revoke permission'))},
 
                'Confirm to revoke permission for {0}: {1} ?': ${h.jshtml(_('Confirm to revoke permission for {0}: {1} ?'))},
 
                'Enabled': ${h.jshtml(_('Enabled'))},
 
                'Disabled': ${h.jshtml(_('Disabled'))},
 
                'Select changeset': ${h.jshtml(_('Select changeset'))},
 
                'Specify changeset': ${h.jshtml(_('Specify changeset'))},
 
                'MSG_SORTASC': ${h.jshtml(_('Click to sort ascending'))},
 
                'MSG_SORTDESC': ${h.jshtml(_('Click to sort descending'))},
 
                'MSG_EMPTY': ${h.jshtml(_('No records found.'))},
 
                'MSG_ERROR': ${h.jshtml(_('Data error.'))},
 
                'MSG_LOADING': ${h.jshtml(_('Loading...'))}
 
            };
 
            var _TM = TRANSLATION_MAP;
 

	
 
            var TOGGLE_FOLLOW_URL  = ${h.js(h.url('toggle_following'))};
 

	
 
            var REPO_NAME = "";
 
            %if hasattr(c, 'repo_name'):
 
                var REPO_NAME = ${h.js(c.repo_name)};
 
            %endif
 

	
 
            var _session_csrf_secret_token = ${h.js(h.session_csrf_secret_token())};
 
        </script>
 
        <script src="${h.url('/js/jquery.min.js', ver=c.kallithea_version)}"></script>
 
        <script src="${h.url('/js/jquery.dataTables.js', ver=c.kallithea_version)}"></script>
 
        <script src="${h.url('/js/dataTables.bootstrap.js', ver=c.kallithea_version)}"></script>
 
        <script src="${h.url('/js/bootstrap.js', ver=c.kallithea_version)}"></script>
 
        <script src="${h.url('/js/select2.js', ver=c.kallithea_version)}"></script>
 
        <script src="${h.url('/js/jquery.caret.min.js', ver=c.kallithea_version)}"></script>
 
        <script src="${h.url('/js/jquery.atwho.min.js', ver=c.kallithea_version)}"></script>
 
        <script src="${h.url('/js/base.js', ver=c.kallithea_version)}"></script>
 
        ## EXTRA FOR JS
 
        <%block name="js_extra"/>
 
        <script>
 
        <script>'use strict';
 
            $(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')}">
 
              <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>
kallithea/templates/changelog/changelog.html
Show inline comments
 
## -*- coding: utf-8 -*-
 

	
 
<%inherit file="/base/base.html"/>
 

	
 
<%namespace name="changelog_table" file="changelog_table.html"/>
 

	
 
<%block name="title">
 
    ${_('%s Changelog') % c.repo_name}
 
    %if c.changelog_for_path:
 
      /${c.changelog_for_path}
 
    %endif
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    <% size = c.size if c.size <= c.total_cs else c.total_cs %>
 
    ${_('Changelog')}
 
    %if c.changelog_for_path:
 
     - /${c.changelog_for_path}
 
    %endif
 
    %if c.revision:
 
    @ ${h.short_id(c.first_revision.raw_id)}
 
    %endif
 
    - ${ungettext('showing %d out of %d revision', 'showing %d out of %d revisions', size) % (size, c.total_cs)}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('changelog', c.first_revision.raw_id if c.first_revision else None)}
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div class="panel-body changelog-panel">
 
        %if c.cs_pagination:
 
                <div class="changelog-heading clearfix" style="${'display:none' if c.changelog_for_path else ''}">
 
                    <div class="pull-left">
 
                        ${h.form(h.url.current(),method='get',class_="form-inline")}
 
                            ${h.submit(None,_('Show'),id='set_size_submit',class_="btn btn-default btn-sm")}
 
                            ${h.text('size',size=3,value=c.size,class_='form-control')}
 
                            ${_('revisions')}
 
                            %if c.branch_name:
 
                                ${h.hidden('branch', c.branch_name)}
 
                            %endif
 
                            <a href="#" class="btn btn-default btn-sm" id="rev_range_clear" style="display:none">${_('Clear selection')}</a>
 
                        ${h.end_form()}
 
                    </div>
 
                    <div class="pull-right">
 
                        <a href="#" class="btn btn-default btn-sm" id="rev_range_container" style="display:none"></a>
 
                        %if c.revision:
 
                            <a class="btn btn-default btn-sm" href="${h.url('changelog_home', repo_name=c.repo_name)}">
 
                                ${_('Go to tip of repository')}
 
                            </a>
 
                        %endif
 
                        %if c.db_repo.fork:
 
                            <a id="compare_fork"
 
                               title="${_('Compare fork with %s' % c.db_repo.fork.repo_name)}"
 
                               href="${h.url('compare_url',repo_name=c.db_repo.fork.repo_name,org_ref_type=c.db_repo.landing_rev[0],org_ref_name=c.db_repo.landing_rev[1],other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.db_repo.landing_rev[0],other_ref_name=request.GET.get('branch') or c.db_repo.landing_rev[1], merge=1)}"
 
                               class="btn btn-default btn-sm"><i class="icon-git-compare"></i>${_('Compare fork with parent repository (%s)' % c.db_repo.fork.repo_name)}</a>
 
                        %endif
 
                        ## text and href of open_new_pr is controlled from javascript
 
                        <a id="open_new_pr" class="btn btn-default btn-sm"></a>
 
                        ${_("Branch filter:")} ${h.select('branch_filter',c.branch_name,c.branch_filters)}
 
                    </div>
 
                </div>
 

	
 
                <div id="graph_nodes">
 
                    <canvas id="graph_canvas" style="width:0"></canvas>
 
                </div>
 

	
 
                <div id="graph_content" style="${'margin: 0px' if c.changelog_for_path else ''}">
 
                  ${changelog_table.changelog(c.repo_name, c.cs_pagination, c.cs_statuses, c.cs_comments,
 
                                              show_checkbox=not c.changelog_for_path,
 
                                              show_branch=not c.branch_name,
 
                                              resize_js='graph.render(jsdata)')}
 
                  <input type="checkbox" id="singlerange" style="display:none"/>
 
                </div>
 

	
 
                ${c.cs_pagination.pager()}
 

	
 
        <script src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
 
        <script>
 
        <script>'use strict';
 
            var jsdata = ${h.js(c.jsdata)};
 
            var graph = new BranchRenderer('graph_canvas', 'graph_content', 'chg_');
 

	
 
            $(document).ready(function(){
 
                var $checkboxes = $('.changeset_range');
 

	
 
                pyroutes.register('changeset_home', ${h.js(h.url('changeset_home', repo_name='%(repo_name)s', revision='%(revision)s'))}, ['repo_name', 'revision']);
 

	
 
                var checkbox_checker = function(e) {
 
                    var $checked_checkboxes = $checkboxes.filter(':checked');
 
                    var $singlerange = $('#singlerange');
 

	
 
                    $('#rev_range_container').hide();
 
                    $checkboxes.show();
 
                    $singlerange.show();
 

	
 
                    if ($checked_checkboxes.length > 0) {
 
                        $checked_checkboxes.first().parent('td').append($singlerange);
 
                        var singlerange = $singlerange.prop('checked');
 
                        var rev_end = $checked_checkboxes.first().prop('name');
 
                        if ($checked_checkboxes.length > 1 || singlerange) {
 
                            var rev_start = $checked_checkboxes.last().prop('name');
 
                            $('#rev_range_container').prop('href',
 
                                pyroutes.url('changeset_home', {'repo_name': ${h.js(c.repo_name)},
 
                                                                'revision': rev_start + '...' + rev_end}));
 
                            $('#rev_range_container').html(
 
                                 _TM['Show Selected Changesets {0} &rarr; {1}'].format(rev_start.substr(0, 12), rev_end.substr(0, 12)));
 
                            $('#rev_range_container').show();
 
                            $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
 
                                                                        {'repo_name': ${h.js(c.repo_name)},
 
                                                                         'rev_start': rev_start,
 
                                                                         'rev_end': rev_end}));
 
                            $('#open_new_pr').html(_TM['Open New Pull Request for {0} &rarr; {1}'].format(rev_start.substr(0, 12), rev_end.substr(0, 12)));
 
                        } else {
 
                            $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
 
                                                                        {'repo_name': ${h.js(c.repo_name)},
 
                                                                         'rev_end': rev_end}));
 
                            $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(rev_end.substr(0, 12)));
 
                        }
 
                        $('#rev_range_clear').show();
 
                        $('#compare_fork').hide();
 

	
 
                        var disabled = true;
 
                        $checkboxes.each(function(){
 
                            var $this = $(this);
 
                            if (disabled) {
 
                                if ($this.prop('checked')) {
 
                                    $this.closest('tr').removeClass('out-of-range');
 
                                    disabled = singlerange;
 
                                } else {
 
                                    $this.closest('tr').addClass('out-of-range');
 
                                }
 
                            } else {
 
                                $this.closest('tr').removeClass('out-of-range');
 
                                disabled = $this.prop('checked');
 
                            }
 
                        });
 

	
 
                        if ($checked_checkboxes.length + (singlerange ? 1 : 0) >= 2) {
 
                            $checkboxes.hide();
 
                            $checked_checkboxes.show();
 
                            if (!singlerange)
 
                                $singlerange.hide();
 
                        }
 
                    } else {
 
                        $('#singlerange').hide().prop('checked', false);
 
                        $('#rev_range_clear').hide();
 
                        %if c.revision:
 
                            $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
 
                                                                        {'repo_name': ${h.js(c.repo_name)},
 
                                                                         'rev_end':${h.js(c.first_revision.raw_id)}}));
 
                            $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(${h.jshtml(c.revision)}));
 
                        %else:
 
                            $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
 
                                                                        {'repo_name': ${h.js(c.repo_name)},
 
                                                                        'branch':${h.js(c.first_revision.branch)}}));
 
                            $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(${h.jshtml(c.first_revision.branch)}));
 
                        %endif
 
                        $('#compare_fork').show();
 
                        $checkboxes.closest('tr').removeClass('out-of-range');
 
                    }
 
                };
 
                checkbox_checker();
 
                $checkboxes.click(function() {
 
                    checkbox_checker();
 
                    graph.render(jsdata);
 
                });
 
                $('#singlerange').click(checkbox_checker);
 

	
 
                $('#rev_range_clear').click(function(e){
 
                    $checkboxes.prop('checked', false);
 
                    checkbox_checker();
 
                    graph.render(jsdata);
 
                });
 

	
 
                var $msgs = $('.message');
 
                // get first element height
 
                var el = $('#graph_content tr')[0];
 
                var row_h = el.clientHeight;
 
                $msgs.each(function() {
 
                    var m = this;
 

	
 
                    var h = m.clientHeight;
 
                    if(h > row_h){
 
                        var offset = row_h - (h+12);
 
                        $(m.nextElementSibling).css('display', 'block');
 
                        $(m.nextElementSibling).css('margin-top', offset+'px');
 
                    }
 
                });
 

	
 
                // change branch filter
 
                $("#branch_filter").select2({
 
                    dropdownAutoWidth: true,
 
                    maxResults: 50,
 
                    sortResults: branchSort
 
                    });
 

	
 
                $("#branch_filter").change(function(e){
 
                    var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
 
                    if(selected_branch != ''){
 
                        window.location = pyroutes.url('changelog_home', {'repo_name': ${h.js(c.repo_name)},
 
                                                                          'branch': selected_branch});
 
                    }else{
 
                        window.location = pyroutes.url('changelog_home', {'repo_name': ${h.js(c.repo_name)}});
 
                    }
 
                    $("#changelog").hide();
 
                });
 

	
 
                graph.render(jsdata);
 
            });
 

	
 
            $(window).resize(function(){
 
                graph.render(jsdata);
 
            });
 
        </script>
 
        %else:
 
            ${_('There are no changes yet')}
 
        %endif
 
    </div>
 
</div>
 
</%def>
kallithea/templates/changelog/changelog_table.html
Show inline comments
 
## Render changelog table with id 'changesets' with the range of changesets,
 
## statuses, and comments.
 
## Optionally, pass a js snippet to run whenever a table resize is triggered.
 
<%def name="changelog(repo_name, cs_range, cs_statuses, cs_comments, show_checkbox=False, show_branch=True, show_index=False, resize_js='')">
 
    <% num_cs = len(cs_range) %>
 
    <table class="table" id="changesets">
 
    <tbody>
 
      %for cnt,cs in enumerate(cs_range):
 
      <tr id="chg_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 else ''}">
 
        %if show_checkbox:
 
        <td class="checkbox-column">
 
          ${h.checkbox(cs.raw_id,class_="changeset_range")}
 
        </td>
 
        %endif
 
        %if show_index:
 
        <td class="changeset-logical-index">
 
          <%
 
              index = num_cs - cnt
 
              if index == 1:
 
                  title = _('First (oldest) changeset in this list')
 
              elif index == num_cs:
 
                  title = _('Last (most recent) changeset in this list')
 
              else:
 
                  title = _('Position in this list of changesets')
 
          %>
 
          <span data-toggle="tooltip" title="${title}">
 
            ${index}
 
          </span>
 
        </td>
 
        %endif
 
        <td class="status">
 
          %if cs_statuses.get(cs.raw_id):
 
            %if cs_statuses.get(cs.raw_id)[2]:
 
              <a data-toggle="tooltip"
 
                  title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (cs_statuses.get(cs.raw_id)[1], cs_statuses.get(cs.raw_id)[5].username, cs_statuses.get(cs.raw_id)[4])}"
 
                  href="${h.url('pullrequest_show',repo_name=cs_statuses.get(cs.raw_id)[3],pull_request_id=cs_statuses.get(cs.raw_id)[2])}">
 
                <i class="icon-circle changeset-status-${cs_statuses.get(cs.raw_id)[0]}"></i>
 
              </a>
 
            %else:
 
              <a data-toggle="tooltip"
 
                  title="${_('Changeset status: %s by %s') % (cs_statuses.get(cs.raw_id)[1], cs_statuses.get(cs.raw_id)[5].username)}"
 
                  href="${cs_comments[cs.raw_id][0].url()}">
 
                <i class="icon-circle changeset-status-${cs_statuses.get(cs.raw_id)[0]}"></i>
 
              </a>
 
            %endif
 
          %endif
 
        </td>
 
        <td class="author" data-toggle="tooltip" title="${cs.author}">
 
          ${h.gravatar(h.email_or_none(cs.author), size=16)}
 
          <span class="user">${h.person(cs.author)}</span>
 
        </td>
 
        <td class="hash">
 
          ${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id), class_='changeset_hash')}
 
        </td>
 
        <td class="date">
 
          <div data-toggle="tooltip" title="${h.fmt_date(cs.date)}">${h.age(cs.date,True)}</div>
 
        </td>
 
        <% message_lines = cs.message.splitlines() %>
 
        %if len(message_lines) > 1:
 
        <td class="expand_commit" title="${_('Expand commit message')}">
 
          <i class="icon-align-left"></i>
 
        </td>
 
        %else:
 
        <td class="expand_commit"></td>
 
        %endif
 
        <td class="mid">
 
          <div class="log-container">
 
            <div class="message">
 
              <div class="message-firstline">${h.urlify_text(message_lines[0], c.repo_name,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}</div>
 
              %if len(message_lines) > 1:
 
              <div class="message-full hidden">${h.urlify_text(cs.message, repo_name)}</div>
 
              %endif
 
            </div>
 
            <div class="extra-container">
 
              %if cs_comments.get(cs.raw_id):
 
                <a class="comments-container comments-cnt" href="${cs_comments[cs.raw_id][0].url()}" data-toggle="tooltip" title="${_('%s comments') % len(cs_comments[cs.raw_id])}">${len(cs_comments[cs.raw_id])}<i class="icon-comment-discussion"></i>
 
                </a>
 
              %endif
 
              %for book in cs.bookmarks:
 
                <span class="label label-bookmark" title="${_('Bookmark %s') % book}">${h.link_to(book,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}</span>
 
              %endfor
 
              %for tag in cs.tags:
 
                <span class="label label-tag" title="${_('Tag %s') % tag}">${h.link_to(tag,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}</span>
 
              %endfor
 
              %if cs.bumped:
 
                <span class="label label-bumped" title="Bumped">Bumped</span>
 
              %endif
 
              %if cs.divergent:
 
                <span class="label label-divergent" title="Divergent">Divergent</span>
 
              %endif
 
              %if cs.extinct:
 
                <span class="label label-extinct" title="Extinct">Extinct</span>
 
              %endif
 
              %if cs.unstable:
 
                <span class="label label-unstable" title="Unstable">Unstable</span>
 
              %endif
 
              %if cs.phase:
 
                <span class="label label-phase" title="Phase">${cs.phase}</span>
 
              %endif
 
              %if show_branch:
 
                %for branch in cs.branches:
 
                  <span class="label label-branch" title="${_('Branch %s' % branch)}">${h.link_to(branch,h.url('changelog_home',repo_name=repo_name,branch=branch))}</span>
 
                %endfor
 
              %endif
 
            </div>
 
          </div>
 
        </td>
 
      </tr>
 
      %endfor
 
    </tbody>
 
    </table>
 

	
 
<script>
 
<script>'use strict';
 
  $(document).ready(function() {
 
    $('#changesets .expand_commit').on('click',function(e){
 
      $(this).next('.mid').find('.message > div').toggleClass('hidden');
 
      ${resize_js};
 
    });
 
  });
 
</script>
 
</%def>
kallithea/templates/changeset/changeset.html
Show inline comments
 
## -*- coding: utf-8 -*-
 

	
 
<%inherit file="/base/base.html"/>
 

	
 
<%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
 

	
 
<%block name="title">
 
    ${_('%s Changeset') % c.repo_name} - ${h.show_id(c.changeset)}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Changeset')} - <span class='changeset_hash'>${h.show_id(c.changeset)}</span>
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('changelog', c.changeset.raw_id)}
 
<div class="panel panel-primary">
 
  <div class="panel-heading clearfix">
 
    ${self.breadcrumbs()}
 
  </div>
 
  <script>
 
  <script>'use strict';
 
    AJAX_COMMENT_URL = ${h.js(url('changeset_comment',repo_name=c.repo_name,revision=c.changeset.raw_id))};
 
    AJAX_COMMENT_DELETE_URL = ${h.js(url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__'))};
 
  </script>
 
  <div class="panel-body">
 
    <div class="panel panel-default">
 
        <div class="panel-heading clearfix">
 
            ${self.parent_child_navigation()}
 

	
 
                <div class="pull-left" title="${_('Changeset status')}">
 
                    %if c.statuses:
 
                        <i class="icon-circle changeset-status-${c.statuses[0]}"></i>
 
                        [${h.changeset_status_lbl(c.statuses[0])}]
 
                    %endif
 
                </div>
 
                <div class="diff-actions pull-left">
 
                  <a href="${h.url('changeset_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id)}"
 
                     data-toggle="tooltip"
 
                     title="${_('Raw diff')}"><i class="icon-diff"></i></a>
 
                  <a href="${h.url('changeset_patch_home',repo_name=c.repo_name,revision=c.changeset.raw_id)}"
 
                     data-toggle="tooltip"
 
                     title="${_('Patch diff')}"><i class="icon-file-powerpoint"></i></a>
 
                  <a href="${h.url('changeset_download_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download')}"
 
                     data-toggle="tooltip"
 
                     title="${_('Download diff')}"><i class="icon-floppy"></i></a>
 
                  ${c.ignorews_url(request.GET)}
 
                  ${c.context_url(request.GET)}
 
                </div>
 
        </div>
 
        <div class="panel-body">
 
            <div class="form-group changeset_content_header clearfix">
 
                <div class="pull-right">
 
                    <span>
 
                        %if len(c.changeset.parents)>1:
 
                        <span class="label label-merge">${_('Merge')}</span>
 
                        %endif
 

	
 
                        %for book in c.changeset.bookmarks:
 
                        <span class="label label-bookmark" title="${_('Bookmark %s') % book}">${h.link_to(book,h.url('changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</span>
 
                        %endfor
 

	
 
                        %for tag in c.changeset.tags:
 
                         <span class="label label-tag"  title="${_('Tag %s') % tag}">${h.link_to(tag,h.url('changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</span>
 
                        %endfor
 

	
 
                        %for branch in c.changeset.branches:
 
                          <span class="label label-branch" title="${_('Branch %s') % branch}">${h.link_to(branch,h.url('changelog_home',repo_name=c.repo_name,branch=branch))}</span>
 
                        %endfor
 
                    </span>
 

	
 
                    <div class="changes">
 
                        % if (len(c.changeset.affected_files) <= c.affected_files_cut_off) or c.fulldiff:
 
                         <span class="label deleted" title="${_('Removed')}">${len(c.changeset.removed)}</span>
 
                         <span class="label changed" title="${_('Changed')}">${len(c.changeset.changed)}</span>
 
                         <span class="label added" title="${_('Added')}">${len(c.changeset.added)}</span>
 
                        % else:
 
                         <span class="label deleted" title="${_('Affected %s files') % len(c.changeset.affected_files)}">!</span>
 
                         <span class="label changed" title="${_('Affected %s files') % len(c.changeset.affected_files)}">!</span>
 
                         <span class="label added"   title="${_('Affected %s files') % len(c.changeset.affected_files)}">!</span>
 
                        % endif
 
                    </div>
 
                </div>
 
                <div class="pull-left">
 
                     <div class="author">
 
                         ${h.gravatar_div(h.email_or_none(c.changeset.author), size=20)}
 
                         <span><b>${h.person(c.changeset.author,'full_name_and_username')}</b> - ${h.age(c.changeset.date,True)} ${h.fmt_date(c.changeset.date)}</span><br/>
 
                         <span>${h.email_or_none(c.changeset.author)}</span><br/>
 
                     </div>
 
                     %if c.changeset_graft_source_hash:
 
                     <div>
 
                       ${_('Grafted from:')} ${h.link_to(h.short_id(c.changeset_graft_source_hash),h.url('changeset_home',repo_name=c.repo_name,revision=c.changeset_graft_source_hash), class_="changeset_hash")}
 
                     </div>
 
                     %endif
 
                     %if c.changeset_transplant_source_hash:
 
                     <div>
 
                       ${_('Transplanted from:')} ${h.link_to(h.short_id(c.changeset_transplant_source_hash),h.url('changeset_home',repo_name=c.repo_name,revision=c.changeset_transplant_source_hash), class_="changeset_hash")}
 
                     </div>
 
                     %endif
 

	
 
                     % if hasattr(c.changeset, 'successors') and c.changeset.successors:
 
                     <div class='successors'>
 
                       <span class='successors_header'>${_('Replaced by:')} </span>
 
                       % for i, s in enumerate(c.changeset.successors):
 
                           <%
 
                           comma = ""
 
                           if i != len(c.changeset.successors)-1:
 
                             comma = ", "
 
                           %>
 
                         <a class='successors_hash' href="${h.url('changeset_home',repo_name=c.repo_name, revision=s)}">${s}</a>${comma}
 
                       % endfor
 
                     </div>
 
                     % endif
 

	
 
                     % if hasattr(c.changeset, 'predecessors') and c.changeset.predecessors:
 
                     <div class='predecessors'>
 
                       <span class='predecessors_header'>${_('Preceded by:')} </span>
 
                       % for i, s in enumerate(c.changeset.predecessors):
 
                           <%
 
                           comma = ""
 
                           if i != len(c.changeset.predecessors)-1:
 
                             comma = ", "
 
                           %>
 
                           <a class="predecessors_hash" href="${h.url('changeset_home',repo_name=c.repo_name, revision=s)}">${s}</a>${comma}
 
                       % endfor
 
                     </div>
 
                     % endif
 
                </div>
 
            </div>
 
            <div class="form-group formatted-fixed">${h.urlify_text(c.changeset.message, c.repo_name)}</div>
 
            <div>
 
              <% a_rev, cs_rev, file_diff_data = c.changes[c.changeset.raw_id] %>
 
              % if c.limited_diff:
 
                  ${ungettext('%s file changed', '%s files changed', len(file_diff_data)) % len(file_diff_data)}:
 
              % else:
 
                  ${ungettext('%s file changed with %s insertions and %s deletions', '%s files changed with %s insertions and %s deletions', len(file_diff_data)) % (len(file_diff_data), c.lines_added, c.lines_deleted)}:
 
              %endif
 
              </div>
 
              <div class="cs_files">
 
                %for fid, url_fid, op, a_path, path, diff, stats in file_diff_data:
 
                    <div class="cs_${op} clearfix">
 
                      <span class="node">
 
                          <i class="icon-diff-${op}"></i>${h.link_to(path, '#%s' % fid)}
 
                      </span>
 
                      <div class="changes">${h.fancy_file_stats(stats)}</div>
 
                    </div>
 
                %endfor
 
                %if c.limited_diff:
 
                  <h5>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff anyway')}</a></h5>
 
                %endif
 
            </div>
 
            <div class="comments-number">
 
                ${comment.comment_count(c.inline_cnt, len(c.comments))}
 
            </div>
 
        </div>
 

	
 
    </div>
 

	
 
    ## diff block
 

	
 
    <div class="commentable-diff">
 
    <%namespace name="diff_block" file="/changeset/diff_block.html"/>
 
    ${diff_block.diff_block_js()}
 
    <% a_rev, cs_rev, file_diff_data = c.changes[c.changeset.raw_id] %>
 
    ${diff_block.diff_block(c.repo_name, 'rev', a_rev, a_rev,
 
                            c.repo_name, 'rev', cs_rev, cs_rev, file_diff_data)}
 
    % if c.limited_diff:
 
      <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff anyway')}</a></h4>
 
    % endif
 
    </div>
 

	
 
    ## template for inline comment form
 
    ${comment.comment_inline_form()}
 

	
 
    ## render comments and inlines
 
    ${comment.generate_comments()}
 

	
 
    ## main comment form and it status
 
    ${comment.comments()}
 

	
 
    </div>
 

	
 
    ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS
 
    <script>
 
    <script>'use strict';
 
      $(document).ready(function(){
 
          $('.code-difftable').on('click', '.add-bubble', function(e){
 
              show_comment_form($(this));
 
          });
 

	
 
          move_comments($(".comments .comments-list-chunk"));
 

	
 
          // hack: re-navigate to target after JS is done ... if a target is set and setting href thus won't reload
 
          if (window.location.hash != "") {
 
              window.location.href = window.location.href;
 
          }
 
      });
 

	
 
    </script>
 

	
 
  </div>
 
</%def>
kallithea/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -3,209 +3,209 @@
 
## <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
 
## ${comment.comment_block(co)}
 
##
 
<%def name="comment_block(co)">
 
  <div class="comment" id="comment-${co.comment_id}">
 
    <div class="comment-prev-next-links"></div>
 
    <div class="panel panel-default">
 
      <div class="panel-heading">
 
          ${h.gravatar_div(co.author.email, size=20)}
 
          <span class="user">
 
              ${co.author.full_name_and_username}
 
          </span>
 

	
 
          <span data-toggle="tooltip" title="${h.fmt_date(co.modified_at)}">
 
              ${h.age(co.modified_at)}
 
          </span>
 
              %if co.pull_request:
 
                <a href="${co.url()}">${_("comment")}</a>
 
                ${_('on pull request')}
 
                <a href="${co.pull_request.url()}">"${co.pull_request.title or _("No title")}"</a>
 
              %else:
 
                ${_('on this changeset')}
 
              %endif
 
              <a class="permalink" href="${co.url()}">&para;</a>
 

	
 
          %if co.author_id == request.authuser.user_id or h.HasRepoPermissionLevel('admin')(c.repo_name):
 
            %if co.deletable():
 
              <button type="button" onClick="confirm('${_('Delete comment?')}') && deleteComment(${co.comment_id})" class="pull-right buttons delete-comment btn btn-default btn-xs">${_('Delete')}</button>
 
            %endif
 
          %endif
 
      </div>
 
      <div class="panel-body">
 
        %if co.status_change:
 
           <div class="automatic-comment">
 
             <p>
 
               ${_("Status change")}: <span class="comment-status-label">${co.status_change[0].status_lbl}</span>
 
               <i class="icon-circle changeset-status-${co.status_change[0].status}"></i>
 
             </p>
 
           </div>
 
        %endif
 
        <div class="comment-text">
 
        %if co.text:
 
          ${h.render_w_mentions(co.text, c.repo_name)|n}
 
        %endif
 
        </div>
 
      </div>
 
    </div>
 
  </div>
 
</%def>
 

	
 

	
 
<%def name="comment_inline_form()">
 
<div id='comment-inline-form-template' style="display: none;">
 
  <div class="comment comment-preview submitting" style="display: none;">
 
    <div class="panel panel-default">
 
      <div class="panel-heading">
 
          ${h.gravatar_div(request.authuser.email, size=20)}
 
          <span class="user">
 
              ${request.authuser.full_name_or_username}
 
          </span>
 

	
 
          <span class="comment-submission-status">
 
              ${_('Submitting ...')}
 
          </span>
 
      </div>
 
      <div class="panel-body">
 
           <div class="automatic-comment" style="display: none;">
 
             <p>
 
               ${_("Status change")}: <span class="comment-status-label"></span>
 
               <i class="icon-circle"></i>
 
             </p>
 
           </div>
 
           <div class="comment-text">
 
             <div class="formatted-fixed">
 
             </div>
 
           </div>
 
      </div>
 
    </div>
 
  </div>
 
  <div class="ac">
 
  %if request.authuser.username != 'default':
 
    ${h.form('#', class_='inline-form')}
 
      <div class="well well-sm clearfix comment-inline-well">
 
        <div class="comment-help">
 
          <span class="text-muted">${_('Comments are in plain text. Use @username to notify another user.')|n}</span>
 
        </div>
 
        <textarea name="text" class="form-control"></textarea>
 

	
 
        <div id="status_block_container" class="status-block general-only hidden">
 
                %if c.pull_request is None:
 
                  ${_('Set changeset status')}:
 
                %else:
 
                  ${_('Vote for pull request status')}:
 
                %endif
 
                <span class="general-only cs-only">
 
                </span>
 
                <label class="radio-inline">
 
                    <input type="radio" class="status_change_radio" name="changeset_status" id="changeset_status_unchanged" value="" checked="checked" />
 
                    ${_('No change')}
 
                </label>
 
                %for status, lbl in c.changeset_statuses:
 
                    <label class="radio-inline">
 
                        <input type="radio" class="status_change_radio" name="changeset_status" id="${status}" value="${status}">
 
                        ${lbl}<i class="icon-circle changeset-status-${status}"></i>
 
                    </label>
 
                %endfor
 

	
 
                %if c.pull_request is not None and ( \
 
                    h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionLevel('admin')(c.repo_name) \
 
                    or c.pull_request.owner_id == request.authuser.user_id):
 
                <div>
 
                  ${_('Finish pull request')}:
 
                  <label class="checkbox-inline">
 
                    <input id="save_close" type="checkbox" name="save_close" class="status_change_checkbox">
 
                    ${_("Close")}
 
                  </label>
 
                  <label class="checkbox-inline">
 
                    <input id="save_delete" type="checkbox" name="save_delete" value="delete" class="status_change_checkbox">
 
                    ${_("Delete")}
 
                  </label>
 
                </div>
 
                %endif
 
        </div>
 

	
 
      </div>
 
      <div class="comment-button">
 
        ${h.submit('save', _('Comment'), class_='btn btn-default btn-sm save-inline-form')}
 
        ${h.reset('hide-inline-form', _('Cancel'), class_='btn btn-default btn-sm hide-inline-form')}
 
      </div>
 
    ${h.end_form()}
 
  %else:
 
      ${h.form('')}
 
      <div class="clearfix">
 
          <div class="comment-help">
 
            ${_('You need to be logged in to comment.')} <a href="${h.url('login_home', came_from=request.path_qs)}">${_('Login now')}</a>
 
          </div>
 
      </div>
 
      <div class="comment-button">
 
      ${h.reset('hide-inline-form', _('Hide'), class_='btn btn-default btn-sm hide-inline-form')}
 
      </div>
 
      ${h.end_form()}
 
  %endif
 
  </div>
 
</div>
 
</%def>
 

	
 

	
 
## show comment count as "x comments (y inline, z general)"
 
<%def name="comment_count(inline_cnt, general_cnt)">
 
    ${'%s (%s, %s)' % (
 
        ungettext("%d comment", "%d comments", inline_cnt + general_cnt) % (inline_cnt + general_cnt),
 
        ungettext("%d inline", "%d inline", inline_cnt) % inline_cnt,
 
        ungettext("%d general", "%d general", general_cnt) % general_cnt
 
    )}
 
    <span class="firstlink"></span>
 
</%def>
 

	
 

	
 
## generate inline comments and the main ones
 
<%def name="generate_comments()">
 
## original location of comments ... but the ones outside diff context remains here
 
<div class="comments inline-comments">
 
  %for f_path, lines in c.inline_comments:
 
    %for line_no, comments in lines.items():
 
      <div class="comments-list-chunk" data-f_path="${f_path}" data-line_no="${line_no}" data-target-id="${h.safeid(f_path)}_${line_no}">
 
        %for co in comments:
 
            ${comment_block(co)}
 
        %endfor
 
      </div>
 
    %endfor
 
  %endfor
 

	
 
      <div class="comments-list-chunk" data-f_path="" data-line_no="" data-target-id="general-comments">
 
        %for co in c.comments:
 
            ${comment_block(co)}
 
        %endfor
 
      </div>
 
</div>
 
<div class="comments-number">
 
    ${comment_count(c.inline_cnt, len(c.comments))}
 
</div>
 
</%def>
 

	
 
## MAIN COMMENT FORM
 
<%def name="comments(change_status=True)">
 
<div class="inline-comments inline-comments-general
 
            ${'show-general-status' if change_status else ''}">
 
  <div id="comments-general-comments" class="">
 
  ## comment_div for general comments
 
  </div>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 

	
 
$(document).ready(function () {
 

	
 
   $(window).on('beforeunload', function(){
 
      var $textareas = $('.comment-inline-form textarea[name=text]');
 
      if($textareas.length > 1 ||
 
         $textareas.val()) {
 
         // this message will not be displayed on all browsers
 
         // (e.g. some versions of Firefox), but the user will still be warned
 
         return 'There are uncommitted comments.';
 
      }
 
   });
 

	
 
});
 
</script>
 
</%def>
kallithea/templates/changeset/diff_block.html
Show inline comments
 
## -*- coding: utf-8 -*-
 

	
 
<%def name="diff_block(a_repo_name, a_ref_type, a_ref_name, a_rev,
 
                       cs_repo_name, cs_ref_name, cs_ref_type, cs_rev,
 
                       file_diff_data)">
 
<div class="diff-collapse">
 
    <button data-target="${'diff-container-%s' % (id(file_diff_data))}" class="diff-collapse-button btn btn-link btn-sm">&uarr; ${_('Collapse Diff')} &uarr;</button>
 
</div>
 
%for id_fid, url_fid, op, a_filename, cs_filename, diff, stats in file_diff_data:
 
    ${diff_block_diffblock(id_fid, url_fid, op, diff,
 
        a_repo_name, a_rev, a_ref_type, a_ref_name, a_filename,
 
        cs_repo_name, cs_rev, cs_ref_type, cs_ref_name, cs_filename,
 
        'diff-container-%s' % id(file_diff_data))}
 
%endfor
 
</%def>
 

	
 
<%def name="diff_block_diffblock(id_fid, url_fid, op, diff,
 
    a_repo_name, a_rev, a_ref_type, a_ref_name, a_filename,
 
    cs_repo_name, cs_rev, cs_ref_type, cs_ref_name, cs_filename, cls)"
 
>
 
    <div id="${id_fid}_target"></div>
 
    <div id="${id_fid}" class="panel panel-default ${cls}">
 
        <div class="panel-heading clearfix">
 
                <div class="pull-left">
 
                    ${cs_filename}
 
                </div>
 
                <div class="pull-left diff-actions">
 
                  <span>
 
                    %if op == 'A':
 
                      <span class="no-file" data-toggle="tooltip" title="${_('No file before')}">
 
                        <i class="icon-minus-circled"></i></span>
 
                    %else:
 
                      <a href="${h.url('files_home', repo_name=a_repo_name, f_path=a_filename, revision=a_rev)}" data-toggle="tooltip" title="${_('File before')}">
 
                        <i class="icon-doc"></i></a>
 
                    %endif
 

	
 
                    %if op == 'A':
 
                      <span class="arrow" data-toggle="tooltip" title="${_('Added')}">&#10142;</span>
 
                    %elif op == 'M':
 
                      <span class="arrow" data-toggle="tooltip" title="${_('Modified')}">&#10142;</span>
 
                    %elif op == 'D':
 
                      <span class="arrow" data-toggle="tooltip" title="${_('Deleted')}">&#10142;</span>
 
                    %elif op == 'R':
 
                      <span class="arrow" data-toggle="tooltip" title="${_('Renamed')}">&#10142;</span>
 
                    %elif op is None:
 
                      <span class="arrow" data-toggle="tooltip" title="${_('No change')}">&#10142;</span>
 
                    %else:
 
                      <span class="arrow" data-toggle="tooltip" title="${_('Unknown operation: %r') % op}">&#10142;</span>
 
                    %endif
 

	
 
                    %if op == 'D':
 
                      <span class="no-file" data-toggle="tooltip" title="${_('No file after')}">
 
                        <i class="icon-minus-circled"></i></span>
 
                    %else:
 
                      <a href="${h.url('files_home', repo_name=cs_repo_name, f_path=cs_filename, revision=cs_rev)}" data-toggle="tooltip" title="${_('File after')}">
 
                        <i class="icon-doc"></i></a>
 
                    %endif
 
                  </span>
 

	
 
                  <a href="${h.url('files_diff_home',repo_name=cs_repo_name,f_path=cs_filename,diff2=cs_rev,diff1=a_rev,diff='diff',fulldiff=1)}" data-toggle="tooltip" title="${_('Show full diff for this file')}">
 
                      <i class="icon-file-code"></i></a>
 
                  <a href="${h.url('files_diff_2way_home',repo_name=cs_repo_name,f_path=cs_filename,diff2=cs_rev,diff1=a_rev,diff='diff',fulldiff=1)}" data-toggle="tooltip" title="${_('Show full side-by-side diff for this file')}">
 
                      <i class="icon-docs"></i></a>
 
                  <a href="${h.url('files_diff_home',repo_name=cs_repo_name,f_path=cs_filename,diff2=cs_rev,diff1=a_rev,diff='raw')}" data-toggle="tooltip" title="${_('Raw diff')}">
 
                      <i class="icon-diff"></i></a>
 
                  <a href="${h.url('files_diff_home',repo_name=cs_repo_name,f_path=cs_filename,diff2=cs_rev,diff1=a_rev,diff='download')}" data-toggle="tooltip" title="${_('Download diff')}">
 
                      <i class="icon-floppy"></i></a>
 
                  ${c.ignorews_url(request.GET, url_fid)}
 
                  ${c.context_url(request.GET, url_fid)}
 
                </div>
 
                <div class="pull-right">
 
                    ${_('Show inline comments')}
 
                    ${h.checkbox('checkbox-show-inline-' + id_fid, checked="checked",class_="show-inline-comments",**{'data-id_for':id_fid})}
 
                </div>
 
        </div>
 
        <div class="no-padding panel-body" data-f_path="${cs_filename}">
 
            ${diff|n}
 
            %if op and cs_filename.rsplit('.')[-1] in ['png', 'gif', 'jpg', 'bmp']:
 
              <div class="btn btn-image-diff-show">Show images</div>
 
              %if op == 'M':
 
                <div id="${id_fid}_image-diff" class="btn btn-image-diff-swap" style="display:none">Press to swap images</div>
 
              %endif
 
              <div>
 
                %if op in 'DM':
 
                  <img id="${id_fid}_image-diff-img-a" class="img-diff img-diff-swapable" style="display:none"
 
                      realsrc="${h.url('files_raw_home',repo_name=a_repo_name,revision=a_rev,f_path=a_filename)}" />
 
                %endif
 
                %if op in 'AM':
 
                  <img id="${id_fid}_image-diff-img-b" class="img-diff img-diff-swapable" style="display:none"
 
                      realsrc="${h.url('files_raw_home',repo_name=cs_repo_name,revision=cs_rev,f_path=cs_filename)}" />
 
                %endif
 
              </div>
 
            %endif
 
        </div>
 
    </div>
 
</%def>
 

	
 
<%def name="diff_block_js()">
 
<script>
 
<script>'use strict';
 
$(document).ready(function(){
 
    $('.btn-image-diff-show').click(function(e){
 
        $('.btn-image-diff-show').hide();
 
        $('.btn-image-diff-swap').show();
 
        $('.img-diff-swapable')
 
            .each(function(i,e){
 
                    $(e).prop('src', $(e).attr('realsrc'));
 
                })
 
            .show();
 
        });
 

	
 
    $('.btn-image-diff-swap').mousedown(function(e){
 
        $('#'+e.currentTarget.id+'-img-a.img-diff-swapable')
 
          .before($('#'+e.currentTarget.id+'-img-b.img-diff-swapable'));
 
    });
 
    var reset = function(e){
 
        $('#'+e.currentTarget.id+'-img-a.img-diff-swapable')
 
          .after($('#'+e.currentTarget.id+'-img-b.img-diff-swapable'));
 
    };
 
    $('.btn-image-diff-swap').mouseup(reset);
 
    $('.btn-image-diff-swap').mouseleave(reset);
 

	
 
    $('.diff-collapse-button').click(function(e) {
 
        $('.diff_block').toggleClass('hidden');
 
        var $button = $(e.currentTarget);
 
        var $target = $('.' + $button.data('target'));
 
        if($target.hasClass('hidden')){
 
            $target.removeClass('hidden');
 
            $button.html("&uarr; {0} &uarr;".format(_TM['Collapse Diff']));
 
        }
 
        else if(!$target.hasClass('hidden')){
 
            $target.addClass('hidden');
 
            $button.html("&darr; {0} &darr;".format(_TM['Expand Diff']));
 
        }
 
    });
 
    $('.show-inline-comments').change(function(e){
 
        var target = e.currentTarget;
 
        if(target == null){
 
            target = this;
 
        }
 
        var boxid = $(target).data('id_for');
 
        if(target.checked){
 
            $('#{0} .inline-comments'.format(boxid)).show();
 
        }else{
 
            $('#{0} .inline-comments'.format(boxid)).hide();
 
        }
 
    });
 
});
 
</script>
 
</%def>
kallithea/templates/compare/compare_cs.html
Show inline comments
 
## Changesets table with graph
 
<%namespace name="changelog_table" file="/changelog/changelog_table.html"/>
 
<div>
 
  %if not c.cs_ranges:
 
    <span class="text-muted">${_('No changesets')}</span>
 
  %else:
 

	
 
    %if c.ancestors:
 
      <div class="ancestor">
 
        %if len(c.ancestors) > 1:
 
        <div class="text-danger">
 
          ${_('Criss cross merge situation with multiple merge ancestors detected!')}
 
        </div>
 
        <div>
 
          ${_('Please merge the target branch to your branch before creating a pull request.')}
 
        </div>
 
        %endif
 
        <div>
 
          ${_('Merge Ancestor')}:
 
          %for ancestor in c.ancestors:
 
            ${h.link_to(h.short_id(ancestor),h.url('changeset_home',repo_name=c.repo_name,revision=ancestor), class_="changeset_hash")}
 
          %endfor
 
        </div>
 
      </div>
 
    %endif
 

	
 
    <div id="graph_nodes">
 
        <canvas id="graph_canvas"></canvas>
 
    </div>
 

	
 
    <div id="graph_content_pr">
 
      ${changelog_table.changelog(c.cs_repo.repo_name, list(reversed(c.cs_ranges)), c.cs_statuses, c.cs_comments,
 
                                  show_index=True,
 
                                  resize_js='graph.render(jsdata)')}
 
    </div>
 

	
 
    %if c.is_ajax_preview:
 
      <h5>
 
      ## links should perhaps use ('rev', c.a_rev) instead ...
 
      ${h.link_to(_('Show merge diff'),
 
        h.url('compare_url',
 
          repo_name=c.a_repo.repo_name,
 
          org_ref_type=c.a_ref_type, org_ref_name=c.a_ref_name,
 
          other_repo=c.cs_repo.repo_name,
 
          other_ref_type=c.cs_ref_type, other_ref_name=c.cs_ref_name,
 
          merge='1')
 
        )}
 
      </h5>
 
    %endif
 
    %if c.cs_ranges_org is not None:
 
      ## TODO: list actual changesets?
 
      <div>
 
        ${h.link_to_ref(c.cs_repo.repo_name, c.cs_ref_type, c.cs_ref_name, c.cs_rev)}
 
        ${_('is')}
 
        <a href="${c.swap_url}">${_('%s changesets') % (len(c.cs_ranges_org))}</a>
 
        ${_('behind')}
 
        ${h.link_to_ref(c.a_repo.repo_name, c.a_ref_type, c.a_ref_name)}
 
      </div>
 
    %endif
 
  %endif
 
</div>
 

	
 
%if c.is_ajax_preview:
 
<div id="jsdata" style="display:none">${h.js(c.jsdata)}</div>
 
%else:
 
<script src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
 
%endif
 

	
 
<script>
 
<script>'use strict';
 
    var jsdata = ${h.js(c.jsdata)};
 
    var graph = new BranchRenderer('graph_canvas', 'graph_content_pr', 'chg_');
 

	
 
    $(document).ready(function(){
 
        graph.render(jsdata);
 

	
 
        $('.expand_commit').click(function(e){
 
            $(this).next('.mid').find('.message').toggleClass('expanded');
 
            graph.render(jsdata);
 
        });
 
    });
 
    $(window).resize(function(){
 
        graph.render(jsdata);
 
    });
 

	
 
</script>
kallithea/templates/compare/compare_diff.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    %if c.compare_home:
 
        ${_('%s Compare') % c.repo_name}
 
    %else:
 
        ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.a_repo.repo_name, c.a_ref_name)} &gt; ${'%s@%s' % (c.cs_repo.repo_name, c.cs_ref_name)}
 
    %endif
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
  ${_('Compare Revisions')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('changelog')}
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div class="panel-body">
 
      <div class="panel panel-default">
 
        <div id="body" class="panel-heading">
 
            <div class="compare-revision-selector">
 
                ## divs are "inline-block" and cannot have whitespace between them.
 
                <span>
 
                    ${h.hidden('compare_org')}
 
                </span><span>
 
                    <i class="icon-right"></i>
 
                </span><span>
 
                    ${h.hidden('compare_other')}
 
                </span><span>
 
                    %if not c.compare_home:
 
                        <a class="btn btn-default btn-sm" href="${c.swap_url}"><i class="icon-arrows-cw"></i>${_('Swap')}</a>
 
                    %endif
 
                    <button type="button" id="compare_revs" class="btn btn-default btn-sm"><i class="icon-git-compare"></i>${_('Compare Revisions')}</button>
 
                </span>
 
            </div>
 
        </div>
 

	
 
    %if c.compare_home:
 
        <div id="changeset_compare_view_content" class="panel-body">
 
         <h4 class="text-muted">${_('Compare revisions, branches, bookmarks, or tags.')}</h4>
 
        </div>
 
    %else:
 
        <div id="changeset_compare_view_content" class="panel-body">
 
                ##CS
 
                <h5>${ungettext('Showing %s commit','Showing %s commits', len(c.cs_ranges)) % len(c.cs_ranges)}</h5>
 
                <%include file="compare_cs.html" />
 

	
 
                ## FILES
 
                <h5>
 
                % if c.limited_diff:
 
                    ${ungettext('%s file changed', '%s files changed', len(c.file_diff_data)) % len(c.file_diff_data)}:
 
                % else:
 
                    ${ungettext('%s file changed with %s insertions and %s deletions','%s files changed with %s insertions and %s deletions', len(c.file_diff_data)) % (len(c.file_diff_data),c.lines_added,c.lines_deleted)}:
 
                %endif
 

	
 
                ${c.ignorews_url(request.GET)}
 
                ${c.context_url(request.GET)}
 
                </h5>
 
                <div class="cs_files">
 
                  %if not c.file_diff_data:
 
                     <span class="text-muted">${_('No files')}</span>
 
                  %endif
 
                  %for fid, url_fid, op, a_path, path, diff, stats in c.file_diff_data:
 
                    <div class="cs_${op} clearfix">
 
                      <span class="node">
 
                          <i class="icon-diff-${op}"></i>
 
                          ${h.link_to(path, '#%s' % fid)}
 
                      </span>
 
                      <div class="changes">${h.fancy_file_stats(stats)}</div>
 
                    </div>
 
                  %endfor
 
                  %if c.limited_diff:
 
                    <h5>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff anyway')}</a></h5>
 
                  %endif
 
                </div>
 
        </div>
 
      </div>
 
    %endif
 

	
 
    %if not c.compare_home:
 
        ## diff block
 
        <%namespace name="diff_block" file="/changeset/diff_block.html"/>
 
        ${diff_block.diff_block_js()}
 
        ${diff_block.diff_block(c.a_repo.repo_name, c.a_ref_type, c.a_ref_name, c.a_rev,
 
                                c.cs_repo.repo_name, c.cs_ref_type, c.cs_ref_name, c.cs_rev, c.file_diff_data)}
 
        % if c.limited_diff:
 
          <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff')}</a></h4>
 
        % endif
 
    %endif
 
    </div>
 

	
 
</div>
 
    <script>
 
    <script>'use strict';
 

	
 
   $(document).ready(function(){
 
    var cache = {};
 

	
 
    function make_revision_dropdown(css_selector, repo_name, ref_name, cache_key) {
 
      $(css_selector).select2({
 
        placeholder: '{0}@{1}'.format(repo_name, ref_name || ${h.jshtml(_('Select changeset'))}),
 
        formatSelection: function(obj){
 
            return '{0}@{1}'.format(repo_name, obj.text).html_escape();
 
        },
 
        dropdownAutoWidth: true,
 
        maxResults: 50,
 
        query: function(query){
 
          var key = cache_key;
 
          var cached = cache[key] ;
 
          if(cached) {
 
            var data = {results: []};
 
            var queryLower = query.term.toLowerCase();
 
            //filter results
 
            $.each(cached.results, function(){
 
                var section = this.text;
 
                var children = [];
 
                $.each(this.children, function(){
 
                    if(children.length < 50 ?
 
                       ((queryLower.length == 0) || (this.text.toLowerCase().indexOf(queryLower) >= 0)) :
 
                       ((queryLower.length != 0) && (this.text.toLowerCase().indexOf(queryLower) == 0))) {
 
                        children.push(this);
 
                    }
 
                });
 
                children = branchSort(children, undefined, query)
 
                data.results.push({'text': section, 'children': children});
 
            });
 
            //push the typed in changeset
 
            data.results.push({'text':_TM['Specify changeset'],
 
                               'children': [{'id': query.term, 'text': query.term, 'type': 'rev'}]});
 
            query.callback(data);
 
          }else{
 
              $.ajax({
 
                url: pyroutes.url('repo_refs_data', {'repo_name': repo_name}),
 
                data: {},
 
                dataType: 'json',
 
                type: 'GET',
 
                success: function(data) {
 
                  cache[key] = data;
 
                  query.callback(data);
 
                }
 
              });
 
          }
 
        }
 
    });
 
    }
 

	
 
    make_revision_dropdown("#compare_org",   ${h.js(c.a_repo.repo_name)},  ${h.js(c.a_ref_name)},  'cache');
 
    make_revision_dropdown("#compare_other", ${h.js(c.cs_repo.repo_name)}, ${h.js(c.cs_ref_name)}, 'cache2');
 

	
 
    var values_changed = function() {
 
        var values = $('#compare_org').select2('data') && $('#compare_other').select2('data');
 
        if (values) {
 
             $('#compare_revs').removeClass("disabled");
 
             // TODO: the swap button ... if any
 
        } else {
 
             $('#compare_revs').addClass("disabled");
 
             // TODO: the swap button ... if any
 
        }
 
    }
 
    values_changed();
 
    $('#compare_org').change(values_changed);
 
    $('#compare_other').change(values_changed);
 
    $('#compare_revs').on('click', function(e){
 
        var org = $('#compare_org').select2('data');
 
        var other = $('#compare_other').select2('data');
 
        if (!org || !other) {
 
            return;
 
        }
 

	
 
        var compare_url = ${h.js(h.url('compare_url',repo_name=c.repo_name,org_ref_type='__other_ref_type__',org_ref_name='__org__',other_ref_type='__org_ref_type__',other_ref_name='__other__', other_repo=c.cs_repo.repo_name))};
 
        var u = compare_url.replace('__other_ref_type__',org.type)
 
                           .replace('__org__',org.text)
 
                           .replace('__org_ref_type__',other.type)
 
                           .replace('__other__',other.text);
 
        window.location = u;
 
    });
 
   });
 
    </script>
 
</%def>
kallithea/templates/files/diff_2way.html
Show inline comments
 
## -*- coding: utf-8 -*-
 

	
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="js_extra">
 
  <script src="${h.url('/codemirror/lib/codemirror.js')}"></script>
 
  <script src="${h.url('/js/mergely.js')}"></script>
 
</%block>
 
<%block name="css_extra">
 
  <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
 
  <link rel="stylesheet" type="text/css" href="${h.url('/css/mergely.css')}"/>
 
</%block>
 

	
 
<%block name="title">
 
    ${_('%s File side-by-side diff') % c.repo_name}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('File diff')} ${h.show_id(c.changeset_1)} &rarr; ${h.show_id(c.changeset_2)}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('changelog')}
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 

	
 
    <div class="no-padding panel-body overflow-x-visible">
 
        <div class="panel panel-default">
 
            <div class="panel-heading clearfix">
 
                    <div class="pull-left">
 
                        ${h.link_to(c.node1.path,h.url('files_home',repo_name=c.repo_name,
 
                        revision=c.cs2.raw_id,f_path=c.node1.path))}
 
                    </div>
 
                    <div class="pull-left diff-actions">
 
                      <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=c.node1.path,diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='diff',fulldiff=1)}"
 
                         data-toggle="tooltip"
 
                         title="${_('Show full diff for this file')}">
 
                          <i class="icon-file-code"></i></a>
 
                      <a href="${h.url('files_diff_2way_home',repo_name=c.repo_name,f_path=c.node1.path,diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='diff',fulldiff=1)}"
 
                         data-toggle="tooltip"
 
                         title="${_('Show full side-by-side diff for this file')}">
 
                          <i class="icon-docs"></i></a>
 
                      <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=c.node1.path,diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='raw')}"
 
                         data-toggle="tooltip"
 
                         title="${_('Raw diff')}"><i class="icon-diff"></i></a>
 
                      <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=c.node1.path,diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='download')}"
 
                         data-toggle="tooltip"
 
                         title="${_('Download diff')}"><i class="icon-floppy"></i></a>
 
                      ${h.checkbox('ignorews', label=_('Ignore whitespace'))}
 
                      ${h.checkbox('edit_mode', label=_('Edit'))}
 
                    </div>
 
            </div>
 
            <div id="compare" class="overflow-x-visible"></div>
 
        </div>
 
    </div>
 

	
 
<script>
 
<script>'use strict';
 
var orig1_url = ${h.jshtml(h.url('files_raw_home',repo_name=c.repo_name,f_path=c.node1.path,revision=c.cs1.raw_id))};
 
var orig2_url = ${h.jshtml(h.url('files_raw_home',repo_name=c.repo_name,f_path=c.node2.path,revision=c.cs2.raw_id))};
 

	
 
$(document).ready(function () {
 
    $('#compare').mergely({
 
        width: 'auto',
 
        /* let the 2 compare panes use all the window space currently available
 
           below footer (i.e. on an empty page with just header and footer): */
 
        height: $(window).height()
 
                - $('.footer').offset().top
 
                - $('.footer').height(),
 
        fgcolor: {a:'#ddffdd',c:'#cccccc',d:'#ffdddd'},
 
        bgcolor: '#fff',
 
        viewport: true,
 
        cmsettings: {mode: 'text/plain', readOnly: true, lineWrapping: false, lineNumbers: true},
 
        lhs: function(setValue) {
 
            if (${h.js(c.node1.is_binary)}) {
 
                setValue('Binary file');
 
            }
 
            else{
 
                $.ajax(orig1_url, {dataType: 'text', success: setValue});
 
            }
 

	
 
        },
 
        rhs: function(setValue) {
 
            if (${h.js(c.node2.is_binary)}) {
 
                setValue('Binary file');
 
            }
 
            else{
 
                $.ajax(orig2_url, {dataType: 'text', success: setValue});
 
            }
 
        }
 
    });
 
    // recompute width - avoids overflow and horizontal scrollbar
 
    $('#compare').mergely('resize');
 

	
 
    $('#ignorews').change(function(e){
 
        var val = e.currentTarget.checked;
 
        $('#compare').mergely('options', {ignorews: val});
 
        $('#compare').mergely('update');
 
    });
 
    $('#edit_mode').change(function(e){
 
        var val = !e.currentTarget.checked;
 
        $('#compare').mergely('cm', 'lhs').setOption('readOnly', val);
 
        $('#compare').mergely('cm', 'rhs').setOption('readOnly', val);
 
        $('#compare').mergely('update');
 
    });
 
});
 
</script>
 

	
 
</div>
 
</%def>
kallithea/templates/files/files.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('%s Files') % c.repo_name}
 
    %if hasattr(c,'file'):
 
        &middot; ${c.file.path or '/'}
 
    %endif
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Files')}
 
    %if c.file:
 
        @ ${h.show_id(c.changeset)}
 
    %endif
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('files', c.revision)}
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        <div class="pull-left">
 
            ${self.breadcrumbs()}
 
        </div>
 
        <div class="pull-right">
 
              ${_("Branch filter:")} ${h.select('branch_selector',c.changeset.raw_id,c.revision_options)}
 
        </div>
 
    </div>
 
    <div class="panel-body">
 
        <div id="files_data">
 
            <%include file='files_ypjax.html'/>
 
        </div>
 
    </div>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
var CACHE = {};
 
var CACHE_EXPIRE = 5*60*1000; //cache for 5*60s
 
//used to construct links from the search list
 
var _repo_files_url = ${h.jshtml(h.url("files_home",repo_name=c.repo_name,revision='',f_path='').replace('//', '/'))};
 
var url_base = ${h.js(h.url("files_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__'))};
 
//send the nodelist request to this url
 
var node_list_url = ${h.js(h.url("files_nodelist_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__'))};
 

	
 
## new pyroutes URLs
 
pyroutes.register('files_nodelist_home', ${h.js(h.url('files_nodelist_home', repo_name=c.repo_name,revision='%(revision)s',f_path='%(f_path)s'))}, ['revision', 'f_path']);
 
pyroutes.register('files_history_home', ${h.js(h.url('files_history_home', repo_name=c.repo_name,revision='%(revision)s',f_path='%(f_path)s'))}, ['revision', 'f_path']);
 
pyroutes.register('files_authors_home', ${h.js(h.url('files_authors_home', repo_name=c.repo_name,revision='%(revision)s',f_path='%(f_path)s'))}, ['revision', 'f_path']);
 

	
 
var ypjax_links = function(){
 
    $('.ypjax-link').click(function(e){
 

	
 
        //don't do ypjax on middle click
 
        if (e.which == 2) {
 
            return true;
 
        }
 

	
 
        var url = e.currentTarget.href;
 

	
 
        //extract rev and the f_path from url.
 
        var parts = url.split(_repo_files_url);
 
        if (parts.length != 2) {
 
            return false;
 
        }
 

	
 
        var parts2 = parts[1].split('/');
 
        var rev = parts2.shift(); // pop the first element which is the revision
 
        var f_path = parts2.join('/');
 

	
 
        //page title - make this consistent with title mako block above
 
        var title = ${h.jshtml(_('%s Files') % c.repo_name)} + " \u00B7 " + (f_path || '/') + " \u00B7 " + ${h.jshtml(c.site_name)};
 

	
 
        var _node_list_url = node_list_url.replace('__REV__',rev).replace('__FPATH__', f_path);
 
        var _url_base = url_base.replace('__REV__',rev);
 

	
 
        // Change our States and save some data for handling events
 
        var state = {url:url, title:title, url_base:_url_base,
 
                     node_list_url:_node_list_url, rev:rev, f_path:f_path};
 
        window.history.pushState(state, null, url);
 
        load_state(state);
 

	
 
        //now we're sure that we can do ypjax things
 
        e.preventDefault();
 
        return false;
 
    });
 
}
 

	
 
var load_state = function(state) {
 
    var $files_data = $('#files_data');
 
    var cache_key = state.url;
 
    var _cache_obj = CACHE[cache_key];
 
    var _cur_time = new Date().getTime();
 
    if (_cache_obj !== undefined && _cache_obj[0] > _cur_time) {
 
        $files_data.html(_cache_obj[1]);
 
        $files_data.css('opacity', '1.0');
 
        post_load_state(state);
 
    } else {
 
        asynchtml(state.url, $files_data, function() {
 
                  post_load_state(state);
 
                  var expire_on = new Date().getTime() + CACHE_EXPIRE;
 
                  CACHE[cache_key] = [expire_on, $files_data.html()];
 
            });
 
    }
 
}
 

	
 
var post_load_state = function(state) {
 
    ypjax_links();
 
    tooltip_activate();
 

	
 
    if(state !== undefined) {
 
        document.title = state.title;
 

	
 
        //initially loaded stuff
 
        var _f_path = state.f_path;
 
        var _rev = state.rev;
 

	
 
        fileBrowserListeners(state.node_list_url, state.url_base);
 
        // Inform Google Analytics of the change
 
        if ( typeof window.pageTracker !== 'undefined' ) {
 
            window.pageTracker._trackPageview(state.url);
 
        }
 
    }
 

	
 
    function highlight_lines(lines){
 
        for(pos in lines){
 
        for(let pos in lines){
 
          $('#L'+lines[pos]).css('background-color','#FFFFBE');
 
        }
 
    }
 
    page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L');
 
    let page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L');
 
    if (page_highlights.length == 2){
 
       highlight_ranges  = page_highlights[1].split(",");
 
       let highlight_ranges  = page_highlights[1].split(",");
 

	
 
       var h_lines = [];
 
       for (pos in highlight_ranges){
 
       for (let pos in highlight_ranges){
 
            var _range = highlight_ranges[pos].split('-');
 
            if(_range.length == 2){
 
                var start = parseInt(_range[0]);
 
                var end = parseInt(_range[1]);
 
                if (start < end){
 
                    for(var i=start;i<=end;i++){
 
                        h_lines.push(i);
 
                    }
 
                }
 
            }
 
            else{
 
                h_lines.push(parseInt(highlight_ranges[pos]));
 
            }
 
      }
 
      highlight_lines(h_lines);
 
      $('#L'+h_lines[0]).each(function(){
 
          this.scrollIntoView();
 
      });
 
    }
 

	
 
    // select code link event
 
    $('#hlcode').mouseup(getSelectionLink);
 

	
 
    // history select field
 
    var cache = {};
 
    $('#diff1').prev('.select2-container').remove(); // Hack to handle repeated JS initialization on reused DOM
 
    $("#diff1").select2({
 
        placeholder: _TM['Select changeset'],
 
        dropdownAutoWidth: true,
 
        maxResults: 50,
 
        query: function(query){
 
          var key = 'cache';
 
          var cached = cache[key] ;
 
          if(cached) {
 
            var data = {results: []};
 
            var queryLower = query.term.toLowerCase();
 
            //filter results
 
            $.each(cached.results, function(){
 
                var section = this.text;
 
                var children = [];
 
                $.each(this.children, function(){
 
                    if(children.length < 50 ?
 
                       ((queryLower.length == 0) || (this.text.toLowerCase().indexOf(queryLower) >= 0)) :
 
                       ((queryLower.length != 0) && (this.text.toLowerCase().indexOf(queryLower) == 0))) {
 
                        children.push(this);
 
                    }
 
                });
 
                children = branchSort(children, undefined, query)
 
                data.results.push({'text': section, 'children': children});
 
            });
 
            //push the typed in changeset
 
            data.results.push({'text':_TM['Specify changeset'],
 
                               'children': [{'id': query.term, 'text': query.term, 'type': 'rev'}]});
 
            query.callback(data);
 
          }else{
 
              $.ajax({
 
                url: pyroutes.url('files_history_home', {'revision': _rev, 'f_path': _f_path}),
 
                data: {},
 
                dataType: 'json',
 
                type: 'GET',
 
                success: function(data) {
 
                  cache[key] = data;
 
                  query.callback(data);
 
                }
 
              });
 
          }
 
        }
 
    });
 
}
 

	
 
$(document).ready(function(){
 
    ypjax_links();
 

	
 
    // Process history navigation event and load its state
 
    window.addEventListener('popstate', function(e){
 
        if (e.state)
 
            load_state(e.state);
 
        else
 
            load_state(initial_state);
 
    });
 

	
 
    // init the search filter
 
    var _node_list_url = node_list_url.replace('__REV__', ${h.js(c.changeset.raw_id)}).replace('__FPATH__', ${h.js(c.file.path)});
 
    var _url_base = url_base.replace('__REV__', ${h.js(c.changeset.raw_id)});
 
    fileBrowserListeners(_node_list_url, _url_base);
 

	
 
    var initial_state = {url:window.location.href, title:document.title, url_base:_url_base,
 
         node_list_url:_node_list_url, rev:${h.js(c.changeset.raw_id)}, f_path:${h.js(c.file.path)}};
 

	
 
    // change branch filter
 
    $("#branch_selector").select2({
 
        dropdownAutoWidth: true,
 
        maxResults: 50,
 
        sortResults: branchSort
 
        });
 

	
 
    $("#branch_selector").change(function(e){
 
        var selected = e.currentTarget.options[e.currentTarget.selectedIndex].value;
 
        if(selected && selected != ${h.js(c.changeset.raw_id)}){
 
            window.location = pyroutes.url('files_home', {'repo_name': ${h.js(c.repo_name)}, 'revision': selected, 'f_path': ${h.js(c.file.path)}});
 
            $("#body").hide();
 
        } else {
 
            $("#branch_selector").val(${h.js(c.changeset.raw_id)});
 
        }
 
    });
 
    $('#show_authors').on('click', function(){
 
        $.ajax({
 
            url: pyroutes.url('files_authors_home', {'revision': ${h.js(c.changeset.raw_id)}, 'f_path': ${h.js(c.file.path)}}),
 
            success: function(data) {
 
                $('#file_authors').html(data);
 
                $('#file_authors').show();
 
                tooltip_activate();
 
            }
 
        });
 
    });
 

	
 
});
 

	
 
</script>
 

	
 
</%def>
kallithea/templates/files/files_add.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('%s Files Add') % c.repo_name}
 
</%block>
 

	
 
<%block name="js_extra">
 
  <script src="${h.url('/codemirror/lib/codemirror.js')}"></script>
 
  <script src="${h.url('/js/codemirror_loadmode.js')}"></script>
 
  <script src="${h.url('/codemirror/mode/meta.js')}"></script>
 
</%block>
 
<%block name="css_extra">
 
  <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
 
</%block>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Add New File')} @ ${h.show_id(c.cs)}
 
</%def>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('files')}
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        <div class="pull-left">
 
            ${self.breadcrumbs()}
 
        </div>
 
        <div class="pull-right">
 
            <a href="#">${_('Branch')}: ${c.cs.branch}</a>
 
        </div>
 
    </div>
 
    <div class="panel-body" id="edit">
 
        <div id="files_data">
 
            ${h.form(h.url.current(),method='post',id='eform',enctype="multipart/form-data", class_="form-inline")}
 
            <h3 class="files_location">
 
              ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cs.raw_id,c.f_path)} /
 
              <span id="filename_container" class="file">
 
                  <input class="form-control input-small" type="text" value="" size="30" name="filename" id="filename" placeholder="${_('Enter filename...')}">
 
                  <input type="hidden" value="${c.f_path}" name="location" id="location">
 
                  ${_('or')} <button type="button" class="btn btn-default btn-sm" id="upload_file_enable">${_('Upload File')}</button>
 
              </span>
 
              <span id="upload_file_container" style="display:none">
 
                  <input class="form-control" type="file" size="20" name="upload_file" id="upload_file">
 
                  ${_('or')} <button type="button" class="btn btn-default btn-sm" id="file_enable">${_('Create New File')}</button>
 
              </span>
 
            </h3>
 
            <div id="body" class="panel panel-default">
 
              <div class="panel-heading clearfix">
 
                  <div class="pull-left">
 
                    <label>${_('New file type')}
 
                        <select class="form-control" id="mimetype" name="mimetype"></select>
 
                    </label>
 
                  </div>
 
              </div>
 
              <div class="panel-body no-padding">
 
                <textarea id="editor" name="content" style="display:none"></textarea>
 
              </div>
 
            </div>
 
            <div>
 
              <div>
 
                  <div>${_('Commit Message')}</div>
 
                  <textarea class="form-control" name="message" placeholder="${c.default_message}"></textarea>
 
              </div>
 
              <div class="buttons">
 
                ${h.submit('commit',_('Commit Changes'),class_="btn btn-success")}
 
                ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
              </div>
 
            </div>
 
            ${h.end_form()}
 
            <script>
 
            <script>'use strict';
 
                $(document).ready(function(){
 
                    var reset_url = ${h.jshtml(h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))};
 
                    var myCodeMirror = initCodeMirror('editor', ${h.jshtml(request.script_name)}, reset_url);
 

	
 
                    //inject new modes, based on codeMirrors modeInfo object
 
                    var $mimetype_select = $('#mimetype');
 
                    $mimetype_select.each(function(){
 
                        var modes_select = this;
 
                        var index = 1;
 
                        for(var i=0;i<CodeMirror.modeInfo.length;i++){
 
                            var m = CodeMirror.modeInfo[i];
 
                            var opt = new Option(m.name, m.mime);
 
                            $(opt).attr('mode', m.mode);
 
                            if (m.mime == 'text/plain') {
 
                                // default plain text
 
                                $(opt).prop('selected', true);
 
                                modes_select.options[0] = opt;
 
                            } else {
 
                                modes_select.options[index++] = opt;
 
                            }
 
                        }
 
                    });
 
                    var $filename_input = $('#filename');
 
                    $mimetype_select.change(function(e){
 
                        var selected = e.currentTarget;
 
                        var node = selected.options[selected.selectedIndex];
 
                        var detected_mode = CodeMirror.findModeByMIME(node.value);
 
                        setCodeMirrorMode(myCodeMirror, detected_mode);
 

	
 
                        var proposed_ext = CodeMirror.findExtensionByMode(detected_mode);
 
                        var file_data = CodeMirror.getFilenameAndExt($filename_input.val());
 
                        var filename = file_data['filename'] || 'filename1';
 
                        $filename_input.val(filename + '.' + proposed_ext);
 
                    });
 

	
 
                    // on type the new filename set mode
 
                    $filename_input.keyup(function(e){
 
                        var file_data = CodeMirror.getFilenameAndExt(this.value);
 
                        if(file_data['ext'] != null){
 
                            var detected_mode = CodeMirror.findModeByExtension(file_data['ext']) || CodeMirror.findModeByMIME('text/plain');
 
                            if (detected_mode){
 
                                setCodeMirrorMode(myCodeMirror, detected_mode);
 
                                $mimetype_select.val(detected_mode.mime);
 
                            }
 
                        }
 
                    });
 
                });
 
            </script>
 
        </div>
 
    </div>
 
</div>
 
</%def>
kallithea/templates/files/files_browser.html
Show inline comments
 
<%namespace name="base" file="/base/base.html"/>
 

	
 
<%def name="file_class(node)">
 
    %if node.is_file():
 
        <%return "browser-file" %>
 
    %elif node.is_submodule():
 
        <%return "submodule-dir"%>
 
    %else:
 
        <%return "browser-dir"%>
 
    %endif
 
</%def>
 
<%def name="file_url(node, c)">
 
    %if node.is_submodule():
 
        <%return node.url or '#'%>
 
    %else:
 
        <%return h.url('files_home', repo_name=c.repo_name, revision=c.changeset.raw_id, f_path=node.path)%>
 
    %endif
 
</%def>
 
<%def name="_file_name(iconclass, name)">
 
    <%return h.literal('<i class="%s"></i><span>%s</span>') % (iconclass, name)%>
 
</%def>
 
<%def name="file_name(node)">
 
    <%
 
        c = "icon-folder-open"
 
        if node.is_file():
 
            c = "icon-doc"
 
        elif node.is_submodule():
 
            c = "icon-file-submodule"
 
    %>
 
    <%return _file_name(c, node.name)%>
 
</%def>
 
<div id="body" class="panel panel-default">
 
    <div class="panel-heading clearfix">
 
        ${base.parent_child_navigation()}
 
    </div>
 

	
 
    <div class="panel-body">
 
        ${h.form(h.url.current())}
 
        <div id="search_activate_id" class="search_activate">
 
            <a class="btn btn-default btn-xs" id="filter_activate" href="#">${_('Search File List')}</a>
 
        </div>
 
        ${h.end_form()}
 
        <div class="browser-search form-inline">
 
            <div>
 
                <div id="node_filter_box_loading" style="display:none">${_('Loading file list...')}</div>
 
                <div id="node_filter_box" style="display:none">
 
                ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.file.path)}/<input class="init" type="text" value="type to search..." name="filter" size="25" id="node_filter">
 
                </div>
 
            </div>
 
        </div>
 
        <table class="table code-browser">
 
            <thead>
 
                <tr>
 
                    <th>${_('Name')}</th>
 
                    <th>${_('Size')}</th>
 
                    <th>${_('Last Revision')}</th>
 
                    <th>${_('Last Modified')}</th>
 
                    <th>${_('Last Committer')}</th>
 
                </tr>
 
            </thead>
 

	
 
            <tbody id="tbody">
 
                %if c.file.parent:
 
                <tr class="parity0">
 
                    <td>
 
                        ${h.link_to(_file_name('icon-folder-open', '..'),h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.file.parent.path),class_="browser-dir ypjax-link")}
 
                    </td>
 
                    <td></td>
 
                    <td></td>
 
                    <td></td>
 
                    <td></td>
 
                </tr>
 
                %endif
 

	
 
            %for cnt,node in enumerate(c.file):
 
                <tr class="parity${cnt%2}">
 
                     <td>
 
                         ${h.link_to(file_name(node),file_url(node,c),class_=file_class(node)+(" ypjax-link" if not node.is_submodule() else ""), target_="_blank" if node.is_submodule() else None)}
 
                     </td>
 
                     <td>
 
                     %if node.is_file():
 
                         ${h.format_byte_size(node.size,binary=True)}
 
                     %endif
 
                     </td>
 
                     <td>
 
                         %if node.is_file():
 
                             <a data-toggle="tooltip" title="${node.last_changeset.message}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=node.last_changeset.raw_id)}" class="changeset_hash">${h.show_id(node.last_changeset)}</a>
 
                         %endif
 
                     </td>
 
                     <td>
 
                         %if node.is_file():
 
                             <span data-toggle="tooltip" title="${h.fmt_date(node.last_changeset.date)}">
 
                            ${h.age(node.last_changeset.date)}</span>
 
                         %endif
 
                     </td>
 
                     <td>
 
                         %if node.is_file():
 
                             <span title="${node.last_changeset.author}">
 
                            ${h.person(node.last_changeset.author)}
 
                            </span>
 
                         %endif
 
                     </td>
 
                </tr>
 
            %endfor
 
            </tbody>
 
            <tbody id="tbody_filtered" style="display:none">
 
            </tbody>
 
        </table>
 
    </div>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        // init node filter if we pass GET param ?search=1
 
        var search_GET = ${h.js(request.GET.get('search',''))};
 
        if(search_GET == "1"){
 
            $("#filter_activate").click();
 
        }
 
    });
 
</script>
kallithea/templates/files/files_edit.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('%s File Edit') % c.repo_name}
 
</%block>
 

	
 
<%block name="js_extra">
 
  <script src="${h.url('/codemirror/lib/codemirror.js')}"></script>
 
  <script src="${h.url('/js/codemirror_loadmode.js')}"></script>
 
  <script src="${h.url('/codemirror/mode/meta.js')}"></script>
 
</%block>
 
<%block name="css_extra">
 
  <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
 
</%block>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Edit file')} @ ${h.show_id(c.cs)}
 
</%def>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('files')}
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        <div class="pull-left">
 
            ${self.breadcrumbs()}
 
        </div>
 
        <div class="pull-right">
 
            <a href="#">${_('Branch')}: ${c.cs.branch}</a>
 
        </div>
 
    </div>
 
    <div class="panel-body" id="edit">
 
        <div id="files_data">
 
            ${h.form(h.url.current(),method='post',id='eform')}
 
            <h3 class="files_location">
 
              ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cs.raw_id,c.file.path)}
 
            </h3>
 
            <div id="body" class="panel panel-default">
 
              <div class="panel-heading clearfix form-inline form-group-sm">
 
                    <span>
 
                        <span><i class="icon-doc-inv"></i></span>
 
                        <span>${h.link_to(h.show_id(c.file.changeset),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.changeset.raw_id))}</span>
 
                        <span>${h.format_byte_size(c.file.size,binary=True)}</span>
 
                        <span>${c.file.mimetype}</span>
 
                        <select class="form-control" id="mimetype" name="mimetype"></select>
 
                    </span>
 
                    <span class="pull-right buttons">
 
                      ${h.link_to(_('Show Annotation'),h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-default btn-xs")}
 
                      ${h.link_to(_('Show as Raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-default btn-xs")}
 
                      ${h.link_to(_('Download as Raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-default btn-xs")}
 
                      % if h.HasRepoPermissionLevel('write')(c.repo_name):
 
                       % if not c.file.is_binary:
 
                        ${h.link_to(_('Source'),h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-default btn-xs")}
 
                       % endif
 
                      % endif
 
                    </span>
 
              </div>
 
              <div class="panel-body no-padding">
 
                <textarea id="editor" name="content" style="display:none">${h.escape(h.safe_str(c.file.content))|n}</textarea>
 
              </div>
 
            </div>
 
            <div>
 
              <div class="form-group">
 
                  <label>${_('Commit Message')}</label>
 
                  <textarea class="form-control" id="commit" name="message" placeholder="${c.default_message}"></textarea>
 
              </div>
 
              <div class="form-group buttons">
 
                ${h.submit('commit',_('Commit Changes'),class_="btn btn-success")}
 
                ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
              </div>
 
            </div>
 
            ${h.end_form()}
 
        </div>
 
    </div>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        var reset_url = ${h.jshtml(h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.file.path))};
 
        var myCodeMirror = initCodeMirror('editor', ${h.jshtml(request.script_name)}, reset_url);
 

	
 
       //inject new modes, based on codeMirrors modeInfo object
 
        var $mimetype_select = $('#mimetype');
 
        $mimetype_select.each(function(){
 
            var modes_select = this;
 
            var index = 1;
 
            for(var i=0;i<CodeMirror.modeInfo.length;i++){
 
                var m = CodeMirror.modeInfo[i];
 
                var opt = new Option(m.name, m.mime);
 
                $(opt).attr('mode', m.mode);
 
                if (m.mime == 'text/plain') {
 
                    // default plain text
 
                    $(opt).prop('selected', true);
 
                    modes_select.options[0] = opt;
 
                } else {
 
                    modes_select.options[index++] = opt;
 
                }
 
            }
 
        });
 
        // try to detect the mode based on the file we edit
 
        var detected_mode = CodeMirror.findModeByExtension(${h.js(c.file.extension)});
 
        if(detected_mode){
 
            setCodeMirrorMode(myCodeMirror, detected_mode);
 
            $($mimetype_select.find('option[value="'+detected_mode.mime+'"]')[0]).prop('selected', true);
 
        }
 

	
 
        $mimetype_select.on('change', function(e){
 
            var selected = e.currentTarget;
 
            var node = selected.options[selected.selectedIndex];
 
            var detected_mode = CodeMirror.findModeByMIME(node.value);
 
            setCodeMirrorMode(myCodeMirror, detected_mode);
 
        });
 
    });
 
</script>
 
</%def>
kallithea/templates/followers/followers.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('%s Followers') % c.repo_name}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Followers')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('followers')}
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div class="panel-body">
 
        <div id="followers">
 
            <%include file='followers_data.html'/>
 
        </div>
 
    </div>
 
</div>
 
<script>
 
<script>'use strict';
 
  $(document).ready(function(){
 
    var $followers = $('#followers');
 
    $followers.on('click','.pager_link',function(e){
 
        asynchtml(e.target.href, $followers, function(){
 
            show_more_event();
 
            tooltip_activate();
 
        });
 
        e.preventDefault();
 
    });
 
  });
 
</script>
 
</%def>
kallithea/templates/forks/fork.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Fork repository %s') % c.repo_name}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Fork')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('createfork')}
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    ${h.form(url('repo_fork_create_home',repo_name=c.repo_info.repo_name))}
 
    <div class="form panel-body settings">
 
            <div class="form-group">
 
                <label class="control-label" for="repo_name">${_('Fork name')}:</label>
 
                <div>
 
                    ${h.text('repo_name',class_='form-control')}
 
                    ${h.hidden('repo_type',c.repo_info.repo_type)}
 
                    ${h.hidden('fork_parent_id',c.repo_info.repo_id)}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="description">${_('Description')}:</label>
 
                <div>
 
                    ${h.textarea('description',class_='form-control')}
 
                    <span class="help-block">${_('Keep it short and to the point. Use a README file for longer descriptions.')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="repo_group">${_('Repository group')}:</label>
 
                <div>
 
                    ${h.select('repo_group','',c.repo_groups,class_='form-control')}
 
                    <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="landing_rev">${_('Landing revision')}:</label>
 
                <div>
 
                    ${h.select('landing_rev','',c.landing_revs,class_='form-control')}
 
                    <span class="help-block">${_('Default revision for files page, downloads, whoosh, and readme.')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="private">${_('Private')}:</label>
 
                <div>
 
                    ${h.checkbox('private',value="True")}
 
                    <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="copy_permissions">${_('Copy permissions')}:</label>
 
                <div>
 
                    ${h.checkbox('copy_permissions',value="True", checked="checked")}
 
                    <span class="help-block">${_('Copy permissions from forked repository')}</span>
 
                </div>
 
            </div>
 

	
 
            %if c.can_update:
 
            <div class="form-group">
 
                <label class="control-label" for="update_after_clone">${_('Update after clone')}:</label>
 
                <div>
 
                    ${h.checkbox('update_after_clone',value="True")}
 
                    <span class="help-block">${_('Checkout source after making a clone')}</span>
 
                </div>
 
            </div>
 
            %endif
 

	
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('fork-submit',_('Fork this Repository'),class_="btn btn-default")}
 
                </div>
 
            </div>
 
    </div>
 
    ${h.end_form()}
 
</div>
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        $("#repo_group").select2({
 
            'dropdownAutoWidth': true
 
        });
 
        $("#landing_rev").select2({
 
            'minimumResultsForSearch': -1
 
        });
 
        $('#repo_name').focus();
 
    });
 
</script>
 
</%def>
kallithea/templates/forks/forks.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('%s Forks') % c.repo_name}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Forks')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('showforks')}
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div class="panel-body">
 
        <div id="forks">
 
            <%include file='forks_data.html'/>
 
        </div>
 
    </div>
 
</div>
 
<script>
 
<script>'use strict';
 
  $(document).ready(function(){
 
      var $forks = $('#forks');
 
      $forks.on('click','.pager_link',function(e){
 
          asynchtml(e.target.href, $forks, function(){
 
              show_more_event();
 
              tooltip_activate();
 
          });
 
          e.preventDefault();
 
      });
 
  });
 
</script>
 
</%def>
kallithea/templates/index_base.html
Show inline comments
 
<%page args="parent,group_name=''" />
 
    <div class="panel panel-primary">
 
        <div class="panel-heading clearfix">
 
            <div class="pull-left panel-title">
 
                %if c.group is not None:
 
                    %for group in c.group.parents:
 
                        ${h.link_to(group.name, url('repos_group_home', group_name=group.group_name))}
 
                        &raquo;
 
                    %endfor
 
                    ${c.group.name}
 
                %endif
 
            </div>
 

	
 
            %if request.authuser.username != 'default':
 
              <div class="pull-right">
 
                <%
 
                    gr_name = c.group.group_name if c.group else None
 
                    # create repositories with write permission on group is set to true
 
                    create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
 
                    group_admin = h.HasRepoGroupPermissionLevel('admin')(gr_name, 'can write into group index page')
 
                    group_write = h.HasRepoGroupPermissionLevel('write')(gr_name, 'can write into group index page')
 
                %>
 
                %if h.HasPermissionAny('hg.admin','hg.create.repository')() or (group_admin or (group_write and create_on_write)):
 
                  %if c.group:
 
                        <a href="${h.url('new_repo',parent_group=c.group.group_id)}" class="btn btn-default btn-xs"><i class="icon-plus"></i>${_('Add Repository')}</a>
 
                        %if h.HasPermissionAny('hg.admin')() or h.HasRepoGroupPermissionLevel('admin')(c.group.group_name):
 
                            <a href="${h.url('new_repos_group', parent_group=c.group.group_id)}" class="btn btn-default btn-xs"><i class="icon-plus"></i>${_('Add Repository Group')}</a>
 
                        %endif
 
                  %else:
 
                    <a href="${h.url('new_repo')}" class="btn btn-default btn-xs"><i class="icon-plus"></i>${_('Add Repository')}</a>
 
                    %if h.HasPermissionAny('hg.admin')():
 
                        <a href="${h.url('new_repos_group')}" class="btn btn-default btn-xs"><i class="icon-plus"></i>${_('Add Repository Group')}</a>
 
                    %endif
 
                  %endif
 
                %endif
 
                %if c.group and h.HasRepoGroupPermissionLevel('admin')(c.group.group_name):
 
                    <a href="${h.url('edit_repo_group',group_name=c.group.group_name)}" title="${_('You have admin right to this group, and can edit it')}" class="btn btn-default btn-xs"><i class="icon-pencil"></i>${_('Edit Repository Group')}</a>
 
                %endif
 
              </div>
 
            %endif
 
        </div>
 
        <div class="panel-body">
 
            <table class="table" id="repos_list_wrap" width="100%"></table>
 
        </div>
 
    </div>
 

	
 
      <script>
 
      <script>'use strict';
 
        var data = ${h.js(c.data)},
 
            $dataTable = $("#repos_list_wrap").DataTable({
 
                data: data.records,
 
                columns: [
 
                    {data: "raw_name", visible: false, searchable: false},
 
                    {title: ${h.jshtml(_('Repository'))}, data: "name", orderData: [0,], render: {
 
                        filter: function(data, type, row, meta) {
 
                            return row.just_name;
 
                        }
 
                    }},
 
                    {data: "following", defaultContent: '', sortable: false},
 
                    {data: "desc", title: ${h.jshtml(_('Description'))}, searchable: false},
 
                    {data: "last_change_iso", defaultContent: '', visible: false, searchable: false},
 
                    {data: "last_change", defaultContent: '', title: ${h.jshtml(_('Last Change'))}, orderData: [4,], searchable: false},
 
                    {data: "last_rev_raw", defaultContent: '', visible: false, searchable: false},
 
                    {data: "last_changeset", defaultContent: '', title: ${h.jshtml(_('Tip'))}, orderData: [6,], searchable: false},
 
                    {data: "owner", defaultContent: '', title: ${h.jshtml(_('Owner'))}, searchable: false},
 
                    {data: "atom", defaultContent: '', sortable: false}
 
                ],
 
                order: [[1, "asc"]],
 
                dom: '<"dataTables_left"f><"dataTables_right"ip>t',
 
                pageLength: 100
 
            });
 
      </script>
kallithea/templates/journal/journal.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('Journal')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    <form id="filter_form" class="pull-left form-inline input-group-sm">
 
        <input class="form-control q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or _('journal filter...')}"/>
 
        <span data-toggle="popover" data-content="${h.journal_filter_help()}">?</span>
 
        <input type='submit' value="${_('Filter')}" class="btn btn-default btn-xs"/>
 
        ${_('Journal')} - ${ungettext('%s Entry', '%s Entries', c.journal_pager.item_count) % (c.journal_pager.item_count)}
 
    </form>
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('journal')}
 
</%block>
 

	
 
<%block name="head_extra">
 
  <link href="${h.url('journal_atom', api_key=request.authuser.api_key)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
 
  <link href="${h.url('journal_rss', api_key=request.authuser.api_key)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
 
</%block>
 

	
 
<%def name="main()">
 
    <div class="panel panel-primary">
 
        <div class="panel-heading clearfix">
 
            <div class="pull-left">
 
                ${self.breadcrumbs()}
 
            </div>
 
            <div class="pull-right panel-title">
 
                <a href="${h.url('my_account_watched')}"><i class="icon-eye"></i>${_('Watched Repositories')}</a>
 
                <a href="${h.url('my_account_repos')}"><i class="icon-database"></i>${_('My Repositories')}</a>
 
                <a id="refresh" href="${h.url('journal')}"><i class="icon-arrows-cw"></i></a>
 
                <a href="${h.url('journal_atom', api_key=request.authuser.api_key)}"><i class="icon-rss-squared"></i></a>
 
            </div>
 
        </div>
 
        <div id="journal" class="panel-body">
 
            <%include file='journal_data.html'/>
 
        </div>
 
    </div>
 

	
 
<script>
 
<script>'use strict';
 

	
 
    $('#j_filter').click(function(){
 
        var $jfilter = $('#j_filter');
 
        if($jfilter.hasClass('initial')){
 
            $jfilter.val('');
 
        }
 
    });
 
    var fix_j_filter_width = function(len){
 
        $('#j_filter').css('width', Math.max(80, len*6.50)+'px');
 
    };
 
    $('#j_filter').keyup(function(){
 
        fix_j_filter_width($('#j_filter').val().length);
 
    });
 
    $('#filter_form').submit(function(e){
 
        e.preventDefault();
 
        var val = $('#j_filter').val();
 
        window.location = ${h.js(url.current(filter='__FILTER__'))}.replace('__FILTER__',val);
 
    });
 
    fix_j_filter_width($('#j_filter').val().length);
 

	
 
    $('#refresh').click(function(e){
 
        asynchtml(${h.js(h.url.current(filter=c.search_term))}, $("#journal"), function(){
 
            show_more_event();
 
            tooltip_activate();
 
            });
 
        e.preventDefault();
 
    });
 

	
 
</script>
 

	
 
<script>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        var $journal = $('#journal');
 
        $journal.on('click','.pager_link',function(e){
 
            asynchtml(e.target.href, $journal, function(){
 
                show_more_event();
 
                tooltip_activate();
 
            });
 
            e.preventDefault();
 
        });
 
        $('#journal').on('click','.show_more',function(e){
 
            var el = e.target;
 
            $('#'+el.id.substring(1)).show();
 
            $(el.parentNode).hide();
 
        });
 
    });
 
</script>
 
</%def>
kallithea/templates/login.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="base/root.html"/>
 

	
 
<%block name="title">
 
    ${_('Log In')}
 
</%block>
 

	
 
<%include file="/base/flash_msg.html"/>
 
<div class="container">
 
<div class="row">
 
<div class="centered-column">
 
<div id="login" class="panel panel-primary">
 
    <div class="panel-heading">
 
      <h5>
 
        <i class="icon-lock"></i>
 
        %if c.site_name:
 
            ${_('Log In to %s') % c.site_name}
 
        %else:
 
            ${_('Log In')}
 
        %endif
 
      </h5>
 
    </div>
 
    <div class="panel-body">
 
        ${h.form(url('login_home', came_from=c.came_from))}
 
        <div class="form">
 

	
 
                <div class="form-group">
 
                    <label class="control-label" for="username">${_('Username')}:</label>
 
                    <div>
 
                        ${h.text('username',class_='form-control')}
 
                    </div>
 
                </div>
 
                <div class="form-group">
 
                    <label class="control-label" for="password">${_('Password')}:</label>
 
                    <div>
 
                        ${h.password('password',class_='form-control')}
 
                    </div>
 
                </div>
 
                <div class="form-group">
 
                    <div>
 
                        <div class="checkbox">
 
                            <label>
 
                                <input type="checkbox" id="remember" name="remember"/>
 
                                ${_('Stay logged in after browser restart')}
 
                            </label>
 
                        </div>
 
                    </div>
 
                </div>
 

	
 
            <div class="form-group">
 
                <div>
 
                    ${h.link_to(_('Forgot your password ?'),h.url('reset_password'))}
 
                    %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
 
                        /
 
                        ${h.link_to(_("Don't have an account ?"),h.url('register'))}
 
                    %endif
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('sign_in',_('Sign In'),class_="btn btn-default")}
 
                </div>
 
            </div>
 
        </div>
 
        ${h.end_form()}
 
        <script>
 
        <script>'use strict';
 
        $(document).ready(function(){
 
            $('#username').focus();
 
        });
 
        </script>
 
    </div>
 
</div>
 
</div>
 
</div>
 
</div>
kallithea/templates/password_reset.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="base/root.html"/>
 

	
 
<%block name="title">
 
    ${_('Password Reset')}
 
</%block>
 

	
 
<%block name="js_extra">
 
    %if c.captcha_active:
 
        <script src="https://www.google.com/recaptcha/api.js"></script>
 
    %endif
 
</%block>
 

	
 
<%include file="/base/flash_msg.html"/>
 
<div class="container">
 
<div class="row">
 
<div class="centered-column">
 
<div id="register" class="panel panel-primary">
 
    <div class="panel-heading">
 
        %if c.site_name:
 
            <h5>${_('Reset Your Password to %s') % c.site_name}</h5>
 
        %else:
 
            <h5>${_('Reset Your Password')}</h5>
 
        %endif
 
    </div>
 
    <div class="panel-body">
 
        ${h.form(url('password_reset'))}
 
        <div class="form">
 
                <div class="form-group">
 
                    <label class="control-label" for="email">${_('Email Address')}:</label>
 
                    <div>
 
                        ${h.text('email', class_='form-control')}
 
                    </div>
 
                </div>
 

	
 
                %if c.captcha_active:
 
                <div class="form-group">
 
                    <label class="control-label" for="recaptcha_field">${_('Captcha')}:</label>
 
                    <div>
 
                        <div id="recaptcha_field" class="g-recaptcha" data-sitekey="${c.captcha_public_key}"></div>
 
                    </div>
 
                </div>
 
                %endif
 

	
 
                <div class="form-group">
 
                    <div class="buttons">
 
                        ${h.submit('send',_('Send Password Reset Email'),class_="btn btn-default")}
 
                    </div>
 
                </div>
 

	
 
                <div class="alert alert-info">
 
                    ${_('A password reset link will be sent to the specified email address if it is registered in the system.')}
 
                </div>
 
        </div>
 
        ${h.end_form()}
 
        <script>
 
        <script>'use strict';
 
         $(document).ready(function(){
 
            $('#email').focus();
 
         });
 
        </script>
 
    </div>
 
</div>
 
</div>
 
</div>
 
</div>
kallithea/templates/pullrequests/pullrequest.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${c.repo_name} ${_('New Pull Request')}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('New Pull Request')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('showpullrequest')}
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 

	
 
    ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')}
 
    <div class="form panel-body">
 
        <div class="settings clearfix">
 
            <div class="form-group">
 
                <label class="control-label" for="pullrequest_title">${_('Title')}:</label>
 
                <div>
 
                    ${h.text('pullrequest_title',class_='form-control',placeholder=_('Summarize the changes - or leave empty'))}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="pullrequest_desc">${_('Description')}:</label>
 
                <div>
 
                    ${h.textarea('pullrequest_desc',class_='form-control',placeholder=_('Write a short description on this pull request'))}
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label">${_('Changeset flow')}:</label>
 
                <div class="clearfix">
 
                    ##ORG
 
                    <div>
 
                        <div>
 
                            <div>
 
                            <b>${_('Origin repository')}:</b> <span id="org_repo_desc">${c.db_repo.description.split('\n')[0]}</span>
 
                            </div>
 
                            <div>
 
                            ${h.select('org_repo','',c.cs_repos,class_='refs')}:${h.select('org_ref',c.default_cs_ref,c.cs_refs,class_='refs')}
 
                            </div>
 
                            <div>
 
                            <b>${_('Revision')}:</b> <span id="org_rev_span">-</span>
 
                            </div>
 
                        </div>
 
                    </div>
 

	
 
                    ##OTHER, most Probably the PARENT OF THIS FORK
 
                    <div>
 
                        <div>
 
                            ## filled with JS
 
                            <div>
 
                            <b>${_('Destination repository')}:</b> <span id="other_repo_desc">${c.a_repo.description.split('\n')[0]}</span>
 
                            </div>
 
                            <div>
 
                            ${h.select('other_repo',c.a_repo.repo_name,c.a_repos,class_='refs')}:${h.select('other_ref',c.default_a_ref,c.a_refs,class_='refs')}
 
                            </div>
 
                            <div>
 
                            <b>${_('Revision')}:</b> <span id="other_rev_span">-</span>
 
                            </div>
 
                        </div>
 
                    </div>
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <div class="buttons">
 
                    ${h.submit('save',_('Create Pull Request'),class_="btn btn-default")}
 
                    ${h.reset('reset',_('Reset'),class_="btn btn-default")}
 
                </div>
 
            </div>
 
        </div>
 

	
 
        <div>
 
           <h4>${_('Changesets')}</h4>
 
           ## overview pulled by ajax
 
           <div id="pull_request_overview"></div>
 
        </div>
 
    </div>
 

	
 
    ${h.end_form()}
 

	
 
</div>
 

	
 
<script src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
 
<script>
 
<script>'use strict';
 
  pyroutes.register('pullrequest_repo_info', ${h.js(url('pullrequest_repo_info',repo_name='%(repo_name)s'))}, ['repo_name']);
 

	
 
  var pendingajax = undefined;
 
  var otherrepoChanged = function(){
 
      var $other_ref = $('#other_ref');
 
      $other_ref.prop('disabled', true);
 
      var repo_name = $('#other_repo').val();
 
      if (pendingajax) {
 
          pendingajax.abort();
 
          pendingajax = undefined;
 
      }
 
      pendingajax = ajaxGET(pyroutes.url('pullrequest_repo_info', {"repo_name": repo_name}),
 
          function(data){
 
              pendingajax = undefined;
 
              $('#other_repo_desc').html(data.description);
 

	
 
              // replace options of other_ref with the ones for the current other_repo
 
              $other_ref.empty();
 
              for(var i = 0; i < data.refs.length; i++)
 
              {
 
                var $optgroup = $('<optgroup/>').prop('label', data.refs[i][1]);
 
                var options = data.refs[i][0];
 
                var length = options.length;
 
                for(var j = 0; j < length; j++)
 
                {
 
                  $optgroup.append($('<'+'option/>').text(options[j][1]).val(options[j][0]));
 
                }
 
                $other_ref.append($optgroup);
 
              }
 
              $other_ref.val(data.selected_ref);
 

	
 
              // re-populate the select2 thingy
 
              $("#other_ref").select2({
 
                  dropdownAutoWidth: true
 
              });
 

	
 
              $other_ref.prop('disabled', false);
 
              loadPreview();
 
          });
 
  };
 

	
 
  var loadPreview = function(){
 
      //url template
 
      var url = ${h.js(h.url('compare_url',
 
                         repo_name='__other_repo__',
 
                         org_ref_type='rev',
 
                         org_ref_name='__other_ref_name__',
 
                         other_repo='__org_repo__',
 
                         other_ref_type='rev',
 
                         other_ref_name='__org_ref_name__',
 
                         is_ajax_preview=True,
 
                         merge=True,
 
                         ))};
 
      var org_repo = $('#pull_request_form #org_repo').val();
 
      var org_ref = $('#pull_request_form #org_ref').val().split(':');
 
      ## TODO: make nice link like link_to_ref() do
 
      $('#org_rev_span').html(org_ref[2].substr(0,12));
 

	
 
      var other_repo = $('#pull_request_form #other_repo').val();
 
      var other_ref = $('#pull_request_form #other_ref').val().split(':');
 
      $('#other_rev_span').html(other_ref[2].substr(0,12));
 

	
 
      var rev_data = {
 
          '__org_repo__': org_repo,
 
          '__org_ref_name__': org_ref[2],
 
          '__other_repo__': other_repo,
 
          '__other_ref_name__': other_ref[2]
 
      }; // gather the org/other ref and repo here
 

	
 
      for (k in rev_data){
 
      for (let k in rev_data){
 
          url = url.replace(k,rev_data[k]);
 
      }
 

	
 
      if (pendingajax) {
 
          pendingajax.abort();
 
          pendingajax = undefined;
 
      }
 
      pendingajax = asynchtml(url, $('#pull_request_overview'), function(o){
 
          pendingajax = undefined;
 
      });
 
  }
 

	
 
  $(document).ready(function(){
 
      $("#org_repo").select2({
 
          dropdownAutoWidth: true
 
      });
 
      ## (org_repo can't change)
 

	
 
      $("#org_ref").select2({
 
          dropdownAutoWidth: true,
 
          maxResults: 50,
 
          sortResults: branchSort
 
      });
 
      $("#org_ref").on("change", function(e){
 
          loadPreview();
 
      });
 

	
 
      $("#other_repo").select2({
 
          dropdownAutoWidth: true
 
      });
 
      $("#other_repo").on("change", function(e){
 
          otherrepoChanged();
 
      });
 

	
 
      $("#other_ref").select2({
 
          dropdownAutoWidth: true,
 
          maxResults: 50,
 
          sortResults: branchSort
 
      });
 
      $("#other_ref").on("change", function(e){
 
          loadPreview();
 
      });
 

	
 
      //lazy load overview after 0.5s
 
      setTimeout(loadPreview, 500);
 
  });
 

	
 
</script>
 

	
 
</%def>
kallithea/templates/pullrequests/pullrequest_show.html
Show inline comments
 
@@ -123,272 +123,272 @@ ${self.repo_context_bar('showpullrequest
 
        <div class="form-group">
 
          <label>${_('Owner')}:</label>
 
          <div class="pr-not-edit">
 
                  ${h.gravatar_div(c.pull_request.owner.email, size=20)}
 
                  <span>${c.pull_request.owner.full_name_and_username}</span><br/>
 
                  <span><a href="mailto:${c.pull_request.owner.email}">${c.pull_request.owner.email}</a></span><br/>
 
          </div>
 
          <div class="pr-do-edit" style="display:none">
 
               ${h.text('owner', class_='form-control', value=c.pull_request.owner.username, placeholder=_('Type name of user'))}
 
          </div>
 
        </div>
 

	
 
        <div class="form-group">
 
          <label>${_('Next iteration')}:</label>
 
            <div>
 
              <p>${c.update_msg}</p>
 
              %if c.avail_cs:
 
              <div id="updaterevs" class="clearfix">
 
                <div id="updaterevs-graph">
 
                  <canvas id="avail_graph_canvas"></canvas>
 
                </div>
 
                <table class="table" id="updaterevs-table">
 
                  %for cnt, cs in enumerate(c.avail_cs):
 
                    <tr id="chg_available_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 and not (editable and cs.revision in c.avail_revs) else ''}">
 
                      %if c.cs_ranges and cs.revision == c.cs_ranges[-1].revision:
 
                        %if editable:
 
                        <td>
 
                            ${h.radio(name='updaterev', value='', checked=True)}
 
                        </td>
 
                        %endif
 
                        <td colspan="4"><span>${_("Current revision - no change")}</span></td>
 
                      %else:
 
                        %if editable:
 
                        <td>
 
                          ${h.radio(name='updaterev', value=cs.raw_id, style=None if cs.revision in c.avail_revs else 'visibility: hidden')}
 
                        </td>
 
                        %endif
 
                        <td><span data-toggle="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
 
                        <td>${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id), class_='changeset_hash')}</td>
 
                        <td>
 
                          <div class="pull-right">
 
                            %for tag in cs.tags:
 
                              <span class="label label-tag" title="${_('Tag %s') % tag}">
 
                                ${h.link_to(tag,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
                              </span>
 
                            %endfor
 
                          </div>
 
                          <div class="message">${h.urlify_text(cs.message.splitlines()[0], c.repo_name)}</div>
 
                        </td>
 
                      %endif
 
                    </tr>
 
                  %endfor
 
                </table>
 
              </div>
 
              <div class="alert alert-info">${_("Pull request iterations do not change content once created. Select a revision to create a new iteration.")}</div>
 
              %endif
 
              %if c.update_msg_other:
 
                <div class="alert alert-info">${c.update_msg_other}</div>
 
              %endif
 
            </div>
 
        </div>
 
        %if editable:
 
        <div class="form-group">
 
          <div class="buttons">
 
            ${h.submit('pr-form-save',_('Save Changes'),class_="btn btn-default btn-sm")}
 
            ${h.submit('pr-form-clone',_('Create New Iteration with Changes'),class_="btn btn-default btn-sm",disabled='disabled')}
 
            ${h.reset('pr-form-reset',_('Cancel Changes'),class_="btn btn-default btn-sm")}
 
          </div>
 
        </div>
 
        %endif
 
      </div>
 
    </div>
 
    ## REVIEWERS
 
    <div class="pr-reviewers-box pull-left">
 
        <h4 class="pr-details-title">${_('Reviewers')}</h4>
 
        <div id="reviewers">
 
          ## members goes here !
 
          <div>
 
            %for member,status in c.pull_request_reviewers:
 
              <input type="hidden" value="${member.user_id}" name="org_review_members" />
 
            %endfor
 
            <ul id="review_members" class="list-unstyled">
 
            %for member,status in c.pull_request_reviewers:
 
              ## WARNING: the HTML below is duplicate with
 
              ## kallithea/public/js/base.js
 
              ## If you change something here it should be reflected in the template too.
 
              <li id="reviewer_${member.user_id}">
 
                <span class="reviewers_member">
 
                  <input type="hidden" value="${member.user_id}" name="review_members" />
 
                  <span class="reviewer_status" data-toggle="tooltip" title="${h.changeset_status_lbl(status)}">
 
                      <i class="icon-circle changeset-status-${status}"></i>
 
                  </span>
 
                  ${h.gravatar(member.email, size=14)}
 
                  <span>
 
                    ${member.full_name_and_username}
 
                    %if c.pull_request.owner_id == member.user_id:
 
                      (${_('Owner')})
 
                    %endif
 
                  </span>
 
                  %if editable:
 
                  <a href="#" class="reviewer_member_remove" onclick="removeReviewMember(${member.user_id})" title="${_('Remove reviewer')}">
 
                      <i class="icon-minus-circled"></i>
 
                  </a>
 
                  %endif
 
                </span>
 
              </li>
 
            %endfor
 
            </ul>
 
          </div>
 
          %if editable:
 
          <div>
 
             ${h.text('user', class_='form-control',placeholder=_('Type name of reviewer to add'))}
 
          </div>
 
          %endif
 
        </div>
 

	
 
        %if not c.pull_request_reviewers:
 
        <h4>${_('Potential Reviewers')}</h4>
 
        <div>
 
          <div>
 
            ${_('Click to add the repository owner as reviewer:')}
 
          </div>
 
          <ul class="list-unstyled">
 
            %for u in [c.pull_request.other_repo.owner]:
 
              <li>
 
                <a class="btn btn-default btn-xs missing_reviewer missing_reviewer_${u.user_id}"
 
                  href="#"
 
                  data-user_id="${u.user_id}"
 
                  data-fname="${u.name}"
 
                  data-lname="${u.lastname}"
 
                  data-nname="${u.username}"
 
                  data-gravatar_lnk="${h.gravatar_url(u.email, size=28, default='default')}"
 
                  data-gravatar_size="14"
 
                  title="Click to add reviewer to the list, then Save Changes."><i class="icon-plus"></i>${u.full_name}</a>
 
              </li>
 
            %endfor
 
          </ul>
 
        </div>
 
        %endif
 
    </div>
 
  ${h.end_form()}
 
</div>
 

	
 
<div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
      <div class="panel-title">${_('Pull Request Content')}</div>
 
    </div>
 
    <div class="panel-body">
 
        <div>
 
            <div id="changeset_compare_view_content">
 
              <h5>
 
                  ${comment.comment_count(c.inline_cnt, len(c.comments))}
 
              </h5>
 
              ##CS
 
              <h5>
 
                ${ungettext('Showing %s commit','Showing %s commits', len(c.cs_ranges)) % len(c.cs_ranges)}
 
              </h5>
 
              <%include file="/compare/compare_cs.html" />
 

	
 
              <h5>
 
              ${_('Common ancestor')}:
 
              ${h.link_to(h.short_id(c.a_rev),h.url('changeset_home',repo_name=c.a_repo.repo_name,revision=c.a_rev), class_="changeset_hash")}
 
              </h5>
 

	
 
              ## FILES
 
              <h5>
 
              % if c.limited_diff:
 
                  ${ungettext('%s file changed', '%s files changed', len(c.file_diff_data)) % len(c.file_diff_data)}:
 
              % else:
 
                  ${ungettext('%s file changed with %s insertions and %s deletions','%s files changed with %s insertions and %s deletions', len(c.file_diff_data)) % (len(c.file_diff_data),c.lines_added,c.lines_deleted)}:
 
              %endif
 
              </h5>
 
              <div class="cs_files">
 
                %if not c.file_diff_data:
 
                   <span class="text-muted">${_('No files')}</span>
 
                %endif
 
                %for fid, url_fid, op, a_path, path, diff, stats in c.file_diff_data:
 
                    <div class="cs_${op} clearfix">
 
                      <span class="node">
 
                          <i class="icon-diff-${op}"></i>
 
                          ${h.link_to(path, '#%s' % fid)}
 
                      </span>
 
                      <div class="changes">${h.fancy_file_stats(stats)}</div>
 
                    </div>
 
                %endfor
 
                %if c.limited_diff:
 
                  <h5>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff anyway')}</a></h5>
 
                %endif
 
              </div>
 
            </div>
 
        </div>
 
    </div>
 
    <script>
 
    <script>'use strict';
 
    // TODO: switch this to pyroutes
 
    AJAX_COMMENT_URL = ${h.js(url('pullrequest_comment',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id))};
 
    AJAX_COMMENT_DELETE_URL = ${h.js(url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__'))};
 

	
 
    pyroutes.register('pullrequest_comment', ${h.js(url('pullrequest_comment',repo_name='%(repo_name)s',pull_request_id='%(pull_request_id)s'))}, ['repo_name', 'pull_request_id']);
 
    pyroutes.register('pullrequest_comment_delete', ${h.js(url('pullrequest_comment_delete',repo_name='%(repo_name)s',comment_id='%(comment_id)s'))}, ['repo_name', 'comment_id']);
 

	
 
    </script>
 

	
 
    ## diff block
 
    <div class="panel-body">
 
    <div class="commentable-diff">
 
    <%namespace name="diff_block" file="/changeset/diff_block.html"/>
 
    ${diff_block.diff_block_js()}
 
    ${diff_block.diff_block(c.a_repo.repo_name, c.a_ref_type, c.a_ref_name, c.a_rev,
 
                            c.cs_repo.repo_name, c.cs_ref_type, c.cs_ref_name, c.cs_rev, c.file_diff_data)}
 
    % if c.limited_diff:
 
      <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff anyway')}</a></h4>
 
    % endif
 
    </div>
 

	
 
    ## template for inline comment form
 
    ${comment.comment_inline_form()}
 

	
 
    ## render comments and inlines
 
    ${comment.generate_comments()}
 

	
 
    ## main comment form and it status
 
    ${comment.comments(change_status=c.allowed_to_change_status)}
 

	
 
    <script>
 
    <script>'use strict';
 
      $(document).ready(function(){
 
          PullRequestAutoComplete($('#user'));
 
          SimpleUserAutoComplete($('#owner'));
 

	
 
          $('.code-difftable').on('click', '.add-bubble', function(e){
 
              show_comment_form($(this));
 
          });
 

	
 
          var avail_jsdata = ${h.js(c.avail_jsdata)};
 
          var avail_r = new BranchRenderer('avail_graph_canvas', 'updaterevs-table', 'chg_available_');
 
          avail_r.render(avail_jsdata);
 

	
 
          $(window).resize(function(){
 
              avail_r.render(avail_jsdata);
 
          });
 

	
 
          move_comments($(".comments .comments-list-chunk"));
 

	
 
          $('#updaterevs input').change(function(e){
 
              var update = !!e.target.value;
 
              $('#pr-form-save').prop('disabled',update);
 
              $('#pr-form-clone').prop('disabled',!update);
 
          });
 
          var $org_review_members = $('#review_members').clone();
 
          $('#pr-form-reset').click(function(e){
 
              $('.pr-do-edit').hide();
 
              $('.pr-not-edit').show();
 
              $('#pr-form-save').prop('disabled',false);
 
              $('#pr-form-clone').prop('disabled',true);
 
              $('#review_members').html($org_review_members);
 
          });
 

	
 
          // hack: re-navigate to target after JS is done ... if a target is set and setting href thus won't reload
 
          if (window.location.hash != "") {
 
              window.location.href = window.location.href;
 
          }
 

	
 
          $('.missing_reviewer').click(function(){
 
            var $this = $(this);
 
            addReviewMember($this.data('user_id'), $this.data('fname'), $this.data('lname'), $this.data('nname'), $this.data('gravatar_lnk'), $this.data('gravatar_size'));
 
          });
 
      });
 
    </script>
 
    </div>
 

	
 
</div>
 

	
 
</%def>
kallithea/templates/register.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="base/root.html"/>
 

	
 
<%block name="title">
 
    ${_('Sign Up')}
 
</%block>
 

	
 
<%block name="js_extra">
 
    %if c.captcha_active:
 
        <script src="https://www.google.com/recaptcha/api.js"></script>
 
    %endif
 
</%block>
 

	
 
<%include file="/base/flash_msg.html"/>
 

	
 
<div class="container">
 
<div class="row">
 
<div class="centered-column">
 
<div id="register" class="panel panel-primary">
 
    <div class="panel-heading">
 
        %if c.site_name:
 
            <h5>${_('Sign Up to %s') % c.site_name}</h5>
 
        %else:
 
            <h5>${_('Sign Up')}</h5>
 
        %endif
 
    </div>
 
    <div class="panel-body">
 
        ${h.form(url('register'))}
 
        <div class="form">
 
                <div class="form-group">
 
                    <label class="control-label" for="username">${_('Username')}:</label>
 
                    <div>
 
                        ${h.text('username',class_='form-control')}
 
                    </div>
 
                </div>
 

	
 
                <div class="form-group">
 
                    <label class="control-label" for="password">${_('Password')}:</label>
 
                    <div>
 
                        ${h.password('password',class_='form-control')}
 
                    </div>
 
                </div>
 

	
 
                <div class="form-group">
 
                    <label class="control-label" for="password_confirmation">${_('Re-enter password')}:</label>
 
                    <div>
 
                        ${h.password('password_confirmation',class_='form-control')}
 
                    </div>
 
                </div>
 

	
 
                <div class="form-group">
 
                    <label class="control-label" for="firstname">${_('First Name')}:</label>
 
                    <div>
 
                        ${h.text('firstname',class_='form-control')}
 
                    </div>
 
                </div>
 

	
 
                <div class="form-group">
 
                    <label class="control-label" for="lastname">${_('Last Name')}:</label>
 
                    <div>
 
                        ${h.text('lastname',class_='form-control')}
 
                    </div>
 
                </div>
 

	
 
                <div class="form-group">
 
                    <label class="control-label" for="email">${_('Email')}:</label>
 
                    <div>
 
                        ${h.text('email',class_='form-control')}
 
                    </div>
 
                </div>
 

	
 
                %if c.captcha_active:
 
                <div class="form-group">
 
                    <label class="control-label" for="recaptcha_field">${_('Captcha')}:</label>
 
                    <div>
 
                        <div id="recaptcha_field" class="g-recaptcha" data-sitekey="${c.captcha_public_key}"></div>
 
                    </div>
 
                </div>
 
                %endif
 

	
 
                <div class="form-group">
 
                    <div class="buttons">
 
                        ${h.submit('sign_up',_('Sign Up'),class_="btn btn-default")}
 
                        %if c.auto_active:
 
                            <div class="alert alert-info">${_('Registered accounts are ready to use and need no further action.')}</div>
 
                        %else:
 
                            <div class="alert alert-info">${_('Please wait for an administrator to activate your account.')}</div>
 
                        %endif
 
                    </div>
 
                </div>
 
        </div>
 
        ${h.end_form()}
 
        <script>
 
        <script>'use strict';
 
        $(document).ready(function(){
 
            $('#username').focus();
 
        });
 
        </script>
 
    </div>
 
 </div>
 
 </div>
 
 </div>
 
 </div>
kallithea/templates/summary/statistics.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%block name="title">
 
    ${_('%s Statistics') % c.repo_name}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Statistics')}
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%block name="head_extra">
 
  <link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=request.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
 
  <link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=request.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
 
  <script src="${h.url('/js/jquery.flot.js', ver=c.kallithea_version)}"></script>
 
  <script src="${h.url('/js/jquery.flot.selection.js', ver=c.kallithea_version)}"></script>
 
  <script src="${h.url('/js/jquery.flot.time.js', ver=c.kallithea_version)}"></script>
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('summary')}
 
    <div class="panel panel-primary">
 
    <div class="panel-heading clearfix">
 
        ${self.breadcrumbs()}
 
    </div>
 

	
 
    <div class="graph panel-body">
 
        <div>
 
        %if not c.stats_percentage:
 
           ${c.no_data_msg}
 
           %if h.HasPermissionAny('hg.admin')('enable stats on from summary'):
 
                ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name),class_="btn btn-default btn-xs")}
 
           %endif
 
        %else:
 
            ${_('Stats gathered: ')} ${c.stats_percentage}%
 
        %endif
 
        </div>
 
        <div id="commit_history" class="pull-left"></div>
 

	
 
        <div id="legend_data" class="pull-left">
 
            <div id="legend_container"></div>
 
            <div id="legend_choices">
 
                <table class="table" id="legend_choices_tables"></table>
 
            </div>
 
        </div>
 

	
 
        <div id="overview"></div>
 
    </div>
 
</div>
 

	
 
<script>
 
<script>'use strict';
 
var data = ${h.js(c.trending_languages)};
 
var total = 0;
 
var tbl = document.createElement('table');
 
tbl.setAttribute('class','trending_language_tbl');
 
var cnt = 0;
 
for (var i=0;i<data.length;i++){
 
    total+= data[i][1].count;
 
}
 
for (var i=0;i<data.length;i++){
 
    cnt += 1;
 

	
 
    var hide = cnt>2;
 
    var tr = document.createElement('tr');
 
    if (hide){
 
        tr.setAttribute('style','display:none');
 
        tr.setAttribute('class','stats_hidden');
 
    }
 
    var k = data[i][0];
 
    var obj = data[i][1];
 
    var percentage = Math.round((obj.count/total*100),2);
 

	
 
    var td1 = document.createElement('td');
 
    td1.width = 150;
 
    var trending_language_label = document.createElement('div');
 
    trending_language_label.innerHTML = obj.desc+" ("+k+")";
 
    td1.appendChild(trending_language_label);
 

	
 
    var td2 = document.createElement('td');
 
    td2.setAttribute('style','padding-right:14px !important');
 
    var trending_language = document.createElement('div');
 
    var nr_files = obj.count + ' ' + ${h.jshtml(_('files'))};
 

	
 
    trending_language.title = k+" "+nr_files;
 

	
 
    if (percentage>22){
 
        trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";
 
    }
 
    else{
 
        trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
 
    }
 

	
 
    trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
 
    trending_language.style.width=percentage+"%";
 
    td2.appendChild(trending_language);
 

	
 
    tr.appendChild(td1);
 
    tr.appendChild(td2);
 
    tbl.appendChild(tr);
 
    if(cnt == 3){
 
        var show_more = document.createElement('tr');
 
        var td = document.createElement('td');
 
        lnk = document.createElement('a');
 
        let lnk = document.createElement('a');
 

	
 
        lnk.href='#';
 
        lnk.innerHTML = ${h.jshtml(_('Show more'))};
 
        lnk.id='code_stats_show_more';
 
        td.appendChild(lnk);
 

	
 
        show_more.appendChild(td);
 
        show_more.appendChild(document.createElement('td'));
 
        tbl.appendChild(show_more);
 
    }
 

	
 
}
 

	
 
</script>
 
<script>
 
<script>'use strict';
 

	
 
/**
 
 * Plots summary graph
 
 *
 
 * @class SummaryPlot
 
 * @param {from} initial from for detailed graph
 
 * @param {to} initial to for detailed graph
 
 * @param {dataset}
 
 * @param {overview_dataset}
 
 */
 
function SummaryPlot(from,to,dataset,overview_dataset) {
 
    var initial_ranges = {
 
        "xaxis":{
 
            "from":from,
 
            "to":to
 
        }
 
    };
 
    for(var key in dataset){
 
      var data = dataset[key].data;
 
      for(var d in data){
 
        data[d].time *= 1000;
 
      }
 
    }
 
    for(var key in overview_dataset){
 
      overview_dataset[key][0] *= 1000;
 
    }
 
    var choiceContainer = $("#legend_choices")[0];
 
    var choiceContainerTable = $("#legend_choices_tables")[0];
 
    var $plotContainer = $('#commit_history');
 
    var plotContainer = $('#commit_history')[0];
 
    var $overviewContainer = $('#overview');
 
    var overviewContainer = $('#overview')[0];
 

	
 
    var plot_options = {
 
        bars: {show:true, align: 'center', lineWidth: 4},
 
        legend: {show:true,
 
                container: "#legend_container",
 
                labelFormatter: function(label, series) {
 
                        // series is the series object for the label
 
                        return '<a href="javascript:void(0)"> ' + label + '</a>';
 
                    }
 
        },
 
        points: {show:true, radius: 0, fill: false},
 
        yaxis: {tickDecimals: 0},
 
        xaxis: {
 
            mode: "time",
 
            timeformat: "%d/%m",
 
            min: from,
 
            max: to
 
        },
 
        grid: {
 
            hoverable: true,
 
            clickable: true,
 
            autoHighlight: true,
 
            color: "#999"
 
        },
 
        //selection: {mode: "x"}
 
    };
 
    var overview_options = {
 
        legend:{show:false},
 
        bars: {show:true, barWidth: 2},
 
        shadowSize: 0,
 
        xaxis: {mode: "time", timeformat: "%d/%m/%y"},
 
        yaxis: {ticks: 3, min: 0, tickDecimals:0},
 
        grid: {color: "#999"},
 
        selection: {mode: "x"}
 
    };
 

	
 
    /**
 
    *get dummy data needed in few places
 
    */
 
    function getDummyData(label){
 
        return {"label":label,
 
         "data":[{"time":0,
 
             "commits":0,
 
                 "added":0,
 
                 "changed":0,
 
                 "removed":0
 
            }],
 
            "schema":["commits"],
 
            "color":'#ffffff'
 
        }
 
    }
 

	
 
    /**
 
     * generate checkboxes accordingly to data
 
     * @param keys
 
     * @returns
 
     */
 
    function generateCheckboxes(data) {
 
        //append checkboxes
 
        var i = 0;
 
        choiceContainerTable.innerHTML = '';
 
        for(var pos in data) {
 

	
 
            data[pos].color = i;
 
            i++;
 
            if(data[pos].label != ''){
 
                choiceContainerTable.innerHTML +=
 
                    '<tr style="display:none"><td><label><input type="checkbox" id="id_user_{0}" name="{0}" checked="checked" /> \
 
                     {0}</label></td></tr>'.format(data[pos].label);
 
            }
 
        }
 
    }
 

	
 
    /**
 
     * ToolTip show
 
     */
 
    function showTooltip(x, y, contents) {
 
        var div=document.getElementById('tooltip');
 
        if(!div) {
 
            div = document.createElement('div');
 
            div.id="tooltip";
 
            div.style.position="absolute";
 
            div.style.border='1px solid #fdd';
 
            div.style.padding='2px';
 
            div.style.backgroundColor='#fee';
 
            document.body.appendChild(div);
 
        }
 
        $(div).css('opacity', 0)
 
        div.innerHTML = contents;
 
        div.style.top=(y + 5) + "px";
 
        div.style.left=(x + 5) + "px";
 

	
 
        $(div).animate({opacity: 0.8}, 200);
 
    }
 

	
 
    /**
 
     * This function will detect if selected period has some changesets
 
       for this user if it does this data is then pushed for displaying
 
       Additionally it will only display users that are selected by the checkbox
 
    */
 
    function getDataAccordingToRanges(ranges) {
 

	
 
        var data = [];
 
        var new_dataset = {};
 
        var keys = [];
 
        var max_commits = 0;
 
        for(var key in dataset){
 

	
 
            for(var ds in dataset[key].data){
 
                commit_data = dataset[key].data[ds];
 
                let commit_data = dataset[key].data[ds];
 
                if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
 
                    if(new_dataset[key] === undefined){
 
                        new_dataset[key] = {data:[],label:key};
 
                    }
 
                    new_dataset[key].data.push([
 
                      commit_data.time,
 
                      commit_data.commits]);
 
                }
 
            }
 
            if (new_dataset[key] !== undefined){
 
                data.push(new_dataset[key]);
 
            }
 
        }
 

	
 
        if (data.length > 0){
 
            return data;
 
        }
 
        else{
 
            //just return dummy data for graph to plot itself
 
            return [getDummyData('')];
 
        }
 
    }
 

	
 
    /**
 
    * redraw using new checkbox data
 
    */
 
    function plotchoiced(e){
 
        args = e.data;
 
        let args = e.data;
 
        var cur_data = args[0];
 
        var cur_ranges = args[1];
 

	
 
        var new_data = [];
 
        var inputs = choiceContainer.getElementsByTagName("input");
 
        inputs[$(e.target).parents('tr').index()].click();
 

	
 
        //show only checked labels
 
        for(var i=0; i<inputs.length; i++) {
 
            var checkbox_key = inputs[i].name;
 

	
 
            if(inputs[i].checked){
 
                for(var d in cur_data){
 
                    if(cur_data[d].label == checkbox_key){
 
                        new_data.push(cur_data[d]);
 
                    }
 
                }
 
            }
 
            else{
 
                //push dummy data to not hide the label
 
                new_data.push(getDummyData(checkbox_key));
 
            }
 
        }
 

	
 
        var new_options = $.extend(plot_options, {
 
            xaxis: {
 
                min: cur_ranges.xaxis.from,
 
                max: cur_ranges.xaxis.to,
 
                mode: "time",
 
                timeformat: "%d/%m"
 
            }
 
        });
 
        if (!new_data){
 
            new_data = [[0,1]];
 
        }
 
        // do the zooming
 
       plot = $.plot(plotContainer, new_data, new_options);
 

	
 
       $plotContainer.on("plotselected", plotselected);
 

	
 
       //resubscribe plothover
 
       $plotContainer.on("plothover", plothover);
 

	
 
       //resubscribe this function after plot update
 
       $('#legend_container tr a').on("click", [cur_data, cur_ranges], plotchoiced);
 

	
 
       // don't fire event on the overview to prevent eternal loop
 
       overview.setSelection(cur_ranges, true);
 

	
 
    }
 

	
 
    /**
 
     * plot only selected items from overview
 
     * @param ranges
 
     * @returns
 
     */
 
    function plotselected(e, ranges) {
 
        //updates the data for new plot
 
        var data = getDataAccordingToRanges(ranges);
 
        generateCheckboxes(data);
 

	
 
        var new_options = $.extend(plot_options, {
 
            xaxis: {
 
                min: ranges.xaxis.from,
 
                max: ranges.xaxis.to,
 
                mode:"time",
 
                timeformat: "%d/%m"
 
            }
 
        });
 
        // do the zooming
 
        plot = $.plot(plotContainer, data, new_options);
 

	
 
        $plotContainer.on("plotselected", plotselected);
 

	
 
        //resubscribe plothover
 
        $plotContainer.on("plothover", plothover);
 

	
 
        // don't fire event on the overview to prevent eternal loop
 
        overview.setSelection(ranges, true);
 

	
 
        //resubscribe choiced
 
        $('#legend_container tr a').on("click", [data, ranges], plotchoiced);
 
    }
 

	
 
    var previousPoint = null;
 

	
 
    function plothover(e, pos, item) {
 
        if (item) {
 
            if (previousPoint != item.datapoint) {
 
                previousPoint = item.datapoint;
 

	
 
                var tooltip = $("#tooltip")[0];
 
                if(tooltip) {
 
                      tooltip.parentNode.removeChild(tooltip);
 
                }
 

	
 
                var d = new Date(item.datapoint[0]);
 
                var fd = d.toDateString();
 
                var nr_commits = item.datapoint[1];
 

	
 
                if (!item.series.label){
 
                    item.series.label = 'commits';
 
                }
 

	
 
                var cur_data = dataset[item.series.label].data[item.dataIndex];
 
                var added = cur_data.added;
 
                var changed = cur_data.changed;
 
                var removed = cur_data.removed;
 

	
 
                var nr_commits_suffix = ' ' + ${h.jshtml(_('commits'))} + ' ';
 
                var added_suffix = ' ' + ${h.jshtml(_('files added'))} + ' ';
 
                var changed_suffix = ' ' + ${h.jshtml(_('files changed'))} + ' ';
 
                var removed_suffix = ' ' + ${h.jshtml(_('files removed'))} + ' ';
 

	
 
                if(nr_commits == 1){ nr_commits_suffix = ' ' + ${h.jshtml(_('commit'))} + ' '; }
 
                if(added == 1) { added_suffix=' ' + ${h.jshtml(_('file added'))} + ' '; }
 
                if(changed == 1) { changed_suffix=' ' + ${h.jshtml(_('file changed'))} + ' '; }
 
                if(removed == 1) { removed_suffix=' ' + ${h.jshtml(_('file removed'))} + ' '; }
 

	
 
                showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd
 
                         +'<br/>'+
 
                         nr_commits + nr_commits_suffix+'<br/>'+
 
                         added + added_suffix +'<br/>'+
 
                         changed + changed_suffix + '<br/>'+
 
                         removed + removed_suffix + '<br/>');
 
            }
 
        }
 
        else {
 
              var tooltip = $("#tooltip")[0];
 

	
 
              if(tooltip) {
 
                    tooltip.parentNode.removeChild(tooltip);
 
              }
 
              previousPoint = null;
 
        }
 
    }
 

	
 
    /**
 
     * MAIN EXECUTION
 
     */
 

	
 
    var data = getDataAccordingToRanges(initial_ranges);
 
    generateCheckboxes(data);
 

	
 
    //main plot
 
    var plot = $.plot(plotContainer,data,plot_options);
 

	
 
    //overview
 
    var overview = $.plot(overviewContainer, [overview_dataset], overview_options);
 

	
 
    //show initial selection on overview
 
    overview.setSelection(initial_ranges);
 

	
 
    $plotContainer.on("plotselected", plotselected);
 
    $plotContainer.on("plothover", plothover);
 

	
 
    $overviewContainer.on("plotselected", function (e, ranges) {
 
        plot.setSelection(ranges);
 
    });
 

	
 
    // user choices on overview
 
    $('#legend_container tr a').on("click", [data, initial_ranges], plotchoiced);
 
}
 

	
 
SummaryPlot(${h.js(c.ts_min)}, ${h.js(c.ts_max)}, ${h.js(c.commit_data)}, ${h.js(c.overview_data)});
 
</script>
 

	
 
</%def>
kallithea/templates/summary/summary.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 
<%namespace name="changelog_table" file="/changelog/changelog_table.html"/>
 

	
 
<%block name="title">
 
    ${_('%s Summary') % c.repo_name}
 
</%block>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Summary')}
 

	
 
    ##FORK
 
    %if c.db_repo.fork:
 
        - <i class="icon-fork"></i>${_('Fork of')} "<a href="${h.url('summary_home',repo_name=c.db_repo.fork.repo_name)}">${c.db_repo.fork.repo_name}</a>"
 
    %endif
 

	
 
    ##REMOTE
 
    %if c.db_repo.clone_uri:
 
       - <i class="icon-fork"></i>${_('Clone from')} "<a href="${h.url(str(h.hide_credentials(c.db_repo.clone_uri)))}">${h.hide_credentials(c.db_repo.clone_uri)}</a>"
 
    %endif
 
</%def>
 

	
 
<%block name="header_menu">
 
    ${self.menu('repositories')}
 
</%block>
 

	
 
<%block name="head_extra">
 
  <link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=request.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
 
  <link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=request.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
 

	
 
  <script>
 
  <script>'use strict';
 
  redirect_hash_branch = function(){
 
    var branch = window.location.hash.replace(/^#(.*)/, '$1');
 
    if (branch){
 
      window.location = ${h.js(h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__'))}
 
        .replace('__BRANCH__',branch);
 
    }
 
  }
 
  redirect_hash_branch();
 
  window.onhashchange = function() {
 
    redirect_hash_branch();
 
  };
 
  </script>
 
</%block>
 

	
 
<%def name="main()">
 
${self.repo_context_bar('summary')}
 
<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="pull-left">
 
            <div class="form-group form-inline">
 
                <label>${_('Clone URL')}:</label>
 
                <div id="clone-url">
 
                  <div id="clone_by_name" class="input-group"
 
                    %if c.ssh_repo_url:
 
                        style="display:none"
 
                    %endif
 
                    >
 
                    <span class="input-group-addon">${self.repolabel(c.db_repo)}</span>
 
                    <input class="form-control" size="80" readonly="readonly" value="${c.clone_repo_url}"/>
 
                    <span class="input-group-addon btn use-id">${_('Use ID')}</span>
 
                    %if c.ssh_repo_url:
 
                    <span class="input-group-addon btn use-ssh">${_('Use SSH')}</span>
 
                    %endif
 
                  </div>
 
                  <div id="clone_by_id" class="input-group" style="display:none">
 
                    <span class="input-group-addon">${self.repolabel(c.db_repo)}</span>
 
                    <input class="form-control" size="80" readonly="readonly" value="${c.clone_repo_url_id}"/>
 
                    <span class="input-group-addon btn use-name">${_('Use Name')}</span>
 
                    %if c.ssh_repo_url:
 
                    <span class="input-group-addon btn use-ssh">${_('Use SSH')}</span>
 
                    %endif
 
                  </div>
 
                  %if c.ssh_repo_url:
 
                  <div id="clone_ssh" class="input-group">
 
                    <span class="input-group-addon">${self.repolabel(c.db_repo)}</span>
 
                    <input id="ssh_url" class="form-control" size="80" readonly="readonly" value="${c.ssh_repo_url}"/>
 
                    <span class="input-group-addon btn use-name">${_('Use HTTP')}</span>
 
                  </div>
 
                  %endif
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
              <label>${_('Description')}:</label>
 
              <div class="formatted-fixed">${h.urlify_text(c.db_repo.description, stylize=c.visual.stylify_metalabels)}</div>
 
            </div>
 

	
 
            <div class="form-group">
 
              <label>${_('Trending files')}:</label>
 
              <div>
 
                %if c.show_stats:
 
                <div id="lang_stats"></div>
 
                %else:
 
                   ${_('Statistics are disabled for this repository')}
 
                   %if h.HasPermissionAny('hg.admin')('enable stats on from summary'):
 
                        ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_statistics'),class_="btn btn-default btn-xs")}
 
                   %endif
 
                %endif
 
              </div>
 
            </div>
 

	
 
            <div class="form-group">
 
              <label>${_('Download')}:</label>
 
              <div class="form-inline">
 
                %if len(c.db_repo_scm_instance.revisions) == 0:
 
                  ${_('There are no downloads yet')}
 
                %elif not c.enable_downloads:
 
                  ${_('Downloads are disabled for this repository')}
 
                    %if h.HasPermissionAny('hg.admin')('enable downloads on from summary'):
 
                        ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_downloads'),class_="btn btn-default btn-xs")}
 
                    %endif
 
                %else:
 
                    <span id="${'zip_link'}">
 
                        <a class="btn btn-default btn-sm" href="${h.url('files_archive_home',repo_name=c.db_repo.repo_name,fname='tip.zip')}"><i class="icon-file-zip"></i>${_('Download as zip')}</a>
 
                    </span>
 
                    ${h.hidden('download_options', class_='form-control')}
 
                    <span>
 
                      <label data-toggle="tooltip" title="${_('Check this to download archive with subrepos')}">
 
                          <input id="archive_subrepos" type="checkbox" name="subrepos" />
 
                          ${_('With subrepos')}
 
                      </label>
 
                    </span>
 
                %endif
 
              </div>
 
            </div>
 
        </div>
 
        <ul id="summary-menu-stats" class="list-group pull-right">
 
            <li class="list-group-item">
 
               <a title="${_('Owner')} ${c.db_repo.owner.email}">
 
                <i class="icon-user"></i>${c.db_repo.owner.username}
 
                ${h.gravatar_div(c.db_repo.owner.email, size=18, div_class="pull-right")}
 
              </a>
 
            </li>
 
            <li class="list-group-item">
 
               <a title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}">
 
                <i class="icon-heart"></i>${_('Followers')}
 
                <span class="badge pull-right" id="current_followers_count">${c.repository_followers}</span>
 
              </a>
 
            </li>
 
            <li class="list-group-item">
 
              <a title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}">
 
                <i class="icon-fork"></i>${_('Forks')}
 
                <span class="badge pull-right">${c.repository_forks}</span>
 
              </a>
 
            </li>
 

	
 
            %if request.authuser.username != 'default':
 
            <li class="list-group-item clearfix">
 
              <a href="#" onclick="javascript:showRepoSize('repo_size_2','${c.db_repo.repo_name}')">
 
                <i class="icon-ruler"></i>${_('Size')}
 
                <span class="badge pull-right" id="repo_size_2"></span>
 
              </a>
 
            </li>
 
            %endif
 

	
 
            <li class="list-group-item">
 
            %if request.authuser.username != 'default':
 
              <a href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=request.authuser.api_key)}"><i class="icon-rss-squared"></i>${_('Feed')}</a>
 
            %else:
 
              <a href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name)}"><i class="icon-rss-squared"></i>${_('Feed')}</a>
 
            %endif
 
            </li>
 

	
 
            %if c.show_stats:
 
            <li class="list-group-item">
 
              <a title="${_('Statistics')}" href="${h.url('repo_stats_home',repo_name=c.repo_name)}">
 
                <i class="icon-graph"></i>${_('Statistics')}
 
              </a>
 
            </li>
 
            %endif
 
        </ul>
 
    </div>
 
</div>
 

	
 

	
 
<div class="panel panel-primary">
 
    <div class="panel-heading">
 
        <div class="panel-title">
 
        %if c.cs_pagination:
 
            ${h.link_to(_('Latest Changes'),h.url('changelog_home',repo_name=c.repo_name))}
 
        %else:
 
            ${_('Quick Start')}
 
         %endif
 
        </div>
 
    </div>
 
    <div class="panel-body">
 
        <div id="shortlog_data">
 
            %if c.cs_pagination:
 
                ${changelog_table.changelog(c.repo_name, c.cs_pagination, c.cs_statuses, c.cs_comments, show_checkbox=False)}
 
                ${c.cs_pagination.pager()}
 
            %else:
 
                %if h.HasRepoPermissionLevel('write')(c.repo_name):
 
                <h4>${_('Add or upload files directly via Kallithea')}</h4>
 
                <div>
 
                  <div id="add_node_id" class="add_node">
 
                      <a class="btn btn-default btn-xs" href="${h.url('files_add_home',repo_name=c.repo_name,revision=0,f_path='', anchor='edit')}">${_('Add New File')}</a>
 
                  </div>
 
                </div>
 
                %endif
 

	
 
                <h4>${_('Push new repository')}</h4>
 
                <pre>
 
${c.db_repo_scm_instance.alias} clone ${c.clone_repo_url}
 
${c.db_repo_scm_instance.alias} add README # add first file
 
${c.db_repo_scm_instance.alias} commit -m "Initial" # commit with message
 
${c.db_repo_scm_instance.alias} push ${'origin master' if h.is_git(c.db_repo_scm_instance) else ''} # push changes back
 
                </pre>
 

	
 
                <h4>${_('Existing repository?')}</h4>
 
                <pre>
 
                %if h.is_git(c.db_repo_scm_instance):
 
git remote add origin ${c.clone_repo_url}
 
git push -u origin master
 
                %else:
 
hg push ${c.clone_repo_url}
 
                %endif
 
                </pre>
 
            %endif
 
        </div>
 
    </div>
 
</div>
 

	
 
%if c.readme_data:
 
<div id="readme" class="anchor">
 
</div>
 
<div class="panel panel-primary">
 
    <div class="panel-heading" title="${_('Readme file from revision %s:%s') % (c.db_repo.landing_rev[0], c.db_repo.landing_rev[1])}">
 
        <div class="panel-title">
 
            <a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a>
 
        </div>
 
    </div>
 
    <div class="readme panel-body">
 
        ${c.readme_data|n}
 
    </div>
 
</div>
 
%endif
 

	
 
<script>
 
<script>'use strict';
 
$(document).ready(function(){
 
    $('#clone-url input').click(function(e){
 
        if($(this).hasClass('selected')){
 
            $(this).removeClass('selected');
 
            return ;
 
        }else{
 
            $(this).addClass('selected');
 
            $(this).select();
 
        }
 
    });
 

	
 
    var $clone_url = $('#clone-url');
 
    var $clone_by_name = $('#clone_by_name');
 
    var $clone_by_id = $('#clone_by_id');
 
    var $clone_ssh = $('#clone_ssh');
 
    $clone_url.on('click', '.btn.use-name', function(e){
 
        $clone_by_name.show();
 
        $clone_by_id.hide();
 
        $clone_ssh.hide();
 
    });
 
    $clone_url.on('click', '.btn.use-id', function(e){
 
        $clone_by_id.show();
 
        $clone_by_name.hide();
 
        $clone_ssh.hide();
 
    });
 
    $clone_url.on('click', '.btn.use-ssh', function(e){
 
        $clone_by_id.hide();
 
        $clone_by_name.hide();
 
        $clone_ssh.show();
 
    });
 

	
 
    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
 
            $.each(cached.results, function(){
 
                var section = this.text;
 
                var children = [];
 
                $.each(this.children, function(){
 
                    if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){
 
                        children.push({'id': this.id, 'text': this.text});
 
                    }
 
                });
 
                data.results.push({'text': section, 'children': children});
 
            });
 
            query.callback(data);
 
          }else{
 
              $.ajax({
 
                url: pyroutes.url('repo_refs_data', {'repo_name': ${h.js(c.repo_name)}}),
 
                data: {},
 
                dataType: 'json',
 
                type: 'GET',
 
                success: function(data) {
 
                  cache[key] = data;
 
                  query.callback({results: data.results});
 
                }
 
              });
 
          }
 
        }
 
    });
 
    // on change of download options
 
    $('#download_options').change(function(e){
 
       var new_cs = e.added
 

	
 
       for(k in tmpl_links){
 
       for(let k in tmpl_links){
 
           var s = $('#'+k+'_link');
 
           if(s){
 
             var title_tmpl = ${h.jshtml(_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__'))};
 
             title_tmpl= title_tmpl.replace('__CS_NAME__',new_cs.text);
 
             title_tmpl = title_tmpl.replace('__CS_EXT__',k);
 
             title_tmpl = '<i class="icon-file-zip"></i>'+ title_tmpl.html_escape();
 
             var url = tmpl_links[k].replace('__CS__',new_cs.id);
 
             var subrepos = $('#archive_subrepos').is(':checked');
 
             url = url.replace('__SUB__',subrepos);
 
             url = url.replace('__NAME__',title_tmpl);
 

	
 
             s.html(url);
 
           }
 
       }
 
    });
 

	
 
    var tmpl_links = {};
 
    %for cnt,archive in enumerate(c.db_repo_scm_instance._get_archives()):
 
      tmpl_links[${h.jshtml(archive['type'])}] = ${h.js(h.link_to('__NAME__', h.url('files_archive_home',repo_name=c.db_repo.repo_name, fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_='btn btn-default btn-sm'))};
 
    %endfor
 
});
 
</script>
 

	
 
%if c.show_stats:
 
<script>
 
<script>'use strict';
 
$(document).ready(function(){
 
    var data = ${h.js(c.trending_languages)};
 
    var total = 0;
 
    var tbl = document.createElement('table');
 
    tbl.setAttribute('class','table');
 
    var cnt = 0;
 
    for (var i=0;i<data.length;i++){
 
        total+= data[i][1].count;
 
    }
 
    for (var i=0;i<data.length;i++){
 
        cnt += 1;
 

	
 
        var hide = cnt>2;
 
        var tr = document.createElement('tr');
 
        if (hide){
 
            tr.setAttribute('style','display:none');
 
            tr.setAttribute('class','stats_hidden');
 
        }
 
        var k = data[i][0];
 
        var obj = data[i][1];
 
        var percentage = Math.round((obj.count/total*100),2);
 

	
 
        var td1 = document.createElement('td');
 
        td1.width = 250;
 
        var trending_language_label = document.createElement('div');
 
        trending_language_label.innerHTML = obj.desc+" ("+k+")";
 
        td1.appendChild(trending_language_label);
 

	
 
        var td2 = document.createElement('td');
 
        td2.setAttribute('style','padding-right:14px !important');
 
        var trending_language = document.createElement('div');
 
        var nr_files = obj.count + ' ' + ${h.jshtml(_('files'))};
 

	
 
        trending_language.title = k+" "+nr_files;
 

	
 
        if (percentage>22){
 
            trending_language.innerHTML = "<b class='progress-bar' role='progressbar'"
 
                + "aria-valuemin='0' aria-valuemax='100' aria-valuenow='" + percentage
 
                + "' style='width: " + percentage + "%;'>" + percentage + "%, " + nr_files + "</b>";
 
        }
 
        else if (percentage>5){
 
            trending_language.innerHTML = "<b class='progress-bar' role='progressbar'"
 
                + "aria-valuemin='0' aria-valuemax='100' aria-valuenow='" + percentage
 
                + "' style='width: " + percentage + "%;'>" + percentage + "%</b>";
 
        }else{
 
            trending_language.innerHTML = "<b class='progress-bar' role='progressbar'"
 
                + "aria-valuemin='0' aria-valuemax='100' aria-valuenow='" + percentage
 
                + "' style='width: " + percentage + "%;'>&nbsp;</b>&nbsp;" + percentage + "%";
 
        }
 

	
 
        td2.appendChild(trending_language);
 

	
 
        tr.appendChild(td1);
 
        tr.appendChild(td2);
 
        tbl.appendChild(tr);
 
        if(cnt == 3){
 
            var show_more = document.createElement('tr');
 
            var td = document.createElement('td');
 
            lnk = document.createElement('a');
 
            let lnk = document.createElement('a');
 

	
 
            lnk.href='#';
 
            lnk.innerHTML = ${h.jshtml(_('Show more'))};
 
            lnk.id='code_stats_show_more';
 
            td.appendChild(lnk);
 

	
 
            show_more.appendChild(td);
 
            show_more.appendChild(document.createElement('td'));
 
            tbl.appendChild(show_more);
 
        }
 

	
 
    }
 
    if (data.length == 0) {
 
        tbl.innerHTML = '<tr><td>' + ${h.jshtml(_('No data ready yet'))} + '</td></tr>';
 
    }
 

	
 
    $('#lang_stats').append(tbl);
 
    $('#code_stats_show_more').click(function(){
 
        $('.stats_hidden').show();
 
        $('#code_stats_show_more').hide();
 
    });
 
});
 
</script>
 
%endif
 

	
 
</%def>
0 comments (0 inline, 0 general)