Skip to content

Commit

Permalink
[People] Admin acts as person. Banner top of new listing
Browse files Browse the repository at this point in the history
  • Loading branch information
aivils committed Dec 21, 2018
1 parent 298de19 commit c682823
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/views/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

.banner {
&--warning {
background-color: #0605ff;
background-color: #f5a623;
color: white;
}
&--title-wrapper {
Expand Down
13 changes: 12 additions & 1 deletion app/models/custom_field_values/dropdown_field_value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,16 @@
#

class DropdownFieldValue < OptionFieldValue
validates_length_of :custom_field_option_selections, :is => 1
validate :validate_selections

private

def validate_selections
if question && question.for_person?
return true unless question.required?
end
unless custom_field_option_selections.size == 1
errors.add(:custom_field_option_selections, :'wrong_length.one')
end
end
end
4 changes: 4 additions & 0 deletions app/views/listings/new.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
- needs_maps = !FeatureFlagHelper.feature_enabled?(:topbar_v1) || search_mode == :keyword
= javascript_include_tag "//maps.googleapis.com/maps/api/js#{key_param}" if needs_maps

- if @listing_presenter.acts_as_person
- content_for :banner_warning do
= t('.you_are_now_posting_a_listing_on_behalf_of', name: @listing_presenter.new_listing_author.full_name)

- content_for :title_header do
%h1= t("homepage.index.post_new_listing")
#new_listing_form.new-listing-form.centered-section
Expand Down
3 changes: 2 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1920,6 +1920,7 @@ en:
community_not_configured_for_payments: "%{service_name} hasn't been configured for payments, so you cannot post new listings yet. Please %{contact_admin_link} for details."
payment_settings_link: "payment settings"
community_not_configured_for_payments_admin: "%{service_name} hasn't been configured for payments, so you cannot post new listings yet. Go to %{payment_settings_link} to fill in the payment details."
you_are_now_posting_a_listing_on_behalf_of: "You are now posting a listing on behalf of %{name}"
quantity:
hour: "Number of hours:"
day: "Number of days:"
Expand Down Expand Up @@ -2317,7 +2318,7 @@ en:
invisible: "(not shown to other users)"
image_is_processing: "Hang on tight. We are processing your profile picture. It will be ready in a minute or two."
shown_in_your_public_profile: "(shown in your public profile)"
editing_profile_of: "Editing profile of: %{name}"
editing_profile_of: "You are now editing the profile of %{name}"
save_information: "Save information"
shipping_address:
shipping_address: "Shipping address"
Expand Down

0 comments on commit c682823

Please sign in to comment.