Add trade warning to closet list form

Just a lil blurb to make sure it's clear that NC sales and stuff are
forbidden! I imagine the people doing it know this, but I want to make
sure we're being explicit, in case there's any element of
miscommunication.
This commit is contained in:
Emi Matchu 2024-04-16 16:53:30 -07:00
parent fa202af26d
commit 1cbcb5bcd6
3 changed files with 33 additions and 1 deletions

View file

@ -0,0 +1,7 @@
document.addEventListener("change", ({ target }) => {
if (target.matches('select[name="closet_list[visibility]"]')) {
target
.closest("form")
.setAttribute("data-list-visibility", target.value);
}
});

View file

@ -1,4 +1,5 @@
@import "../partials/secondary_nav"
@import "../partials/clean/mixins"
body.closet_lists-new, body.closet_lists-create, body.closet_lists-edit, body.closet_lists-update
+secondary-nav
@ -30,3 +31,15 @@ body.closet_lists-new, body.closet_lists-create, body.closet_lists-edit, body.cl
font:
size: 85%
.trade-warning
+warning
margin-bottom: 1em
padding: .75em .5em
text-align: center
p:last-of-type
margin-bottom: 0
// Only show the trade warning when the list is marked as Trading!
form:not([data-list-visibility="2"]) .trade-warning
display: none

View file

@ -1,7 +1,8 @@
- secondary_nav do
= link_to t('.your_items_link'), user_closet_hangers_path(current_user), :class => 'button'
= form_for [@closet_list.user, @closet_list] do |f|
= form_for [@closet_list.user, @closet_list],
html: {data: {"list-visibility" => @closet_list.visibility}} do |f|
%ul.fields
%li
= f.label :name
@ -18,5 +19,16 @@
%span.hint= t '.description.hint'
= f.text_area :description
%span.hint= t '.description.markup_hint_html'
%li.trade-warning
:markdown
Please use these lists *only* for real NC trades, negotiated on
Neopets.com! We need to keep users safe, so we'll delete *any* list
that seems suspicious.
If you're doing something more creative, please do so in another
setting, where traders can better manage reputation and trust. Thank
you!
= f.submit t('.submit')
- content_for :javascripts do
= javascript_include_tag "closet_lists/form"