summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/commits.js
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-03-14 15:04:15 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-03-14 15:04:15 +0000
commit57443cff5a471e850dc55655ec5f34d30c95ef6c (patch)
tree4a8da5adb5fa9f3c6c5dbacf53affeb86924d1e7 /app/assets/javascripts/commits.js
parentef67677422c110073c2dc4ca9cc8e8b30c2e2559 (diff)
parent68672c5b52006d7c1d45f055f52ad4abecce3e09 (diff)
downloadgitlab-ce-20450-fix-ujs-actions-part-3-step2.tar.gz
Merge branch 'fl-remove-ujs-pipelines' into 20450-fix-ujs-actions-part-3-step220450-fix-ujs-actions-part-3-step2
* fl-remove-ujs-pipelines: (118 commits) Merge branch '20450-fix-ujs-actions-part-3-step1' into '20450-fix-ujs-actions-part-3' Patch 15 Use a button and a post request instead of UJS links - part 1 - Environments Fix 'ExecJS disabled' error on issues index Update markdown.md example with asterisks and underscores for clarity Fix missing blob line permalink updater on blob:show Organize our polyfills and standardize on core-js fix broken variable reference remove IIFEs in preparation for ES module refactor Adds docs for QueryRecorder tests Do not show LFS object when LFS is disabled Display error message when deleting tag in web UI fails Update permalink/blame buttons with line number fragment hash Retry only on feature specs that use JS, on CI Implement `json_response` as a `let` variable New file from interface on existing branch Fix regression in runners registration v1 api Use gitlab-workhorse 1.4.1 Reserve few project and nested group paths Add GitLab QA CE strategy and simplify inflector ...
Diffstat (limited to 'app/assets/javascripts/commits.js')
-rw-r--r--app/assets/javascripts/commits.js118
1 files changed, 58 insertions, 60 deletions
diff --git a/app/assets/javascripts/commits.js b/app/assets/javascripts/commits.js
index ccd895f3bf4..e3f9eaaf39c 100644
--- a/app/assets/javascripts/commits.js
+++ b/app/assets/javascripts/commits.js
@@ -1,68 +1,66 @@
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, consistent-return, no-return-assign, no-param-reassign, one-var, no-var, one-var-declaration-per-line, no-unused-vars, prefer-template, object-shorthand, comma-dangle, max-len, prefer-arrow-callback */
/* global Pager */
-(function() {
- this.CommitsList = (function() {
- var CommitsList = {};
+window.CommitsList = (function() {
+ var CommitsList = {};
- CommitsList.timer = null;
+ CommitsList.timer = null;
- CommitsList.init = function(limit) {
- $("body").on("click", ".day-commits-table li.commit", function(e) {
- if (e.target.nodeName !== "A") {
- location.href = $(this).attr("url");
- e.stopPropagation();
- return false;
- }
- });
- Pager.init(limit, false, false, function() {
- gl.utils.localTimeAgo($('.js-timeago'));
- });
- this.content = $("#commits-list");
- this.searchField = $("#commits-search");
- this.lastSearch = this.searchField.val();
- return this.initSearch();
- };
+ CommitsList.init = function(limit) {
+ $("body").on("click", ".day-commits-table li.commit", function(e) {
+ if (e.target.nodeName !== "A") {
+ location.href = $(this).attr("url");
+ e.stopPropagation();
+ return false;
+ }
+ });
+ Pager.init(limit, false, false, function() {
+ gl.utils.localTimeAgo($('.js-timeago'));
+ });
+ this.content = $("#commits-list");
+ this.searchField = $("#commits-search");
+ this.lastSearch = this.searchField.val();
+ 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.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();
- if (search === CommitsList.lastSearch) return;
- 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.lastSearch = search;
- CommitsList.content.html(data.html);
- return history.replaceState({
- page: commitsUrl
- // Change url so if user reload a page - search results are saved
- }, document.title, commitsUrl);
- },
- error: function() {
- CommitsList.lastSearch = null;
- },
- dataType: "json"
- });
- };
+ CommitsList.filterResults = function() {
+ var commitsUrl, form, search;
+ form = $(".commits-search-form");
+ search = CommitsList.searchField.val();
+ if (search === CommitsList.lastSearch) return;
+ 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.lastSearch = search;
+ CommitsList.content.html(data.html);
+ return history.replaceState({
+ page: commitsUrl
+ // Change url so if user reload a page - search results are saved
+ }, document.title, commitsUrl);
+ },
+ error: function() {
+ CommitsList.lastSearch = null;
+ },
+ dataType: "json"
+ });
+ };
- return CommitsList;
- })();
-}).call(window);
+ return CommitsList;
+})();