#3447 fix broken watchers dropdown in repo_info
Merged 5 years ago by pingou. Opened 5 years ago by ryanlerch.
ryanlerch/pagure broken-watch-repo-info  into  master

@@ -342,84 +342,5 @@ 

      });

  

  });

- 

- $(function() {

-   $( "#more_gits" ).click(function() {

-       if ($( "#more_gits" ).html() == 'more') {

-         $( "#more_gits" ).html('less');

-       } else {

-         $( "#more_gits" ).html('more');

-       }

-   });

- 

-   {% if g.authenticated and g.repo_committer %}

-   $.ajax({

-     url: '{{ url_for("internal_ns.get_pull_request_ready_branch") }}' ,

-     type: 'POST',

-     data: {

-       namespace: "{{ repo.namespace if repo.namespace }}",

-       repo: "{{ repo.name }}",

-       repouser: "{{ repo.user.user if repo.is_fork else '' }}",

-       csrf_token: "{{ g.confirmationform.csrf_token.current_token }}",

-     },

-     dataType: 'json',

-     success: function(res) {

-       if (res.code == 'OK'){

-         for (branch in res.message.new_branch){

-           var nb_commits = res.message.new_branch[branch]['commits']

-           var nb_target = res.message.new_branch[branch]['target_branch']

-           var url = "{{ url_for(

-             'ui_ns.new_request_pull',

-             repo=repo.name,

-             username=repo.user.user if repo.is_fork else None,

-             namespace=repo.namespace,

-             branch_to='',

-             branch_from='') }}";

-           url = url.slice(0, -2) + nb_target + '..' + branch

-           html = '<div class="alert alert-info" role="alert"> \

-                 The branch ' + branch +' contains ' + nb_commits.length

-                 +  ' commits not in the ' + nb_target + ' branch \

-                 <span class="pr-toplabel"> \

-                 <span class="fa fa-random"> </span> \

-                 {{ head }}</span> \

-                 <div id="request_pull" class="col-md-2"> \

-                 <a class="btn btn-primary btn-sm" href="' + url + '"> Create pull request </a> \

-                 </div></div>';

-           /*$($('.bodycontent').find('.row').children()[0]).before(html);*/

-           {% if repo.is_fork %}

-           html2 = ' \

-                 <a class="small label label-sm label-primary" data-toggle="tooltip" \

-                 href="' + url + '"title="' + branch +' contains ' + nb_commits.length + ' \

-                  commit not in the upstream project '

-                  + nb_target + ' branch. Click to create new PR now.'+'"> New PR</a> \

-                 </div>';

-           {% else %}

-           html2 = ' \

-                 <a class="small label label-sm label-primary" data-toggle="tooltip" \

-                 href="' + url + '" title="' + branch +' contains ' + nb_commits.length + ' \

-                  commit not in the ' + nb_target + ' branch. Click to create new PR now.' \

-                  +'"> New PR</a> \

-                 </div>';

-           {%endif%}

-           var _b = branch.replace(/\./g, '\\.').replace('/', '__').replace('\+', '\\+');

-           $('#branch-' + _b + ' .branch_del').prepend(html2);

-           $('[data-toggle="tooltip"]').tooltip({placement : 'bottom'});

-         }

-         for (branch in res.message.branch_w_pr){

-           var html = ' \

-               <a class="small label label-sm label-success" data-toggle="tooltip" '

-                + 'href="{{ request.url_root }}' + res.message.branch_w_pr[branch]

-                + '"title="' + branch +' is already in an opened pull-request">'

-                + 'PR#' + res.message.branch_w_pr[branch].split('/').slice(-1)[0]  + ' </a> \

-               </div>';

-           $('#branch-' + branch.replace(/\./g, '\\.').replace('/', '__')

-             + ' .branch_del').prepend(html);

-           $('[data-toggle="tooltip"]').tooltip({placement : 'bottom'});

-         }

-       }

-     }

-   });

-   {% endif %}

- });

  </script>

  {% endblock %}

There was some old, unused JS in repo_info that was broken,
and was causing the watch dropdown to not work anymore.

This removes that JS, and the watch dropdown should work again.

fixes #3444

Works fine for me here, let's rebase and see what jenkins says :)

rebased onto b29ac45

5 years ago

Pull-Request has been merged by pingou

5 years ago