Skip to content
Snippets Groups Projects
Commit adb08bfd authored by Arnaud Levy's avatar Arnaud Levy
Browse files

cat

parent 19a65746
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,8 @@ class Communication::Website::Category < ApplicationRecord
before_create :set_position
def list_of_other_categories
website.list_of_categories.reject! { |p| p[:id] == id }
new_record? ? website.list_of_categories
: website.list_of_categories.reject! { |p| p[:id] == id }
end
def to_s
......
......@@ -23,9 +23,8 @@
class: 'js-slug-input',
data: { source: '#communication_website_category_name' }
} %>
<% categories = category.new_record? ? @website.categories : category.list_of_other_categories %>
<%= f.association :parent,
collection: categories,
collection: category.list_of_other_categories,
label_method: ->(p) { sanitize p[:label] },
value_method: ->(p) { p[:id] } %>
<ul>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment