Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
599f1cb0
Commit
599f1cb0
authored
Oct 20, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted last method to jQuery
parent
c1be12d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
13 deletions
+20
-13
app/assets/javascripts/extensions/element.js.es6
app/assets/javascripts/extensions/element.js.es6
+6
-0
app/assets/javascripts/pipelines.js.es6
app/assets/javascripts/pipelines.js.es6
+14
-13
No files found.
app/assets/javascripts/extensions/element.js.es6
0 → 100644
View file @
599f1cb0
Element.prototype.matches = Element.prototype.matches || Element.prototype.msMatches;
Element.prototype.closest = function closest(selector, selectedElement = this) {
if (!selectedElement) return;
return selectedElement.matches(selector) ? selectedElement : Element.prototype.closest(selector, selectedElement.parentElement);
};
app/assets/javascripts/pipelines.js.es6
View file @
599f1cb0
...
@@ -7,9 +7,9 @@
...
@@ -7,9 +7,9 @@
}
}
initGraphToggle() {
initGraphToggle() {
this.pipelineGraph = document.querySelector('.pipeline-graph');
this.toggleButton = document.querySelector('.toggle-pipeline-btn');
this.toggleButton = document.querySelector('.toggle-pipeline-btn');
this.toggleButtonText = this.toggleButton.querySelector('.toggle-btn-text');
this.toggleButtonText = this.toggleButton.querySelector('.toggle-btn-text');
this.pipelineGraph = document.querySelector('.pipeline-graph');
this.toggleButton.addEventListener('click', this.toggleGraph.bind(this));
this.toggleButton.addEventListener('click', this.toggleGraph.bind(this));
}
}
...
@@ -17,21 +17,22 @@
...
@@ -17,21 +17,22 @@
const graphCollapsed = this.pipelineGraph.classList.contains('graph-collapsed');
const graphCollapsed = this.pipelineGraph.classList.contains('graph-collapsed');
this.toggleButton.classList.toggle('graph-collapsed');
this.toggleButton.classList.toggle('graph-collapsed');
this.pipelineGraph.classList.toggle('graph-collapsed');
this.pipelineGraph.classList.toggle('graph-collapsed');
graphCollapsed ? this.toggleButtonText.textContent = 'Hide' : this.toggleButtonText.textContent =
'Expand';
this.toggleButtonText.textContent = graphCollapsed ? 'Hide' :
'Expand';
}
}
addMarginToBuildColumns() {
addMarginToBuildColumns() {
const $secondChildBuildNode = $('.build:nth-child(2)');
const secondChildBuildNodes = this.pipelineGraph.querySelectorAll('.build:nth-child(2)');
if ($secondChildBuildNode.length) {
for (buildNodeIndex in secondChildBuildNodes) {
const $firstChildBuildNode = $secondChildBuildNode.prev('.build');
const buildNode = secondChildBuildNodes[buildNodeIndex];
const $multiBuildColumn = $secondChildBuildNode.closest('.stage-column');
const firstChildBuildNode = buildNode.previousElementSibling;
const $previousColumn = $multiBuildColumn.prev('.stage-column');
if (!firstChildBuildNode || !firstChildBuildNode.matches('.build')) continue;
$multiBuildColumn.addClass('left-margin');
const multiBuildColumn = buildNode.closest('.stage-column');
$firstChildBuildNode.addClass('left-connector');
const previousColumn = multiBuildColumn.previousElementSibling;
$previousColumn.each(function() {
if (!previousColumn || !previousColumn.matches('.stage-column')) continue;
$this = $(this);
multiBuildColumn.classList.add('left-margin');
if ($('.build', $this).length === 1) $this.addClass('no-margin');
firstChildBuildNode.classList.add('left-connector');
});
const columnBuilds = previousColumn.querySelectorAll('.build');
if (columnBuilds.length === 1) previousColumn.classList.add('no-margin');
}
}
this.pipelineGraph.classList.remove('hidden');
this.pipelineGraph.classList.remove('hidden');
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment