Commit 4bdfb039 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'master' into 'dz-remove-namespaces-path-uniq'

Merge Request - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8013

# Conflicts:
#   db/schema.rb
parents 161d7c02 b70b9628
...@@ -132,7 +132,7 @@ gem 'after_commit_queue', '~> 1.3.0' ...@@ -132,7 +132,7 @@ gem 'after_commit_queue', '~> 1.3.0'
gem 'acts-as-taggable-on', '~> 4.0' gem 'acts-as-taggable-on', '~> 4.0'
# Background jobs # Background jobs
gem 'sidekiq', '~> 4.2' gem 'sidekiq', '~> 4.2.7'
gem 'sidekiq-cron', '~> 0.4.4' gem 'sidekiq-cron', '~> 0.4.4'
gem 'redis-namespace', '~> 1.5.2' gem 'redis-namespace', '~> 1.5.2'
gem 'sidekiq-limit_fetch', '~> 3.4' gem 'sidekiq-limit_fetch', '~> 3.4'
......
...@@ -126,7 +126,7 @@ GEM ...@@ -126,7 +126,7 @@ GEM
coffee-script-source (1.10.0) coffee-script-source (1.10.0)
colorize (0.7.7) colorize (0.7.7)
concurrent-ruby (1.0.2) concurrent-ruby (1.0.2)
connection_pool (2.2.0) connection_pool (2.2.1)
crack (0.4.3) crack (0.4.3)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
creole (0.5.0) creole (0.5.0)
...@@ -648,10 +648,10 @@ GEM ...@@ -648,10 +648,10 @@ GEM
rack rack
shoulda-matchers (2.8.0) shoulda-matchers (2.8.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
sidekiq (4.2.1) sidekiq (4.2.7)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0) connection_pool (~> 2.2, >= 2.2.0)
rack-protection (~> 1.5) rack-protection (>= 1.5.0)
redis (~> 3.2, >= 3.2.1) redis (~> 3.2, >= 3.2.1)
sidekiq-cron (0.4.4) sidekiq-cron (0.4.4)
redis-namespace (>= 1.5.2) redis-namespace (>= 1.5.2)
...@@ -928,7 +928,7 @@ DEPENDENCIES ...@@ -928,7 +928,7 @@ DEPENDENCIES
settingslogic (~> 2.0.9) settingslogic (~> 2.0.9)
sham_rack (~> 1.3.6) sham_rack (~> 1.3.6)
shoulda-matchers (~> 2.8.0) shoulda-matchers (~> 2.8.0)
sidekiq (~> 4.2) sidekiq (~> 4.2.7)
sidekiq-cron (~> 0.4.4) sidekiq-cron (~> 0.4.4)
sidekiq-limit_fetch (~> 3.4) sidekiq-limit_fetch (~> 3.4)
simplecov (= 0.12.0) simplecov (= 0.12.0)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
this.CommitFile = (function() { this.CommitFile = (function() {
function CommitFile(file) { function CommitFile(file) {
if ($('.image', file).length) { if ($('.image', file).length) {
new ImageFile(file); new gl.ImageFile(file);
} }
} }
......
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-use-before-define, prefer-arrow-callback, no-else-return, consistent-return, prefer-template, quotes, one-var, one-var-declaration-per-line, no-unused-vars, no-return-assign, comma-dangle, quote-props, no-unused-expressions, no-sequences, object-shorthand, padded-blocks, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-use-before-define, prefer-arrow-callback, no-else-return, consistent-return, prefer-template, quotes, one-var, one-var-declaration-per-line, no-unused-vars, no-return-assign, comma-dangle, quote-props, no-unused-expressions, no-sequences, object-shorthand, padded-blocks, max-len */
(function() { (function() {
this.ImageFile = (function() { gl.ImageFile = (function() {
var prepareFrames; var prepareFrames;
// Width where images must fits in, for 2-up this gets divided by 2 // Width where images must fits in, for 2-up this gets divided by 2
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
var genericError, genericSuccess, showTooltip; var genericError, genericSuccess, showTooltip;
genericSuccess = function(e) { genericSuccess = function(e) {
showTooltip(e.trigger, 'Copied!'); showTooltip(e.trigger, 'Copied');
// Clear the selection and blur the trigger so it loses its border // Clear the selection and blur the trigger so it loses its border
e.clearSelection(); e.clearSelection();
return $(e.trigger).blur(); return $(e.trigger).blur();
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
var originalTitle = $target.data('original-title'); var originalTitle = $target.data('original-title');
$target $target
.attr('title', 'Copied!') .attr('title', 'Copied')
.tooltip('fixTitle') .tooltip('fixTitle')
.tooltip('show') .tooltip('show')
.attr('title', originalTitle) .attr('title', originalTitle)
......
...@@ -5,8 +5,11 @@ ...@@ -5,8 +5,11 @@
class Diff { class Diff {
constructor() { constructor() {
$('.files .diff-file').singleFileDiff(); const $diffFile = $('.files .diff-file');
$('.files .diff-file').filesCommentButton(); $diffFile.singleFileDiff();
$diffFile.filesCommentButton();
$diffFile.each((index, file) => new gl.ImageFile(file));
if (this.diffViewType() === 'parallel') { if (this.diffViewType() === 'parallel') {
$('.content-wrapper .container-fluid').removeClass('container-limited'); $('.content-wrapper .container-fluid').removeClass('container-limited');
......
...@@ -52,6 +52,10 @@ ...@@ -52,6 +52,10 @@
return $.fn.atwho["default"].callbacks.filter(query, data, searchKey); return $.fn.atwho["default"].callbacks.filter(query, data, searchKey);
}, },
beforeInsert: function(value) { beforeInsert: function(value) {
if (value && !this.setting.skipSpecialCharacterTest) {
var withoutAt = value.substring(1);
if (withoutAt && /[^\w\d]/.test(withoutAt)) value = value.charAt() + '"' + withoutAt + '"';
}
if (!GitLab.GfmAutoComplete.dataLoaded) { if (!GitLab.GfmAutoComplete.dataLoaded) {
return this.at; return this.at;
} else { } else {
...@@ -117,6 +121,7 @@ ...@@ -117,6 +121,7 @@
insertTpl: ':${name}:', insertTpl: ':${name}:',
data: ['loading'], data: ['loading'],
startWithSpace: false, startWithSpace: false,
skipSpecialCharacterTest: true,
callbacks: { callbacks: {
sorter: this.DefaultOptions.sorter, sorter: this.DefaultOptions.sorter,
filter: this.DefaultOptions.filter, filter: this.DefaultOptions.filter,
...@@ -141,6 +146,7 @@ ...@@ -141,6 +146,7 @@
data: ['loading'], data: ['loading'],
startWithSpace: false, startWithSpace: false,
alwaysHighlightFirst: true, alwaysHighlightFirst: true,
skipSpecialCharacterTest: true,
callbacks: { callbacks: {
sorter: this.DefaultOptions.sorter, sorter: this.DefaultOptions.sorter,
filter: this.DefaultOptions.filter, filter: this.DefaultOptions.filter,
...@@ -219,12 +225,13 @@ ...@@ -219,12 +225,13 @@
} }
}; };
})(this), })(this),
insertTpl: '${atwho-at}"${title}"', insertTpl: '${atwho-at}${title}',
data: ['loading'], data: ['loading'],
startWithSpace: false, startWithSpace: false,
callbacks: { callbacks: {
matcher: this.DefaultOptions.matcher, matcher: this.DefaultOptions.matcher,
sorter: this.DefaultOptions.sorter, sorter: this.DefaultOptions.sorter,
beforeInsert: this.DefaultOptions.beforeInsert,
beforeSave: function(milestones) { beforeSave: function(milestones) {
return $.map(milestones, function(m) { return $.map(milestones, function(m) {
if (m.title == null) { if (m.title == null) {
...@@ -284,18 +291,11 @@ ...@@ -284,18 +291,11 @@
callbacks: { callbacks: {
matcher: this.DefaultOptions.matcher, matcher: this.DefaultOptions.matcher,
sorter: this.DefaultOptions.sorter, sorter: this.DefaultOptions.sorter,
beforeInsert: this.DefaultOptions.beforeInsert,
beforeSave: function(merges) { beforeSave: function(merges) {
var sanitizeLabelTitle;
sanitizeLabelTitle = function(title) {
if (/[\w\?&]+\s+[\w\?&]+/g.test(title)) {
return "\"" + (sanitize(title)) + "\"";
} else {
return sanitize(title);
}
};
return $.map(merges, function(m) { return $.map(merges, function(m) {
return { return {
title: sanitizeLabelTitle(m.title), title: sanitize(m.title),
color: m.color, color: m.color,
search: "" + m.title search: "" + m.title
}; };
...@@ -308,6 +308,7 @@ ...@@ -308,6 +308,7 @@
at: '/', at: '/',
alias: 'commands', alias: 'commands',
searchKey: 'search', searchKey: 'search',
skipSpecialCharacterTest: true,
displayTpl: function(value) { displayTpl: function(value) {
var tpl = '<li>/${name}'; var tpl = '<li>/${name}';
if (value.aliases.length > 0) { if (value.aliases.length > 0) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
(function() { (function() {
window.ContributorsStatGraphUtil = { window.ContributorsStatGraphUtil = {
parse_log: function(log) { parse_log: function(log) {
var by_author, by_email, data, entry, i, len, total; var by_author, by_email, data, entry, i, len, total, normalized_email;
total = {}; total = {};
by_author = {}; by_author = {};
by_email = {}; by_email = {};
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
if (total[entry.date] == null) { if (total[entry.date] == null) {
this.add_date(entry.date, total); this.add_date(entry.date, total);
} }
data = by_author[entry.author_name] || by_email[entry.author_email]; normalized_email = entry.author_email.toLowerCase();
data = by_author[entry.author_name] || by_email[normalized_email];
if (data == null) { if (data == null) {
data = this.add_author(entry, by_author, by_email); data = this.add_author(entry, by_author, by_email);
} }
...@@ -32,12 +33,14 @@ ...@@ -32,12 +33,14 @@
return collection[date].date = date; return collection[date].date = date;
}, },
add_author: function(author, by_author, by_email) { add_author: function(author, by_author, by_email) {
var data; var data, normalized_email;
data = {}; data = {};
data.author_name = author.author_name; data.author_name = author.author_name;
data.author_email = author.author_email; data.author_email = author.author_email;
normalized_email = author.author_email.toLowerCase();
by_author[author.author_name] = data; by_author[author.author_name] = data;
return by_email[author.author_email] = data; by_email[normalized_email] = data;
return data;
}, },
store_data: function(entry, total, by_author) { store_data: function(entry, total, by_author) {
this.store_commits(total, by_author); this.store_commits(total, by_author);
......
...@@ -40,19 +40,26 @@ ...@@ -40,19 +40,26 @@
$('#modal_merge_info').modal({ $('#modal_merge_info').modal({
show: false show: false
}); });
this.firstCICheck = true;
this.readyForCICheck = false;
this.readyForCIEnvironmentCheck = false;
this.cancel = false;
clearInterval(this.fetchBuildStatusInterval);
clearInterval(this.fetchBuildEnvironmentStatusInterval);
this.clearEventListeners(); this.clearEventListeners();
this.addEventListeners(); this.addEventListeners();
this.getCIStatus(false); this.getCIStatus(false);
this.getCIEnvironmentsStatus();
this.retrieveSuccessIcon(); this.retrieveSuccessIcon();
this.pollCIStatus();
this.pollCIEnvironmentsStatus(); this.ciStatusInterval = new global.SmartInterval({
callback: this.getCIStatus.bind(this, true),
startingInterval: 10000,
maxInterval: 30000,
hiddenInterval: 120000,
incrementByFactorOf: 5000,
});
this.ciEnvironmentStatusInterval = new global.SmartInterval({
callback: this.getCIEnvironmentsStatus.bind(this),
startingInterval: 30000,
maxInterval: 120000,
hiddenInterval: 240000,
incrementByFactorOf: 15000,
immediateExecution: true,
});
notifyPermissions(); notifyPermissions();
} }
...@@ -60,10 +67,6 @@ ...@@ -60,10 +67,6 @@
return $(document).off('page:change.merge_request'); return $(document).off('page:change.merge_request');
}; };
MergeRequestWidget.prototype.cancelPolling = function() {
return this.cancel = true;
};
MergeRequestWidget.prototype.addEventListeners = function() { MergeRequestWidget.prototype.addEventListeners = function() {
var allowedPages; var allowedPages;
allowedPages = ['show', 'commits', 'builds', 'pipelines', 'changes']; allowedPages = ['show', 'commits', 'builds', 'pipelines', 'changes'];
...@@ -72,9 +75,6 @@ ...@@ -72,9 +75,6 @@
var page; var page;
page = $('body').data('page').split(':').last(); page = $('body').data('page').split(':').last();
if (allowedPages.indexOf(page) < 0) { if (allowedPages.indexOf(page) < 0) {
clearInterval(_this.fetchBuildStatusInterval);
clearInterval(_this.fetchBuildEnvironmentStatusInterval);
_this.cancelPolling();
return _this.clearEventListeners(); return _this.clearEventListeners();
} }
}; };
...@@ -114,6 +114,11 @@ ...@@ -114,6 +114,11 @@
}); });
}; };
MergeRequestWidget.prototype.cancelPolling = function () {
this.ciStatusInterval.cancel();
this.ciEnvironmentStatusInterval.cancel();
};
MergeRequestWidget.prototype.getMergeStatus = function() { MergeRequestWidget.prototype.getMergeStatus = function() {
return $.get(this.opts.merge_check_url, function(data) { return $.get(this.opts.merge_check_url, function(data) {
return $('.mr-state-widget').replaceWith(data); return $('.mr-state-widget').replaceWith(data);
...@@ -131,18 +136,6 @@ ...@@ -131,18 +136,6 @@
} }
}; };
MergeRequestWidget.prototype.pollCIStatus = function() {
return this.fetchBuildStatusInterval = setInterval(((function(_this) {
return function() {
if (!_this.readyForCICheck) {
return;
}
_this.getCIStatus(true);
return _this.readyForCICheck = false;
};
})(this)), 10000);
};
MergeRequestWidget.prototype.getCIStatus = function(showNotification) { MergeRequestWidget.prototype.getCIStatus = function(showNotification) {
var _this; var _this;
_this = this; _this = this;
...@@ -150,23 +143,17 @@ ...@@ -150,23 +143,17 @@
return $.getJSON(this.opts.ci_status_url, (function(_this) { return $.getJSON(this.opts.ci_status_url, (function(_this) {
return function(data) { return function(data) {
var message, status, title; var message, status, title;
if (_this.cancel) {
return;
}
_this.readyForCICheck = true;
if (data.status === '') { if (data.status === '') {
return; return;
} }
if (data.environments && data.environments.length) _this.renderEnvironments(data.environments); if (data.environments && data.environments.length) _this.renderEnvironments(data.environments);
if (_this.firstCICheck || data.status !== _this.opts.ci_status && (data.status != null)) { if (data.status !== _this.opts.ci_status && (data.status != null)) {
_this.opts.ci_status = data.status; _this.opts.ci_status = data.status;
_this.showCIStatus(data.status); _this.showCIStatus(data.status);
if (data.coverage) { if (data.coverage) {
_this.showCICoverage(data.coverage); _this.showCICoverage(data.coverage);
} }
// The first check should only update the UI, a notification if (showNotification) {
// should only be displayed on status changes
if (showNotification && !_this.firstCICheck) {
status = _this.ciLabelForStatus(data.status); status = _this.ciLabelForStatus(data.status);
if (status === "preparing") { if (status === "preparing") {
title = _this.opts.ci_title.preparing; title = _this.opts.ci_title.preparing;
...@@ -184,24 +171,13 @@ ...@@ -184,24 +171,13 @@
return Turbolinks.visit(_this.opts.builds_path); return Turbolinks.visit(_this.opts.builds_path);
}); });
} }
return _this.firstCICheck = false;
} }
}; };
})(this)); })(this));
}; };
MergeRequestWidget.prototype.pollCIEnvironmentsStatus = function() {
this.fetchBuildEnvironmentStatusInterval = setInterval(() => {
if (!this.readyForCIEnvironmentCheck) return;
this.getCIEnvironmentsStatus();
this.readyForCIEnvironmentCheck = false;
}, 300000);
};
MergeRequestWidget.prototype.getCIEnvironmentsStatus = function() { MergeRequestWidget.prototype.getCIEnvironmentsStatus = function() {
$.getJSON(this.opts.ci_environments_status_url, (environments) => { $.getJSON(this.opts.ci_environments_status_url, (environments) => {
if (this.cancel) return;
this.readyForCIEnvironmentCheck = true;
if (environments && environments.length) this.renderEnvironments(environments); if (environments && environments.length) this.renderEnvironments(environments);
}); });
}; };
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
((global) => { ((global) => {
class Pipelines { class Pipelines {
constructor(options) { constructor(options = {}) {
if (options.initTabs && options.tabsOptions) { if (options.initTabs && options.tabsOptions) {
new global.LinkedTabs(options.tabsOptions); new global.LinkedTabs(options.tabsOptions);
...@@ -14,9 +14,11 @@ ...@@ -14,9 +14,11 @@
} }
addMarginToBuildColumns() { addMarginToBuildColumns() {
this.pipelineGraph = document.querySelector('.pipeline-graph'); this.pipelineGraph = document.querySelector('.js-pipeline-graph');
const secondChildBuildNodes = document.querySelector('.pipeline-graph').querySelectorAll('.build:nth-child(2)');
for (buildNodeIndex in secondChildBuildNodes) { const secondChildBuildNodes = this.pipelineGraph.querySelectorAll('.build:nth-child(2)');
for (const buildNodeIndex in secondChildBuildNodes) {
const buildNode = secondChildBuildNodes[buildNodeIndex]; const buildNode = secondChildBuildNodes[buildNodeIndex];
const firstChildBuildNode = buildNode.previousElementSibling; const firstChildBuildNode = buildNode.previousElementSibling;
if (!firstChildBuildNode || !firstChildBuildNode.matches('.build')) continue; if (!firstChildBuildNode || !firstChildBuildNode.matches('.build')) continue;
...@@ -28,6 +30,7 @@ ...@@ -28,6 +30,7 @@
const columnBuilds = previousColumn.querySelectorAll('.build'); const columnBuilds = previousColumn.querySelectorAll('.build');
if (columnBuilds.length === 1) previousColumn.classList.add('no-margin'); if (columnBuilds.length === 1) previousColumn.classList.add('no-margin');
} }
this.pipelineGraph.classList.remove('hidden'); this.pipelineGraph.classList.remove('hidden');
} }
} }
......
...@@ -7,24 +7,31 @@ ...@@ -7,24 +7,31 @@
(() => { (() => {
class SmartInterval { class SmartInterval {
/** /**
* @param { function } callback Function to be called on each iteration (required) * @param { function } opts.callback Function to be called on each iteration (required)
* @param { milliseconds } startingInterval `currentInterval` is set to this initially * @param { milliseconds } opts.startingInterval `currentInterval` is set to this initially
* @param { milliseconds } maxInterval `currentInterval` will be incremented to this * @param { milliseconds } opts.maxInterval `currentInterval` will be incremented to this
* @param { integer } incrementByFactorOf `currentInterval` is incremented by this factor * @param { milliseconds } opts.hiddenInterval `currentInterval` is set to this
* @param { boolean } lazyStart Configure if timer is initialized on instantiation or lazily * when the page is hidden
* @param { integer } opts.incrementByFactorOf `currentInterval` is incremented by this factor
* @param { boolean } opts.lazyStart Configure if timer is initialized on
* instantiation or lazily
* @param { boolean } opts.immediateExecution Configure if callback should
* be executed before the first interval.
*/ */
constructor({ callback, startingInterval, maxInterval, incrementByFactorOf, lazyStart }) { constructor(opts = {}) {
this.cfg = { this.cfg = {
callback, callback: opts.callback,
startingInterval, startingInterval: opts.startingInterval,
maxInterval, maxInterval: opts.maxInterval,
incrementByFactorOf, hiddenInterval: opts.hiddenInterval,
lazyStart, incrementByFactorOf: opts.incrementByFactorOf,
lazyStart: opts.lazyStart,
immediateExecution: opts.immediateExecution,
}; };
this.state = { this.state = {
intervalId: null, intervalId: null,
currentInterval: startingInterval, currentInterval: this.cfg.startingInterval,
pageVisibility: 'visible', pageVisibility: 'visible',
}; };
...@@ -36,6 +43,11 @@ ...@@ -36,6 +43,11 @@
const cfg = this.cfg; const cfg = this.cfg;
const state = this.state; const state = this.state;
if (cfg.immediateExecution) {
cfg.immediateExecution = false;
cfg.callback();
}
state.intervalId = window.setInterval(() => { state.intervalId = window.setInterval(() => {
cfg.callback(); cfg.callback();
...@@ -54,14 +66,29 @@ ...@@ -54,14 +66,29 @@
this.stopTimer(); this.stopTimer();
} }
onVisibilityHidden() {
if (this.cfg.hiddenInterval) {
this.setCurrentInterval(this.cfg.hiddenInterval);
this.resume();
} else {
this.cancel();
}
}
// start a timer, using the existing interval // start a timer, using the existing interval
resume() { resume() {
this.stopTimer(); // stop exsiting timer, in case timer was not previously stopped this.stopTimer(); // stop exsiting timer, in case timer was not previously stopped
this.start(); this.start();
} }
onVisibilityVisible() {
this.cancel();
this.start();
}
destroy() { destroy() {
this.cancel(); this.cancel();
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
$(document).off('visibilitychange').off('page:before-unload'); $(document).off('visibilitychange').off('page:before-unload');
} }
...@@ -80,11 +107,7 @@ ...@@ -80,11 +107,7 @@
initVisibilityChangeHandling() { initVisibilityChangeHandling() {
// cancel interval when tab no longer shown (prevents cached pages from polling) // cancel interval when tab no longer shown (prevents cached pages from polling)
$(document) document.addEventListener('visibilitychange', this.handleVisibilityChange.bind(this));
.off('visibilitychange').on('visibilitychange', (e) => {
this.state.pageVisibility = e.target.visibilityState;
this.handleVisibilityChange();
});
} }
initPageUnloadHandling() { initPageUnloadHandling() {
...@@ -92,10 +115,11 @@ ...@@ -92,10 +115,11 @@
$(document).on('page:before-unload', () => this.cancel()); $(document).on('page:before-unload', () => this.cancel());
} }
handleVisibilityChange() { handleVisibilityChange(e) {
const state = this.state; this.state.pageVisibility = e.target.visibilityState;
const intervalAction = this.isPageVisible() ?
const intervalAction = state.pageVisibility === 'hidden' ? this.cancel : this.resume; this.onVisibilityVisible :
this.onVisibilityHidden;
intervalAction.apply(this); intervalAction.apply(this);
} }
...@@ -111,6 +135,7 @@ ...@@ -111,6 +135,7 @@
incrementInterval() { incrementInterval() {
const cfg = this.cfg; const cfg = this.cfg;
const currentInterval = this.getCurrentInterval(); const currentInterval = this.getCurrentInterval();
if (cfg.hiddenInterval && !this.isPageVisible()) return;
let nextInterval = currentInterval * cfg.incrementByFactorOf; let nextInterval = currentInterval * cfg.incrementByFactorOf;
if (nextInterval > cfg.maxInterval) { if (nextInterval > cfg.maxInterval) {
...@@ -120,6 +145,8 @@ ...@@ -120,6 +145,8 @@
this.setCurrentInterval(nextInterval); this.setCurrentInterval(nextInterval);
} }
isPageVisible() { return this.state.pageVisibility === 'visible'; }
stopTimer() { stopTimer() {
const state = this.state; const state = this.state;
......
...@@ -486,6 +486,7 @@ $jq-ui-default-color: #777; ...@@ -486,6 +486,7 @@ $jq-ui-default-color: #777;
$label-gray-bg: #f8fafc; $label-gray-bg: #f8fafc;
$label-inverse-bg: #333; $label-inverse-bg: #333;
$label-remove-border: rgba(0, 0, 0, .1); $label-remove-border: rgba(0, 0, 0, .1);
$label-border-radius: 14px;
/* /*
* Lint * Lint
......
.deployments-container { @media (max-width: $screen-md-max) {
.deployments-container {
width: 100%; width: 100%;
overflow: auto; overflow: auto;
}
} }
.environments-list-loading { .environments-list-loading {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
.color-label { .color-label {
padding: 6px 10px; padding: 6px 10px;
border-radius: $label-border-radius;
} }
} }
......
...@@ -104,7 +104,8 @@ ...@@ -104,7 +104,8 @@
} }
.color-label { .color-label {
padding: 3px 4px; padding: 3px 7px;
border-radius: $label-border-radius;
} }
.dropdown-labels-error { .dropdown-labels-error {
......
.notification-list-item { .notification-list-item {
line-height: 34px; line-height: 34px;
.dropdown-menu {
@extend .dropdown-menu-align-right;
}
} }
.notification { .notification {
......
...@@ -37,13 +37,14 @@ ...@@ -37,13 +37,14 @@
} }
} }
.content-list { @media (max-width: $screen-md-max) {
.content-list {
&.pipelines, &.pipelines,
&.builds-content-list { &.builds-content-list {
width: 100%; width: 100%;
overflow: auto; overflow: auto;
} }
}
} }
.pipeline-holder { .pipeline-holder {
...@@ -666,10 +667,6 @@ ...@@ -666,10 +667,6 @@
min-width: 900px; min-width: 900px;
} }
.content-list.pipelines {
overflow: auto;
}
.stage { .stage {
max-width: 100px; max-width: 100px;
width: 100px; width: 100px;
......
...@@ -188,6 +188,10 @@ ...@@ -188,6 +188,10 @@
margin-left: 10px; margin-left: 10px;
} }
.notification-dropdown .dropdown-menu {
@extend .dropdown-menu-align-right;
}
.download-button { .download-button {
@media (max-width: $screen-md-max) { @media (max-width: $screen-md-max) {
margin-left: 0; margin-left: 0;
......
.snippet-row {
.title {
margin-bottom: 2px;
}
.snippet-filename {
padding: 0 2px;
}
}
.snippet-form-holder .file-holder .file-title { .snippet-form-holder .file-holder .file-title {
padding: 2px; padding: 2px;
} }
...@@ -24,11 +34,17 @@ ...@@ -24,11 +34,17 @@
padding-bottom: $gl-padding; padding-bottom: $gl-padding;
} }
.snippet-header {
padding: $gl-padding 0;
}
.snippet-title { .snippet-title {
font-size: 24px; font-size: 24px;
font-weight: 600; font-weight: 600;
padding: $gl-padding; }
padding-left: 0;
.snippet-edited-ago {
color: $gray-darkest;
} }
.snippet-actions { .snippet-actions {
......
...@@ -10,7 +10,14 @@ class Projects::ReleasesController < Projects::ApplicationController ...@@ -10,7 +10,14 @@ class Projects::ReleasesController < Projects::ApplicationController
end end
def update def update
# Release belongs to Tag which is not active record object,
# it exists only to save a description to each Tag.
# If description is empty we should destroy the existing record.
if release_params[:description].present?
release.update_attributes(release_params) release.update_attributes(release_params)
else
release.destroy
end
redirect_to namespace_project_tag_path(@project.namespace, @project, @tag.name) redirect_to namespace_project_tag_path(@project.namespace, @project, @tag.name)
end end
......
...@@ -19,10 +19,12 @@ class Projects::SnippetsController < Projects::ApplicationController ...@@ -19,10 +19,12 @@ class Projects::SnippetsController < Projects::ApplicationController
respond_to :html respond_to :html
def index def index
@snippets = SnippetsFinder.new.execute(current_user, { @snippets = SnippetsFinder.new.execute(
current_user,
filter: :by_project, filter: :by_project,
project: @project project: @project,
}) scope: params[:scope]
)
@snippets = @snippets.page(params[:page]) @snippets = @snippets.page(params[:page])
end end
......
...@@ -37,6 +37,12 @@ class SessionsController < Devise::SessionsController ...@@ -37,6 +37,12 @@ class SessionsController < Devise::SessionsController
end end
end end
def destroy
super
# hide the signed_out notice
flash[:notice] = nil
end
private private
# Handle an "initial setup" state, where there's only one user, it's an admin, # Handle an "initial setup" state, where there's only one user, it's an admin,
......
class SnippetsFinder class SnippetsFinder
def execute(current_user, params = {}) def execute(current_user, params = {})
filter = params[:filter] filter = params[:filter]
user = params.fetch(:user, current_user)
case filter case filter
when :all then when :all then
snippets(current_user).fresh snippets(current_user).fresh
when :public then
Snippet.are_public.fresh
when :by_user then when :by_user then
by_user(current_user, params[:user], params[:scope]) by_user(current_user, user, params[:scope])
when :by_project when :by_project
by_project(current_user, params[:project]) by_project(current_user, params[:project], params[:scope])
end end
end end
...@@ -29,35 +32,35 @@ class SnippetsFinder ...@@ -29,35 +32,35 @@ class SnippetsFinder
def by_user(current_user, user, scope) def by_user(current_user, user, scope)
snippets = user.snippets.fresh snippets = user.snippets.fresh
return snippets.are_public unless current_user if current_user
include_private = user == current_user
if user == current_user by_scope(snippets, scope, include_private)
case scope
when 'are_internal' then
snippets.are_internal
when 'are_private' then
snippets.are_private
when 'are_public' then
snippets.are_public
else
snippets
end
else else
snippets.public_and_internal snippets.are_public
end end
end end
def by_project(current_user, project) def by_project(current_user, project, scope)
snippets = project.snippets.fresh snippets = project.snippets.fresh
if current_user if current_user
if project.team.member?(current_user) || current_user.admin? include_private = project.team.member?(current_user) || current_user.admin?
snippets by_scope(snippets, scope, include_private)
else else
snippets.public_and_internal snippets.are_public
end end
else end
def by_scope(snippets, scope = nil, include_private = false)
case scope.to_s
when 'are_private'
include_private ? snippets.are_private : Snippet.none
when 'are_internal'
snippets.are_internal
when 'are_public'
snippets.are_public snippets.are_public
else
include_private ? snippets : snippets.public_and_internal
end end
end end
end end
...@@ -16,7 +16,7 @@ module ButtonHelper ...@@ -16,7 +16,7 @@ module ButtonHelper
# See http://clipboardjs.com/#usage # See http://clipboardjs.com/#usage
def clipboard_button(data = {}) def clipboard_button(data = {})
css_class = data[:class] || 'btn-clipboard btn-transparent' css_class = data[:class] || 'btn-clipboard btn-transparent'
title = data[:title] || 'Copy to Clipboard' title = data[:title] || 'Copy to clipboard'
data = { toggle: 'tooltip', placement: 'bottom', container: 'body' }.merge(data) data = { toggle: 'tooltip', placement: 'bottom', container: 'body' }.merge(data)
content_tag :button, content_tag :button,
icon('clipboard'), icon('clipboard'),
......
...@@ -4,25 +4,7 @@ module CiStatusHelper ...@@ -4,25 +4,7 @@ module CiStatusHelper
builds_namespace_project_commit_path(project.namespace, project, pipeline.sha) builds_namespace_project_commit_path(project.namespace, project, pipeline.sha)
end end
def ci_status_with_icon(status, target = nil) # Is used by Commit and Merge Request Widget
content = ci_icon_for_status(status) + ci_text_for_status(status)
klass = "ci-status ci-#{status}"
if target
link_to content, target, class: klass
else
content_tag :span, content, class: klass
end
end
def ci_text_for_status(status)
if detailed_status?(status)
status.text
else
status
end
end
def ci_label_for_status(status) def ci_label_for_status(status)
if detailed_status?(status) if detailed_status?(status)
return status.label return status.label
......
...@@ -14,10 +14,12 @@ module EnvironmentHelper ...@@ -14,10 +14,12 @@ module EnvironmentHelper
end end
end end
def deployment_link(deployment) def deployment_link(deployment, text: nil)
return unless deployment return unless deployment
link_to "##{deployment.iid}", [deployment.project.namespace.becomes(Namespace), deployment.project, deployment.deployable] link_label = text ? text : "##{deployment.iid}"
link_to link_label, [deployment.project.namespace.becomes(Namespace), deployment.project, deployment.deployable]
end end
def last_deployment_link_for_environment_build(project, build) def last_deployment_link_for_environment_build(project, build)
......
...@@ -159,6 +159,11 @@ module GitlabRoutingHelper ...@@ -159,6 +159,11 @@ module GitlabRoutingHelper
resend_invite_namespace_project_project_member_path(project_member.source.namespace, project_member.source, project_member) resend_invite_namespace_project_project_member_path(project_member.source.namespace, project_member.source, project_member)
end end
# Snippets
def personal_snippet_url(snippet, *args)
snippet_url(snippet)
end
# Groups # Groups
## Members ## Members
......
...@@ -8,6 +8,17 @@ module SnippetsHelper ...@@ -8,6 +8,17 @@ module SnippetsHelper
end end
end end
# Return the path of a snippets index for a user or for a project
#
# @returns String, path to snippet index
def subject_snippets_path(subject = nil, opts = nil)
if subject.is_a?(Project)
namespace_project_snippets_path(subject.namespace, subject, opts)
else # assume subject === User
dashboard_snippets_path(opts)
end
end
# Get an array of line numbers surrounding a matching # Get an array of line numbers surrounding a matching
# line, bounded by min/max. # line, bounded by min/max.
# #
......
...@@ -100,6 +100,12 @@ module Ci ...@@ -100,6 +100,12 @@ module Ci
end end
end end
def detailed_status(current_user)
Gitlab::Ci::Status::Build::Factory
.new(self, current_user)
.fabricate!
end
def manual? def manual?
self.when == 'manual' self.when == 'manual'
end end
...@@ -123,8 +129,13 @@ module Ci ...@@ -123,8 +129,13 @@ module Ci
end end
end end
def cancelable?
active?
end
def retryable? def retryable?
project.builds_enabled? && commands.present? && complete? project.builds_enabled? && commands.present? &&
(success? || failed? || canceled?)
end end
def retried? def retried?
...@@ -148,7 +159,7 @@ module Ci ...@@ -148,7 +159,7 @@ module Ci
end end
def environment_action def environment_action
self.options.fetch(:environment, {}).fetch(:action, 'start') self.options.fetch(:environment, {}).fetch(:action, 'start') if self.options
end end
def outdated_deployment? def outdated_deployment?
......
...@@ -336,8 +336,10 @@ module Ci ...@@ -336,8 +336,10 @@ module Ci
.select { |merge_request| merge_request.head_pipeline.try(:id) == self.id } .select { |merge_request| merge_request.head_pipeline.try(:id) == self.id }
end end
def detailed_status def detailed_status(current_user)
Gitlab::Ci::Status::Pipeline::Factory.new(self).fabricate! Gitlab::Ci::Status::Pipeline::Factory
.new(self, current_user)
.fabricate!
end end
private private
......
...@@ -22,8 +22,10 @@ module Ci ...@@ -22,8 +22,10 @@ module Ci
@status ||= statuses.latest.status @status ||= statuses.latest.status
end end
def detailed_status def detailed_status(current_user)
Gitlab::Ci::Status::Stage::Factory.new(self).fabricate! Gitlab::Ci::Status::Stage::Factory
.new(self, current_user)
.fabricate!
end end
def statuses def statuses
......
...@@ -131,4 +131,10 @@ class CommitStatus < ActiveRecord::Base ...@@ -131,4 +131,10 @@ class CommitStatus < ActiveRecord::Base
def has_trace? def has_trace?
false false
end end
def detailed_status(current_user)
Gitlab::Ci::Status::Factory
.new(self, current_user)
.fabricate!
end
end end
...@@ -7,6 +7,7 @@ module Routable ...@@ -7,6 +7,7 @@ module Routable
has_one :route, as: :source, autosave: true, dependent: :destroy has_one :route, as: :source, autosave: true, dependent: :destroy
validates_associated :route validates_associated :route
validates :route, presence: true
before_validation :update_route_path, if: :full_path_changed? before_validation :update_route_path, if: :full_path_changed?
end end
...@@ -28,17 +29,17 @@ module Routable ...@@ -28,17 +29,17 @@ module Routable
order_sql = "(CASE WHEN #{binary} routes.path = #{connection.quote(path)} THEN 0 ELSE 1 END)" order_sql = "(CASE WHEN #{binary} routes.path = #{connection.quote(path)} THEN 0 ELSE 1 END)"
where_paths_in([path]).reorder(order_sql).take where_full_path_in([path]).reorder(order_sql).take
end end
# Builds a relation to find multiple objects by their full paths. # Builds a relation to find multiple objects by their full paths.
# #
# Usage: # Usage:
# #
# Klass.where_paths_in(%w{gitlab-org/gitlab-ce gitlab-org/gitlab-ee}) # Klass.where_full_path_in(%w{gitlab-org/gitlab-ce gitlab-org/gitlab-ee})
# #
# Returns an ActiveRecord::Relation. # Returns an ActiveRecord::Relation.
def where_paths_in(paths) def where_full_path_in(paths)
wheres = [] wheres = []
cast_lower = Gitlab::Database.postgresql? cast_lower = Gitlab::Database.postgresql?
......
...@@ -3,7 +3,8 @@ require "addressable/uri" ...@@ -3,7 +3,8 @@ require "addressable/uri"
class BuildkiteService < CiService class BuildkiteService < CiService
ENDPOINT = "https://buildkite.com" ENDPOINT = "https://buildkite.com"
prop_accessor :project_url, :token, :enable_ssl_verification prop_accessor :project_url, :token
boolean_accessor :enable_ssl_verification
validates :project_url, presence: true, url: true, if: :activated? validates :project_url, presence: true, url: true, if: :activated?
validates :token, presence: true, if: :activated? validates :token, presence: true, if: :activated?
......
class DroneCiService < CiService class DroneCiService < CiService
prop_accessor :drone_url, :token, :enable_ssl_verification prop_accessor :drone_url, :token
boolean_accessor :enable_ssl_verification
validates :drone_url, presence: true, url: true, if: :activated? validates :drone_url, presence: true, url: true, if: :activated?
validates :token, presence: true, if: :activated? validates :token, presence: true, if: :activated?
......
class EmailsOnPushService < Service class EmailsOnPushService < Service
prop_accessor :send_from_committer_email boolean_accessor :send_from_committer_email
prop_accessor :disable_diffs boolean_accessor :disable_diffs
prop_accessor :recipients prop_accessor :recipients
validates :recipients, presence: true, if: :activated? validates :recipients, presence: true, if: :activated?
...@@ -33,11 +33,11 @@ class EmailsOnPushService < Service ...@@ -33,11 +33,11 @@ class EmailsOnPushService < Service
end end
def send_from_committer_email? def send_from_committer_email?
self.send_from_committer_email == "1" Gitlab::Utils.to_boolean(self.send_from_committer_email)
end end
def disable_diffs? def disable_diffs?
self.disable_diffs == "1" Gitlab::Utils.to_boolean(self.disable_diffs)
end end
def fields def fields
......
...@@ -8,8 +8,8 @@ class HipchatService < Service ...@@ -8,8 +8,8 @@ class HipchatService < Service
ul ol li dl dt dd ul ol li dl dt dd
] ]
prop_accessor :token, :room, :server, :notify, :color, :api_version prop_accessor :token, :room, :server, :color, :api_version
boolean_accessor :notify_only_broken_builds boolean_accessor :notify_only_broken_builds, :notify
validates :token, presence: true, if: :activated? validates :token, presence: true, if: :activated?
def initialize_properties def initialize_properties
...@@ -75,7 +75,7 @@ class HipchatService < Service ...@@ -75,7 +75,7 @@ class HipchatService < Service
end end
def message_options(data = nil) def message_options(data = nil)
{ notify: notify.present? && notify == '1', color: message_color(data) } { notify: notify.present? && Gitlab::Utils.to_boolean(notify), color: message_color(data) }
end end
def create_message(data) def create_message(data)
......
...@@ -2,7 +2,8 @@ require 'uri' ...@@ -2,7 +2,8 @@ require 'uri'
class IrkerService < Service class IrkerService < Service
prop_accessor :server_host, :server_port, :default_irc_uri prop_accessor :server_host, :server_port, :default_irc_uri
prop_accessor :colorize_messages, :recipients, :channels prop_accessor :recipients, :channels
boolean_accessor :colorize_messages
validates :recipients, presence: true, if: :activated? validates :recipients, presence: true, if: :activated?
before_validation :get_channels before_validation :get_channels
......
...@@ -220,7 +220,7 @@ class JiraService < IssueTrackerService ...@@ -220,7 +220,7 @@ class JiraService < IssueTrackerService
entity_title = data[:entity][:title] entity_title = data[:entity][:title]
project_name = data[:project][:name] project_name = data[:project][:name]
message = "[#{user_name}|#{user_url}] mentioned this issue in [a #{entity_name} of #{project_name}|#{entity_url}]:\n'#{entity_title}'" message = "[#{user_name}|#{user_url}] mentioned this issue in [a #{entity_name} of #{project_name}|#{entity_url}]:\n'#{entity_title.chomp}'"
link_title = "GitLab: Mentioned on #{entity_name} - #{entity_title}" link_title = "GitLab: Mentioned on #{entity_name} - #{entity_title}"
link_props = build_remote_link_props(url: entity_url, title: link_title) link_props = build_remote_link_props(url: entity_url, title: link_title)
......
...@@ -304,10 +304,6 @@ class User < ActiveRecord::Base ...@@ -304,10 +304,6 @@ class User < ActiveRecord::Base
personal_access_token.user if personal_access_token personal_access_token.user if personal_access_token
end end
def by_username_or_id(name_or_id)
find_by('users.username = ? OR users.id = ?', name_or_id.to_s, name_or_id.to_i)
end
# Returns a user for the given SSH key. # Returns a user for the given SSH key.
def find_by_ssh_key_id(key_id) def find_by_ssh_key_id(key_id)
find_by(id: Key.unscoped.select(:user_id).where(id: key_id)) find_by(id: Key.unscoped.select(:user_id).where(id: key_id))
......
...@@ -15,5 +15,11 @@ class GroupMemberPolicy < BasePolicy ...@@ -15,5 +15,11 @@ class GroupMemberPolicy < BasePolicy
elsif @user == target_user elsif @user == target_user
can! :destroy_group_member can! :destroy_group_member
end end
additional_rules!
end
def additional_rules!
# This is meant to be overriden in EE
end end
end end
...@@ -33,6 +33,8 @@ class GroupPolicy < BasePolicy ...@@ -33,6 +33,8 @@ class GroupPolicy < BasePolicy
if globally_viewable && @subject.request_access_enabled && !member if globally_viewable && @subject.request_access_enabled && !member
can! :request_access can! :request_access
end end
additional_rules!(master)
end end
def can_read_group? def can_read_group?
...@@ -43,4 +45,8 @@ class GroupPolicy < BasePolicy ...@@ -43,4 +45,8 @@ class GroupPolicy < BasePolicy
GroupProjectsFinder.new(@subject).execute(@user).any? GroupProjectsFinder.new(@subject).execute(@user).any?
end end
def additional_rules!(master)
# This is meant to be overriden in EE
end
end end
...@@ -6,9 +6,14 @@ class PersonalSnippetPolicy < BasePolicy ...@@ -6,9 +6,14 @@ class PersonalSnippetPolicy < BasePolicy
if @subject.author == @user if @subject.author == @user
can! :read_personal_snippet can! :read_personal_snippet
can! :update_personal_snippet can! :update_personal_snippet
can! :destroy_personal_snippet
can! :admin_personal_snippet can! :admin_personal_snippet
end end
unless @user.external?
can! :create_personal_snippet
end
if @subject.internal? && !@user.external? if @subject.internal? && !@user.external?
can! :read_personal_snippet can! :read_personal_snippet
end end
......
...@@ -35,7 +35,7 @@ module Commits ...@@ -35,7 +35,7 @@ module Commits
success success
else else
error_msg = "Sorry, we cannot #{action.to_s.dasherize} this #{@commit.change_type_title(current_user)} automatically. error_msg = "Sorry, we cannot #{action.to_s.dasherize} this #{@commit.change_type_title(current_user)} automatically.
It may have already been #{action.to_s.dasherize}, or a more recent commit may have updated some of its content." A #{action.to_s.dasherize} may have already been performed with this #{@commit.change_type_title(current_user)}, or a more recent commit may have updated some of its content."
raise ChangeError, error_msg raise ChangeError, error_msg
end end
end end
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
%span %span
Overview Overview
= nav_link(controller: [:admin, :projects]) do = nav_link(controller: [:admin, :projects]) do
= link_to admin_namespaces_projects_path, title: 'Projects' do = link_to admin_projects_path, title: 'Projects' do
%span %span
Projects Projects
= nav_link(controller: :users) do = nav_link(controller: :users) do
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
.light-well.well-centered .light-well.well-centered
%h4 Projects %h4 Projects
.data .data
= link_to admin_namespaces_projects_path do = link_to admin_projects_path do
%h1= number_with_delimiter(Project.cached_count) %h1= number_with_delimiter(Project.cached_count)
%hr %hr
= link_to('New Project', new_project_path, class: "btn btn-new") = link_to('New Project', new_project_path, class: "btn btn-new")
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
%li.group-row{ class: css_class } %li.group-row{ class: css_class }
.controls .controls
= link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: 'btn' = link_to 'Edit', admin_group_edit_path(group), id: "edit_#{dom_id(group)}", class: 'btn'
= link_to 'Delete', [:admin, group], data: { confirm: "Are you sure you want to remove #{group.name}?" }, method: :delete, class: 'btn btn-remove' = link_to 'Delete', [:admin, group], data: { confirm: "Are you sure you want to remove #{group.name}?" }, method: :delete, class: 'btn btn-remove'
.stats .stats
%span %span
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
%h3.page-title %h3.page-title
Group: #{@group.name} Group: #{@group.name}
= link_to edit_admin_group_path(@group), class: "btn pull-right" do = link_to admin_group_edit_path(@group), class: "btn pull-right" do
%i.fa.fa-pencil-square-o %i.fa.fa-pencil-square-o
Edit Edit
%hr %hr
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
Read more about project permissions Read more about project permissions
%strong= link_to "here", help_page_path("user/permissions"), class: "vlink" %strong= link_to "here", help_page_path("user/permissions"), class: "vlink"
= form_tag members_update_admin_group_path(@group), id: "new_project_member", class: "bulk_import", method: :put do = form_tag admin_group_members_update_path(@group), id: "new_project_member", class: "bulk_import", method: :put do
%div %div
= users_select_tag(:user_ids, multiple: true, email_user: true, scope: :all) = users_select_tag(:user_ids, multiple: true, email_user: true, scope: :all)
%div.prepend-top-10 %div.prepend-top-10
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
%div{ class: container_class } %div{ class: container_class }
.top-area .top-area
.prepend-top-default .prepend-top-default
= form_tag admin_namespaces_projects_path, method: :get do |f| = form_tag admin_projects_path, method: :get do |f|
.search-holder .search-holder
.search-field-holder .search-field-holder
= search_field_tag :name, params[:name], class: "form-control search-text-input js-search-input", id: "dashboard_search", autofocus: true, spellcheck: false, placeholder: 'Search by name' = search_field_tag :name, params[:name], class: "form-control search-text-input js-search-input", id: "dashboard_search", autofocus: true, spellcheck: false, placeholder: 'Search by name'
...@@ -41,19 +41,19 @@ ...@@ -41,19 +41,19 @@
= button_tag "Search", class: "btn btn-primary btn-search" = button_tag "Search", class: "btn btn-primary btn-search"
%ul.nav-links %ul.nav-links
- opts = params[:visibility_level].present? ? {} : { page: admin_namespaces_projects_path } - opts = params[:visibility_level].present? ? {} : { page: admin_projects_path }
= nav_link(opts) do = nav_link(opts) do
= link_to admin_namespaces_projects_path do = link_to admin_projects_path do
All All
= nav_link(html_options: { class: params[:visibility_level] == Gitlab::VisibilityLevel::PRIVATE.to_s ? 'active' : '' }) do = nav_link(html_options: { class: params[:visibility_level] == Gitlab::VisibilityLevel::PRIVATE.to_s ? 'active' : '' }) do
= link_to admin_namespaces_projects_path(visibility_level: Gitlab::VisibilityLevel::PRIVATE) do = link_to admin_projects_path(visibility_level: Gitlab::VisibilityLevel::PRIVATE) do
Private Private
= nav_link(html_options: { class: params[:visibility_level] == Gitlab::VisibilityLevel::INTERNAL.to_s ? 'active' : '' }) do = nav_link(html_options: { class: params[:visibility_level] == Gitlab::VisibilityLevel::INTERNAL.to_s ? 'active' : '' }) do
= link_to admin_namespaces_projects_path(visibility_level: Gitlab::VisibilityLevel::INTERNAL) do = link_to admin_projects_path(visibility_level: Gitlab::VisibilityLevel::INTERNAL) do
Internal Internal
= nav_link(html_options: { class: params[:visibility_level] == Gitlab::VisibilityLevel::PUBLIC.to_s ? 'active' : '' }) do = nav_link(html_options: { class: params[:visibility_level] == Gitlab::VisibilityLevel::PUBLIC.to_s ? 'active' : '' }) do
= link_to admin_namespaces_projects_path(visibility_level: Gitlab::VisibilityLevel::PUBLIC) do = link_to admin_projects_path(visibility_level: Gitlab::VisibilityLevel::PUBLIC) do
Public Public
.nav-controls .nav-controls
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
%strong ##{build.id} %strong ##{build.id}
%td.status %td.status
= ci_status_with_icon(build.status) = render 'ci/status/badge', status: build.detailed_status(current_user)
%td.status %td.status
- if project - if project
......
- status = local_assigns.fetch(:status)
- if status.has_details?
= link_to status.details_path, class: "ci-status ci-#{status}" do
= custom_icon(status.icon)
= status.text
- else
%span{ class: "ci-status ci-#{status}" }
= custom_icon(status.icon)
= status.text
%ul.nav-links .top-area
%ul.nav-links
= nav_link(page: dashboard_snippets_path, html_options: {class: 'home'}) do = nav_link(page: dashboard_snippets_path, html_options: {class: 'home'}) do
= link_to dashboard_snippets_path, title: 'Your snippets', data: {placement: 'right'} do = link_to dashboard_snippets_path, title: 'Your snippets', data: {placement: 'right'} do
Your Snippets Your Snippets
= nav_link(page: explore_snippets_path) do = nav_link(page: explore_snippets_path) do
= link_to explore_snippets_path, title: 'Explore snippets', data: {placement: 'right'} do = link_to explore_snippets_path, title: 'Explore snippets', data: {placement: 'right'} do
Explore Snippets Explore Snippets
- if current_user
.nav-controls.hidden-xs
= link_to new_snippet_path, class: "btn btn-new", title: "New snippet" do
New snippet
...@@ -2,41 +2,11 @@ ...@@ -2,41 +2,11 @@
- header_title "Snippets", dashboard_snippets_path - header_title "Snippets", dashboard_snippets_path
= render 'dashboard/snippets_head' = render 'dashboard/snippets_head'
= render partial: 'snippets/snippets_scope_menu', locals: { include_private: true }
.nav-block .visible-xs
.controls.hidden-xs &nbsp;
= link_to new_snippet_path, class: "btn btn-new", title: "New snippet" do
= icon('plus')
New snippet
.nav-links.snippet-scope-menu
%li{ class: ("active" unless params[:scope]) }
= link_to dashboard_snippets_path do
All
%span.badge
= current_user.snippets.count
%li{ class: ("active" if params[:scope] == "are_private") }
= link_to dashboard_snippets_path(scope: 'are_private') do
Private
%span.badge
= current_user.snippets.are_private.count
%li{ class: ("active" if params[:scope] == "are_internal") }
= link_to dashboard_snippets_path(scope: 'are_internal') do
Internal
%span.badge
= current_user.snippets.are_internal.count
%li{ class: ("active" if params[:scope] == "are_public") }
= link_to dashboard_snippets_path(scope: 'are_public') do
Public
%span.badge
= current_user.snippets.are_public.count
.visible-xs
= link_to new_snippet_path, class: "btn btn-new btn-block", title: "New snippet" do = link_to new_snippet_path, class: "btn btn-new btn-block", title: "New snippet" do
= icon('plus')
New snippet New snippet
= render 'snippets/snippets' = render partial: 'snippets/snippets', locals: { link_project: true }
...@@ -6,12 +6,4 @@ ...@@ -6,12 +6,4 @@
- else - else
= render 'explore/head' = render 'explore/head'
.row-content-block = render partial: 'snippets/snippets', locals: { link_project: true }
- if current_user
= link_to new_snippet_path, class: "btn btn-new btn-wide-on-sm pull-right", title: "New snippet" do
New snippet
.oneline
Public snippets created by you and other users are listed here
= render 'snippets/snippets'
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
- if group_issues(@group).exists? - if group_issues(@group).exists?
.top-area .top-area
= render 'shared/issuable/nav', type: :issues = render 'shared/issuable/nav', type: :issues
.nav-controls
- if current_user - if current_user
.nav-controls
= link_to url_for(params.merge(format: :atom, private_token: current_user.private_token)), class: 'btn' do = link_to url_for(params.merge(format: :atom, private_token: current_user.private_token)), class: 'btn' do
= icon('rss') = icon('rss')
%span.icon-label %span.icon-label
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
.top-area .top-area
= render 'shared/issuable/nav', type: :merge_requests = render 'shared/issuable/nav', type: :merge_requests
- if current_user
.nav-controls .nav-controls
= render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New Merge Request" = render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New Merge Request"
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
%br %br
.clearfix .clearfix
.form-group.pull-left.global-notification-setting .form-group.pull-left.global-notification-setting
= render 'shared/notifications/button', notification_setting: @global_notification_setting, left_align: true = render 'shared/notifications/button', notification_setting: @global_notification_setting
.clearfix .clearfix
......
.content-block.build-header .content-block.build-header
.header-content .header-content
= ci_status_with_icon(@build.status) = render 'ci/status/badge', status: @build.detailed_status(current_user)
Build Build
%strong ##{@build.id} %strong ##{@build.id}
in pipeline in pipeline
......
...@@ -46,8 +46,7 @@ ...@@ -46,8 +46,7 @@
- else - else
This build is creating a deployment to #{environment_link_for_build(@build.project, @build)} This build is creating a deployment to #{environment_link_for_build(@build.project, @build)}
- if environment.try(:last_deployment) - if environment.try(:last_deployment)
and will overwrite the and will overwrite the #{deployment_link(environment.last_deployment, text: 'latest deployment')}
= link_to 'latest deployment', deployment_link(environment.last_deployment)
.prepend-top-default .prepend-top-default
- if @build.erased? - if @build.erased?
......
...@@ -9,10 +9,7 @@ ...@@ -9,10 +9,7 @@
%tr.build.commit{class: ('retried' if retried)} %tr.build.commit{class: ('retried' if retried)}
%td.status %td.status
- if can?(current_user, :read_build, build) = render "ci/status/badge", status: build.detailed_status(current_user)
= ci_status_with_icon(build.status, namespace_project_build_url(build.project.namespace, build.project, build))
- else
= ci_status_with_icon(build.status)
%td.branch-commit %td.branch-commit
- if can?(current_user, :read_build, build) - if can?(current_user, :read_build, build)
......
- is_playable = subject.playable? && can?(current_user, :update_build, @project) - is_playable = subject.playable? && can?(current_user, :update_build, @project)
- if is_playable - if is_playable
= link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, data: { toggle: 'tooltip', title: "#{subject.name} - play", container: '.pipeline-graph', placement: 'bottom' } do = link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, data: { toggle: 'tooltip', title: "#{subject.name} - play", container: '.js-pipeline-graph', placement: 'bottom' } do
= ci_icon_for_status('play') = ci_icon_for_status('play')
.ci-status-text= subject.name .ci-status-text= subject.name
- elsif can?(current_user, :read_build, @project) - elsif can?(current_user, :read_build, @project)
= link_to namespace_project_build_path(subject.project.namespace, subject.project, subject), data: { toggle: 'tooltip', title: "#{subject.name} - #{subject.status}", container: '.pipeline-graph', placement: 'bottom' } do = link_to namespace_project_build_path(subject.project.namespace, subject.project, subject), data: { toggle: 'tooltip', title: "#{subject.name} - #{subject.status}", container: '.js-pipeline-graph', placement: 'bottom' } do
%span{class: "ci-status-icon ci-status-icon-#{subject.status}"} %span{class: "ci-status-icon ci-status-icon-#{subject.status}"}
= ci_icon_for_status(subject.status) = ci_icon_for_status(subject.status)
.ci-status-text= subject.name .ci-status-text= subject.name
......
- status = pipeline.status - status = pipeline.status
- detailed_status = pipeline.detailed_status
- show_commit = local_assigns.fetch(:show_commit, true) - show_commit = local_assigns.fetch(:show_commit, true)
- show_branch = local_assigns.fetch(:show_branch, true) - show_branch = local_assigns.fetch(:show_branch, true)
%tr.commit %tr.commit
%td.commit-link %td.commit-link
= link_to namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline.id), class: "ci-status ci-#{detailed_status}" do = render 'ci/status/badge', status: pipeline.detailed_status(current_user)
= ci_icon_for_status(detailed_status)
= ci_text_for_status(detailed_status)
%td %td
= link_to namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline.id) do = link_to namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline.id) do
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
%a.close{href: "#", "data-dismiss" => "modal"} × %a.close{href: "#", "data-dismiss" => "modal"} ×
%h3.page-title== #{label} this #{commit.change_type_title(current_user)} %h3.page-title== #{label} this #{commit.change_type_title(current_user)}
.modal-body .modal-body
= form_tag send("#{type.underscore}_namespace_project_commit_path", @project.namespace, @project, commit.id), method: :post, remote: false, class: 'form-horizontal js-#{type}-form js-requires-input' do = form_tag send("#{type.underscore}_namespace_project_commit_path", @project.namespace, @project, commit.id), method: :post, remote: false, class: "form-horizontal js-#{type}-form js-requires-input" do
.form-group.branch .form-group.branch
= label_tag 'target_branch', target_label, class: 'control-label' = label_tag 'target_branch', target_label, class: 'control-label'
.col-sm-10 .col-sm-10
...@@ -23,12 +23,11 @@ ...@@ -23,12 +23,11 @@
- if can?(current_user, :push_code, @project) - if can?(current_user, :push_code, @project)
.js-create-merge-request-container .js-create-merge-request-container
.checkbox .checkbox
- nonce = SecureRandom.hex = label_tag do
= label_tag "create_merge_request-#{nonce}" do = check_box_tag 'create_merge_request', 1, true, class: 'js-create-merge-request', id: nil
= check_box_tag 'create_merge_request', 1, true, class: 'js-create-merge-request', id: "create_merge_request-#{nonce}"
Start a <strong>new merge request</strong> with these changes Start a <strong>new merge request</strong> with these changes
- else - else
= hidden_field_tag 'create_merge_request', 1 = hidden_field_tag 'create_merge_request', 1, id: nil
.form-actions .form-actions
= submit_tag label, class: 'btn btn-create' = submit_tag label, class: 'btn btn-create'
= link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal" = link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal"
......
.page-content-header .page-content-header
.header-main-content .header-main-content
%strong Commit %strong
%strong.monospace.js-details-short= @commit.short_id
= link_to("#", class: "js-details-expand hidden-xs hidden-sm") do
%span.text-expander
\...
%span.js-details-content.hide
%strong.monospace.commit-hash-full= @commit.id
= clipboard_button(clipboard_text: @commit.id) = clipboard_button(clipboard_text: @commit.id)
= @commit.short_id
%span.hidden-xs authored %span.hidden-xs authored
#{time_ago_with_tooltip(@commit.authored_date)} #{time_ago_with_tooltip(@commit.authored_date)}
%span by %span by
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
in in
= time_interval_in_words pipeline.duration = time_interval_in_words pipeline.duration
.row-content-block.build-content.middle-block.hidden .row-content-block.build-content.middle-block.js-pipeline-graph.hidden
= render "projects/pipelines/graph", pipeline: pipeline = render "projects/pipelines/graph", pipeline: pipeline
- if pipeline.yaml_errors.present? - if pipeline.yaml_errors.present?
......
...@@ -8,10 +8,7 @@ ...@@ -8,10 +8,7 @@
%tr.generic_commit_status{class: ('retried' if retried)} %tr.generic_commit_status{class: ('retried' if retried)}
%td.status %td.status
- if can?(current_user, :read_commit_status, generic_commit_status) && generic_commit_status.target_url = render 'ci/status/badge', status: generic_commit_status.detailed_status(current_user)
= ci_status_with_icon(generic_commit_status.status, generic_commit_status.target_url)
- else
= ci_status_with_icon(generic_commit_status.status)
%td.generic_commit_status-link %td.generic_commit_status-link
- if can?(current_user, :read_commit_status, generic_commit_status) && generic_commit_status.target_url - if can?(current_user, :read_commit_status, generic_commit_status) && generic_commit_status.target_url
......
%a{ data: { toggle: 'tooltip', title: "#{subject.name} - #{subject.status}", container: '.pipeline-graph', placement: 'bottom' } } %a{ data: { toggle: 'tooltip', title: "#{subject.name} - #{subject.status}", container: '.js-pipeline-graph', placement: 'bottom' } }
- if subject.target_url - if subject.target_url
= link_to subject.target_url do = link_to subject.target_url do
%span{class: "ci-status-icon ci-status-icon-#{subject.status}"} %span{class: "ci-status-icon ci-status-icon-#{subject.status}"}
......
.page-content-header .page-content-header
.header-main-content .header-main-content
= ci_status_with_icon(@pipeline.detailed_status) = render 'ci/status/badge', status: @pipeline.detailed_status(current_user)
%strong Pipeline ##{@commit.pipelines.last.id} %strong Pipeline ##{@commit.pipelines.last.id}
triggered #{time_ago_with_tooltip(@commit.authored_date)} by triggered #{time_ago_with_tooltip(@commit.authored_date)} by
= author_avatar(@commit, size: 24) = author_avatar(@commit, size: 24)
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
.tab-content .tab-content
#js-tab-pipeline.tab-pane #js-tab-pipeline.tab-pane
.build-content.middle-block .build-content.middle-block.js-pipeline-graph
= render "projects/pipelines/graph", pipeline: pipeline = render "projects/pipelines/graph", pipeline: pipeline
#js-tab-builds.tab-pane #js-tab-builds.tab-pane
......
.hidden-xs .hidden-xs
- if can?(current_user, :create_project_snippet, @project)
= link_to new_namespace_project_snippet_path(@project.namespace, @project), class: 'btn btn-grouped btn-create new-snippet-link', title: "New snippet" do
New snippet
- if can?(current_user, :update_project_snippet, @snippet)
= link_to namespace_project_snippet_path(@project.namespace, @project, @snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-grouped btn-danger", title: 'Delete Snippet' do
Delete
- if can?(current_user, :update_project_snippet, @snippet) - if can?(current_user, :update_project_snippet, @snippet)
= link_to edit_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-grouped snippable-edit" do = link_to edit_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-grouped" do
Edit Edit
- if can?(current_user, :update_project_snippet, @snippet)
= link_to namespace_project_snippet_path(@project.namespace, @project, @snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-grouped btn-inverted btn-remove", title: 'Delete Snippet' do
Delete
- if can?(current_user, :create_project_snippet, @project)
= link_to new_namespace_project_snippet_path(@project.namespace, @project), class: 'btn btn-grouped btn-inverted btn-create', title: "New snippet" do
New snippet
- if can?(current_user, :create_project_snippet, @project) || can?(current_user, :update_project_snippet, @snippet) - if can?(current_user, :create_project_snippet, @project) || can?(current_user, :update_project_snippet, @snippet)
.visible-xs-block.dropdown .visible-xs-block.dropdown
%button.btn.btn-default.btn-block.append-bottom-0.prepend-top-5{ data: { toggle: "dropdown" } } %button.btn.btn-default.btn-block.append-bottom-0.prepend-top-5{ data: { toggle: "dropdown" } }
......
- page_title "Snippets" - page_title "Snippets"
.sub-header-block - if current_user
.top-area
- include_private = @project.team.member?(current_user) || current_user.admin?
= render partial: 'snippets/snippets_scope_menu', locals: { subject: @project, include_private: include_private }
.nav-controls.hidden-xs
- if can?(current_user, :create_project_snippet, @project) - if can?(current_user, :create_project_snippet, @project)
= link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new btn-wide-on-sm pull-right", title: "New snippet" do = link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new", title: "New snippet" do
New snippet New snippet
.oneline - if can?(current_user, :create_project_snippet, @project)
Share code pastes with others out of git repository .visible-xs
&nbsp;
= link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new btn-block", title: "New snippet" do
New snippet
= render 'snippets/snippets' = render 'snippets/snippets'
...@@ -19,4 +19,4 @@ ...@@ -19,4 +19,4 @@
%li.build %li.build
.curve .curve
.dropdown.inline.build-content .dropdown.inline.build-content
= render "projects/stage/in_stage_group", name: group_name, subject: grouped_statuses = render 'projects/stage/in_stage_group', name: group_name, subject: grouped_statuses
...@@ -5,14 +5,11 @@ ...@@ -5,14 +5,11 @@
%tr %tr
%th Name %th Name
%th.hidden-xs %th.hidden-xs
.pull-left Last Commit .pull-left Last commit
.last-commit.hidden-sm.pull-left .last-commit.hidden-sm.pull-left
&nbsp;
%i.fa.fa-angle-right
&nbsp;
%small.light %small.light
= clipboard_button(clipboard_text: @commit.id)
= link_to @commit.short_id, namespace_project_commit_path(@project.namespace, @project, @commit), class: "monospace" = link_to @commit.short_id, namespace_project_commit_path(@project.namespace, @project, @commit), class: "monospace"
&ndash;
= time_ago_with_tooltip(@commit.committed_date) = time_ago_with_tooltip(@commit.committed_date)
= @commit.full_title = @commit.full_title
%small.commit-history-link-spacer &#124; %small.commit-history-link-spacer &#124;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#{@message}. #{@message}.
%p %p
= link_to "See the affected projects in the GitLab admin panel", admin_namespaces_projects_url(last_repository_check_failed: 1) = link_to "See the affected projects in the GitLab admin panel", admin_projects_url(last_repository_check_failed: 1)
%p %p
You are receiving this message because you are a GitLab administrator for #{Gitlab.config.gitlab.url}. You are receiving this message because you are a GitLab administrator for #{Gitlab.config.gitlab.url}.
#{@message}. #{@message}.
\ \
View details: #{admin_namespaces_projects_url(last_repository_check_failed: 1)} View details: #{admin_projects_url(last_repository_check_failed: 1)}
You are receiving this message because you are a GitLab administrator You are receiving this message because you are a GitLab administrator
for #{Gitlab.config.gitlab.url}. for #{Gitlab.config.gitlab.url}.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
= link_to snippet_title.project.name_with_namespace, namespace_project_path(snippet_title.project.namespace, snippet_title.project) = link_to snippet_title.project.name_with_namespace, namespace_project_path(snippet_title.project.namespace, snippet_title.project)
.snippet-info .snippet-info
= "##{snippet_title.id}" = snippet_title.to_reference
%span %span
by by
= link_to user_snippets_path(snippet_title.author) do = link_to user_snippets_path(snippet_title.author) do
......
<svg width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><g fill-rule="evenodd"><path d="M0 7a7 7 0 1 1 14 0A7 7 0 0 1 0 7z"/><path d="M13 7A6 6 0 1 0 1 7a6 6 0 0 0 12 0z" fill="#FFF"/><path d="M10.5 7.63V6.37l-.787-.13c-.044-.175-.132-.349-.263-.61l.481-.652-.918-.913-.657.478a2.346 2.346 0 0 0-.612-.26L7.656 3.5H6.388l-.132.783c-.219.043-.394.13-.612.26l-.657-.478-.918.913.437.652c-.131.218-.175.392-.262.61l-.744.086v1.261l.787.13c.044.218.132.392.263.61l-.438.651.92.913.655-.434c.175.086.394.173.613.26l.131.783h1.313l.131-.783c.219-.043.394-.13.613-.26l.656.478.918-.913-.48-.652c.13-.218.218-.435.262-.61l.656-.13zM7 8.283a1.285 1.285 0 0 1-1.313-1.305c0-.739.57-1.304 1.313-1.304.744 0 1.313.565 1.313 1.304 0 .74-.57 1.305-1.313 1.305z"/></g></svg>
- left_align = local_assigns[:left_align]
- if notification_setting - if notification_setting
.dropdown.notification-dropdown .dropdown.notification-dropdown
= form_for notification_setting, remote: true, html: { class: "inline notification-form" } do |f| = form_for notification_setting, remote: true, html: { class: "inline notification-form" } do |f|
...@@ -19,7 +18,7 @@ ...@@ -19,7 +18,7 @@
= notification_title(notification_setting.level) = notification_title(notification_setting.level)
= icon("caret-down") = icon("caret-down")
= render "shared/notifications/notification_dropdown", notification_setting: notification_setting, left_align: left_align = render "shared/notifications/notification_dropdown", notification_setting: notification_setting
= content_for :scripts_body do = content_for :scripts_body do
= render "shared/notifications/custom_notifications", notification_setting: notification_setting = render "shared/notifications/custom_notifications", notification_setting: notification_setting
- left_align = local_assigns[:left_align] %ul.dropdown-menu.dropdown-menu-no-wrap.dropdown-menu-selectable.dropdown-menu-large{ role: "menu", class: [notifications_menu_identifier("dropdown", notification_setting)] }
%ul.dropdown-menu.dropdown-menu-no-wrap.dropdown-menu-selectable.dropdown-menu-large{ role: "menu", class: [notifications_menu_identifier("dropdown", notification_setting), ("dropdown-menu-align-right" unless left_align)] }
- NotificationSetting.levels.each_key do |level| - NotificationSetting.levels.each_key do |level|
- next if level == "custom" - next if level == "custom"
- next if level == "global" && notification_setting.source.nil? - next if level == "global" && notification_setting.source.nil?
......
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
%span.creator %span.creator
authored authored
= time_ago_with_tooltip(@snippet.created_at, placement: 'bottom', html_class: 'snippet_updated_ago') = time_ago_with_tooltip(@snippet.created_at, placement: 'bottom', html_class: 'snippet_updated_ago')
- if @snippet.updated_at != @snippet.created_at
%span
= icon('edit', title: 'edited')
= time_ago_with_tooltip(@snippet.updated_at, placement: 'bottom', html_class: 'snippet_edited_ago')
by #{link_to_member(@project, @snippet.author, size: 24, author_class: "author item-title", avatar_class: "hidden-xs")} by #{link_to_member(@project, @snippet.author, size: 24, author_class: "author item-title", avatar_class: "hidden-xs")}
.snippet-actions .snippet-actions
...@@ -20,5 +16,9 @@ ...@@ -20,5 +16,9 @@
- else - else
= render "snippets/actions" = render "snippets/actions"
%h2.snippet-title.prepend-top-0.append-bottom-0 .snippet-header
%h2.snippet-title.prepend-top-0.append-bottom-0
= markdown_field(@snippet, :title) = markdown_field(@snippet, :title)
- if @snippet.updated_at != @snippet.created_at
= edited_time_ago_with_tooltip(@snippet, placement: 'bottom', html_class: 'snippet-edited-ago')
- link_project = local_assigns.fetch(:link_project, false)
%li.snippet-row %li.snippet-row
= image_tag avatar_icon(snippet.author_email), class: "avatar s40 hidden-xs", alt: '' = image_tag avatar_icon(snippet.author_email), class: "avatar s40 hidden-xs", alt: ''
.title .title
= link_to reliable_snippet_path(snippet) do = link_to reliable_snippet_path(snippet) do
= snippet.title = snippet.title
- if snippet.private? - if snippet.file_name
%span.label.label-gray.hidden-xs %span.snippet-filename.monospace.hidden-xs
= icon('lock')
private
%span.monospace.pull-right.hidden-xs
= snippet.file_name = snippet.file_name
%ul.controls.visible-xs %ul.controls
%li %li
- note_count = snippet.notes.user.count - note_count = snippet.notes.user.count
= link_to reliable_snippet_path(snippet, anchor: 'notes'), class: ('no-comments' if note_count.zero?) do = link_to reliable_snippet_path(snippet, anchor: 'notes'), class: ('no-comments' if note_count.zero?) do
...@@ -22,11 +21,17 @@ ...@@ -22,11 +21,17 @@
= visibility_level_label(snippet.visibility_level) = visibility_level_label(snippet.visibility_level)
= visibility_level_icon(snippet.visibility_level, fw: false) = visibility_level_icon(snippet.visibility_level, fw: false)
%small.pull-right.cgray.hidden-xs .snippet-info
- if snippet.project_id? #{snippet.to_reference} &middot;
= link_to snippet.project.name_with_namespace, namespace_project_path(snippet.project.namespace, snippet.project) authored #{time_ago_with_tooltip(snippet.created_at, placement: 'bottom', html_class: 'snippet-created-ago')}
by
.snippet-info.hidden-xs
= link_to user_snippets_path(snippet.author) do = link_to user_snippets_path(snippet.author) do
= snippet.author_name = snippet.author_name
authored #{time_ago_with_tooltip(snippet.created_at)} - if link_project && snippet.project_id?
%span.hidden-xs
in
= link_to namespace_project_path(snippet.project.namespace, snippet.project) do
= snippet.project.name_with_namespace
.pull-right.snippet-updated-at
%span updated #{time_ago_with_tooltip(snippet.updated_at, placement: 'bottom')}
.hidden-xs .hidden-xs
- if current_user
= link_to new_snippet_path, class: "btn btn-grouped btn-create new-snippet-link", title: "New snippet" do
New snippet
- if can?(current_user, :admin_personal_snippet, @snippet)
= link_to snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-grouped btn-danger", title: 'Delete Snippet' do
Delete
- if can?(current_user, :update_personal_snippet, @snippet) - if can?(current_user, :update_personal_snippet, @snippet)
= link_to edit_snippet_path(@snippet), class: "btn btn-grouped snippable-edit" do = link_to edit_snippet_path(@snippet), class: "btn btn-grouped" do
Edit Edit
- if can?(current_user, :admin_personal_snippet, @snippet)
= link_to snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-grouped btn-inverted btn-remove", title: 'Delete Snippet' do
Delete
- if current_user
= link_to new_snippet_path, class: "btn btn-grouped btn-inverted btn-create", title: "New snippet" do
New snippet
- if current_user - if current_user
.visible-xs-block.dropdown .visible-xs-block.dropdown
%button.btn.btn-default.btn-block.append-bottom-0.prepend-top-5{ data: { toggle: "dropdown" } } %button.btn.btn-default.btn-block.append-bottom-0.prepend-top-5{ data: { toggle: "dropdown" } }
......
- remote = local_assigns.fetch(:remote, false) - remote = local_assigns.fetch(:remote, false)
- link_project = local_assigns.fetch(:link_project, false)
.snippets-list-holder .snippets-list-holder
%ul.content-list %ul.content-list
= render partial: 'shared/snippets/snippet', collection: @snippets = render partial: 'shared/snippets/snippet', collection: @snippets, locals: { link_project: link_project }
- if @snippets.empty? - if @snippets.empty?
%li %li
.nothing-here-block Nothing here. .nothing-here-block Nothing here.
......
- subject = local_assigns.fetch(:subject, current_user)
- include_private = local_assigns.fetch(:include_private, false)
.nav-links.snippet-scope-menu
%li{ class: ("active" unless params[:scope]) }
= link_to subject_snippets_path(subject) do
All
%span.badge
- if include_private
= subject.snippets.count
- else
= subject.snippets.public_and_internal.count
- if include_private
%li{ class: ("active" if params[:scope] == "are_private") }
= link_to subject_snippets_path(subject, scope: 'are_private') do
Private
%span.badge
= subject.snippets.are_private.count
%li{ class: ("active" if params[:scope] == "are_internal") }
= link_to subject_snippets_path(subject, scope: 'are_internal') do
Internal
%span.badge
= subject.snippets.are_internal.count
%li{ class: ("active" if params[:scope] == "are_public") }
= link_to subject_snippets_path(subject, scope: 'are_public') do
Public
%span.badge
= subject.snippets.are_public.count
---
title: group authors in contribution graph with case insensitive email handle comparison
merge_request: 8021
author:
---
title: Prevent overflow with vertical scroll when we have space to show content
merge_request: 8061
author:
---
title: Use SmartInterval for MR widget and improve visibilitychange functionality
merge_request: 7762
author:
---
title: Prevent user creating issue or MR without signing in for a group
merge_request: 7902
author:
---
title: Fix Latest deployment link is broken
merge_request: 7839
author:
---
title: 'fix: removed signed_out notification'
merge_request: 7958
author: jnoortheen
---
title: 'API: Memoize the current_user so that sudo can work properly'
merge_request: 8017
author:
---
title: Fix TypeError: Cannot read property 'initTabs' on commit builds tab
merge_request: 8009
author:
---
title: Allow all alphanumeric characters in file names
merge_request: 8002
author: winniehell
---
title: 'API: Ability to cherry pick a commit'
merge_request: 8047
author: Robert Schilling
---
title: 'API: Simple representation of group''s projects'
merge_request: 8060
author: Robert Schilling
---
title: Replace static fixture for awards_handler_spec
merge_request: 7661
author: winniehell
---
title: For single line git commit messages, the close quote should be on the same
line as the open quote
merge_request:
author:
---
title: 'API: Endpoint to expose personal snippets as /snippets'
merge_request: 6373
author: Bernard Guyzmo Pratz
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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