修正项目文档删除BUG

This commit is contained in:
nwb 2014-07-28 17:14:02 +08:00
parent 2c79a51e48
commit cb4efd914e
4 changed files with 29 additions and 14 deletions

View File

@ -181,7 +181,7 @@ class AttachmentsController < ApplicationController
respond_to do |format|
# modify by nwb
if !@attachment.container.nil? && (@attachment.container.is_a?(Course) || @attachment.container.course)
if !@attachment.container.nil? && (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) &&(@attachment.container.is_a?(Course) || @attachment.container.course)
if @attachment.container.is_a?(News)
format.html { redirect_to_referer_or news_path(@attachment.container) }
elsif @course.nil?
@ -243,6 +243,9 @@ class AttachmentsController < ApplicationController
attach_copied_obj.container = obj
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 1
end
@obj = obj
@save_flag = attach_copied_obj.save
@save_message = attach_copied_obj.errors.full_messages
@ -272,6 +275,9 @@ class AttachmentsController < ApplicationController
attach_copied_obj.container = obj
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 4
end
@obj = obj
@save_flag = attach_copied_obj.save
@save_message = attach_copied_obj.errors.full_messages

View File

@ -186,6 +186,7 @@ en:
notice_account_deleted: "Your account has been permanently deleted."
notice_user_successful_create: "User %{id} created."
error_attachment_empty: "error in add file"
error_class_period_only_num: "class period can only digital"
error_can_t_load_default_data: "Default configuration could not be loaded: %{value}"
error_scm_not_found: "The entry or revision was not found in the repository."

View File

@ -195,6 +195,7 @@ zh:
notice_gantt_chart_truncated: "这个表是截断的因为它超过了可以显示的最大数量(%{max})"
error_complete_occupation: "请您填写工作单位,否则本系统的部分功能将无法正常使用。"
error_attachment_empty: "添加文件出错!"
error_class_period_only_num: "课程学时只能为数字"
error_can_t_load_default_data: "无法载入默认设置:%{value}"

View File

@ -439,6 +439,26 @@ ActiveRecord::Schema.define(:version => 20140728014933) do
t.datetime "updated_at", :null => false
end
create_table "gitlab_projects", :force => true do |t|
t.integer "gitlab_project_id"
t.integer "project_id"
t.string "repository_url"
t.string "web_url"
t.string "localfile_url"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "gitlab_users", :force => true do |t|
t.integer "gitlab_user_id"
t.integer "user_id"
t.string "email"
t.string "password"
t.string "login", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groups_users", :id => false, :force => true do |t|
t.integer "group_id", :null => false
t.integer "user_id", :null => false
@ -881,19 +901,6 @@ ActiveRecord::Schema.define(:version => 20140728014933) do
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
create_table "rich_rich_files", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "rich_file_file_name"
t.string "rich_file_content_type"
t.integer "rich_file_file_size"
t.datetime "rich_file_updated_at"
t.string "owner_type"
t.integer "owner_id"
t.text "uri_cache"
t.string "simplified_type", :default => "file"
end
create_table "roles", :force => true do |t|
t.string "name", :limit => 30, :default => "", :null => false
t.integer "position", :default => 1