1.文档添加密级设置

2.新建文档、修改文档视图修改
This commit is contained in:
nwb 2014-07-14 10:44:07 +08:00
parent 48e2d8ecee
commit 87b623bc51
6 changed files with 15 additions and 21 deletions

View File

@ -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)

View File

@ -1,7 +1,10 @@
<%= error_messages_for @document %>
<div class="box tabular">
<p><%= f.select :category_id, DocumentCategory.active.collect {|c| [c.name, c.id]} %></p>
<p><%= f.select :category_id, DocumentCategory.active.collect {|c| [c.name, c.id]} %> </p>
<p> <em style ="display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %>
<%= l(:label_document_public_info) %></em>
</p>
<p><%= f.text_field :title, :required => true, :size => 60 %></p>
<p><%= f.text_area :description, :cols => 60, :rows => 15, :class => 'wiki-edit' %></p>
</div>

View File

@ -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

View File

@ -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: 新建角色

View File

@ -0,0 +1,5 @@
class AddIsPublicToDocuments < ActiveRecord::Migration
def change
add_column :documents, :is_public, :integer,:default => 1
end
end

View File

@ -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