diff --git a/app/controllers/admin/seminars_controller.rb b/app/controllers/admin/seminars_controller.rb index 800e67a..d95ad02 100644 --- a/app/controllers/admin/seminars_controller.rb +++ b/app/controllers/admin/seminars_controller.rb @@ -58,11 +58,10 @@ class Admin::SeminarsController < OrbitAdminController end def new - + @member = nil @seminar = SeminarMain.new - @seminar_items = SeminarItem.all - + @review = @seminar.seminar_reviews.new() end def create @@ -85,9 +84,14 @@ class Admin::SeminarsController < OrbitAdminController end def edit - @seminar_items = SeminarItem.all - + attribute = SeminarMain.where(id: params[:id]) + if attribute.first.seminar_reviews.first.nil? + @review = attribute.first.seminar_reviews.new() + else + @review = attribute.first.seminar_reviews.first + end + @member = MemberProfile.find(@review.reviewer_id) rescue nil end def update @@ -190,5 +194,4 @@ class Admin::SeminarsController < OrbitAdminController params.require(:seminar_main).permit! end - end diff --git a/app/models/seminar_main.rb b/app/models/seminar_main.rb index 7b284ad..c9badcc 100644 --- a/app/models/seminar_main.rb +++ b/app/models/seminar_main.rb @@ -35,13 +35,14 @@ class SeminarMain has_many :seminar_item_contents, :autosave => true, :dependent => :destroy has_many :seminar_signups, :autosave => true, :dependent => :destroy has_many :seminar_signup_fields, :autosave => true, :dependent => :destroy - + has_many :seminar_reviews, :autosave => true, :dependent => :destroy + accepts_nested_attributes_for :seminar_links, :allow_destroy => true accepts_nested_attributes_for :seminar_files, :allow_destroy => true accepts_nested_attributes_for :seminar_item_contents, :allow_destroy => true accepts_nested_attributes_for :seminar_signups, :allow_destroy => true accepts_nested_attributes_for :seminar_signup_fields, :allow_destroy => true - + accepts_nested_attributes_for :seminar_reviews, :allow_destroy => true def self.time_range(date1 = null, date2 = null) diff --git a/app/models/seminar_review.rb b/app/models/seminar_review.rb new file mode 100644 index 0000000..8ed7aee --- /dev/null +++ b/app/models/seminar_review.rb @@ -0,0 +1,12 @@ +# encoding: utf-8 +require "orbit_form_helper" +class SeminarReview + + include Mongoid::Document + include Mongoid::Timestamps + + field :review_start_date, :type => Date, :default => Time.now + field :review_end_date, :type => Date, :default => Time.now + field :reviewer_id + belongs_to :seminar_main +end diff --git a/app/views/admin/seminars/_form.html.erb b/app/views/admin/seminars/_form.html.erb index f6e9605..e6c94fd 100644 --- a/app/views/admin/seminars/_form.html.erb +++ b/app/views/admin/seminars/_form.html.erb @@ -18,7 +18,8 @@
@@ -102,12 +103,38 @@