Adds phases to form
This commit is contained in:
@@ -40,7 +40,9 @@ class Admin::BudgetsController < Admin::BaseController
|
||||
private
|
||||
|
||||
def budget_params
|
||||
params.require(:budget).permit(:name, :description, :phase, :currency_symbol)
|
||||
descriptions = Budget::PHASES.map{|p| "description_#{p}"}.map(&:to_sym)
|
||||
valid_attributes = [:name, :phase, :currency_symbol] + descriptions
|
||||
params.require(:budget).permit(*valid_attributes)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -31,6 +31,10 @@ class Budget < ActiveRecord::Base
|
||||
self.send("description_#{self.phase}").try(:html_safe)
|
||||
end
|
||||
|
||||
def self.description_max_length
|
||||
2000
|
||||
end
|
||||
|
||||
def accepting?
|
||||
phase == "accepting"
|
||||
end
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
<%= f.text_field :name, maxlength: Budget.title_max_length %>
|
||||
|
||||
<%= f.cktext_area :description, maxlength: Budget.description_max_length, ckeditor: { language: I18n.locale } %>
|
||||
<% Budget::PHASES.each do |phase| %>
|
||||
<%= f.cktext_area "description_#{phase}", maxlength: Budget.description_max_length, ckeditor: { language: I18n.locale } %>
|
||||
<% end %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-9 column">
|
||||
|
||||
Reference in New Issue
Block a user