diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 8dc5d80a..2a0f9761 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -26,13 +26,13 @@ class HomeworkAttachController < ApplicationController #删除留言 def destroy @journal_destroyed = JournalsForMessage.delete_message(params[:object_id]) - @homework = HomeworkAttach.find(params[:id]) - @jours = @homework.journals_for_messages.order("created_on DESC") - @limit = 10 - @feedback_count = @jours.count - @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - @offset ||= @feedback_pages.offset - @jour = @jours[@offset, @limit] + #@homework = HomeworkAttach.find(params[:id]) + #@jours = @homework.journals_for_messages.order("created_on DESC") + #@limit = 10 + #@feedback_count = @jours.count + #@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + #@offset ||= @feedback_pages.offset + #@jour = @jours[@offset, @limit] respond_to do |format| format.js end @@ -43,11 +43,11 @@ class HomeworkAttachController < ApplicationController @homework = HomeworkAttach.find(params[:jour_id]) @homework.addjours User.current.id, params[:new_form][:user_message],0 @jours = @homework.journals_for_messages.order("created_on DESC") - @limit = 10 - @feedback_count = @jours.count - @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - @offset ||= @feedback_pages.offset - @jour = @jours[@offset, @limit] + #@limit = 10 + #@feedback_count = @jours.count + #@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + #@offset ||= @feedback_pages.offset + #@jour = @jours[@offset, @limit] respond_to do |format| format.js end diff --git a/app/controllers/homework_users_controller.rb b/app/controllers/homework_users_controller.rb new file mode 100644 index 00000000..cb55d965 --- /dev/null +++ b/app/controllers/homework_users_controller.rb @@ -0,0 +1,3 @@ +class HomeworkUsersController < ApplicationController + +end diff --git a/app/helpers/homework_users_helper.rb b/app/helpers/homework_users_helper.rb new file mode 100644 index 00000000..48a9a8e4 --- /dev/null +++ b/app/helpers/homework_users_helper.rb @@ -0,0 +1,2 @@ +module HomeworkUsersHelper +end diff --git a/app/models/homework_attach.rb b/app/models/homework_attach.rb index 4bac5844..e395e65e 100644 --- a/app/models/homework_attach.rb +++ b/app/models/homework_attach.rb @@ -1,8 +1,12 @@ class HomeworkAttach < ActiveRecord::Base include Redmine::SafeAttributes + + #attr_accessible :name, :description, :state, :user_id, :bid_id + belongs_to :user belongs_to :bid has_many :journals_for_messages, :as => :jour, :dependent => :destroy + has_many :homework_users, :dependent => :destroy seems_rateable :allow_update => true, :dimensions => :quality safe_attributes "bid_id", diff --git a/app/models/homework_user.rb b/app/models/homework_user.rb new file mode 100644 index 00000000..da7e65af --- /dev/null +++ b/app/models/homework_user.rb @@ -0,0 +1,6 @@ +class HomeworkUser < ActiveRecord::Base + attr_accessible :homework_attach_id, :user_id + + belongs_to :homework_attach + has_one :user +end diff --git a/app/models/user.rb b/app/models/user.rb index d16d790d..84027579 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -68,6 +68,8 @@ class User < Principal ['none', :label_user_mail_option_none] ] + has_one :homework_user + has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)}, :after_remove => Proc.new {|user, group| group.user_removed(user)} has_many :changesets, :dependent => :nullify diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 8a00f12a..d63c4f81 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -85,12 +85,12 @@