From cb4efd914e01dbe0f12ae9e0cc2559cc3806dcda Mon Sep 17 00:00:00 2001 From: nwb Date: Mon, 28 Jul 2014 17:14:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=A1=B9=E7=9B=AE=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=88=A0=E9=99=A4BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 8 +++++- config/locales/en.yml | 1 + config/locales/zh.yml | 1 + db/schema.rb | 33 ++++++++++++++--------- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 0f29d6000..f00cbb03d 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index 1e975decc..e1b93f649 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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." diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3f9e3200a..f51548875 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -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}" diff --git a/db/schema.rb b/db/schema.rb index 05886b190..85fd8a8f8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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