-
-
-
{{file_status_text}} {{ status }}
+
+
+
+ {{ file_status_text }}
+ {{ status }}
+
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 13b577774..140a855a0 100755
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -15,18 +15,27 @@ import initGitGraph from './features/gitgraph.js';
import initClipboard from './features/clipboard.js';
import initUserHeatmap from './features/userheatmap.js';
import initDateTimePicker from './features/datetimepicker.js';
-import {initTribute, issuesTribute, emojiTribute} from './features/tribute.js';
+import {
+ initTribute,
+ issuesTribute,
+ emojiTribute
+} from './features/tribute.js';
import createDropzone from './features/dropzone.js';
import highlight from './features/highlight.js';
import ActivityTopAuthors from './components/ActivityTopAuthors.vue';
-import {initNotificationsTable, initNotificationCount} from './features/notification.js';
+import {
+ initNotificationsTable,
+ initNotificationCount
+} from './features/notification.js';
import {createCodeEditor} from './features/codeeditor.js';
import MinioUploader from './components/MinioUploader.vue';
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
function htmlEncode(text) {
- return jQuery('
').text(text).html();
+ return jQuery('
')
+ .text(text)
+ .html();
}
let previewFileModes;
@@ -38,21 +47,31 @@ $.fn.tab.settings.silent = true;
function initCommentPreviewTab($form) {
const $tabMenu = $form.find('.tabular.menu');
$tabMenu.find('.item').tab();
- $tabMenu.find(`.item[data-tab="${$tabMenu.data('preview')}"]`).on('click', function () {
- const $this = $(this);
- $.post($this.data('url'), {
- _csrf: csrf,
- mode: 'gfm',
- context: $this.data('context'),
- text: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val()
- }, (data) => {
- const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`);
- $previewPanel.html(data);
- $('pre code', $previewPanel[0]).each(function () {
- highlight(this);
- });
+ $tabMenu
+ .find(`.item[data-tab="${$tabMenu.data('preview')}"]`)
+ .on('click', function () {
+ const $this = $(this);
+ $.post(
+ $this.data('url'),
+ {
+ _csrf: csrf,
+ mode: 'gfm',
+ context: $this.data('context'),
+ text: $form
+ .find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`)
+ .val()
+ },
+ (data) => {
+ const $previewPanel = $form.find(
+ `.tab[data-tab="${$tabMenu.data('preview')}"]`
+ );
+ $previewPanel.html(data);
+ $('pre code', $previewPanel[0]).each(function () {
+ highlight(this);
+ });
+ }
+ );
});
- });
buttonsClickOnEnter();
}
@@ -60,7 +79,9 @@ function initCommentPreviewTab($form) {
function initEditPreviewTab($form) {
const $tabMenu = $form.find('.tabular.menu');
$tabMenu.find('.item').tab();
- const $previewTab = $tabMenu.find(`.item[data-tab="${$tabMenu.data('preview')}"]`);
+ const $previewTab = $tabMenu.find(
+ `.item[data-tab="${$tabMenu.data('preview')}"]`
+ );
if ($previewTab.length) {
previewFileModes = $previewTab.data('preview-file-modes').split(',');
$previewTab.on('click', function () {
@@ -71,18 +92,26 @@ function initEditPreviewTab($form) {
context += treePathEl.val();
}
context = context.substring(0, context.lastIndexOf('/'));
- $.post($this.data('url'), {
- _csrf: csrf,
- mode: 'gfm',
- context,
- text: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val()
- }, (data) => {
- const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`);
- $previewPanel.html(data);
- $('pre code', $previewPanel[0]).each(function () {
- highlight(this);
- });
- });
+ $.post(
+ $this.data('url'),
+ {
+ _csrf: csrf,
+ mode: 'gfm',
+ context,
+ text: $form
+ .find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`)
+ .val()
+ },
+ (data) => {
+ const $previewPanel = $form.find(
+ `.tab[data-tab="${$tabMenu.data('preview')}"]`
+ );
+ $previewPanel.html(data);
+ $('pre code', $previewPanel[0]).each(function () {
+ highlight(this);
+ });
+ }
+ );
});
}
}
@@ -90,17 +119,27 @@ function initEditPreviewTab($form) {
function initEditDiffTab($form) {
const $tabMenu = $form.find('.tabular.menu');
$tabMenu.find('.item').tab();
- $tabMenu.find(`.item[data-tab="${$tabMenu.data('diff')}"]`).on('click', function () {
- const $this = $(this);
- $.post($this.data('url'), {
- _csrf: csrf,
- context: $this.data('context'),
- content: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val()
- }, (data) => {
- const $diffPreviewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('diff')}"]`);
- $diffPreviewPanel.html(data);
+ $tabMenu
+ .find(`.item[data-tab="${$tabMenu.data('diff')}"]`)
+ .on('click', function () {
+ const $this = $(this);
+ $.post(
+ $this.data('url'),
+ {
+ _csrf: csrf,
+ context: $this.data('context'),
+ content: $form
+ .find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`)
+ .val()
+ },
+ (data) => {
+ const $diffPreviewPanel = $form.find(
+ `.tab[data-tab="${$tabMenu.data('diff')}"]`
+ );
+ $diffPreviewPanel.html(data);
+ }
+ );
});
- });
}
function initEditForm() {
@@ -123,13 +162,15 @@ function initBranchSelector() {
$selectBranch.find('.scrolling.reference-list-menu').css('display', 'none');
$selectBranch.find('.reference .text').removeClass('black');
$($(this).data('target')).css('display', 'block');
- $(this).find('.text').addClass('black');
+ $(this)
+ .find('.text')
+ .addClass('black');
return false;
});
}
function initLabelEdit() {
-// Create label
+ // Create label
const $newLabelPanel = $('.new-label.segment');
$('.new-label.button').on('click', () => {
$newLabelPanel.show();
@@ -151,18 +192,23 @@ function initLabelEdit() {
$('.edit-label .new-label-input').val($(this).data('title'));
$('.edit-label .new-label-desc-input').val($(this).data('description'));
$('.edit-label .color-picker').val($(this).data('color'));
- $('.minicolors-swatch-color').css('background-color', $(this).data('color'));
- $('.edit-label.modal').modal({
- onApprove() {
- $('.edit-label.form').trigger('submit');
- }
- }).modal('show');
+ $('.minicolors-swatch-color').css(
+ 'background-color',
+ $(this).data('color')
+ );
+ $('.edit-label.modal')
+ .modal({
+ onApprove() {
+ $('.edit-label.form').trigger('submit');
+ }
+ })
+ .modal('show');
return false;
});
}
function updateIssuesMeta(url, action, issueIds, elementId, isAdd) {
- return new Promise(((resolve) => {
+ return new Promise((resolve) => {
$.ajax({
type: 'POST',
url,
@@ -175,7 +221,7 @@ function updateIssuesMeta(url, action, issueIds, elementId, isAdd) {
},
success: resolve
});
- }));
+ });
}
function initRepoStatusChecker() {
@@ -190,7 +236,7 @@ function initRepoStatusChecker() {
type: 'GET',
url: `${AppSubUrl}/${repo_name}/status`,
data: {
- _csrf: csrf,
+ _csrf: csrf
},
complete(xhr) {
if (xhr.status === 200) {
@@ -220,52 +266,66 @@ function initReactionSelector(parent) {
reactions = '.reactions > ';
}
- parent.find(`${reactions}a.label`).popup({position: 'bottom left', metadata: {content: 'title', title: 'none'}});
-
- parent.find(`.select-reaction > .menu > .item, ${reactions}a.label`).on('click', function (e) {
- const vm = this;
- e.preventDefault();
+ parent.find(`${reactions}a.label`).popup({
+ position: 'bottom left',
+ metadata: {content: 'title', title: 'none'}
+ });
- if ($(this).hasClass('disabled')) return;
+ parent
+ .find(`.select-reaction > .menu > .item, ${reactions}a.label`)
+ .on('click', function (e) {
+ const vm = this;
+ e.preventDefault();
- const actionURL = $(this).hasClass('item') ? $(this).closest('.select-reaction').data('action-url') : $(this).data('action-url');
- const url = `${actionURL}/${$(this).hasClass('blue') ? 'unreact' : 'react'}`;
- $.ajax({
- type: 'POST',
- url,
- data: {
- _csrf: csrf,
- content: $(this).data('content')
- }
- }).done((resp) => {
- if (resp && (resp.html || resp.empty)) {
- const content = $(vm).closest('.content');
- let react = content.find('.segment.reactions');
- if (!resp.empty && react.length > 0) {
- react.remove();
+ if ($(this).hasClass('disabled')) return;
+
+ const actionURL = $(this).hasClass('item') ?
+ $(this)
+ .closest('.select-reaction')
+ .data('action-url') :
+ $(this).data('action-url');
+ const url = `${actionURL}/${
+ $(this).hasClass('blue') ? 'unreact' : 'react'
+ }`;
+ $.ajax({
+ type: 'POST',
+ url,
+ data: {
+ _csrf: csrf,
+ content: $(this).data('content')
}
- if (!resp.empty) {
- react = $('
');
- const attachments = content.find('.segment.bottom:first');
- if (attachments.length > 0) {
- react.insertBefore(attachments);
- } else {
- react.appendTo(content);
+ }).done((resp) => {
+ if (resp && (resp.html || resp.empty)) {
+ const content = $(vm).closest('.content');
+ let react = content.find('.segment.reactions');
+ if (!resp.empty && react.length > 0) {
+ react.remove();
+ }
+ if (!resp.empty) {
+ react = $('
');
+ const attachments = content.find('.segment.bottom:first');
+ if (attachments.length > 0) {
+ react.insertBefore(attachments);
+ } else {
+ react.appendTo(content);
+ }
+ react.html(resp.html);
+ react.find('.dropdown').dropdown();
+ initReactionSelector(react);
}
- react.html(resp.html);
- react.find('.dropdown').dropdown();
- initReactionSelector(react);
}
- }
+ });
});
- });
}
function insertAtCursor(field, value) {
if (field.selectionStart || field.selectionStart === 0) {
const startPos = field.selectionStart;
const endPos = field.selectionEnd;
- field.value = field.value.substring(0, startPos) + value + field.value.substring(endPos, field.value.length);
+ field.value =
+ field.value.substring(0, startPos) +
+ value +
+ field.value.substring(endPos, field.value.length);
field.selectionStart = startPos + value.length;
field.selectionEnd = startPos + value.length;
} else {
@@ -299,7 +359,7 @@ function retrieveImageFromClipboardAsBlob(pasteEvent, callback) {
if (!items[i].type.includes('image')) continue;
const blob = items[i].getAsFile();
- if (typeof (callback) === 'function') {
+ if (typeof callback === 'function') {
pasteEvent.preventDefault();
pasteEvent.stopPropagation();
callback(blob);
@@ -330,18 +390,28 @@ function reload() {
function initImagePaste(target) {
target.each(function () {
const field = this;
- field.addEventListener('paste', (event) => {
- retrieveImageFromClipboardAsBlob(event, (img) => {
- const name = img.name.substr(0, img.name.lastIndexOf('.'));
- insertAtCursor(field, `![${name}]()`);
- uploadFile(img, (res) => {
- const data = JSON.parse(res);
- replaceAndKeepCursor(field, `![${name}]()`, ``);
- const input = $(`
`).val(data.uuid);
- $('.files').append(input);
+ field.addEventListener(
+ 'paste',
+ (event) => {
+ retrieveImageFromClipboardAsBlob(event, (img) => {
+ const name = img.name.substr(0, img.name.lastIndexOf('.'));
+ insertAtCursor(field, `![${name}]()`);
+ uploadFile(img, (res) => {
+ const data = JSON.parse(res);
+ replaceAndKeepCursor(
+ field,
+ `![${name}]()`,
+ ``
+ );
+ const input = $(
+ `
`
+ ).val(data.uuid);
+ $('.files').append(input);
+ });
});
- });
- }, false);
+ },
+ false
+ );
});
}
@@ -352,8 +422,13 @@ function initSimpleMDEImagePaste(simplemde, files) {
uploadFile(img, (res) => {
const data = JSON.parse(res);
const pos = simplemde.codemirror.getCursor();
- simplemde.codemirror.replaceRange(``, pos);
- const input = $(`
`).val(data.uuid);
+ simplemde.codemirror.replaceRange(
+ ``,
+ pos
+ );
+ const input = $(
+ `
`
+ ).val(data.uuid);
files.append(input);
});
});
@@ -367,7 +442,9 @@ function initCommentForm() {
return;
}
- autoSimpleMDE = setCommentSimpleMDE($('.comment.form textarea:not(.review-textarea)'));
+ autoSimpleMDE = setCommentSimpleMDE(
+ $('.comment.form textarea:not(.review-textarea)')
+ );
initBranchSelector();
initCommentPreviewTab($('.comment.form'));
initImagePaste($('.comment.form textarea'));
@@ -401,7 +478,10 @@ function initCommentForm() {
$listMenu.find('.item:not(.no-select)').on('click', function () {
// we don't need the action attribute when updating assignees
- if (selector === 'select-assignees-modify' || selector === 'select-reviewers-modify') {
+ if (
+ selector === 'select-assignees-modify' ||
+ selector === 'select-reviewers-modify'
+ ) {
// UI magic. We need to do this here, otherwise it would destroy the functionality of
// adding/removing labels
@@ -411,11 +491,15 @@ function initCommentForm() {
if ($(this).hasClass('checked')) {
$(this).removeClass('checked');
- $(this).find('.octicon-check').addClass('invisible');
+ $(this)
+ .find('.octicon-check')
+ .addClass('invisible');
$(this).data('is-checked', 'remove');
} else {
$(this).addClass('checked');
- $(this).find('.octicon-check').removeClass('invisible');
+ $(this)
+ .find('.octicon-check')
+ .removeClass('invisible');
$(this).data('is-checked', 'add');
}
@@ -432,13 +516,15 @@ function initCommentForm() {
if ($(this).hasClass('checked')) {
$(this).removeClass('checked');
- $(this).find('.octicon-check').addClass('invisible');
+ $(this)
+ .find('.octicon-check')
+ .addClass('invisible');
if (hasLabelUpdateAction) {
if (!($(this).data('id') in labels)) {
labels[$(this).data('id')] = {
'update-url': $listMenu.data('update-url'),
action: 'detach',
- 'issue-id': $listMenu.data('issue-id'),
+ 'issue-id': $listMenu.data('issue-id')
};
} else {
delete labels[$(this).data('id')];
@@ -446,13 +532,15 @@ function initCommentForm() {
}
} else {
$(this).addClass('checked');
- $(this).find('.octicon-check').removeClass('invisible');
+ $(this)
+ .find('.octicon-check')
+ .removeClass('invisible');
if (hasLabelUpdateAction) {
if (!($(this).data('id') in labels)) {
labels[$(this).data('id')] = {
'update-url': $listMenu.data('update-url'),
action: 'attach',
- 'issue-id': $listMenu.data('issue-id'),
+ 'issue-id': $listMenu.data('issue-id')
};
} else {
delete labels[$(this).data('id')];
@@ -461,20 +549,27 @@ function initCommentForm() {
}
const listIds = [];
- $(this).parent().find('.item').each(function () {
- if ($(this).hasClass('checked')) {
- listIds.push($(this).data('id'));
- $($(this).data('id-selector')).removeClass('hide');
- } else {
- $($(this).data('id-selector')).addClass('hide');
- }
- });
+ $(this)
+ .parent()
+ .find('.item')
+ .each(function () {
+ if ($(this).hasClass('checked')) {
+ listIds.push($(this).data('id'));
+ $($(this).data('id-selector')).removeClass('hide');
+ } else {
+ $($(this).data('id-selector')).addClass('hide');
+ }
+ });
if (listIds.length === 0) {
$noSelect.removeClass('hide');
} else {
$noSelect.addClass('hide');
}
- $($(this).parent().data('id')).val(listIds.join(','));
+ $(
+ $(this)
+ .parent()
+ .data('id')
+ ).val(listIds.join(','));
return false;
});
$listMenu.find('.no-select.item').on('click', function () {
@@ -488,17 +583,26 @@ function initCommentForm() {
).then(reload);
}
- $(this).parent().find('.item').each(function () {
- $(this).removeClass('checked');
- $(this).find('.octicon').addClass('invisible');
- $(this).data('is-checked', 'remove');
- });
+ $(this)
+ .parent()
+ .find('.item')
+ .each(function () {
+ $(this).removeClass('checked');
+ $(this)
+ .find('.octicon')
+ .addClass('invisible');
+ $(this).data('is-checked', 'remove');
+ });
$list.find('.item').each(function () {
$(this).addClass('hide');
});
$noSelect.removeClass('hide');
- $($(this).parent().data('id')).val('');
+ $(
+ $(this)
+ .parent()
+ .data('id')
+ ).val('');
});
}
@@ -514,9 +618,12 @@ function initCommentForm() {
const hasUpdateAction = $menu.data('action') === 'update';
$menu.find('.item:not(.no-select)').on('click', function () {
- $(this).parent().find('.item').each(function () {
- $(this).removeClass('selected active');
- });
+ $(this)
+ .parent()
+ .find('.item')
+ .each(function () {
+ $(this).removeClass('selected active');
+ });
$(this).addClass('selected active');
if (hasUpdateAction) {
@@ -530,21 +637,34 @@ function initCommentForm() {
}
switch (input_id) {
case '#milestone_id':
- $list.find('.selected').html(`
${
- htmlEncode($(this).text())}`);
+ $list
+ .find('.selected')
+ .html(
+ `
${htmlEncode(
+ $(this).text()
+ )}`
+ );
break;
case '#assignee_id':
- $list.find('.selected').html(`
` +
- `
${
- htmlEncode($(this).text())}`);
+ $list
+ .find('.selected')
+ .html(
+ `
` +
+ `
${htmlEncode($(this).text())}`
+ );
}
$(`.ui${select_id}.list .no-select`).addClass('hide');
$(input_id).val($(this).data('id'));
});
$menu.find('.no-select.item').on('click', function () {
- $(this).parent().find('.item:not(.no-select)').each(function () {
- $(this).removeClass('selected active');
- });
+ $(this)
+ .parent()
+ .find('.item:not(.no-select)')
+ .each(function () {
+ $(this).removeClass('selected active');
+ });
if (hasUpdateAction) {
updateIssuesMeta(
@@ -669,13 +789,7 @@ function initIssueComments() {
const isChecked = $(this).data('is-checked');
event.preventDefault();
- updateIssuesMeta(
- url,
- '',
- issueId,
- id,
- isChecked
- ).then(reload);
+ updateIssuesMeta(url, '', issueId, id, isChecked).then(reload);
});
$(document).on('click', (event) => {
@@ -717,7 +831,10 @@ async function initRepository() {
}
// File list and commits
- if ($('.repository.file.list').length > 0 || ('.repository.commits').length > 0) {
+ if (
+ $('.repository.file.list').length > 0 ||
+ '.repository.commits'.length > 0
+ ) {
initFilterBranchTagDropdown('.choose.reference .dropdown');
}
@@ -732,19 +849,27 @@ async function initRepository() {
$('.enable-system').on('change', function () {
if (this.checked) {
$($(this).data('target')).removeClass('disabled');
- if (!$(this).data('context')) $($(this).data('context')).addClass('disabled');
+ if (!$(this).data('context')) {
+ $($(this).data('context')).addClass('disabled');
+ }
} else {
$($(this).data('target')).addClass('disabled');
- if (!$(this).data('context')) $($(this).data('context')).removeClass('disabled');
+ if (!$(this).data('context')) {
+ $($(this).data('context')).removeClass('disabled');
+ }
}
});
$('.enable-system-radio').on('change', function () {
if (this.value === 'false') {
$($(this).data('target')).addClass('disabled');
- if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).removeClass('disabled');
+ if (typeof $(this).data('context') !== 'undefined') {
+ $($(this).data('context')).removeClass('disabled');
+ }
} else if (this.value === 'true') {
$($(this).data('target')).removeClass('disabled');
- if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).addClass('disabled');
+ if (typeof $(this).data('context') !== 'undefined') {
+ $($(this).data('context')).addClass('disabled');
+ }
}
});
}
@@ -766,7 +891,7 @@ async function initRepository() {
startDate: $datepicker.data('start-date'),
onSelectDate(date) {
$('#deadline').val(date.toISOString().substring(0, 10));
- },
+ }
});
$('#clear-date').on('click', () => {
$('#deadline').val('');
@@ -798,50 +923,65 @@ async function initRepository() {
const branchNameOld = selectionTextField.data('branch');
// Replace branch name to keep translation from HTML template
- selectionTextField.html(selectionTextField.html().replace(
- `${baseName}:${branchNameOld}`,
- `${baseName}:${branchNameNew}`
- ));
+ selectionTextField.html(
+ selectionTextField
+ .html()
+ .replace(
+ `${baseName}:${branchNameOld}`,
+ `${baseName}:${branchNameNew}`
+ )
+ );
selectionTextField.data('branch', branchNameNew); // update branch name in setting
};
$('#branch-select > .item').on('click', changeBranchSelect);
$('#edit-title').on('click', editTitleToggle);
$('#cancel-edit-title').on('click', editTitleToggle);
- $('#save-edit-title').on('click', editTitleToggle).on('click', function () {
- const pullrequest_targetbranch_change = function (update_url) {
- const targetBranch = $('#pull-target-branch').data('branch');
- const $branchTarget = $('#branch_target');
- if (targetBranch === $branchTarget.text()) {
- return false;
- }
- $.post(update_url, {
- _csrf: csrf,
- target_branch: targetBranch
- }).done((data) => {
- $branchTarget.text(data.base_branch);
- }).always(() => {
- reload();
- });
- };
+ $('#save-edit-title')
+ .on('click', editTitleToggle)
+ .on('click', function () {
+ const pullrequest_targetbranch_change = function (update_url) {
+ const targetBranch = $('#pull-target-branch').data('branch');
+ const $branchTarget = $('#branch_target');
+ if (targetBranch === $branchTarget.text()) {
+ return false;
+ }
+ $.post(update_url, {
+ _csrf: csrf,
+ target_branch: targetBranch
+ })
+ .done((data) => {
+ $branchTarget.text(data.base_branch);
+ })
+ .always(() => {
+ reload();
+ });
+ };
- const pullrequest_target_update_url = $(this).data('target-update-url');
- if ($editInput.val().length === 0 || $editInput.val() === $issueTitle.text()) {
- $editInput.val($issueTitle.text());
- pullrequest_targetbranch_change(pullrequest_target_update_url);
- } else {
- $.post($(this).data('update-url'), {
- _csrf: csrf,
- title: $editInput.val()
- }, (data) => {
- $editInput.val(data.title);
- $issueTitle.text(data.title);
+ const pullrequest_target_update_url = $(this).data('target-update-url');
+ if (
+ $editInput.val().length === 0 ||
+ $editInput.val() === $issueTitle.text()
+ ) {
+ $editInput.val($issueTitle.text());
pullrequest_targetbranch_change(pullrequest_target_update_url);
- reload();
- });
- }
- return false;
- });
+ } else {
+ $.post(
+ $(this).data('update-url'),
+ {
+ _csrf: csrf,
+ title: $editInput.val()
+ },
+ (data) => {
+ $editInput.val(data.title);
+ $issueTitle.text(data.title);
+ pullrequest_targetbranch_change(pullrequest_target_update_url);
+ reload();
+ }
+ );
+ }
+ return false;
+ });
// Issue Comments
initIssueComments();
@@ -853,9 +993,14 @@ async function initRepository() {
// Quote reply
$('.quote-reply').on('click', function (event) {
- $(this).closest('.dropdown').find('.menu').toggle('visible');
+ $(this)
+ .closest('.dropdown')
+ .find('.menu')
+ .toggle('visible');
const target = $(this).data('target');
- const quote = $(`#comment-${target}`).text().replace(/\n/g, '\n> ');
+ const quote = $(`#comment-${target}`)
+ .text()
+ .replace(/\n/g, '\n> ');
const content = `> ${quote}\n\n`;
let $content;
@@ -881,8 +1026,13 @@ async function initRepository() {
// Edit issue or comment content
$('.edit-content').on('click', async function (event) {
- $(this).closest('.dropdown').find('.menu').toggle('visible');
- const $segment = $(this).closest('.header').next();
+ $(this)
+ .closest('.dropdown')
+ .find('.menu')
+ .toggle('visible');
+ const $segment = $(this)
+ .closest('.header')
+ .next();
const $editContentZone = $segment.find('.edit-content-zone');
const $renderContent = $segment.find('.render-content');
const $rawContent = $segment.find('.raw-content');
@@ -908,7 +1058,10 @@ async function initRepository() {
headers: {'X-Csrf-Token': csrf},
maxFiles: $dropzone.data('max-file'),
maxFilesize: $dropzone.data('max-size'),
- acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),
+ acceptedFiles:
+ $dropzone.data('accepts') === '*/*' ?
+ null :
+ $dropzone.data('accepts'),
addRemoveLinks: true,
dictDefaultMessage: $dropzone.data('default-message'),
dictInvalidFileType: $dropzone.data('invalid-input-type'),
@@ -920,7 +1073,9 @@ async function initRepository() {
uuid: data.uuid,
submitted: false
};
- const input = $(`
`).val(data.uuid);
+ const input = $(
+ `
`
+ ).val(data.uuid);
$files.append(input);
});
this.on('removedfile', (file) => {
@@ -928,7 +1083,11 @@ async function initRepository() {
return;
}
$(`#${filenameDict[file.name].uuid}`).remove();
- if ($dropzone.data('remove-url') && $dropzone.data('csrf') && !filenameDict[file.name].submitted) {
+ if (
+ $dropzone.data('remove-url') &&
+ $dropzone.data('csrf') &&
+ !filenameDict[file.name].submitted
+ ) {
$.post($dropzone.data('remove-url'), {
file: filenameDict[file.name].uuid,
_csrf: $dropzone.data('csrf')
@@ -945,7 +1104,9 @@ async function initRepository() {
dz.removeAllFiles(true);
$files.empty();
$.each(data, function () {
- const imgSrc = `${$dropzone.data('upload-url')}/${this.uuid}`;
+ const imgSrc = `${$dropzone.data('upload-url')}/${
+ this.uuid
+ }`;
dz.emit('addedfile', this);
dz.emit('thumbnail', this, imgSrc);
dz.emit('complete', this);
@@ -954,8 +1115,12 @@ async function initRepository() {
submitted: true,
uuid: this.uuid
};
- $dropzone.find(`img[src='${imgSrc}']`).css('max-width', '100%');
- const input = $(`
`).val(this.uuid);
+ $dropzone
+ .find(`img[src='${imgSrc}']`)
+ .css('max-width', '100%');
+ const input = $(
+ `
`
+ ).val(this.uuid);
$files.append(input);
});
});
@@ -969,10 +1134,18 @@ async function initRepository() {
const $tabMenu = $editContentForm.find('.tabular.menu');
$tabMenu.attr('data-write', $editContentZone.data('write'));
$tabMenu.attr('data-preview', $editContentZone.data('preview'));
- $tabMenu.find('.write.item').attr('data-tab', $editContentZone.data('write'));
- $tabMenu.find('.preview.item').attr('data-tab', $editContentZone.data('preview'));
- $editContentForm.find('.write').attr('data-tab', $editContentZone.data('write'));
- $editContentForm.find('.preview').attr('data-tab', $editContentZone.data('preview'));
+ $tabMenu
+ .find('.write.item')
+ .attr('data-tab', $editContentZone.data('write'));
+ $tabMenu
+ .find('.preview.item')
+ .attr('data-tab', $editContentZone.data('preview'));
+ $editContentForm
+ .find('.write')
+ .attr('data-tab', $editContentZone.data('write'));
+ $editContentForm
+ .find('.preview')
+ .attr('data-tab', $editContentZone.data('preview'));
$simplemde = setCommentSimpleMDE($textarea);
commentMDEditors[$editContentZone.data('write')] = $simplemde;
initCommentPreviewTab($editContentForm);
@@ -986,39 +1159,49 @@ async function initRepository() {
$editContentZone.find('.save.button').on('click', () => {
$renderContent.show();
$editContentZone.hide();
- const $attachments = $files.find('[name=files]').map(function () {
- return $(this).val();
- }).get();
- $.post($editContentZone.data('update-url'), {
- _csrf: csrf,
- content: $textarea.val(),
- context: $editContentZone.data('context'),
- files: $attachments
- }, (data) => {
- if (data.length === 0) {
- $renderContent.html($('#no-content').html());
- } else {
- $renderContent.html(data.content);
- $('pre code', $renderContent[0]).each(function () {
- highlight(this);
- });
- }
- const $content = $segment.parent();
- if (!$content.find('.ui.small.images').length) {
- if (data.attachments !== '') {
- $content.append(
- '
'
- );
+ const $attachments = $files
+ .find('[name=files]')
+ .map(function () {
+ return $(this).val();
+ })
+ .get();
+ $.post(
+ $editContentZone.data('update-url'),
+ {
+ _csrf: csrf,
+ content: $textarea.val(),
+ context: $editContentZone.data('context'),
+ files: $attachments
+ },
+ (data) => {
+ if (data.length === 0) {
+ $renderContent.html($('#no-content').html());
+ } else {
+ $renderContent.html(data.content);
+ $('pre code', $renderContent[0]).each(function () {
+ highlight(this);
+ });
+ }
+ const $content = $segment.parent();
+ if (!$content.find('.ui.small.images').length) {
+ if (data.attachments !== '') {
+ $content.append(
+ '
'
+ );
+ $content.find('.ui.small.images').html(data.attachments);
+ }
+ } else if (data.attachments === '') {
+ $content
+ .find('.ui.small.images')
+ .parent()
+ .remove();
+ } else {
$content.find('.ui.small.images').html(data.attachments);
}
- } else if (data.attachments === '') {
- $content.find('.ui.small.images').parent().remove();
- } else {
- $content.find('.ui.small.images').html(data.attachments);
+ dz.emit('submit');
+ dz.emit('reload');
}
- dz.emit('submit');
- dz.emit('reload');
- });
+ );
});
} else {
$textarea = $segment.find('textarea');
@@ -1069,7 +1252,9 @@ async function initRepository() {
$mergeButton.on('click', function (e) {
e.preventDefault();
$(`.${$(this).data('do')}-fields`).show();
- $(this).parent().hide();
+ $(this)
+ .parent()
+ .hide();
});
$('.merge-button > .dropdown').dropdown({
onChange(_text, _value, $choice) {
@@ -1081,7 +1266,9 @@ async function initRepository() {
});
$('.merge-cancel').on('click', function (e) {
e.preventDefault();
- $(this).closest('.form').hide();
+ $(this)
+ .closest('.form')
+ .hide();
$mergeButton.parent().show();
});
initReactionSelector();
@@ -1106,30 +1293,36 @@ async function initRepository() {
$.post($this.data('url'), {
_csrf: $this.data('csrf'),
file: $uuid,
- is_private: $private,
- }).done((_data) => {
- $(`[data-uuid='${$uuid}']`).removeClass('positive active');
- $(`[data-uuid='${$uuid}']`).data('is-private', $private);
- $this.addClass('positive active');
- }).fail(() => {
- window.location.reload();
- });
+ is_private: $private
+ })
+ .done((_data) => {
+ $(`[data-uuid='${$uuid}']`).removeClass('positive active');
+ $(`[data-uuid='${$uuid}']`).data('is-private', $private);
+ $this.addClass('positive active');
+ })
+ .fail(() => {
+ window.location.reload();
+ });
});
$('[data-dataset-delete]').on('click', function () {
const $this = $(this);
- $('#data-dataset-delete-modal').modal({
- closable: false,
- onApprove() {
- $.post($this.data('remove-url'), {
- _csrf: $this.data('csrf'),
- file: $this.data('uuid')
- }).done((_data) => {
- $(`#${$this.data('uuid')}`).hide();
- }).fail(() => {
- window.location.reload();
- });
- }
- }).modal('show');
+ $('#data-dataset-delete-modal')
+ .modal({
+ closable: false,
+ onApprove() {
+ $.post($this.data('remove-url'), {
+ _csrf: $this.data('csrf'),
+ file: $this.data('uuid')
+ })
+ .done((_data) => {
+ $(`#${$this.data('uuid')}`).hide();
+ })
+ .fail(() => {
+ window.location.reload();
+ });
+ }
+ })
+ .modal('show');
});
$('[data-category-id]').on('click', function () {
const category = $(this).data('category-id');
@@ -1156,7 +1349,9 @@ async function initRepository() {
const $item = $(this);
const addLine = $item.find('span[data-line].add').data('line');
const delLine = $item.find('span[data-line].del').data('line');
- const addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;
+ const addPercent =
+ (parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine))) *
+ 100;
$item.find('.bar .add').css('width', `${addPercent}%`);
});
}
@@ -1189,20 +1384,25 @@ async function initRepository() {
e.preventDefault();
$repoComparePull.find('.pullrequest-form').show();
autoSimpleMDE.codemirror.refresh();
- $(this).parent().hide();
+ $(this)
+ .parent()
+ .hide();
});
}
// Branches
if ($('.repository.settings.branches').length > 0) {
initFilterSearchDropdown('.protected-branches .dropdown');
- $('.enable-protection, .enable-whitelist, .enable-statuscheck').on('change', function () {
- if (this.checked) {
- $($(this).data('target')).removeClass('disabled');
- } else {
- $($(this).data('target')).addClass('disabled');
+ $('.enable-protection, .enable-whitelist, .enable-statuscheck').on(
+ 'change',
+ function () {
+ if (this.checked) {
+ $($(this).data('target')).removeClass('disabled');
+ } else {
+ $($(this).data('target')).addClass('disabled');
+ }
}
- });
+ );
$('.disable-whitelist').on('change', function () {
if (this.checked) {
$($(this).data('target')).addClass('disabled');
@@ -1223,8 +1423,16 @@ function initMigration() {
const toggleMigrations = function () {
const authUserName = $('#auth_username').val();
const cloneAddr = $('#clone_addr').val();
- if (!$('#mirror').is(':checked') && (authUserName && authUserName.length > 0) &&
- (cloneAddr !== undefined && (cloneAddr.startsWith('https://github.com') || cloneAddr.startsWith('http://github.com') || cloneAddr.startsWith('http://gitlab.com') || cloneAddr.startsWith('https://gitlab.com')))) {
+ if (
+ !$('#mirror').is(':checked') &&
+ authUserName &&
+ authUserName.length > 0 &&
+ cloneAddr !== undefined &&
+ (cloneAddr.startsWith('https://github.com') ||
+ cloneAddr.startsWith('http://github.com') ||
+ cloneAddr.startsWith('http://gitlab.com') ||
+ cloneAddr.startsWith('https://gitlab.com'))
+ ) {
$('#migrate_items').show();
} else {
$('#migrate_items').hide();
@@ -1260,7 +1468,9 @@ function initPullRequestReview() {
$('button.comment-form-reply').on('click', function (e) {
e.preventDefault();
$(this).hide();
- const form = $(this).parent().find('.comment-form');
+ const form = $(this)
+ .parent()
+ .find('.comment-form');
form.removeClass('hide');
assingMenuAttributes(form.find('.menu'));
});
@@ -1271,24 +1481,38 @@ function initPullRequestReview() {
$('.diff-detail-box.ui.sticky').sticky();
- $('.btn-review').on('click', function (e) {
- e.preventDefault();
- $(this).closest('.dropdown').find('.menu').toggle('visible');
- }).closest('.dropdown').find('.link.close')
+ $('.btn-review')
+ .on('click', function (e) {
+ e.preventDefault();
+ $(this)
+ .closest('.dropdown')
+ .find('.menu')
+ .toggle('visible');
+ })
+ .closest('.dropdown')
+ .find('.link.close')
.on('click', function (e) {
e.preventDefault();
- $(this).closest('.menu').toggle('visible');
+ $(this)
+ .closest('.menu')
+ .toggle('visible');
});
$('.code-view .lines-code,.code-view .lines-num')
.on('mouseenter', function () {
const parent = $(this).closest('td');
- $(this).closest('tr').addClass(
- parent.hasClass('lines-num-old') || parent.hasClass('lines-code-old') ? 'focus-lines-old' : 'focus-lines-new'
- );
+ $(this)
+ .closest('tr')
+ .addClass(
+ parent.hasClass('lines-num-old') || parent.hasClass('lines-code-old') ?
+ 'focus-lines-old' :
+ 'focus-lines-new'
+ );
})
.on('mouseleave', function () {
- $(this).closest('tr').removeClass('focus-lines-new focus-lines-old');
+ $(this)
+ .closest('tr')
+ .removeClass('focus-lines-new focus-lines-old');
});
$('.add-code-comment').on('click', function (e) {
// https://github.com/go-gitea/gitea/issues/4745
@@ -1296,7 +1520,9 @@ function initPullRequestReview() {
return;
}
e.preventDefault();
- const isSplit = $(this).closest('.code-diff').hasClass('code-diff-split');
+ const isSplit = $(this)
+ .closest('.code-diff')
+ .hasClass('code-diff-split');
const side = $(this).data('side');
const idx = $(this).data('idx');
const path = $(this).data('path');
@@ -1304,10 +1530,13 @@ function initPullRequestReview() {
const tr = $(this).closest('tr');
let ntr = tr.next();
if (!ntr.hasClass('add-comment')) {
- ntr = $(``);
+ ntr = $(
+ ``
+ );
tr.after(ntr);
}
const td = ntr.find(`.add-comment-${side}`);
@@ -1318,7 +1547,9 @@ function initPullRequestReview() {
assingMenuAttributes(commentCloud.find('.menu'));
td.find("input[name='line']").val(idx);
- td.find("input[name='side']").val(side === 'left' ? 'previous' : 'proposed');
+ td.find("input[name='side']").val(
+ side === 'left' ? 'previous' : 'proposed'
+ );
td.find("input[name='path']").val(path);
}
commentCloud.find('textarea').focus();
@@ -1333,8 +1564,14 @@ function assingMenuAttributes(menu) {
const tab = $(this).attr('data-tab') + id;
$(this).attr('data-tab', tab);
});
- menu.parent().find("*[data-tab='write']").attr('data-tab', `write${id}`);
- menu.parent().find("*[data-tab='preview']").attr('data-tab', `preview${id}`);
+ menu
+ .parent()
+ .find("*[data-tab='write']")
+ .attr('data-tab', `write${id}`);
+ menu
+ .parent()
+ .find("*[data-tab='preview']")
+ .attr('data-tab', `preview${id}`);
initCommentPreviewTab(menu.parent('.form'));
return id;
}
@@ -1354,7 +1591,10 @@ function initRepositoryCollaboration() {
function initTeamSettings() {
// Change team access mode
$('.organization.new.team input[name=permission]').on('change', () => {
- const val = $('input[name=permission]:checked', '.organization.new.team').val();
+ const val = $(
+ 'input[name=permission]:checked',
+ '.organization.new.team'
+ ).val();
if (val === 'admin') {
$('.organization.new.team .team-units').hide();
} else {
@@ -1372,7 +1612,8 @@ function initWikiForm() {
autoDownloadFontAwesome: false,
element: $editArea[0],
forceSync: true,
- previewRender(plainText, preview) { // Async method
+ previewRender(plainText, preview) {
+ // Async method
setTimeout(() => {
// FIXME: still send render request when return back to edit mode
const render = function () {
@@ -1381,17 +1622,23 @@ function initWikiForm() {
clearTimeout(sideBySideTimeout);
sideBySideTimeout = null;
}
- $.post($editArea.data('url'), {
- _csrf: csrf,
- mode: 'gfm',
- context: $editArea.data('context'),
- text: plainText
- }, (data) => {
- preview.innerHTML = `
${data}
`;
- $(preview).find('pre code').each((_, e) => {
- highlight(e);
- });
- });
+ $.post(
+ $editArea.data('url'),
+ {
+ _csrf: csrf,
+ mode: 'gfm',
+ context: $editArea.data('context'),
+ text: plainText
+ },
+ (data) => {
+ preview.innerHTML = `
${data}
`;
+ $(preview)
+ .find('pre code')
+ .each((_, e) => {
+ highlight(e);
+ });
+ }
+ );
};
if (!simplemde.isSideBySideActive()) {
render();
@@ -1420,8 +1667,17 @@ function initWikiForm() {
indentWithTabs: false,
tabSize: 4,
spellChecker: false,
- toolbar: ['bold', 'italic', 'strikethrough', '|',
- 'heading-1', 'heading-2', 'heading-3', 'heading-bigger', 'heading-smaller', '|',
+ toolbar: [
+ 'bold',
+ 'italic',
+ 'strikethrough',
+ '|',
+ 'heading-1',
+ 'heading-2',
+ 'heading-3',
+ 'heading-bigger',
+ 'heading-smaller',
+ '|',
{
name: 'code-inline',
action(e) {
@@ -1435,8 +1691,12 @@ function initWikiForm() {
cm.focus();
},
className: 'fa fa-angle-right',
- title: 'Add Inline Code',
- }, 'code', 'quote', '|', {
+ title: 'Add Inline Code'
+ },
+ 'code',
+ 'quote',
+ '|',
+ {
name: 'checkbox-empty',
action(e) {
const cm = e.codemirror;
@@ -1444,7 +1704,7 @@ function initWikiForm() {
cm.focus();
},
className: 'fa fa-square-o',
- title: 'Add Checkbox (empty)',
+ title: 'Add Checkbox (empty)'
},
{
name: 'checkbox-checked',
@@ -1454,26 +1714,39 @@ function initWikiForm() {
cm.focus();
},
className: 'fa fa-check-square-o',
- title: 'Add Checkbox (checked)',
- }, '|',
- 'unordered-list', 'ordered-list', '|',
- 'link', 'image', 'table', 'horizontal-rule', '|',
- 'clean-block', 'preview', 'fullscreen', 'side-by-side', '|',
+ title: 'Add Checkbox (checked)'
+ },
+ '|',
+ 'unordered-list',
+ 'ordered-list',
+ '|',
+ 'link',
+ 'image',
+ 'table',
+ 'horizontal-rule',
+ '|',
+ 'clean-block',
+ 'preview',
+ 'fullscreen',
+ 'side-by-side',
+ '|',
{
name: 'revert-to-textarea',
action(e) {
e.toTextArea();
},
className: 'fa fa-file',
- title: 'Revert to simple textarea',
- },
+ title: 'Revert to simple textarea'
+ }
]
});
$(simplemde.codemirror.getInputField()).addClass('js-quick-submit');
setTimeout(() => {
const $bEdit = $('.repository.wiki.new .previewtabs a[data-tab="write"]');
- const $bPrev = $('.repository.wiki.new .previewtabs a[data-tab="preview"]');
+ const $bPrev = $(
+ '.repository.wiki.new .previewtabs a[data-tab="preview"]'
+ );
const $toolbar = $('.editor-toolbar');
const $bPreview = $('.editor-toolbar a.fa-eye');
const $bSideBySide = $('.editor-toolbar a.fa-columns');
@@ -1540,20 +1813,38 @@ function setCommentSimpleMDE($editArea) {
indentWithTabs: false,
tabSize: 4,
spellChecker: false,
- toolbar: ['bold', 'italic', 'strikethrough', '|',
- 'heading-1', 'heading-2', 'heading-3', 'heading-bigger', 'heading-smaller', '|',
- 'code', 'quote', '|',
- 'unordered-list', 'ordered-list', '|',
- 'link', 'image', 'table', 'horizontal-rule', '|',
- 'clean-block', '|',
+ toolbar: [
+ 'bold',
+ 'italic',
+ 'strikethrough',
+ '|',
+ 'heading-1',
+ 'heading-2',
+ 'heading-3',
+ 'heading-bigger',
+ 'heading-smaller',
+ '|',
+ 'code',
+ 'quote',
+ '|',
+ 'unordered-list',
+ 'ordered-list',
+ '|',
+ 'link',
+ 'image',
+ 'table',
+ 'horizontal-rule',
+ '|',
+ 'clean-block',
+ '|',
{
name: 'revert-to-textarea',
action(e) {
e.toTextArea();
},
className: 'fa fa-file',
- title: 'Revert to simple textarea',
- },
+ title: 'Revert to simple textarea'
+ }
]
});
$(simplemde.codemirror.getInputField()).addClass('js-quick-submit');
@@ -1588,50 +1879,59 @@ async function initEditor() {
});
const $editFilename = $('#file-name');
- $editFilename.on('keyup', function (e) {
- const $section = $('.breadcrumb span.section');
- const $divider = $('.breadcrumb div.divider');
- let value;
- let parts;
-
- if (e.keyCode === 8) {
- if ($(this).getCursorPosition() === 0) {
- if ($section.length > 0) {
- value = $section.last().find('a').text();
- $(this).val(value + $(this).val());
- $(this)[0].setSelectionRange(value.length, value.length);
- $section.last().remove();
- $divider.last().remove();
+ $editFilename
+ .on('keyup', function (e) {
+ const $section = $('.breadcrumb span.section');
+ const $divider = $('.breadcrumb div.divider');
+ let value;
+ let parts;
+
+ if (e.keyCode === 8) {
+ if ($(this).getCursorPosition() === 0) {
+ if ($section.length > 0) {
+ value = $section
+ .last()
+ .find('a')
+ .text();
+ $(this).val(value + $(this).val());
+ $(this)[0].setSelectionRange(value.length, value.length);
+ $section.last().remove();
+ $divider.last().remove();
+ }
}
}
- }
- if (e.keyCode === 191) {
- parts = $(this).val().split('/');
- for (let i = 0; i < parts.length; ++i) {
- value = parts[i];
- if (i < parts.length - 1) {
- if (value.length) {
- $(`
${value}`).insertBefore($(this));
- $('
/
').insertBefore($(this));
+ if (e.keyCode === 191) {
+ parts = $(this)
+ .val()
+ .split('/');
+ for (let i = 0; i < parts.length; ++i) {
+ value = parts[i];
+ if (i < parts.length - 1) {
+ if (value.length) {
+ $(
+ `
${value}`
+ ).insertBefore($(this));
+ $('
/
').insertBefore($(this));
+ }
+ } else {
+ $(this).val(value);
}
- } else {
- $(this).val(value);
+ $(this)[0].setSelectionRange(0, 0);
}
- $(this)[0].setSelectionRange(0, 0);
- }
- }
- parts = [];
- $('.breadcrumb span.section').each(function () {
- const element = $(this);
- if (element.find('a').length) {
- parts.push(element.find('a').text());
- } else {
- parts.push(element.text());
}
- });
- if ($(this).val()) parts.push($(this).val());
- $('#tree_path').val(parts.join('/'));
- }).trigger('keyup');
+ parts = [];
+ $('.breadcrumb span.section').each(function () {
+ const element = $(this);
+ if (element.find('a').length) {
+ parts.push(element.find('a').text());
+ } else {
+ parts.push(element.text());
+ }
+ });
+ if ($(this).val()) parts.push($(this).val());
+ $('#tree_path').val(parts.join('/'));
+ })
+ .trigger('keyup');
const $editArea = $('.repository.editor textarea#edit_area');
if (!$editArea.length) return;
@@ -1661,11 +1961,13 @@ async function initEditor() {
$commitButton.on('click', (event) => {
// A modal which asks if an empty file should be committed
if ($editArea.val().length === 0) {
- $('#edit-empty-content-modal').modal({
- onApprove() {
- $('.edit.form').trigger('submit');
- }
- }).modal('show');
+ $('#edit-empty-content-modal')
+ .modal({
+ onApprove() {
+ $('.edit.form').trigger('submit');
+ }
+ })
+ .modal('show');
event.preventDefault();
}
});
@@ -1680,7 +1982,16 @@ function initOrganization() {
if ($('.organization.settings.options').length > 0) {
$('#org_name').on('keyup', function () {
const $prompt = $('#org-name-change-prompt');
- if ($(this).val().toString().toLowerCase() !== $(this).data('org-name').toString().toLowerCase()) {
+ if (
+ $(this)
+ .val()
+ .toString()
+ .toLowerCase() !==
+ $(this)
+ .data('org-name')
+ .toString()
+ .toLowerCase()
+ ) {
$prompt.show();
} else {
$prompt.hide();
@@ -1699,7 +2010,16 @@ function initUserSettings() {
if ($('.user.settings.profile').length > 0) {
$('#username').on('keyup', function () {
const $prompt = $('#name-change-prompt');
- if ($(this).val().toString().toLowerCase() !== $(this).data('name').toString().toLowerCase()) {
+ if (
+ $(this)
+ .val()
+ .toString()
+ .toLowerCase() !==
+ $(this)
+ .data('name')
+ .toString()
+ .toLowerCase()
+ ) {
$prompt.show();
} else {
$prompt.hide();
@@ -1713,10 +2033,13 @@ function initGithook() {
return;
}
- CodeMirror.autoLoadMode(CodeMirror.fromTextArea($('#content')[0], {
- lineNumbers: true,
- mode: 'shell'
- }), 'shell');
+ CodeMirror.autoLoadMode(
+ CodeMirror.fromTextArea($('#content')[0], {
+ lineNumbers: true,
+ mode: 'shell'
+ }),
+ 'shell'
+ );
}
function initWebhook() {
@@ -1737,7 +2060,10 @@ function initWebhook() {
const updateContentType = function () {
const visible = $('#http_method').val() === 'POST';
- $('#content_type').parent().parent()[visible ? 'show' : 'hide']();
+ $('#content_type')
+ .parent()
+ .parent()
+ [visible ? 'show' : 'hide']();
};
updateContentType();
$('#http_method').on('change', () => {
@@ -1766,7 +2092,11 @@ function initAdmin() {
// New user
if ($('.admin.new.user').length > 0 || $('.admin.edit.user').length > 0) {
$('#login_type').on('change', function () {
- if ($(this).val().substring(0, 1) === '0') {
+ if (
+ $(this)
+ .val()
+ .substring(0, 1) === '0'
+ ) {
$('#login_name').removeAttr('required');
$('.non-local').hide();
$('.local').show();
@@ -1796,17 +2126,23 @@ function initAdmin() {
function onUsePagedSearchChange() {
if ($('#use_paged_search').prop('checked')) {
- $('.search-page-size').show()
- .find('input').attr('required', 'required');
+ $('.search-page-size')
+ .show()
+ .find('input')
+ .attr('required', 'required');
} else {
- $('.search-page-size').hide()
- .find('input').removeAttr('required');
+ $('.search-page-size')
+ .hide()
+ .find('input')
+ .removeAttr('required');
}
}
function onOAuth2Change() {
$('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide();
- $('.open_id_connect_auto_discovery_url input[required]').removeAttr('required');
+ $('.open_id_connect_auto_discovery_url input[required]').removeAttr(
+ 'required'
+ );
const provider = $('#oauth2_provider').val();
switch (provider) {
@@ -1817,7 +2153,10 @@ function initAdmin() {
$('.oauth2_use_custom_url').show();
break;
case 'openidConnect':
- $('.open_id_connect_auto_discovery_url input').attr('required', 'required');
+ $('.open_id_connect_auto_discovery_url input').attr(
+ 'required',
+ 'required'
+ );
$('.open_id_connect_auto_discovery_url').show();
break;
}
@@ -1837,13 +2176,19 @@ function initAdmin() {
switch (provider) {
case 'github':
- $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input').attr('required', 'required');
- $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url').show();
+ $(
+ '.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input'
+ ).attr('required', 'required');
+ $(
+ '.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url'
+ ).show();
break;
case 'nextcloud':
case 'gitea':
case 'gitlab':
- $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input').attr('required', 'required');
+ $(
+ '.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input'
+ ).attr('required', 'required');
$('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url').show();
$('#oauth2_email_url').val('');
break;
@@ -1854,16 +2199,23 @@ function initAdmin() {
// New authentication
if ($('.admin.new.authentication').length > 0) {
$('#auth_type').on('change', function () {
- $('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls, .search-page-size, .sspi').hide();
+ $(
+ '.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls, .search-page-size, .sspi'
+ ).hide();
- $('.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required], .sspi input[required]').removeAttr('required');
+ $(
+ '.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required], .sspi input[required]'
+ ).removeAttr('required');
$('.binddnrequired').removeClass('required');
const authType = $(this).val();
switch (authType) {
case '2': // LDAP
$('.ldap').show();
- $('.binddnrequired input, .ldap div.required:not(.dldap) input').attr('required', 'required');
+ $('.binddnrequired input, .ldap div.required:not(.dldap) input').attr(
+ 'required',
+ 'required'
+ );
$('.binddnrequired').addClass('required');
break;
case '3': // SMTP
@@ -1877,11 +2229,16 @@ function initAdmin() {
break;
case '5': // LDAP
$('.dldap').show();
- $('.dldap div.required:not(.ldap) input').attr('required', 'required');
+ $('.dldap div.required:not(.ldap) input').attr(
+ 'required',
+ 'required'
+ );
break;
case '6': // OAuth2
$('.oauth2').show();
- $('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required');
+ $(
+ '.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input'
+ ).attr('required', 'required');
onOAuth2Change();
break;
case '7': // SSPI
@@ -1964,7 +2321,8 @@ function initAdmin() {
function buttonsClickOnEnter() {
$('.ui.button').on('keypress', function (e) {
- if (e.keyCode === 13 || e.keyCode === 32) { // enter key or space bar
+ if (e.keyCode === 13 || e.keyCode === 32) {
+ // enter key or space bar
$(this).trigger('click');
}
});
@@ -2002,14 +2360,16 @@ function searchTeams() {
$searchTeamBox.search({
minCharacters: 2,
apiSettings: {
- url: `${AppSubUrl}/api/v1/orgs/${$searchTeamBox.data('org')}/teams/search?q={query}`,
+ url: `${AppSubUrl}/api/v1/orgs/${$searchTeamBox.data(
+ 'org'
+ )}/teams/search?q={query}`,
headers: {'X-Csrf-Token': csrf},
onResponse(response) {
const items = [];
$.each(response.data, (_i, item) => {
const title = `${item.name} (${item.permission} access)`;
items.push({
- title,
+ title
});
});
@@ -2026,7 +2386,9 @@ function searchRepositories() {
$searchRepoBox.search({
minCharacters: 2,
apiSettings: {
- url: `${AppSubUrl}/api/v1/repos/search?q={query}&uid=${$searchRepoBox.data('uid')}`,
+ url: `${AppSubUrl}/api/v1/repos/search?q={query}&uid=${$searchRepoBox.data(
+ 'uid'
+ )}`,
onResponse(response) {
const items = [];
$.each(response.data, (_i, item) => {
@@ -2048,28 +2410,37 @@ function initCodeView() {
if ($('.code-view .linenums').length > 0) {
$(document).on('click', '.lines-num span', function (e) {
const $select = $(this);
- const $list = $select.parent().siblings('.lines-code').find('ol.linenums > li');
- selectRange($list, $list.filter(`[rel=${$select.attr('id')}]`), (e.shiftKey ? $list.filter('.active').eq(0) : null));
+ const $list = $select
+ .parent()
+ .siblings('.lines-code')
+ .find('ol.linenums > li');
+ selectRange(
+ $list,
+ $list.filter(`[rel=${$select.attr('id')}]`),
+ e.shiftKey ? $list.filter('.active').eq(0) : null
+ );
deSelect();
});
- $(window).on('hashchange', () => {
- let m = window.location.hash.match(/^#(L\d+)-(L\d+)$/);
- const $list = $('.code-view ol.linenums > li');
- let $first;
- if (m) {
- $first = $list.filter(`.${m[1]}`);
- selectRange($list, $first, $list.filter(`.${m[2]}`));
- $('html, body').scrollTop($first.offset().top - 200);
- return;
- }
- m = window.location.hash.match(/^#(L|n)(\d+)$/);
- if (m) {
- $first = $list.filter(`.L${m[2]}`);
- selectRange($list, $first);
- $('html, body').scrollTop($first.offset().top - 200);
- }
- }).trigger('hashchange');
+ $(window)
+ .on('hashchange', () => {
+ let m = window.location.hash.match(/^#(L\d+)-(L\d+)$/);
+ const $list = $('.code-view ol.linenums > li');
+ let $first;
+ if (m) {
+ $first = $list.filter(`.${m[1]}`);
+ selectRange($list, $first, $list.filter(`.${m[2]}`));
+ $('html, body').scrollTop($first.offset().top - 200);
+ return;
+ }
+ m = window.location.hash.match(/^#(L|n)(\d+)$/);
+ if (m) {
+ $first = $list.filter(`.L${m[2]}`);
+ selectRange($list, $first);
+ $('html, body').scrollTop($first.offset().top - 200);
+ }
+ })
+ .trigger('hashchange');
}
$('.fold-code').on('click', ({target}) => {
const box = target.closest('.file-content');
@@ -2081,23 +2452,34 @@ function initCodeView() {
function insertBlobExcerpt(e) {
const $blob = $(e.target);
const $row = $blob.parent().parent();
- $.get(`${$blob.data('url')}?${$blob.data('query')}&anchor=${$blob.data('anchor')}`, (blob) => {
- $row.replaceWith(blob);
- $(`[data-anchor="${$blob.data('anchor')}"]`).on('click', (e) => { insertBlobExcerpt(e) });
- $('.diff-detail-box.ui.sticky').sticky();
- });
+ $.get(
+ `${$blob.data('url')}?${$blob.data('query')}&anchor=${$blob.data(
+ 'anchor'
+ )}`,
+ (blob) => {
+ $row.replaceWith(blob);
+ $(`[data-anchor="${$blob.data('anchor')}"]`).on('click', (e) => {
+ insertBlobExcerpt(e);
+ });
+ $('.diff-detail-box.ui.sticky').sticky();
+ }
+ );
}
- $('.ui.blob-excerpt').on('click', (e) => { insertBlobExcerpt(e) });
+ $('.ui.blob-excerpt').on('click', (e) => {
+ insertBlobExcerpt(e);
+ });
}
function initU2FAuth() {
if ($('#wait-for-key').length === 0) {
return;
}
- u2fApi.ensureSupport()
+ u2fApi
+ .ensureSupport()
.then(() => {
$.getJSON(`${AppSubUrl}/user/u2f/challenge`).done((req) => {
- u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30)
+ u2fApi
+ .sign(req.appId, req.challenge, req.registeredKeys, 30)
.then(u2fSigned)
.catch((err) => {
if (err === undefined) {
@@ -2107,7 +2489,8 @@ function initU2FAuth() {
u2fError(err.metaData.code);
});
});
- }).catch(() => {
+ })
+ .catch(() => {
// Fallback in case browser do not support U2F
window.location.href = `${AppSubUrl}/user/two_factor`;
});
@@ -2118,12 +2501,14 @@ function u2fSigned(resp) {
type: 'POST',
headers: {'X-Csrf-Token': csrf},
data: JSON.stringify(resp),
- contentType: 'application/json; charset=utf-8',
- }).done((res) => {
- window.location.replace(res);
- }).fail(() => {
- u2fError(1);
- });
+ contentType: 'application/json; charset=utf-8'
+ })
+ .done((res) => {
+ window.location.replace(res);
+ })
+ .fail(() => {
+ u2fError(1);
+ });
}
function u2fRegistered(resp) {
@@ -2180,7 +2565,8 @@ function initU2FRegister() {
$('#u2f-error').modal({allowMultiple: false});
$('#register-security-key').on('click', (e) => {
e.preventDefault();
- u2fApi.ensureSupport()
+ u2fApi
+ .ensureSupport()
.then(u2fRegisterRequest)
.catch(() => {
u2fError('browser');
@@ -2192,26 +2578,33 @@ function u2fRegisterRequest() {
$.post(`${AppSubUrl}/user/settings/security/u2f/request_register`, {
_csrf: csrf,
name: $('#nickname').val()
- }).done((req) => {
- $('#nickname').closest('div.field').removeClass('error');
- $('#register-device').modal('show');
- if (req.registeredKeys === null) {
- req.registeredKeys = [];
- }
- u2fApi.register(req.appId, req.registerRequests, req.registeredKeys, 30)
- .then(u2fRegistered)
- .catch((reason) => {
- if (reason === undefined) {
- u2fError(1);
- return;
- }
- u2fError(reason.metaData.code);
- });
- }).fail((xhr) => {
- if (xhr.status === 409) {
- $('#nickname').closest('div.field').addClass('error');
- }
- });
+ })
+ .done((req) => {
+ $('#nickname')
+ .closest('div.field')
+ .removeClass('error');
+ $('#register-device').modal('show');
+ if (req.registeredKeys === null) {
+ req.registeredKeys = [];
+ }
+ u2fApi
+ .register(req.appId, req.registerRequests, req.registeredKeys, 30)
+ .then(u2fRegistered)
+ .catch((reason) => {
+ if (reason === undefined) {
+ u2fError(1);
+ return;
+ }
+ u2fError(reason.metaData.code);
+ });
+ })
+ .fail((xhr) => {
+ if (xhr.status === 409) {
+ $('#nickname')
+ .closest('div.field')
+ .addClass('error');
+ }
+ });
}
function initWipTitle() {
@@ -2220,7 +2613,10 @@ function initWipTitle() {
const $issueTitle = $('#issue_title');
$issueTitle.focus();
- const value = $issueTitle.val().trim().toUpperCase();
+ const value = $issueTitle
+ .val()
+ .trim()
+ .toUpperCase();
for (const i in wipPrefixes) {
if (value.startsWith(wipPrefixes[i].toUpperCase())) {
@@ -2249,30 +2645,31 @@ function initTemplateSearch() {
checkTemplate();
const changeOwner = function () {
- $('#repo_template_search')
- .dropdown({
- apiSettings: {
- url: `${AppSubUrl}/api/v1/repos/search?q={query}&template=true&priority_owner_id=${$('#uid').val()}`,
- onResponse(response) {
- const filteredResponse = {success: true, results: []};
+ $('#repo_template_search').dropdown({
+ apiSettings: {
+ url: `${AppSubUrl}/api/v1/repos/search?q={query}&template=true&priority_owner_id=${$(
+ '#uid'
+ ).val()}`,
+ onResponse(response) {
+ const filteredResponse = {success: true, results: []};
+ filteredResponse.results.push({
+ name: '',
+ value: ''
+ });
+ // Parse the response from the api to work with our dropdown
+ $.each(response.data, (_r, repo) => {
filteredResponse.results.push({
- name: '',
- value: ''
- });
- // Parse the response from the api to work with our dropdown
- $.each(response.data, (_r, repo) => {
- filteredResponse.results.push({
- name: htmlEncode(repo.full_name),
- value: repo.id
- });
+ name: htmlEncode(repo.full_name),
+ value: repo.id
});
- return filteredResponse;
- },
- cache: false,
+ });
+ return filteredResponse;
},
+ cache: false
+ },
- fullTextSearch: true
- });
+ fullTextSearch: true
+ });
};
$('#uid').on('change', changeOwner);
changeOwner();
@@ -2342,7 +2739,8 @@ $(document).ready(async () => {
headers: {'X-Csrf-Token': csrf},
maxFiles: $dropzone.data('max-file'),
maxFilesize: $dropzone.data('max-size'),
- acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),
+ acceptedFiles:
+ $dropzone.data('accepts') === '*/*' ? null : $dropzone.data('accepts'),
addRemoveLinks: true,
dictDefaultMessage: $dropzone.data('default-message'),
dictInvalidFileType: $dropzone.data('invalid-input-type'),
@@ -2351,7 +2749,9 @@ $(document).ready(async () => {
init() {
this.on('success', (file, data) => {
filenameDict[file.name] = data.uuid;
- const input = $(`
`).val(data.uuid);
+ const input = $(
+ `
`
+ ).val(data.uuid);
$('.files').append(input);
});
this.on('removedfile', (file) => {
@@ -2365,69 +2765,69 @@ $(document).ready(async () => {
});
}
});
- },
+ }
});
}
// dataset Dropzone
- const $dataset = $('#dataset');
- if ($dataset.length > 0) {
- const filenameDict = {};
- let previewTemplate = '';
- previewTemplate += '
\n ';
- previewTemplate += '
\n ';
- previewTemplate += '
';
- previewTemplate += ' ';
- previewTemplate += '
\n ';
- previewTemplate += '
\n ';
- previewTemplate += '
\n ';
- previewTemplate += '
';
- previewTemplate += '
\n ';
- previewTemplate += '
\n ';
- previewTemplate += '
';
- previewTemplate += ' 上传成功';
- previewTemplate += '
\n ';
- previewTemplate += '
';
- previewTemplate += ' 上传失败';
- previewTemplate += '
\n ';
- previewTemplate += '
';
- previewTemplate += ' ';
- previewTemplate += '
\n';
- previewTemplate += '
';
-
- await createDropzone('#dataset', {
- url: $dataset.data('upload-url'),
- headers: {'X-Csrf-Token': csrf},
- maxFiles: $dataset.data('max-file'),
- maxFilesize: $dataset.data('max-size'),
- acceptedFiles: ($dataset.data('accepts') === '*/*') ? null : $dataset.data('accepts'),
- addRemoveLinks: true,
- timeout: 0,
- dictDefaultMessage: $dataset.data('default-message'),
- dictInvalidFileType: $dataset.data('invalid-input-type'),
- dictFileTooBig: $dataset.data('file-too-big'),
- dictRemoveFile: $dataset.data('remove-file'),
- previewTemplate,
- init() {
- this.on('success', (file, data) => {
- filenameDict[file.name] = data.uuid;
- const input = $(`
`).val(data.uuid);
- $('.files').append(input);
- });
- this.on('removedfile', (file) => {
- if (file.name in filenameDict) {
- $(`#${filenameDict[file.name]}`).remove();
- }
- if ($dataset.data('remove-url') && $dataset.data('csrf')) {
- $.post($dataset.data('remove-url'), {
- file: filenameDict[file.name],
- _csrf: $dataset.data('csrf')
- });
- }
- });
- },
- });
- }
+ // const $dataset = $('#dataset');
+ // if ($dataset.length > 0) {
+ // const filenameDict = {};
+ // let previewTemplate = '';
+ // previewTemplate += '
\n ';
+ // previewTemplate += '
\n ';
+ // previewTemplate += '
';
+ // previewTemplate += ' ';
+ // previewTemplate += '
\n ';
+ // previewTemplate += '
\n ';
+ // previewTemplate += '
\n ';
+ // previewTemplate += '
';
+ // previewTemplate += '
\n ';
+ // previewTemplate += '
\n ';
+ // previewTemplate += '
';
+ // previewTemplate += ' 上传成功';
+ // previewTemplate += '
\n ';
+ // previewTemplate += '
';
+ // previewTemplate += ' 上传失败';
+ // previewTemplate += '
\n ';
+ // previewTemplate += '
';
+ // previewTemplate += ' ';
+ // previewTemplate += '
\n';
+ // previewTemplate += '
';
+
+ // await createDropzone('#dataset', {
+ // url: $dataset.data('upload-url'),
+ // headers: {'X-Csrf-Token': csrf},
+ // maxFiles: $dataset.data('max-file'),
+ // maxFilesize: $dataset.data('max-size'),
+ // acceptedFiles: ($dataset.data('accepts') === '*/*') ? null : $dataset.data('accepts'),
+ // addRemoveLinks: true,
+ // timeout: 0,
+ // dictDefaultMessage: $dataset.data('default-message'),
+ // dictInvalidFileType: $dataset.data('invalid-input-type'),
+ // dictFileTooBig: $dataset.data('file-too-big'),
+ // dictRemoveFile: $dataset.data('remove-file'),
+ // previewTemplate,
+ // init() {
+ // this.on('success', (file, data) => {
+ // filenameDict[file.name] = data.uuid;
+ // const input = $(`
`).val(data.uuid);
+ // $('.files').append(input);
+ // });
+ // this.on('removedfile', (file) => {
+ // if (file.name in filenameDict) {
+ // $(`#${filenameDict[file.name]}`).remove();
+ // }
+ // if ($dataset.data('remove-url') && $dataset.data('csrf')) {
+ // $.post($dataset.data('remove-url'), {
+ // file: filenameDict[file.name],
+ // _csrf: $dataset.data('csrf')
+ // });
+ // }
+ // });
+ // },
+ // });
+ // }
// Helpers.
$('.delete-button').on('click', showDeletePopup);
@@ -2463,11 +2863,17 @@ $(document).ready(async () => {
// Set anchor.
$('.markdown').each(function () {
- $(this).find('h1, h2, h3, h4, h5, h6').each(function () {
- let node = $(this);
- node = node.wrap('
');
- node.append(`
${svg('octicon-link', 16)}`);
- });
+ $(this)
+ .find('h1, h2, h3, h4, h5, h6')
+ .each(function () {
+ let node = $(this);
+ node = node.wrap('
');
+ node.append(
+ `
${svg('octicon-link', 16)}`
+ );
+ });
});
$('.issue-checkbox').on('click', () => {
@@ -2484,9 +2890,13 @@ $(document).ready(async () => {
$('.issue-action').on('click', function () {
let {action} = this.dataset;
let {elementId} = this.dataset;
- const issueIDs = $('.issue-checkbox').children('input:checked').map(function () {
- return this.dataset.issueId;
- }).get().join();
+ const issueIDs = $('.issue-checkbox')
+ .children('input:checked')
+ .map(function () {
+ return this.dataset.issueId;
+ })
+ .get()
+ .join();
const {url} = this.dataset;
if (elementId === '0' && url.substr(-9) === '/assignee') {
elementId = '';
@@ -2496,7 +2906,9 @@ $(document).ready(async () => {
// NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the checkboxes stay checked after reload
if (action === 'close' || action === 'open') {
// uncheck all checkboxes
- $('.issue-checkbox input[type="checkbox"]').each((_, e) => { e.checked = false });
+ $('.issue-checkbox input[type="checkbox"]').each((_, e) => {
+ e.checked = false;
+ });
}
reload();
});
@@ -2504,10 +2916,12 @@ $(document).ready(async () => {
// NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay checked after reload
// trigger ckecked event, if checkboxes are checked on load
- $('.issue-checkbox input[type="checkbox"]:checked').first().each((_, e) => {
- e.checked = false;
- $(e).trigger('click');
- });
+ $('.issue-checkbox input[type="checkbox"]:checked')
+ .first()
+ .each((_, e) => {
+ e.checked = false;
+ $(e).trigger('click');
+ });
$('.resolve-conversation').on('click', function (e) {
e.preventDefault();
@@ -2518,7 +2932,7 @@ $(document).ready(async () => {
$.post(url, {
_csrf: csrf,
action,
- comment_id: id,
+ comment_id: id
}).then(reload);
});
@@ -2587,7 +3001,8 @@ $(document).ready(async () => {
const $cloneAddr = $('#clone_addr');
$cloneAddr.on('change', () => {
const $repoName = $('#repo_name');
- if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) { // Only modify if repo_name input is blank
+ if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) {
+ // Only modify if repo_name input is blank
$repoName.val($cloneAddr.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3]);
}
});
@@ -2597,7 +3012,7 @@ $(document).ready(async () => {
highlight(document.querySelectorAll('pre code')),
initGitGraph(),
initClipboard(),
- initUserHeatmap(),
+ initUserHeatmap()
]);
});
@@ -2651,7 +3066,9 @@ $(() => {
// Parse SSH Key
$('#ssh-key-content').on('change paste keyup', function () {
- const arrays = $(this).val().split(' ');
+ const arrays = $(this)
+ .val()
+ .split(' ');
const $title = $('#ssh-key-title');
if ($title.val() === '' && arrays.length === 3 && arrays[2] !== '') {
$title.val(arrays[2]);
@@ -2669,22 +3086,24 @@ function showDeletePopup() {
const dialog = $(`.delete.modal${filter}`);
dialog.find('.name').text($this.data('name'));
- dialog.modal({
- closable: false,
- onApprove() {
- if ($this.data('type') === 'form') {
- $($this.data('form')).trigger('submit');
- return;
- }
+ dialog
+ .modal({
+ closable: false,
+ onApprove() {
+ if ($this.data('type') === 'form') {
+ $($this.data('form')).trigger('submit');
+ return;
+ }
- $.post($this.data('url'), {
- _csrf: csrf,
- id: $this.data('id')
- }).done((data) => {
- window.location.href = data.redirect;
- });
- }
- }).modal('show');
+ $.post($this.data('url'), {
+ _csrf: csrf,
+ id: $this.data('id')
+ }).done((data) => {
+ window.location.href = data.redirect;
+ });
+ }
+ })
+ .modal('show');
return false;
}
@@ -2698,22 +3117,24 @@ function showAddAllPopup() {
const dialog = $(`.addall.modal${filter}`);
dialog.find('.name').text($this.data('name'));
- dialog.modal({
- closable: false,
- onApprove() {
- if ($this.data('type') === 'form') {
- $($this.data('form')).trigger('submit');
- return;
- }
+ dialog
+ .modal({
+ closable: false,
+ onApprove() {
+ if ($this.data('type') === 'form') {
+ $($this.data('form')).trigger('submit');
+ return;
+ }
- $.post($this.data('url'), {
- _csrf: csrf,
- id: $this.data('id')
- }).done((data) => {
- window.location.href = data.redirect;
- });
- }
- }).modal('show');
+ $.post($this.data('url'), {
+ _csrf: csrf,
+ id: $this.data('id')
+ }).done((data) => {
+ window.location.href = data.redirect;
+ });
+ }
+ })
+ .modal('show');
return false;
}
@@ -2839,45 +3260,62 @@ function initVueComponents() {
counts: {},
repoTypes: {
all: {
- searchMode: '',
+ searchMode: ''
},
forks: {
- searchMode: 'fork',
+ searchMode: 'fork'
},
mirrors: {
- searchMode: 'mirror',
+ searchMode: 'mirror'
},
sources: {
- searchMode: 'source',
+ searchMode: 'source'
},
collaborative: {
- searchMode: 'collaborative',
- },
+ searchMode: 'collaborative'
+ }
}
};
},
computed: {
showMoreReposLink() {
- return this.repos.length > 0 && this.repos.length < this.counts[`${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`];
+ return (
+ this.repos.length > 0 &&
+ this.repos.length <
+ this.counts[
+ `${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`
+ ]
+ );
},
searchURL() {
- return `${this.suburl}/api/v1/repos/search?sort=updated&order=desc&uid=${this.uid}&q=${this.searchQuery
- }&page=${this.page}&limit=${this.searchLimit}&mode=${this.repoTypes[this.reposFilter].searchMode
- }${this.reposFilter !== 'all' ? '&exclusive=1' : ''
- }${this.archivedFilter === 'archived' ? '&archived=true' : ''}${this.archivedFilter === 'unarchived' ? '&archived=false' : ''
- }${this.privateFilter === 'private' ? '&onlyPrivate=true' : ''}${this.privateFilter === 'public' ? '&private=false' : ''
- }`;
+ return `${
+ this.suburl
+ }/api/v1/repos/search?sort=updated&order=desc&uid=${this.uid}&q=${
+ this.searchQuery
+ }&page=${this.page}&limit=${this.searchLimit}&mode=${
+ this.repoTypes[this.reposFilter].searchMode
+ }${this.reposFilter !== 'all' ? '&exclusive=1' : ''}${
+ this.archivedFilter === 'archived' ? '&archived=true' : ''
+ }${this.archivedFilter === 'unarchived' ? '&archived=false' : ''}${
+ this.privateFilter === 'private' ? '&onlyPrivate=true' : ''
+ }${this.privateFilter === 'public' ? '&private=false' : ''}`;
},
repoTypeCount() {
- return this.counts[`${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`];
+ return this.counts[
+ `${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`
+ ];
}
},
mounted() {
this.searchRepos(this.reposFilter);
- $(this.$el).find('.poping.up').popup();
- $(this.$el).find('.dropdown').dropdown();
+ $(this.$el)
+ .find('.poping.up')
+ .popup();
+ $(this.$el)
+ .find('.dropdown')
+ .dropdown();
this.setCheckboxes();
const self = this;
Vue.nextTick(() => {
@@ -2928,7 +3366,11 @@ function initVueComponents() {
this.reposFilter = filter;
this.repos = [];
this.page = 1;
- Vue.set(this.counts, `${filter}:${this.archivedFilter}:${this.privateFilter}`, 0);
+ Vue.set(
+ this.counts,
+ `${filter}:${this.archivedFilter}:${this.privateFilter}`,
+ 0
+ );
this.searchRepos();
},
@@ -2992,7 +3434,11 @@ function initVueComponents() {
this.page = 1;
this.repos = [];
this.setCheckboxes();
- Vue.set(this.counts, `${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`, 0);
+ Vue.set(
+ this.counts,
+ `${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`,
+ 0
+ );
this.searchRepos();
},
@@ -3014,11 +3460,14 @@ function initVueComponents() {
this.page = 1;
this.repos = [];
this.setCheckboxes();
- Vue.set(this.counts, `${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`, 0);
+ Vue.set(
+ this.counts,
+ `${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`,
+ 0
+ );
this.searchRepos();
},
-
changePage(page) {
this.page = page;
if (this.page > this.finalPage) {
@@ -3028,7 +3477,11 @@ function initVueComponents() {
this.page = 1;
}
this.repos = [];
- Vue.set(this.counts, `${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`, 0);
+ Vue.set(
+ this.counts,
+ `${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`,
+ 0
+ );
this.searchRepos();
},
@@ -3074,7 +3527,11 @@ function initVueComponents() {
},
showRepo(repo) {
- return this.showArchivedRepo(repo) && this.showPrivateRepo(repo) && this.showFilteredRepo(repo);
+ return (
+ this.showArchivedRepo(repo) &&
+ this.showPrivateRepo(repo) &&
+ this.showFilteredRepo(repo)
+ );
},
searchRepos() {
@@ -3090,10 +3547,18 @@ function initVueComponents() {
if (searchedURL === self.searchURL) {
self.repos = result.data;
const count = request.getResponseHeader('X-Total-Count');
- if (searchedQuery === '' && searchedMode === '' && self.archivedFilter === 'both') {
+ if (
+ searchedQuery === '' &&
+ searchedMode === '' &&
+ self.archivedFilter === 'both'
+ ) {
self.reposTotalCount = count;
}
- Vue.set(self.counts, `${self.reposFilter}:${self.archivedFilter}:${self.privateFilter}`, count);
+ Vue.set(
+ self.counts,
+ `${self.reposFilter}:${self.archivedFilter}:${self.privateFilter}`,
+ count
+ );
self.finalPage = Math.floor(count / self.searchLimit) + 1;
self.updateHistory();
}
@@ -3107,11 +3572,14 @@ function initVueComponents() {
repoClass(repo) {
if (repo.fork) {
return 'octicon-repo-forked';
- } if (repo.mirror) {
+ }
+ if (repo.mirror) {
return 'octicon-repo-clone';
- } if (repo.template) {
+ }
+ if (repo.template) {
return `octicon-repo-template${repo.private ? '-private' : ''}`;
- } if (repo.private) {
+ }
+ if (repo.private) {
return 'octicon-lock';
}
return 'octicon-repo';
@@ -3122,8 +3590,13 @@ function initVueComponents() {
function initCtrlEnterSubmit() {
$('.js-quick-submit').on('keydown', function (e) {
- if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode === 13 || e.keyCode === 10)) {
- $(this).closest('form').trigger('submit');
+ if (
+ ((e.ctrlKey && !e.altKey) || e.metaKey) &&
+ (e.keyCode === 13 || e.keyCode === 10)
+ ) {
+ $(this)
+ .closest('form')
+ .trigger('submit');
}
});
}
@@ -3140,14 +3613,18 @@ function initVueApp() {
delimiters: ['${', '}'],
el,
data: {
- searchLimit: Number((document.querySelector('meta[name=_search_limit]') || {}).content),
+ searchLimit: Number(
+ (document.querySelector('meta[name=_search_limit]') || {}).content
+ ),
suburl: AppSubUrl,
- uid: Number((document.querySelector('meta[name=_context_uid]') || {}).content),
- activityTopAuthors: window.ActivityTopAuthors || [],
+ uid: Number(
+ (document.querySelector('meta[name=_context_uid]') || {}).content
+ ),
+ activityTopAuthors: window.ActivityTopAuthors || []
},
components: {
- ActivityTopAuthors,
- },
+ ActivityTopAuthors
+ }
});
}
@@ -3171,7 +3648,8 @@ window.timeAddManual = function () {
onApprove() {
$('#add_time_manual_form').trigger('submit');
}
- }).modal('show');
+ })
+ .modal('show');
};
window.toggleStopwatch = function () {
@@ -3213,7 +3691,8 @@ function initFilterBranchTagDropdown(selector) {
const vm = this;
this.noResults = vm.$el.getAttribute('data-no-results');
- this.canCreateBranch = vm.$el.getAttribute('data-can-create-branch') === 'true';
+ this.canCreateBranch =
+ vm.$el.getAttribute('data-can-create-branch') === 'true';
document.body.addEventListener('click', (event) => {
if (vm.$el.contains(event.target)) {
@@ -3238,11 +3717,15 @@ function initFilterBranchTagDropdown(selector) {
const vm = this;
const items = vm.items.filter((item) => {
- return ((vm.mode === 'branches' && item.branch) || (vm.mode === 'tags' && item.tag)) &&
- (!vm.searchTerm || item.name.toLowerCase().includes(vm.searchTerm.toLowerCase()));
+ return (
+ ((vm.mode === 'branches' && item.branch) ||
+ (vm.mode === 'tags' && item.tag)) &&
+ (!vm.searchTerm ||
+ item.name.toLowerCase().includes(vm.searchTerm.toLowerCase()))
+ );
});
- vm.active = (items.length === 0 && vm.showCreateNewBranch ? 0 : -1);
+ vm.active = items.length === 0 && vm.showCreateNewBranch ? 0 : -1;
return items;
},
@@ -3255,7 +3738,11 @@ function initFilterBranchTagDropdown(selector) {
return false;
}
- return vm.items.filter((item) => item.name.toLowerCase() === vm.searchTerm.toLowerCase()).length === 0;
+ return (
+ vm.items.filter(
+ (item) => item.name.toLowerCase() === vm.searchTerm.toLowerCase()
+ ).length === 0
+ );
}
},
@@ -3305,7 +3792,10 @@ function initFilterBranchTagDropdown(selector) {
if (el.offsetTop < cont.scrollTop) {
cont.scrollTop = el.offsetTop;
- } else if (el.offsetTop + el.clientHeight > cont.scrollTop + cont.clientHeight) {
+ } else if (
+ el.offsetTop + el.clientHeight >
+ cont.scrollTop + cont.clientHeight
+ ) {
cont.scrollTop = el.offsetTop + el.clientHeight - cont.clientHeight;
}
},
@@ -3319,7 +3809,10 @@ function initFilterBranchTagDropdown(selector) {
vm.active = vm.getSelectedIndexInFiltered();
}
- if (vm.active + (vm.showCreateNewBranch ? 0 : 1) >= vm.filteredItems.length) {
+ if (
+ vm.active + (vm.showCreateNewBranch ? 0 : 1) >=
+ vm.filteredItems.length
+ ) {
return;
}
vm.active++;
@@ -3362,7 +3855,10 @@ function initFilterBranchTagDropdown(selector) {
$('.commit-button').on('click', function (e) {
e.preventDefault();
- $(this).parent().find('.commit-body').toggle();
+ $(this)
+ .parent()
+ .find('.commit-body')
+ .toggle();
});
function initNavbarContentToggle() {
@@ -3408,48 +3904,62 @@ function initTopicbar() {
saveBtn.on('click', () => {
const topics = $('input[name=topics]').val();
- $.post(saveBtn.data('link'), {
- _csrf: csrf,
- topics
- }, (_data, _textStatus, xhr) => {
- if (xhr.responseJSON.status === 'ok') {
- viewDiv.children('.topic').remove();
- if (topics.length) {
- const topicArray = topics.split(',');
-
- const last = viewDiv.children('a').last();
- for (let i = 0; i < topicArray.length; i++) {
- const link = $('
');
- link.attr('href', `${AppSubUrl}/explore/repos?q=${encodeURIComponent(topicArray[i])}&topic=1`);
- link.text(topicArray[i]);
- link.insertBefore(last);
+ $.post(
+ saveBtn.data('link'),
+ {
+ _csrf: csrf,
+ topics
+ },
+ (_data, _textStatus, xhr) => {
+ if (xhr.responseJSON.status === 'ok') {
+ viewDiv.children('.topic').remove();
+ if (topics.length) {
+ const topicArray = topics.split(',');
+
+ const last = viewDiv.children('a').last();
+ for (let i = 0; i < topicArray.length; i++) {
+ const link = $('
');
+ link.attr(
+ 'href',
+ `${AppSubUrl}/explore/repos?q=${encodeURIComponent(
+ topicArray[i]
+ )}&topic=1`
+ );
+ link.text(topicArray[i]);
+ link.insertBefore(last);
+ }
}
+ editDiv.css('display', 'none');
+ viewDiv.show();
}
- editDiv.css('display', 'none');
- viewDiv.show();
}
- }).fail((xhr) => {
- if (xhr.status === 422) {
- if (xhr.responseJSON.invalidTopics.length > 0) {
- topicPrompts.formatPrompt = xhr.responseJSON.message;
-
- const {invalidTopics} = xhr.responseJSON;
- const topicLables = topicDropdown.children('a.ui.label');
-
- topics.split(',').forEach((value, index) => {
- for (let i = 0; i < invalidTopics.length; i++) {
- if (invalidTopics[i] === value) {
- topicLables.eq(index).removeClass('green').addClass('red');
+ )
+ .fail((xhr) => {
+ if (xhr.status === 422) {
+ if (xhr.responseJSON.invalidTopics.length > 0) {
+ topicPrompts.formatPrompt = xhr.responseJSON.message;
+
+ const {invalidTopics} = xhr.responseJSON;
+ const topicLables = topicDropdown.children('a.ui.label');
+
+ topics.split(',').forEach((value, index) => {
+ for (let i = 0; i < invalidTopics.length; i++) {
+ if (invalidTopics[i] === value) {
+ topicLables
+ .eq(index)
+ .removeClass('green')
+ .addClass('red');
+ }
}
- }
- });
- } else {
- topicPrompts.countPrompt = xhr.responseJSON.message;
+ });
+ } else {
+ topicPrompts.countPrompt = xhr.responseJSON.message;
+ }
}
- }
- }).always(() => {
- topicForm.form('validate form');
- });
+ })
+ .always(() => {
+ topicForm.form('validate form');
+ });
});
topicDropdown.dropdown({
@@ -3462,7 +3972,7 @@ function initTopicbar() {
duration: 200,
variation: false,
blue: true,
- basic: true,
+ basic: true
},
className: {
label: 'ui small label'
@@ -3474,7 +3984,7 @@ function initTopicbar() {
onResponse(res) {
const formattedResponse = {
success: false,
- results: [],
+ results: []
};
const stripTags = function (text) {
return text.replace(/<[^>]*>?/gm, '');
@@ -3483,7 +3993,11 @@ function initTopicbar() {
const query = stripTags(this.urlData.query.trim());
let found_query = false;
const current_topics = [];
- topicDropdown.find('div.label.visible.topic,a.label.visible').each((_, e) => { current_topics.push(e.dataset.value) });
+ topicDropdown
+ .find('div.label.visible.topic,a.label.visible')
+ .each((_, e) => {
+ current_topics.push(e.dataset.value);
+ });
if (res.topics) {
let found = false;
@@ -3493,10 +4007,15 @@ function initTopicbar() {
continue;
}
- if (res.topics[i].topic_name.toLowerCase() === query.toLowerCase()) {
+ if (
+ res.topics[i].topic_name.toLowerCase() === query.toLowerCase()
+ ) {
found_query = true;
}
- formattedResponse.results.push({description: res.topics[i].topic_name, 'data-value': res.topics[i].topic_name});
+ formattedResponse.results.push({
+ description: res.topics[i].topic_name,
+ 'data-value': res.topics[i].topic_name
+ });
found = true;
}
formattedResponse.success = found;
@@ -3504,7 +4023,10 @@ function initTopicbar() {
if (query.length > 0 && !found_query) {
formattedResponse.success = true;
- formattedResponse.results.unshift({description: query, 'data-value': query});
+ formattedResponse.results.unshift({
+ description: query,
+ 'data-value': query
+ });
} else if (query.length > 0 && found_query) {
formattedResponse.results.sort((a, b) => {
if (a.description.toLowerCase() === query.toLowerCase()) return -1;
@@ -3516,11 +4038,14 @@ function initTopicbar() {
}
return formattedResponse;
- },
+ }
},
onLabelCreate(value) {
value = value.toLowerCase().trim();
- this.attr('data-value', value).contents().first().replaceWith(value);
+ this.attr('data-value', value)
+ .contents()
+ .first()
+ .replaceWith(value);
return $(this);
},
onAdd(addedValue, _addedText, $addedChoice) {
@@ -3532,9 +4057,17 @@ function initTopicbar() {
$.fn.form.settings.rules.validateTopic = function (_values, regExp) {
const topics = topicDropdown.children('a.ui.label');
- const status = topics.length === 0 || topics.last().attr('data-value').match(regExp);
+ const status =
+ topics.length === 0 ||
+ topics
+ .last()
+ .attr('data-value')
+ .match(regExp);
if (!status) {
- topics.last().removeClass('green').addClass('red');
+ topics
+ .last()
+ .removeClass('green')
+ .addClass('red');
}
return status && topicDropdown.children('a.ui.label.red').length === 0;
};
@@ -3556,7 +4089,7 @@ function initTopicbar() {
prompt: topicPrompts.countPrompt
}
]
- },
+ }
}
});
}
@@ -3588,11 +4121,11 @@ window.updateDeadline = function (deadlineString) {
$.ajax(`${$('#update-issue-deadline-form').attr('action')}/deadline`, {
data: JSON.stringify({
- due_date: realDeadline,
+ due_date: realDeadline
}),
headers: {
'X-Csrf-Token': csrf,
- 'X-Remote': true,
+ 'X-Remote': true
},
contentType: 'application/json',
type: 'POST',
@@ -3616,7 +4149,8 @@ window.deleteDependencyModal = function (id, type) {
$('#dependencyType').val(type);
$('#removeDependencyForm').trigger('submit');
}
- }).modal('show');
+ })
+ .modal('show');
};
function initIssueList() {
@@ -3628,32 +4162,34 @@ function initIssueList() {
if (crossRepoSearch === 'true') {
issueSearchUrl = `${AppSubUrl}/api/v1/repos/issues/search?q={query}&priority_repo_id=${repoId}&type=${tp}`;
}
- $('#new-dependency-drop-list')
- .dropdown({
- apiSettings: {
- url: issueSearchUrl,
- onResponse(response) {
- const filteredResponse = {success: true, results: []};
- const currIssueId = $('#new-dependency-drop-list').data('issue-id');
- // Parse the response from the api to work with our dropdown
- $.each(response, (_i, issue) => {
- // Don't list current issue in the dependency list.
- if (issue.id === currIssueId) {
- return;
- }
- filteredResponse.results.push({
- name: `#${issue.number} ${htmlEncode(issue.title)
- }
${htmlEncode(issue.repository.full_name)}
`,
- value: issue.id
- });
+ $('#new-dependency-drop-list').dropdown({
+ apiSettings: {
+ url: issueSearchUrl,
+ onResponse(response) {
+ const filteredResponse = {success: true, results: []};
+ const currIssueId = $('#new-dependency-drop-list').data('issue-id');
+ // Parse the response from the api to work with our dropdown
+ $.each(response, (_i, issue) => {
+ // Don't list current issue in the dependency list.
+ if (issue.id === currIssueId) {
+ return;
+ }
+ filteredResponse.results.push({
+ name: `#${issue.number} ${htmlEncode(
+ issue.title
+ )}
${htmlEncode(
+ issue.repository.full_name
+ )}
`,
+ value: issue.id
});
- return filteredResponse;
- },
- cache: false,
+ });
+ return filteredResponse;
},
+ cache: false
+ },
- fullTextSearch: true
- });
+ fullTextSearch: true
+ });
$('.menu a.label-filter-item').each(function () {
$(this).on('click', function (e) {
@@ -3673,7 +4209,9 @@ function initIssueList() {
$('.menu .ui.dropdown.label-filter').on('keydown', (e) => {
if (e.altKey && e.keyCode === 13) {
- const selectedItems = $('.menu .ui.dropdown.label-filter .menu .item.selected');
+ const selectedItems = $(
+ '.menu .ui.dropdown.label-filter .menu .item.selected'
+ );
if (selectedItems.length > 0) {
const item = $(selectedItems[0]);
@@ -3693,7 +4231,10 @@ window.cancelCodeComment = function (btn) {
const form = $(btn).closest('form');
if (form.length > 0 && form.hasClass('comment-form')) {
form.addClass('hide');
- form.parent().find('button.comment-form-reply').show();
+ form
+ .parent()
+ .find('button.comment-form-reply')
+ .show();
} else {
form.closest('.comment-code-cloud').remove();
}
diff --git a/web_src/less/_dataset.less b/web_src/less/_dataset.less
index c69432823..f3fc87b69 100644
--- a/web_src/less/_dataset.less
+++ b/web_src/less/_dataset.less
@@ -1,162 +1,165 @@
.dataset {
- padding-top: 15px;
- .dataset-files {
- margin: 0 30px !important;
- #dataset {
- .dz-preview {
- border-bottom: 1px solid rgb(218, 220, 224);
- min-height: 0;
- }
- .dz-preview.dz-file-preview,
- .dz-preview.dz-processing {
- display: flex;
- align-items: center;
- .dz-details {
- z-index: 1;
- opacity: 1 !important;
- display: flex;
- padding: 0 0 10px 0;
- min-width: 60%;
- max-width: 60%;
- position: relative;
- }
- .dz-success-mark {
- z-index: 0;
- position: relative;
- top: 0;
- left: auto;
- color: green;
- margin: 0 16px;
- }
- .dz-error-mark {
- z-index: 0;
- position: relative;
- top: 0;
- left: auto;
- color: red;
- margin: 0 16px;
- }
- .bar {
- background: #21ba45;
+ padding-top: 15px;
+ .dataset-files {
+ margin: 30px 0 !important;
+ #dataset {
+ .dz-preview {
+ border-bottom: 1px solid rgb(218, 220, 224);
+ min-height: 0;
+ }
+ .dz-preview.dz-file-preview,
+ .dz-preview.dz-processing {
+ display: flex;
+ align-items: center;
+ .dz-details {
+ z-index: 1;
+ opacity: 1 !important;
+ display: flex;
+ padding: 0 0 10px 0;
+ min-width: 60%;
+ max-width: 60%;
+ position: relative;
+ }
+ .dz-success-mark {
+ z-index: 0;
+ position: relative;
+ top: 0;
+ left: auto;
+ color: green;
+ margin: 0 16px;
+ }
+ .dz-error-mark {
+ z-index: 0;
+ position: relative;
+ top: 0;
+ left: auto;
+ color: red;
+ margin: 0 16px;
+ }
+ .bar {
+ background: #21ba45;
+ }
+ .dz-progress {
+ left: 4px;
+ background: grey;
+ width: 70%;
+ top: 20px;
+ margin: 0;
+ }
+ .dz-file {
+ margin-bottom: auto;
+ }
+ }
+ .dz-preview .dz-error-message {
+ top: 30px;
+ }
}
- .dz-progress {
- left: 4px;
- background: grey;
- width: 70%;
- top: 20px;
- margin: 0;
+ .upload-info {
+ padding-top: 8px;
}
- .dz-file {
- margin-bottom: auto;
+ }
+ #dataset-list {
+ border-top: 1px solid #dddddd;
+ margin-top: 20px;
+ padding-top: 15px;
+
+ > li {
+ list-style: none;
+
+ .meta,
+ .detail {
+ padding-top: 30px;
+ padding-bottom: 40px;
+ }
+
+ .meta {
+ text-align: right;
+ position: relative;
+
+ .tag:not(.icon) {
+ display: block;
+ margin-top: 15px;
+ }
+
+ .commit {
+ display: block;
+ margin-top: 10px;
+ }
+ }
+
+ .detail {
+ border-left: 1px solid #dddddd;
+
+ .author {
+ img {
+ margin-bottom: -3px;
+ }
+ }
+
+ .download {
+ margin-top: 20px;
+
+ > a {
+ .svg {
+ margin-left: 5px;
+ margin-right: 5px;
+ }
+ }
+
+ .list {
+ padding-left: 0;
+ border-top: 1px solid #eeeeee;
+
+ li {
+ list-style: none;
+ display: block;
+ padding-top: 8px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #eeeeee;
+
+ a > .text.right {
+ margin-right: 5px;
+ }
+ }
+ }
+ }
+
+ .dot {
+ width: 9px;
+ height: 9px;
+ background-color: #cccccc;
+ z-index: 999;
+ position: absolute;
+ display: block;
+ left: -5px;
+ top: 40px;
+ border-radius: 6px;
+ border: 1px solid #ffffff;
+ }
+ }
}
- }
- .dz-preview .dz-error-message {
- top: 30px;
- }
}
- }
- #dataset-list {
- border-top: 1px solid #dddddd;
- margin-top: 20px;
- padding-top: 15px;
-
- > li {
- list-style: none;
-
- .meta,
- .detail {
- padding-top: 30px;
- padding-bottom: 40px;
- }
-
- .meta {
- text-align: right;
- position: relative;
-
- .tag:not(.icon) {
- display: block;
- margin-top: 15px;
- }
-
- .commit {
- display: block;
- margin-top: 10px;
- }
- }
-
- .detail {
- border-left: 1px solid #dddddd;
-
- .author {
- img {
- margin-bottom: -3px;
- }
- }
-
- .download {
- margin-top: 20px;
-
- > a {
- .svg {
- margin-left: 5px;
- margin-right: 5px;
- }
- }
-
- .list {
- padding-left: 0;
- border-top: 1px solid #eeeeee;
-
- li {
- list-style: none;
- display: block;
- padding-top: 8px;
- padding-bottom: 8px;
- border-bottom: 1px solid #eeeeee;
-
- a > .text.right {
- margin-right: 5px;
- }
- }
- }
- }
-
- .dot {
- width: 9px;
- height: 9px;
- background-color: #cccccc;
- z-index: 999;
- position: absolute;
- display: block;
- left: -5px;
- top: 40px;
- border-radius: 6px;
- border: 1px solid #ffffff;
- }
- }
- }
- }
- .item {
- padding-top: 15px;
- padding-bottom: 10px;
- border-bottom: 1px dashed #aaaaaa;
- }
- .ui.grid>.row {
- align-items: center;
- }
- .title {
- font-size: 16px;
- font-weight: bold;
- margin: 0 6px;
- }
+ .item {
+ padding-top: 15px;
+ padding-bottom: 10px;
+ border-bottom: 1px dashed #aaaaaa;
+ }
+ .ui.grid > .row {
+ align-items: center;
+ }
+ .title {
+ font-size: 16px;
+ font-weight: bold;
+ margin: 0 6px;
+ }
}
.dataset-list {
- .octicon-check {
- padding-right: 8px;;
- }
- .hide {
- display: none;
- }
+ .octicon-check {
+ padding-right: 8px;
+ }
+ .hide {
+ display: none;
+ }
}
.ui.dataset.list {
.item {
@@ -200,4 +203,4 @@
height: 24px;
}
}
-}
\ No newline at end of file
+}