Merge pull request '[gitea] week 2024-20 cherry pick (gitea-github/main -> forgejo)' (#3729) from earl-warren/wcp/2024-20 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3729 Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
This commit is contained in:
commit
1b3e6a4831
55 changed files with 806 additions and 328 deletions
|
@ -898,6 +898,7 @@ input:-webkit-autofill:active,
|
|||
font-weight: var(--font-weight-normal);
|
||||
margin: 0 6px;
|
||||
padding: 5px 10px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ui .sha.label .shortsha {
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
color: var(--color-console-fg);
|
||||
font-family: var(--fonts-monospace);
|
||||
border-radius: var(--border-radius);
|
||||
word-break: break-word;
|
||||
overflow-wrap: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.console img { max-width: 100%; }
|
||||
|
|
|
@ -5,7 +5,6 @@ Gitea's private styles use `g-` prefix.
|
|||
|
||||
.gt-word-break {
|
||||
word-wrap: break-word !important;
|
||||
word-break: break-word; /* compat: Safari */
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ td .commit-summary {
|
|||
}
|
||||
|
||||
.repository.file.list .non-diff-file-content .plain-text pre {
|
||||
word-break: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
|
@ -2487,14 +2487,10 @@ tbody.commit-list {
|
|||
.commit-body {
|
||||
margin: 0.25em 0;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
line-height: initial;
|
||||
}
|
||||
|
||||
/* PR-comment */
|
||||
.repository .timeline-item .commit-body {
|
||||
margin-left: 45px;
|
||||
}
|
||||
|
||||
.git-notes.top {
|
||||
text-align: left;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
color: var(--color-text);
|
||||
font-size: 16px;
|
||||
font-weight: var(--font-weight-semibold);
|
||||
word-break: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@
|
|||
flex-wrap: wrap;
|
||||
gap: .25rem;
|
||||
color: var(--color-text-light-2);
|
||||
word-break: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.flex-item .flex-item-body a {
|
||||
|
|
|
@ -67,7 +67,7 @@ export default {
|
|||
const weekValues = Object.values(this.data);
|
||||
const start = weekValues[0].week;
|
||||
const end = firstStartDateAfterDate(new Date());
|
||||
const startDays = startDaysBetween(new Date(start), new Date(end));
|
||||
const startDays = startDaysBetween(start, end);
|
||||
this.data = fillEmptyStartDaysWithZeroes(startDays, this.data);
|
||||
this.errorText = '';
|
||||
} else {
|
||||
|
|
|
@ -114,7 +114,7 @@ export default {
|
|||
const weekValues = Object.values(total.weeks);
|
||||
this.xAxisStart = weekValues[0].week;
|
||||
this.xAxisEnd = firstStartDateAfterDate(new Date());
|
||||
const startDays = startDaysBetween(new Date(this.xAxisStart), new Date(this.xAxisEnd));
|
||||
const startDays = startDaysBetween(this.xAxisStart, this.xAxisEnd);
|
||||
total.weeks = fillEmptyStartDaysWithZeroes(startDays, total.weeks);
|
||||
this.xAxisMin = this.xAxisStart;
|
||||
this.xAxisMax = this.xAxisEnd;
|
||||
|
|
|
@ -62,7 +62,7 @@ export default {
|
|||
const data = await response.json();
|
||||
const start = Object.values(data)[0].week;
|
||||
const end = firstStartDateAfterDate(new Date());
|
||||
const startDays = startDaysBetween(new Date(start), new Date(end));
|
||||
const startDays = startDaysBetween(start, end);
|
||||
this.data = fillEmptyStartDaysWithZeroes(startDays, data).slice(-52);
|
||||
this.errorText = '';
|
||||
} else {
|
||||
|
|
|
@ -101,10 +101,6 @@ export async function createMonaco(textarea, filename, editorOpts) {
|
|||
},
|
||||
});
|
||||
|
||||
// Quick fix: https://github.com/microsoft/monaco-editor/issues/2962
|
||||
monaco.languages.register({id: 'vs.editor.nullLanguage'});
|
||||
monaco.languages.setLanguageConfiguration('vs.editor.nullLanguage', {});
|
||||
|
||||
const editor = monaco.editor.create(container, {
|
||||
value: textarea.value,
|
||||
theme: 'gitea',
|
||||
|
|
|
@ -2,7 +2,6 @@ import $ from 'jquery';
|
|||
import {contrastColor} from '../utils/color.js';
|
||||
import {createSortable} from '../modules/sortable.js';
|
||||
import {POST, DELETE, PUT} from '../modules/fetch.js';
|
||||
import tinycolor from 'tinycolor2';
|
||||
|
||||
function updateIssueCount(cards) {
|
||||
const parent = cards.parentElement;
|
||||
|
@ -63,17 +62,20 @@ async function initRepoProjectSortable() {
|
|||
delay: 500,
|
||||
onSort: async () => {
|
||||
boardColumns = mainBoard.getElementsByClassName('project-column');
|
||||
for (let i = 0; i < boardColumns.length; i++) {
|
||||
const column = boardColumns[i];
|
||||
if (parseInt(column.getAttribute('data-sorting')) !== i) {
|
||||
try {
|
||||
const bgColor = column.style.backgroundColor; // will be rgb() string
|
||||
const color = bgColor ? tinycolor(bgColor).toHexString() : '';
|
||||
await PUT(column.getAttribute('data-url'), {data: {sorting: i, color}});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
const columnSorting = {
|
||||
columns: Array.from(boardColumns, (column, i) => ({
|
||||
columnID: parseInt(column.getAttribute('data-id')),
|
||||
sorting: i,
|
||||
})),
|
||||
};
|
||||
|
||||
try {
|
||||
await POST(mainBoard.getAttribute('data-url'), {
|
||||
data: columnSorting,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,25 +1,30 @@
|
|||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc.js';
|
||||
import {getCurrentLocale} from '../utils.js';
|
||||
|
||||
// Returns an array of millisecond-timestamps of start-of-week days (Sundays)
|
||||
export function startDaysBetween(startDate, endDate) {
|
||||
// Ensure the start date is a Sunday
|
||||
while (startDate.getDay() !== 0) {
|
||||
startDate.setDate(startDate.getDate() + 1);
|
||||
}
|
||||
dayjs.extend(utc);
|
||||
|
||||
const start = dayjs(startDate);
|
||||
const end = dayjs(endDate);
|
||||
const startDays = [];
|
||||
/**
|
||||
* Returns an array of millisecond-timestamps of start-of-week days (Sundays)
|
||||
*
|
||||
* @param startConfig The start date. Can take any type that `Date` accepts.
|
||||
* @param endConfig The end date. Can take any type that `Date` accepts.
|
||||
*/
|
||||
export function startDaysBetween(startDate, endDate) {
|
||||
const start = dayjs.utc(startDate);
|
||||
const end = dayjs.utc(endDate);
|
||||
|
||||
let current = start;
|
||||
|
||||
// Ensure the start date is a Sunday
|
||||
while (current.day() !== 0) {
|
||||
current = current.add(1, 'day');
|
||||
}
|
||||
|
||||
const startDays = [];
|
||||
while (current.isBefore(end)) {
|
||||
startDays.push(current.valueOf());
|
||||
// we are adding 7 * 24 hours instead of 1 week because we don't want
|
||||
// date library to use local time zone to calculate 1 week from now.
|
||||
// local time zone is problematic because of daylight saving time (dst)
|
||||
// used on some countries
|
||||
current = current.add(7 * 24, 'hour');
|
||||
current = current.add(1, 'week');
|
||||
}
|
||||
|
||||
return startDays;
|
||||
|
@ -29,10 +34,10 @@ export function firstStartDateAfterDate(inputDate) {
|
|||
if (!(inputDate instanceof Date)) {
|
||||
throw new Error('Invalid date');
|
||||
}
|
||||
const dayOfWeek = inputDate.getDay();
|
||||
const dayOfWeek = inputDate.getUTCDay();
|
||||
const daysUntilSunday = 7 - dayOfWeek;
|
||||
const resultDate = new Date(inputDate.getTime());
|
||||
resultDate.setDate(resultDate.getDate() + daysUntilSunday);
|
||||
resultDate.setUTCDate(resultDate.getUTCDate() + daysUntilSunday);
|
||||
return resultDate.valueOf();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue