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
 
@@ -255,49 +255,49 @@ body {
 
     
 
      /* 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">
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);
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 ]
 
];
 

	
 
@@ -81,79 +83,79 @@ function BranchRenderer(canvas_id, conte
 

	
 
		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));
 
@@ -171,60 +173,60 @@ function BranchRenderer(canvas_id, conte
 
				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
 
@@ -6,47 +6,47 @@
 
</%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
 
@@ -16,47 +16,47 @@
 
          ${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
 
@@ -84,49 +84,49 @@
 
                <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']);
 
        }
 
    });
kallithea/templates/admin/gists/edit.html
Show inline comments
 
@@ -14,93 +14,93 @@
 
  <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
 
@@ -125,49 +125,49 @@
 
                                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>
kallithea/templates/admin/gists/new.html
Show inline comments
 
@@ -34,49 +34,49 @@
 
            <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
kallithea/templates/admin/my_account/my_account_api_keys.html
Show inline comments
 
@@ -69,31 +69,31 @@
 
            </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
 
@@ -40,45 +40,45 @@
 

	
 
            <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
 
@@ -81,43 +81,43 @@ ${h.form(url('edit_repo_group_perms', gr
 
                            <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
 
@@ -20,31 +20,31 @@ ${h.form(url('update_repos_group',group_
 
            <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
 
@@ -9,43 +9,43 @@
 
    ${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
 
@@ -44,49 +44,49 @@ ${h.form(url('repos'))}
 
                ${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
kallithea/templates/admin/repos/repo_creating.html
Show inline comments
 
@@ -21,47 +21,47 @@
 
    <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">
kallithea/templates/admin/repos/repo_edit_permissions.html
Show inline comments
 
@@ -66,42 +66,42 @@ ${h.form(url('edit_repo_perms_update', r
 
                            <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
 
@@ -82,37 +82,37 @@ ${h.form(url('update_repo', repo_name=c.
 

	
 
            %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
 
@@ -8,45 +8,45 @@
 
<%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
 
@@ -29,37 +29,37 @@ ${h.form(url('admin_settings_hooks'), me
 
                            <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
 
@@ -48,33 +48,33 @@ ${h.form(url('admin_settings'), method='
 
                <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
 
@@ -31,30 +31,30 @@
 
            </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
 
@@ -71,42 +71,42 @@ ${h.form(url('edit_user_group_perms_upda
 
                            <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
 
@@ -27,27 +27,27 @@ ${h.form(url('update_users_group', id=c.
 
                            ${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
 
@@ -8,43 +8,43 @@
 
<%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
 
@@ -63,30 +63,30 @@
 
                <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
 
@@ -56,31 +56,31 @@
 
                <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
 
@@ -7,48 +7,48 @@
 

	
 
<%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
 
@@ -156,49 +156,49 @@
 
                   <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",
 
@@ -378,49 +378,49 @@
 
                </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>';
 
@@ -506,30 +506,30 @@
 
            });
 
        });
 
    </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
 
@@ -76,49 +76,49 @@
 
                           <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);
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} ?'))},
 
@@ -56,49 +56,49 @@
 
                '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>
kallithea/templates/changelog/changelog.html
Show inline comments
 
@@ -60,49 +60,49 @@ ${self.repo_context_bar('changelog', c.f
 
                               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)},
kallithea/templates/changelog/changelog_table.html
Show inline comments
 
@@ -89,33 +89,33 @@
 
                <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>
 
@@ -163,42 +163,42 @@ ${self.repo_context_bar('changelog', c.c
 

	
 
    <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
 
@@ -171,41 +171,41 @@
 
      </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
 
@@ -75,49 +75,49 @@
 
        </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');
kallithea/templates/compare/compare_cs.html
Show inline comments
 
@@ -45,41 +45,41 @@
 
          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
 
@@ -77,49 +77,49 @@ ${self.repo_context_bar('changelog')}
 
                      <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 ?
kallithea/templates/files/diff_2way.html
Show inline comments
 
@@ -39,49 +39,49 @@ ${self.repo_context_bar('changelog')}
 
                    </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});
 
            }
 

	
 
        },
kallithea/templates/files/files.html
Show inline comments
 
@@ -15,49 +15,49 @@
 
</%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.
 
@@ -104,58 +104,58 @@ var load_state = function(state) {
 
                  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
kallithea/templates/files/files_add.html
Show inline comments
 
@@ -49,49 +49,49 @@ ${self.repo_context_bar('files')}
 
            </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){
kallithea/templates/files/files_browser.html
Show inline comments
 
@@ -88,33 +88,33 @@
 
                         %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
 
@@ -56,49 +56,49 @@ ${self.repo_context_bar('files')}
 
                        ${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)});
kallithea/templates/followers/followers.html
Show inline comments
 
@@ -4,37 +4,37 @@
 
<%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
 
@@ -67,36 +67,36 @@ ${self.repo_context_bar('createfork')}
 
                <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
 
@@ -4,37 +4,37 @@
 
<%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
 
@@ -23,49 +23,49 @@
 
                %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
 
@@ -20,73 +20,73 @@
 

	
 
<%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
 
@@ -43,34 +43,34 @@
 
                                <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
 
@@ -32,34 +32,34 @@
 
                        ${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
 
@@ -71,49 +71,49 @@ ${self.repo_context_bar('showpullrequest
 
                    </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++)
 
@@ -141,49 +141,49 @@ ${self.repo_context_bar('showpullrequest
 
                         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){
kallithea/templates/pullrequests/pullrequest_show.html
Show inline comments
 
@@ -291,80 +291,80 @@ ${self.repo_context_bar('showpullrequest
 
              % 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();
kallithea/templates/register.html
Show inline comments
 
@@ -69,34 +69,34 @@
 
                    </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
 
@@ -30,49 +30,49 @@ ${self.repo_context_bar('summary')}
 
    <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');
 
@@ -82,64 +82,64 @@ for (var i=0;i<data.length;i++){
 
    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){
 
@@ -239,77 +239,77 @@ function SummaryPlot(from,to,dataset,ove
 
            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));
 
            }
 
        }
 

	
kallithea/templates/summary/summary.html
Show inline comments
 
@@ -6,49 +6,49 @@
 
</%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>
 
@@ -217,49 +217,49 @@ 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();
 
@@ -288,74 +288,74 @@ $(document).ready(function(){
 
                        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;
 
@@ -372,49 +372,49 @@ $(document).ready(function(){
 

	
 
        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
0 comments (0 inline, 0 general)