Commit 728f1f71 authored by Jack Davison's avatar Jack Davison

Refactored less readable existance checks

CoffeeScript generated JavaScript contains some unreadable
expressions. This refactoring addresses complex uses of
the exestential operator that produced unreadable Javascript.
parent a66a3c74
...@@ -12,6 +12,7 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -12,6 +12,7 @@ Please view this file on the master branch, on stable branches it's out of date.
- Escape ref and path for relative links !6050 (winniehell) - Escape ref and path for relative links !6050 (winniehell)
- Fixed link typo on /help/ui to Alerts section. !6915 (Sam Rose) - Fixed link typo on /help/ui to Alerts section. !6915 (Sam Rose)
- Fix filtering of milestones with quotes in title (airatshigapov) - Fix filtering of milestones with quotes in title (airatshigapov)
- Refactor less readable existance checking code from CoffeeScript !6289 (jlogandavison)
- Simpler arguments passed to named_route on toggle_award_url helper method - Simpler arguments passed to named_route on toggle_award_url helper method
- Fix: Backup restore doesn't clear cache - Fix: Backup restore doesn't clear cache
- API: Fix project deploy keys 400 and 500 errors when adding an existing key. !6784 (Joshua Welsh) - API: Fix project deploy keys 400 and 500 errors when adding an existing key. !6784 (Joshua Welsh)
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
css = { css = {
top: ($addBtn.offset().top + $addBtn.outerHeight()) + "px" top: ($addBtn.offset().top + $addBtn.outerHeight()) + "px"
}; };
if ((position != null) && position === 'right') { if (position === 'right') {
css.left = (($addBtn.offset().left - $menu.outerWidth()) + 20) + "px"; css.left = (($addBtn.offset().left - $menu.outerWidth()) + 20) + "px";
$menu.addClass('is-aligned-right'); $menu.addClass('is-aligned-right');
} else { } else {
......
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
FILTER_INPUT = '.dropdown-input .dropdown-input-field'; FILTER_INPUT = '.dropdown-input .dropdown-input-field';
function GitLabDropdown(el1, options) { function GitLabDropdown(el1, options) {
var ref, ref1, ref2, ref3, searchFields, selector, self; var searchFields, selector, self;
this.el = el1; this.el = el1;
this.options = options; this.options = options;
this.updateLabel = bind(this.updateLabel, this); this.updateLabel = bind(this.updateLabel, this);
...@@ -219,7 +219,11 @@ ...@@ -219,7 +219,11 @@
selector = $(this.el).data("target"); selector = $(this.el).data("target");
this.dropdown = selector != null ? $(selector) : $(this.el).parent(); this.dropdown = selector != null ? $(selector) : $(this.el).parent();
// Set Defaults // Set Defaults
ref = this.options, this.filterInput = (ref1 = ref.filterInput) != null ? ref1 : this.getElement(FILTER_INPUT), this.highlight = (ref2 = ref.highlight) != null ? ref2 : false, this.filterInputBlur = (ref3 = ref.filterInputBlur) != null ? ref3 : true; this.filterInput = this.options.filterInput || this.getElement(FILTER_INPUT);
this.highlight = !!this.options.highlight
this.filterInputBlur = this.options.filterInputBlur != null
? this.options.filterInputBlur
: true;
// If no input is passed create a default one // If no input is passed create a default one
self = this; self = this;
// If selector was passed // If selector was passed
...@@ -418,7 +422,9 @@ ...@@ -418,7 +422,9 @@
var $target; var $target;
if (this.options.multiSelect) { if (this.options.multiSelect) {
$target = $(e.target); $target = $(e.target);
if ($target && !$target.hasClass('dropdown-menu-close') && !$target.hasClass('dropdown-menu-close-icon') && !$target.data('is-link')) { if ($target && !$target.hasClass('dropdown-menu-close') &&
!$target.hasClass('dropdown-menu-close-icon') &&
!$target.data('is-link')) {
e.stopPropagation(); e.stopPropagation();
return false; return false;
} else { } else {
...@@ -634,7 +640,9 @@ ...@@ -634,7 +640,9 @@
} }
field = []; field = [];
value = this.options.id ? this.options.id(selectedObject, el) : selectedObject.id; value = this.options.id
? this.options.id(selectedObject, el)
: selectedObject.id;
if (isInput) { if (isInput) {
field = $(this.el); field = $(this.el);
} else if(value) { } else if(value) {
......
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
ContributorsGraph.set_y_domain = function(data) { ContributorsGraph.set_y_domain = function(data) {
return ContributorsGraph.prototype.y_domain = [ return ContributorsGraph.prototype.y_domain = [
0, d3.max(data, function(d) { 0, d3.max(data, function(d) {
var ref, ref1; return d.commits = d.commits || d.additions || d.deletions;
return d.commits = (ref = (ref1 = d.commits) != null ? ref1 : d.additions) != null ? ref : d.deletions;
}) })
]; ];
}; };
...@@ -44,8 +43,7 @@ ...@@ -44,8 +43,7 @@
ContributorsGraph.init_y_domain = function(data) { ContributorsGraph.init_y_domain = function(data) {
return ContributorsGraph.prototype.y_domain = [ return ContributorsGraph.prototype.y_domain = [
0, d3.max(data, function(d) { 0, d3.max(data, function(d) {
var ref, ref1; return d.commits = d.commits || d.additions || d.deletions;
return d.commits = (ref = (ref1 = d.commits) != null ? ref1 : d.additions) != null ? ref : d.deletions;
}) })
]; ];
}; };
...@@ -147,9 +145,8 @@ ...@@ -147,9 +145,8 @@
return this.area = d3.svg.area().x(function(d) { return this.area = d3.svg.area().x(function(d) {
return x(d.date); return x(d.date);
}).y0(this.height).y1(function(d) { }).y0(this.height).y1(function(d) {
var ref, ref1, xa; d.commits = d.commits || d.additions || d.deletions;
xa = d.commits = (ref = (ref1 = d.commits) != null ? ref1 : d.additions) != null ? ref : d.deletions; return y(d.commits);
return y(xa);
}).interpolate("basis"); }).interpolate("basis");
}; };
......
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
}; };
IssuableForm.prototype.handleSubmit = function() { IssuableForm.prototype.handleSubmit = function() {
var ref, ref1; var fieldId = (this.issueMoveField != null) ? this.issueMoveField.val() : null;
if (((ref = parseInt((ref1 = this.issueMoveField) != null ? ref1.val() : void 0)) != null ? ref : 0) > 0) { if ((parseInt(fieldId) || 0) > 0) {
if (!confirm(this.issueMoveConfirmMsg)) { if (!confirm(this.issueMoveConfirmMsg)) {
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment