Changeset - f4e158ed49b1
kallithea/public/js/base.js
Show inline comments
 
@@ -168,18 +168,18 @@ var pyroutes = (function() {
 
        }
 
        function str_repeat(input, multiplier) {
 
            for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}
 
            return output.join('');
 
        }
 

	
 
        var str_format = function() {
 
        function str_format() {
 
            if (!str_format.cache.hasOwnProperty(arguments[0])) {
 
                str_format.cache[arguments[0]] = str_format.parse(arguments[0]);
 
            }
 
            return str_format.format.call(null, str_format.cache[arguments[0]], arguments);
 
        };
 
        }
 

	
 
        str_format.format = function(parse_tree, argv) {
 
            var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
 
            for (i = 0; i < tree_length; i++) {
 
                node_type = get_type(parse_tree[i]);
 
                if (node_type === 'string') {
 
@@ -724,27 +724,27 @@ function _comment_div_append_form($comme
 
            'f_path': f_path,
 
            'line': line_no,
 
            'changeset_status': review_status,
 
            'save_close': pr_close,
 
            'save_delete': pr_delete
 
        };
 
        var success = function(json_data) {
 
        function success(json_data) {
 
            if (pr_delete) {
 
                location = json_data['location'];
 
            } else {
 
                $comment_div.append(json_data['rendered_text']);
 
                comment_div_state($comment_div, f_path, line_no);
 
                linkInlineComments($('.firstlink'), $('.comment:first-child'));
 
                if ((review_status || pr_close) && !f_path && !line_no) {
 
                    // Page changed a lot - reload it after closing the submitted form
 
                    comment_div_state($comment_div, f_path, line_no, false);
 
                    location.reload(true);
 
                }
 
            }
 
        };
 
        var failure = function(x, s, e) {
 
        }
 
        function failure(x, s, e) {
 
            $preview.removeClass('submitting').addClass('failed');
 
            var $status = $preview.find('.comment-submission-status');
 
            $('<span>', {
 
                'title': e,
 
                text: _TM['Unable to post']
 
            }).replaceAll($status.contents());
 
@@ -763,13 +763,13 @@ function _comment_div_append_form($comme
 
                    'class': 'btn btn-default btn-xs',
 
                    text: _TM['Cancel']
 
                }).click(function() {
 
                    comment_div_state($comment_div, f_path, line_no);
 
                })
 
            ).appendTo($status);
 
        };
 
        }
 
        ajaxPOST(AJAX_COMMENT_URL, postData, success, failure);
 
    });
 

	
 
    // add event handler for hide/cancel buttons
 
    $form.find('.hide-inline-form').click(function(e) {
 
        comment_div_state($comment_div, f_path, line_no);
 
@@ -785,13 +785,13 @@ function _comment_div_append_form($comme
 
}
 

	
 

	
 
function deleteComment(comment_id) {
 
    var url = AJAX_COMMENT_DELETE_URL.replace('__COMMENT_ID__', comment_id);
 
    var postData = {};
 
    var success = function(o) {
 
    function success(o) {
 
        $('#comment-'+comment_id).remove();
 
        // Ignore that this might leave a stray Add button (or have a pending form with another comment) ...
 
    }
 
    ajaxPOST(url, postData, success);
 
}
 

	
 
@@ -828,13 +828,13 @@ function linkInlineComments($firstlinks,
 
function fileBrowserListeners(node_list_url, url_base){
 
    var $node_filter = $('#node_filter');
 

	
 
    var filterTimeout = null;
 
    var nodes = null;
 

	
 
    var initFilter = function(){
 
    function initFilter(){
 
        $('#node_filter_box_loading').show();
 
        $('#search_activate_id').hide();
 
        $('#add_node_id').hide();
 
        $.ajax({url: node_list_url, headers: {'X-PARTIAL-XHR': '1'}, cache: false})
 
            .done(function(json) {
 
                    nodes = json.nodes;
 
@@ -849,13 +849,13 @@ function fileBrowserListeners(node_list_
 
            .fail(function() {
 
                    console.log('fileBrowserListeners initFilter failed to load');
 
                })
 
        ;
 
    }
 

	
 
    var updateFilter = function(e) {
 
    function updateFilter(e) {
 
        return function(){
 
            // Reset timeout
 
            filterTimeout = null;
 
            var query = e.currentTarget.value.toLowerCase();
 
            var match = [];
 
            var matches = 0;
 
@@ -896,13 +896,13 @@ function fileBrowserListeners(node_list_
 
            }
 
            else{
 
                $('#tbody').show();
 
                $('#tbody_filtered').hide();
 
            }
 
        }
 
    };
 
    }
 

	
 
    $('#filter_activate').click(function(){
 
            initFilter();
 
        });
 
    $node_filter.click(function(){
 
            if($node_filter.hasClass('init')){
 
@@ -1319,18 +1319,18 @@ function addPermAction(perm_type) {
 
    var next_id = $('.new_members').length;
 
    $last_node.before($('<tr class="new_members">').append(template.format(next_id, perm_type, _TM['Type name of user or member to grant permission'])));
 
    MembersAutoComplete($("#perm_new_member_name_"+next_id), $("#perm_new_member_type_"+next_id));
 
}
 

	
 
function ajaxActionRevokePermission(url, obj_id, obj_type, field_id, extra_data) {
 
    var success = function (o) {
 
    function success(o) {
 
            $('#' + field_id).remove();
 
        };
 
    var failure = function (o) {
 
        }
 
    function failure(o) {
 
            alert(_TM['Failed to revoke permission'] + ": " + o.status);
 
        };
 
        }
 
    var query_params = {};
 
    // put extra data into POST
 
    if (extra_data !== undefined && (typeof extra_data === 'object')){
 
        for(var k in extra_data){
 
            query_params[k] = extra_data[k];
 
        }
kallithea/public/js/mergely.js
Show inline comments
 
@@ -696,13 +696,13 @@ jQuery.extend(Mgly.CodeMirrorDiffView.pr
 
		this.editor[this.id + '-lhs'].on('scroll', function(){ self._scrolling(self.id + '-lhs'); });
 
		this.editor[this.id + '-rhs'].on('change', function(){ if (self.settings.autoupdate) self._changing(self.id + '-lhs', self.id + '-rhs'); });
 
		this.editor[this.id + '-rhs'].on('scroll', function(){ self._scrolling(self.id + '-rhs'); });
 
		// resize
 
		if (this.settings.autoresize) {
 
			var sz_timeout1 = null;
 
			var sz = function(init) {
 
			function sz(init) {
 
				//self.em_height = null; //recalculate
 
				if (self.settings.resize) self.settings.resize(init);
 
				self.editor[self.id + '-lhs'].refresh();
 
				self.editor[self.id + '-rhs'].refresh();
 
				if (self.settings.autoupdate) {
 
					self._changing(self.id + '-lhs', self.id + '-rhs');
 
@@ -851,13 +851,13 @@ jQuery.extend(Mgly.CodeMirrorDiffView.pr
 
		this._clear();
 
		this._diff(editor_name1, editor_name2);
 
	},
 
	_clear: function() {
 
		var self = this, name, editor, fns, timer, i, change, l;
 

	
 
		var clear_changes = function() {
 
		function clear_changes() {
 
			timer = new Mgly.Timer();
 
			for (i = 0, l = editor.lineCount(); i < l; ++i) {
 
				editor.removeLineClass(i, 'background');
 
			}
 
			for (i = 0; i < fns.length; ++i) {
 
				//var edid = editor.getDoc().id;
kallithea/templates/admin/admin.html
Show inline comments
 
@@ -32,15 +32,15 @@ $(document).ready(function() {
 
  $('#j_filter').click(function(){
 
    var $jfilter = $('#j_filter');
 
    if($jfilter.hasClass('initial')){
 
        $jfilter.val('');
 
    }
 
  });
 
  var fix_j_filter_width = function(len){
 
  function fix_j_filter_width(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();
kallithea/templates/admin/auth/auth_settings.html
Show inline comments
 
@@ -105,13 +105,13 @@
 
    </div>
 
</div>
 

	
 
<script>'use strict';
 
    $('.toggle-plugin').click(function(e){
 
        var $auth_plugins_input = $('#auth_plugins');
 
        var notEmpty = function(element, index, array) {
 
        function notEmpty(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');
 

	
kallithea/templates/admin/repo_groups/repo_group_add.html
Show inline comments
 
@@ -60,13 +60,13 @@
 
            </div>
 
    </div>
 
    ${h.end_form()}
 
</div>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        var setCopyPermsOption = function(group_val){
 
        function setCopyPermsOption(group_val){
 
            if(group_val != "-1"){
 
                $('#copy_perms').show();
 
            }
 
            else{
 
                $('#copy_perms').hide();
 
            }
kallithea/templates/admin/repos/repo_add_base.html
Show inline comments
 
@@ -64,13 +64,13 @@ ${h.form(url('repos'))}
 
                ${h.submit('add',_('Add'),class_="btn btn-default")}
 
            </div>
 
        </div>
 
</div>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        var setCopyPermsOption = function(group_val){
 
        function setCopyPermsOption(group_val){
 
            if(group_val != "-1"){
 
                $('#copy_perms').show();
 
            }
 
            else{
 
                $('#copy_perms').hide();
 
            }
kallithea/templates/admin/settings/settings_hooks.html
Show inline comments
 
@@ -50,16 +50,16 @@ ${h.form(url('admin_settings_hooks'), me
 
${h.end_form()}
 
% endif
 

	
 
<script>'use strict';
 
function delete_hook(hook_id, field_id) {
 
    var sUrl = ${h.js(h.url('admin_settings_hooks_delete'))};
 
    var success = function (o) {
 
    function success(o) {
 
            $('#' + field_id).remove();
 
        };
 
    var failure = function (o) {
 
        }
 
    function failure(o) {
 
            alert(${h.js(_('Failed to remove hook'))});
 
        };
 
        }
 
    var postData = {'hook_id': hook_id};
 
    ajaxPOST(sUrl, postData, success, failure);
 
};
 
</script>
kallithea/templates/base/base.html
Show inline comments
 
@@ -401,13 +401,13 @@
 

	
 
    <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){
 
            function format(state){
 
                if (!state.id){
 
                  return state.text.html_escape(); // optgroup
 
                }
 
                var obj_dict = state.obj;
 
                var tmpl = '';
 

	
kallithea/templates/base/perms_summary.html
Show inline comments
 
@@ -96,22 +96,22 @@
 
        </div>
 
        %endif
 
     %endfor
 
</div>
 
<script>'use strict';
 
    $(document).ready(function(){
 
        var show_empty = function(section){
 
        function show_empty(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){
 
        function update_show($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){
kallithea/templates/changelog/changelog.html
Show inline comments
 
@@ -87,13 +87,13 @@ ${self.repo_context_bar('changelog', c.f
 

	
 
            $(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) {
 
                function checkbox_checker(e) {
 
                    var $checked_checkboxes = $checkboxes.filter(':checked');
 
                    var $singlerange = $('#singlerange');
 

	
 
                    $('#rev_range_container').hide();
 
                    $checkboxes.show();
 
                    $singlerange.show();
 
@@ -160,13 +160,13 @@ ${self.repo_context_bar('changelog', c.f
 
                                                                        'branch':${h.js(c.first_revision.branch)}}));
 
                            $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(${h.jshtml(c.first_revision.branch)}));
 
                        %endif
 
                        $('#compare_fork').show();
 
                        $checkboxes.closest('tr').removeClass('out-of-range');
 
                    }
 
                };
 
                }
 
                checkbox_checker();
 
                $checkboxes.click(function() {
 
                    checkbox_checker();
 
                    graph.render(jsdata);
 
                });
 
                $('#singlerange').click(checkbox_checker);
kallithea/templates/changeset/diff_block.html
Show inline comments
 
@@ -109,16 +109,16 @@ $(document).ready(function(){
 
        });
 

	
 
    $('.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){
 
    function reset(e){
 
        $('#'+e.currentTarget.id+'-img-a.img-diff-swapable')
 
          .after($('#'+e.currentTarget.id+'-img-b.img-diff-swapable'));
 
    };
 
    }
 
    $('.btn-image-diff-swap').mouseup(reset);
 
    $('.btn-image-diff-swap').mouseleave(reset);
 

	
 
    $('.diff-collapse-button').click(function(e) {
 
        $('.diff_block').toggleClass('hidden');
 
        var $button = $(e.currentTarget);
kallithea/templates/compare/compare_diff.html
Show inline comments
 
@@ -151,13 +151,13 @@ ${self.repo_context_bar('changelog')}
 
    });
 
    }
 

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

	
 
    var values_changed = function() {
 
    function values_changed() {
 
        var values = $('#compare_org').select2('data') && $('#compare_other').select2('data');
 
        if (values) {
 
             $('#compare_revs').removeClass("disabled");
 
             // TODO: the swap button ... if any
 
        } else {
 
             $('#compare_revs').addClass("disabled");
kallithea/templates/journal/journal.html
Show inline comments
 
@@ -46,15 +46,15 @@
 
    $('#j_filter').click(function(){
 
        var $jfilter = $('#j_filter');
 
        if($jfilter.hasClass('initial')){
 
            $jfilter.val('');
 
        }
 
    });
 
    var fix_j_filter_width = function(len){
 
    function fix_j_filter_width(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();
kallithea/templates/pullrequests/pullrequest.html
Show inline comments
 
@@ -93,13 +93,13 @@ ${self.repo_context_bar('showpullrequest
 

	
 
<script src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></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(){
 
  function otherrepoChanged(){
 
      var $other_ref = $('#other_ref');
 
      $other_ref.prop('disabled', true);
 
      var repo_name = $('#other_repo').val();
 
      if (pendingajax) {
 
          pendingajax.abort();
 
          pendingajax = undefined;
 
@@ -129,15 +129,15 @@ ${self.repo_context_bar('showpullrequest
 
                  dropdownAutoWidth: true
 
              });
 

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

	
 
  var loadPreview = function(){
 
  function loadPreview(){
 
      //url template
 
      var url = ${h.js(h.url('compare_url',
 
                         repo_name='__other_repo__',
 
                         org_ref_type='rev',
 
                         org_ref_name='__other_ref_name__',
 
                         other_repo='__org_repo__',
0 comments (0 inline, 0 general)