diff --git a/app/assets/stylesheets/classified_listings.scss b/app/assets/stylesheets/classified_listings.scss index ae2236fdb..69252880e 100644 --- a/app/assets/stylesheets/classified_listings.scss +++ b/app/assets/stylesheets/classified_listings.scss @@ -181,9 +181,12 @@ } .classified-errors { background: $red; - color: white; + color: $black; padding: 20px; border-radius: 3px; + h2 { + color: $black; + } } label { display: inline-block; diff --git a/app/assets/stylesheets/classified_listings_form.scss b/app/assets/stylesheets/classified_listings_form.scss deleted file mode 100644 index d73a900db..000000000 --- a/app/assets/stylesheets/classified_listings_form.scss +++ /dev/null @@ -1 +0,0 @@ -@import 'variables'; diff --git a/app/controllers/classified_listings_controller.rb b/app/controllers/classified_listings_controller.rb index 682d42f84..7725334b4 100644 --- a/app/controllers/classified_listings_controller.rb +++ b/app/controllers/classified_listings_controller.rb @@ -46,12 +46,16 @@ class ClassifiedListingsController < ApplicationController @classified_listing.bumped_at = Time.current @classified_listing.published = true @classified_listing.organization_id = current_user.organization_id if @org - return unless @classified_listing.save - - clear_listings_cache - credits.limit(@number_of_credits_needed).update_all(spent: true) - @classified_listing.index! - redirect_to "/listings" + if @classified_listing.save + clear_listings_cache + credits.limit(@number_of_credits_needed).update_all(spent: true) + @classified_listing.index! + redirect_to "/listings" + else + @credits = current_user.credits.where(spent: false) + @classified_listing.cached_tag_list = classified_listing_params[:tag_list] + render :new + end end def update diff --git a/app/javascript/listings/elements/categories.jsx b/app/javascript/listings/elements/categories.jsx index fbcd7145d..d8f399a0e 100644 --- a/app/javascript/listings/elements/categories.jsx +++ b/app/javascript/listings/elements/categories.jsx @@ -3,8 +3,14 @@ import { h, Component } from 'preact'; class Categories extends Component { options = () => { - const { categoriesForSelect } = this.props + const { categoriesForSelect, category } = this.props return categoriesForSelect.map(array => { + // array example: ["Education/Courses (1 Credit)", "education"] + if(category === array[1]) { + return( + + ) + } return( ) @@ -51,6 +57,7 @@ class Categories extends Component { Categories.propTypes = { categoriesForSelect: PropTypes.array.isRequired, categoriesForDetails: PropTypes.array.isRequired, + category: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired, } diff --git a/app/javascript/listings/listingForm.jsx b/app/javascript/listings/listingForm.jsx index 207bbe9cb..b096fcfd6 100644 --- a/app/javascript/listings/listingForm.jsx +++ b/app/javascript/listings/listingForm.jsx @@ -47,7 +47,7 @@ export default class ListingForm extends Component {