diff --git a/app/controllers/admin/nccu_com_vnccu_programs_controller.rb b/app/controllers/admin/nccu_com_vnccu_programs_controller.rb index a32f97d..623b402 100644 --- a/app/controllers/admin/nccu_com_vnccu_programs_controller.rb +++ b/app/controllers/admin/nccu_com_vnccu_programs_controller.rb @@ -20,7 +20,7 @@ class Admin::NccuComVnccuProgramsController < OrbitAdminController @filter_fields = filter_fields(@categories) @table_fields = [:category, 'nccu_com_vnccu_program.year', 'nccu_com_vnccu_program.semester', 'nccu_com_vnccu_program.program_name', 'nccu_com_vnccu_program.week', 'nccu_com_vnccu_program.hour', 'nccu_com_vnccu_program.host'] - !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"} + !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:year=>"desc",:id=>"desc"} @nccu_com_vnccu_programs = ComVnccuProgram.order_by(sort).with_categories(filters("category")) diff --git a/app/models/com_vnccu_program.rb b/app/models/com_vnccu_program.rb index 784ca41..8bde7e0 100644 --- a/app/models/com_vnccu_program.rb +++ b/app/models/com_vnccu_program.rb @@ -34,7 +34,7 @@ class ComVnccuProgram @role = Role.where(:key=>"host").first for i in 1..5 - @nickname_field = AttributeField.where(:key => 'nickname'+i.to_s, :role_id => @role).first + @nickname_field = AttributeField.where(:key => i.to_s, :role_id => @role).first @values_data = AttributeValue.where(:attribute_field_id => @nickname_field, :val.ne => "").collect{|t|t[:val]}.join('-').split('-') @values.concat(@values_data) diff --git a/app/views/admin/nccu_com_vnccu_programs/_form.html.erb b/app/views/admin/nccu_com_vnccu_programs/_form.html.erb index 423672b..cf42807 100644 --- a/app/views/admin/nccu_com_vnccu_programs/_form.html.erb +++ b/app/views/admin/nccu_com_vnccu_programs/_form.html.erb @@ -48,7 +48,7 @@
- <%= select_year((@nccu_com_vnccu_program.year ? @nccu_com_vnccu_program.year.to_i : DateTime.now.year), {:start_year => (DateTime.now.year - 1911), :end_year => (2014 - 1911)}, {:name => 'com_vnccu_program[year]', :class => "span1"} ) %> + <%= select_year((@nccu_com_vnccu_program.year ? @nccu_com_vnccu_program.year.to_i : (DateTime.now.year - 1911)), {:start_year => (DateTime.now.year + 2 - 1911), :end_year => (DateTime.now.year - 6 - 1911)}, {:name => 'com_vnccu_program[year]', :class => "span1"} ) %>