diff --git a/app/models/document.rb b/app/models/document.rb index 7c2730682..661949ca9 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -39,7 +39,7 @@ class Document < ActiveRecord::Base includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_documents, *args)) } - safe_attributes 'category_id', 'title', 'description' + safe_attributes 'category_id', 'title', 'description','is_public' def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_documents, project) diff --git a/app/views/documents/_form.html.erb b/app/views/documents/_form.html.erb index 53d8fc3bb..72361b9ab 100644 --- a/app/views/documents/_form.html.erb +++ b/app/views/documents/_form.html.erb @@ -1,7 +1,10 @@ <%= error_messages_for @document %>
-

<%= f.select :category_id, DocumentCategory.active.collect {|c| [c.name, c.id]} %>

+

<%= f.select :category_id, DocumentCategory.active.collect {|c| [c.name, c.id]} %>

+

<%= f.check_box :is_public, :style => "margin-left:10px;" %> + <%= l(:label_document_public_info) %> +

<%= f.text_field :title, :required => true, :size => 60 %>

<%= f.text_area :description, :cols => 60, :rows => 15, :class => 'wiki-edit' %>

diff --git a/config/locales/en.yml b/config/locales/en.yml index 6566564c9..db673c69c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -537,6 +537,7 @@ en: label_document_new: New document label_document_plural: Documents label_document_added: Document added + label_document_public_info: "If you don't choose public, only the project's members can see the document." label_role: Role label_role_plural: Roles label_role_new: New role diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 1be9e7b20..36d89da10 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -533,6 +533,7 @@ zh: label_document_new: 新建文档 label_document_plural: 文档 label_document_added: 文档已添加 + label_document_public_info: (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该文档。) label_role: 角色 label_role_plural: 角色 label_role_new: 新建角色 diff --git a/db/migrate/20140714021812_add_is_public_to_documents.rb b/db/migrate/20140714021812_add_is_public_to_documents.rb new file mode 100644 index 000000000..2c21c7d03 --- /dev/null +++ b/db/migrate/20140714021812_add_is_public_to_documents.rb @@ -0,0 +1,5 @@ +class AddIsPublicToDocuments < ActiveRecord::Migration + def change + add_column :documents, :is_public, :integer,:default => 1 + end +end diff --git a/db/schema.rb b/db/schema.rb index f63f3cb46..109c1f189 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,11 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -<<<<<<< HEAD -ActiveRecord::Schema.define(:version => 20140710030426) do -======= -ActiveRecord::Schema.define(:version => 20140708023356) do ->>>>>>> 056f86caad29ca95632d9da9e1e616cd00e2349a +ActiveRecord::Schema.define(:version => 20140714021812) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -383,6 +379,7 @@ ActiveRecord::Schema.define(:version => 20140708023356) do t.text "description" t.datetime "created_on" t.integer "user_id", :default => 0 + t.integer "is_public", :default => 1 end add_index "documents", ["category_id"], :name => "index_documents_on_category_id" @@ -799,7 +796,7 @@ ActiveRecord::Schema.define(:version => 20140708023356) do end create_table "relative_memos", :force => true do |t| - t.integer "osp_id", :null => false + t.integer "osp_id" t.integer "parent_id" t.string "subject", :null => false t.text "content", :null => false @@ -836,19 +833,6 @@ ActiveRecord::Schema.define(:version => 20140708023356) 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