Compare commits

..

No commits in common. "4ae5acfdc36fb12595bcdf0ad0338e25e6d7f22a" and "fa202af26d9f6c6e4284b94e4da9a794079665e0" have entirely different histories.

5 changed files with 3 additions and 41 deletions

View file

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

View file

@ -1,5 +1,4 @@
@import "../partials/secondary_nav" @import "../partials/secondary_nav"
@import "../partials/clean/mixins"
body.closet_lists-new, body.closet_lists-create, body.closet_lists-edit, body.closet_lists-update body.closet_lists-new, body.closet_lists-create, body.closet_lists-edit, body.closet_lists-update
+secondary-nav +secondary-nav
@ -31,15 +30,3 @@ body.closet_lists-new, body.closet_lists-create, body.closet_lists-edit, body.cl
font: font:
size: 85% 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

@ -8,7 +8,7 @@ class ClosetListsController < ApplicationController
save_successful! save_successful!
else else
save_failed! save_failed!
render action: :new, status: :unprocessable_entity render :action => :new
end end
end end
@ -28,7 +28,7 @@ class ClosetListsController < ApplicationController
save_successful! save_successful!
else else
save_failed! save_failed!
render action: :edit, status: :unprocessable_entity render :action => :edit
end end
end end

View file

@ -5,12 +5,6 @@ class ClosetList < ApplicationRecord
validates :name, :presence => true, :uniqueness => {:scope => :user_id} validates :name, :presence => true, :uniqueness => {:scope => :user_id}
validates :user, :presence => true validates :user, :presence => true
validates :hangers_owned, :inclusion => {:in => [true, false], :message => "can't be blank"} validates :hangers_owned, :inclusion => {:in => [true, false], :message => "can't be blank"}
validates :description, format: {
# This isn't a very careful email filter! It's easy to avoid. But the
# purpose is to communicate the rules, more than actual prevention.
without: /\b([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\b/i, # from emailregex.com
message: "must not contain email addresses"
}
delegate :log_trade_activity, to: :user delegate :log_trade_activity, to: :user

View file

@ -1,8 +1,7 @@
- secondary_nav do - secondary_nav do
= link_to t('.your_items_link'), user_closet_hangers_path(current_user), :class => 'button' = link_to t('.your_items_link'), user_closet_hangers_path(current_user), :class => 'button'
= form_for [@closet_list.user, @closet_list], = form_for [@closet_list.user, @closet_list] do |f|
html: {data: {"list-visibility" => @closet_list.visibility}} do |f|
%ul.fields %ul.fields
%li %li
= f.label :name = f.label :name
@ -19,16 +18,5 @@
%span.hint= t '.description.hint' %span.hint= t '.description.hint'
= f.text_area :description = f.text_area :description
%span.hint= t '.description.markup_hint_html' %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') = f.submit t('.submit')
- content_for :javascripts do
= javascript_include_tag "closet_lists/form"