diff --git a/app/assets/javascripts/repository/branch.js.coffee b/app/assets/javascripts/repository/branch.js.coffee index b6038d5..5da9fdd 100644 --- a/app/assets/javascripts/repository/branch.js.coffee +++ b/app/assets/javascripts/repository/branch.js.coffee @@ -17,4 +17,13 @@ class Repository.Branch cancel_request: -> if @request != null @request.abort() - @request = null \ No newline at end of file + @request = null + + # private method + #fill_options = (options, el) -> + fill_options: (options, el) -> + for option in options + do -> + el.append($("") + .attr("value", option) + .text(option)) diff --git a/app/views/repositories/_form.html.erb b/app/views/repositories/_form.html.erb index 3c26c3d..78bbbae 100644 --- a/app/views/repositories/_form.html.erb +++ b/app/views/repositories/_form.html.erb @@ -125,7 +125,7 @@ el.empty(); // remove old options if(repository_branch.names[address] != null) { - fill_options(repository_branch.names[address], el); + repository_branch.fill_options(repository_branch.names[address], el); return; } @@ -140,16 +140,10 @@ options = data["branches"]; if (options != null) { repository_branch.names[address] = options; - fill_options(options, el); + repository_branch.fill_options(options, el); } } })); } - function fill_options (options, el) { - $.each(options, function(index, value) { - el.append($("") - .attr("value", value).text(value)); - }); - } -- libgit2 0.21.2