Skip to content

Commit

Permalink
Revert "turns out this was manually disabled"
Browse files Browse the repository at this point in the history
This reverts commit 7330b68.
  • Loading branch information
DrumsnChocolate committed Jan 19, 2025
1 parent 7330b68 commit 6a9c901
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions app/models/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Product < ApplicationRecord
has_many :price_lists, through: :product_prices, dependent: :restrict_with_error

validates :name, :category, presence: true
validate :name_readonly

accepts_nested_attributes_for :product_prices, allow_destroy: true

Expand All @@ -18,4 +19,10 @@ def t_category
end

private

def name_readonly
return if new_record?

errors.add(:name, 'is readonly') if name_changed?
end
end
6 changes: 3 additions & 3 deletions app/views/price_lists/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
<div class="form-check">
<input class="form-check-input" type="checkbox" id="show-archived-check" v-model="showArchived">
<label class="form-check-label" for="show-archived-check">
Laat gearchieveerde prijslijsten zien
Laat gearchieveerde prijslijsten zien
</label>
</div>
<% end %>

<table id='price-lists-table' class='price-lists-table table table-striped overflow-scroll mw-100 mx-auto d-block pe-2'>
<thead class="table-header-rotated products">
<tr>
Expand Down Expand Up @@ -60,7 +60,7 @@
</td>
<td class="products-new products-name">
<div class="d-flex">
<input class="form-control flex-grow-1" placeholder="Productnaam" type="text" v-model="product.name">
<input class="form-control flex-grow-1" placeholder="Productnaam" type="text" v-model="product.name" :disabled="product.id"/>
</div>
</td>
<td class="products-new products-category">
Expand Down

0 comments on commit 6a9c901

Please sign in to comment.