Skip to content

Commit

Permalink
fix general event create form
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Woodall committed May 5, 2018
1 parent 3557da9 commit be82512
Show file tree
Hide file tree
Showing 6 changed files with 413 additions and 5,796 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -19,3 +19,4 @@ public/client/dist/**/*
/node_modules
yarn-debug.log*
.yarn-integrity
yarn-error.log
7 changes: 3 additions & 4 deletions app/forms/general/events/create_form.rb
Expand Up @@ -9,6 +9,7 @@ class General::Events::CreateForm
attribute :page_id, Integer
attribute :summary, String
attribute :description, String
attribute :tag_list, String

attribute :repeat, Boolean
attribute :repeat_on_sunday, Boolean
Expand All @@ -28,6 +29,7 @@ def initialize(event)
self.repeat = false
self.ends = 'on'
self.ends_after_occurrences = 10
self.tag_list = event.tag_list
end

def self.model_name
Expand All @@ -41,7 +43,6 @@ def persisted?
validates_presence_of :starts_on,
:duration,
:location_id,
:page_id,
:summary

validates :ends_on, presence: { if: :repeating_with_end_date? }
Expand All @@ -63,11 +64,9 @@ def repeating_with_occurances?

def submit(params)
assign_attributes(whitelist(params))
puts valid?
puts errors.messages.to_json
return false unless valid?
Event.transaction do
@event.update_attributes(self.attributes.slice(:starts_on, :duration, :location_id, :page_id, :summary))
@event.update_attributes(self.attributes.slice(:starts_on, :duration, :location_id, :page_id, :summary, :tag_list))
@event.save
if(repeating?)
schedule = IceCube::Schedule.new(now = starts_on) do |schedule|
Expand Down
1 change: 0 additions & 1 deletion app/forms/general/events/update_form.rb
Expand Up @@ -14,7 +14,6 @@ class General::Events::UpdateForm

def initialize(event)
@event = event
puts @event.tag_list
assign_attributes event.attributes.slice(*self.attributes.stringify_keys.keys)
self.tag_list = event.tag_list
end
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"engines": {
"node": "9.8.0"
"node": "10.0.0"
},
"scripts": {
"postinstall": "./bin/heroku_install"
Expand Down

0 comments on commit be82512

Please sign in to comment.