Generator updates (#16339)

* generator

* mod tools update
This commit is contained in:
ludwiczakpawel 2022-01-28 12:20:30 +01:00 committed by GitHub
parent 914b984e9b
commit 1abf02d94b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 45 deletions

View file

@ -198,7 +198,7 @@ function buildArticleHTML(article) {
// We need to be able to set the data-info hash attribute with escaped characters.
var name = article.user.name.replace(/[\\"']/g, '\\$&');
var previewCardContent = `
<div id="story-author-preview-content-${article.id}" class="profile-preview-card__content crayons-dropdown p-4" data-repositioning-dropdown="true" style="border-top: var(--su-7) solid var(--card-color);" data-testid="profile-preview-card">
<div id="story-author-preview-content-${article.id}" class="profile-preview-card__content crayons-dropdown p-4 pt-0 branded-7" data-repositioning-dropdown="true" style="border-top-color: var(--card-color);" data-testid="profile-preview-card">
<div class="gap-4 grid">
<div class="-mt-4">
<a href="/${profileUsername}" class="flex">

View file

@ -28,6 +28,8 @@ $colors: (
'accent-success': var(--accent-success),
'accent-warning': var(--accent-warning),
'accent-danger': var(--accent-danger),
'primary': var(--color-primary),
'secondary': var(--color-secondary),
);
////////////////////////////////////////////////////////////////////////////////////
@ -154,7 +156,7 @@ $z-indexes: (
@each $name, $value in $values {
.#{$prefix}#{$separator}#{$name} {
@each $property in $properties {
#{$property}: $value;
#{$property}: $value !important; // TODO: Remove !important once we drop Bootstrap as dependency. More: https://forem-team.slack.com/archives/C01K9U7UATV/p1642687819005100
}
}
}

View file

@ -160,7 +160,7 @@ describe('addAdjustTagListeners()', () => {
<button class="adjustable-tag" data-adjustment-type="subtract" data-tag-name="${tagName}">
#${tagName}
</button>
<form id="adjustment-reason-container" class="adjustment-reason-container hidden">
<form id="adjustment-reason-container" class="adjustment-reason-container">
<textarea class="crayons-textfield" placeholder="Reason for tag adjustment (required)" id="tag-adjustment-reason" required></textarea>
<button class="crayons-btn" id="tag-adjust-submit" type="submit">Submit</button>
</form>
@ -173,17 +173,6 @@ describe('addAdjustTagListeners()', () => {
const tagBtn = document.getElementsByClassName('adjustable-tag')[0];
tagBtn.click();
expect(tagBtn.classList).toContain('active');
expect(
document.getElementById('adjustment-reason-container').classList,
).not.toContain('hidden');
});
it('hides the form if the button is clicked again', () => {
const tagBtn = document.getElementsByClassName('adjustable-tag')[0];
tagBtn.click();
tagBtn.click();
expect(
document.getElementById('adjustment-reason-container').classList,
).toContain('hidden');
});
});
});
@ -203,7 +192,7 @@ describe('addAdjustTagListeners()', () => {
<button class="adjustable-tag" data-adjustment-type="subtract" data-tag-name="ruby">
#ruby
</button>
<form id="adjustment-reason-container" class="adjustment-reason-container hidden">
<form id="adjustment-reason-container" class="adjustment-reason-container">
<textarea class="crayons-textfield" placeholder="Reason for tag adjustment" id="tag-adjustment-reason" required></textarea>
<button class="crayons-btn" id="tag-adjust-submit" type="submit">Submit</button>
</form>

View file

@ -176,12 +176,6 @@ const adminUnpublishArticle = async (id, username, slug) => {
}
};
function toggleSubmitContainer() {
document
.getElementById('adjustment-reason-container')
.classList.toggle('hidden');
}
function clearAdjustmentReason() {
document.getElementById('tag-adjustment-reason').value = '';
}
@ -242,7 +236,6 @@ async function adjustTag(el) {
el.value = '';
}
toggleSubmitContainer();
clearAdjustmentReason();
if (outcome.result === 'addition') {
@ -297,18 +290,8 @@ export function handleAdjustTagBtn(btn) {
}
btn.classList.toggle('active');
});
if (btn.classList.contains('active')) {
document
.getElementById('adjustment-reason-container')
.classList.remove('hidden');
} else {
document
.getElementById('adjustment-reason-container')
.classList.add('hidden');
}
} else {
btn.classList.toggle('active');
toggleSubmitContainer();
}
}
@ -317,10 +300,6 @@ function handleAdminInput() {
if (addTagInput) {
addTagInput.addEventListener('focus', () => {
document
.getElementById('adjustment-reason-container')
.classList.remove('hidden');
const activeTagBtns = Array.from(
document.querySelectorAll('button.adjustable-tag.active'),
);
@ -330,7 +309,6 @@ function handleAdminInput() {
});
addTagInput.addEventListener('focusout', () => {
if (addTagInput.value === '') {
toggleSubmitContainer();
}
});
}

View file

@ -76,7 +76,7 @@ Object {
Stella Macejkovic
</button>
<div
class="profile-preview-card__content crayons-dropdown p-4"
class="profile-preview-card__content crayons-dropdown p-4 pt-0 branded-7"
data-repositioning-dropdown="true"
data-testid="profile-preview-card"
id="story-author-preview-content-62407"
@ -326,7 +326,7 @@ Object {
Stella Macejkovic
</button>
<div
class="profile-preview-card__content crayons-dropdown p-4"
class="profile-preview-card__content crayons-dropdown p-4 pt-0 branded-7"
data-repositioning-dropdown="true"
data-testid="profile-preview-card"
id="story-author-preview-content-62407"

View file

@ -21,8 +21,8 @@ export const MinimalProfilePreviewCard = ({
<div
id={contentId}
class="profile-preview-card__content crayons-dropdown p-4"
style="border-top: var(--su-7) solid var(--card-color);"
class="profile-preview-card__content crayons-dropdown p-4 pt-0 branded-7"
style="border-top-color: var(--card-color);"
data-repositioning-dropdown="true"
data-testid="profile-preview-card"
>

View file

@ -45,8 +45,8 @@
</button>
<div
id="story-author-preview-content-<%= story.id %>"
class="profile-preview-card__content crayons-dropdown"
style="border-top: var(--su-7) solid var(--card-color);"
class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"
style="border-top-color: var(--card-color);"
data-repositioning-dropdown="true"
data-testid="profile-preview-card">
<div class="gap-4 grid">

View file

@ -106,7 +106,7 @@
</button>
<% end %>
<% end %>
<form id="adjustment-reason-container" class="adjustment-reason-container hidden">
<form id="adjustment-reason-container" class="adjustment-reason-container">
<textarea class="crayons-textfield" placeholder="<%= t("views.moderations.actions.adjust.reason") %>" id="tag-adjustment-reason" required></textarea>
<button class="crayons-btn" id="tag-adjust-submit" type="submit"><%= t("views.moderations.actions.adjust.submit") %></button>
</form>

View file

@ -1,4 +1,4 @@
<div id="<%= id %>" class="profile-preview-card__content p-4 crayons-dropdown" style="--card-color: <%= Color::CompareHex.new([user_colors(actor)[:bg], user_colors(actor)[:text]]).brightness(0.88) %>; border-top: var(--su-7) solid var(--card-color);" data-testid="profile-preview-card" data-repositioning-dropdown="true">
<div id="<%= id %>" class="profile-preview-card__content p-4 pt-0 branded-7 crayons-dropdown" style="--card-color: <%= Color::CompareHex.new([user_colors(actor)[:bg], user_colors(actor)[:text]]).brightness(0.88) %>; border-top-color: var(--card-color);" data-testid="profile-preview-card" data-repositioning-dropdown="true">
<div class="gap-4 grid">
<%= render "shared/profile_card_content", context: "preview-card", actor: actor %>
</div>