Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-07-24 23:45:11 +0300
committerFatih Acet <acetfatih@gmail.com>2016-07-24 23:45:11 +0300
commitaaa9509d120524573085e94af9de5cdde83e3271 (patch)
tree3824cffd4cdd132ee9cf75a00a7624f5ccc0dabd /app/assets/javascripts/commits.js
parent56b79181adc0bd6e9abef97ea075c14be971a01a (diff)
ES6ify all the things!
Diffstat (limited to 'app/assets/javascripts/commits.js')
-rw-r--r--app/assets/javascripts/commits.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/app/assets/javascripts/commits.js b/app/assets/javascripts/commits.js
new file mode 100644
index 00000000000..37f168c5190
--- /dev/null
+++ b/app/assets/javascripts/commits.js
@@ -0,0 +1,58 @@
+(function() {
+ this.CommitsList = (function() {
+ function CommitsList() {}
+
+ CommitsList.timer = null;
+
+ CommitsList.init = function(limit) {
+ $("body").on("click", ".day-commits-table li.commit", function(event) {
+ if (event.target.nodeName !== "A") {
+ location.href = $(this).attr("url");
+ e.stopPropagation();
+ return false;
+ }
+ });
+ Pager.init(limit, false);
+ this.content = $("#commits-list");
+ this.searchField = $("#commits-search");
+ return this.initSearch();
+ };
+
+ CommitsList.initSearch = function() {
+ this.timer = null;
+ return this.searchField.keyup((function(_this) {
+ return function() {
+ clearTimeout(_this.timer);
+ return _this.timer = setTimeout(_this.filterResults, 500);
+ };
+ })(this));
+ };
+
+ CommitsList.filterResults = function() {
+ var commitsUrl, form, search;
+ form = $(".commits-search-form");
+ search = CommitsList.searchField.val();
+ commitsUrl = form.attr("action") + '?' + form.serialize();
+ CommitsList.content.fadeTo('fast', 0.5);
+ return $.ajax({
+ type: "GET",
+ url: form.attr("action"),
+ data: form.serialize(),
+ complete: function() {
+ return CommitsList.content.fadeTo('fast', 1.0);
+ },
+ success: function(data) {
+ CommitsList.content.html(data.html);
+ return history.replaceState({
+ page: commitsUrl
+ }, document.title, commitsUrl);
+ },
+ dataType: "json"
+ });
+ };
+
+ return CommitsList;
+
+ })();
+
+}).call(this);