组织增加是否允许游客下载的选项
This commit is contained in:
parent
6b44b93f0e
commit
bd99352ab1
|
@ -600,7 +600,7 @@ private
|
|||
|
||||
def has_login
|
||||
unless @attachment && @attachment.container_type == "PhoneAppVersion"
|
||||
render_403 if !User.current.logged? && @attachment.container_type != 'OrgSubfield' && @attachment.container_type != 'OrgDocumentComment'
|
||||
render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -116,6 +116,7 @@ class OrganizationsController < ApplicationController
|
|||
@organization.description = params[:organization][:description]
|
||||
# @organization.domain = params[:organization][:domain]
|
||||
@organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
|
||||
@organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0
|
||||
#@organization.name = params[:organization][:name]
|
||||
@organization.save
|
||||
respond_to do |format|
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" mb5" style="margin-left:40px; ">
|
||||
<label >允许游客下载:</label>
|
||||
<input id="organization_alow_download" name="organization[allow_guest_download]" type="checkbox" value="1" checked="checked">
|
||||
<span class="c_grey">(打钩为允许游客下载文件)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" ml125" >
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_organization();" >创建</a>
|
||||
<%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
|
||||
|
|
|
@ -65,6 +65,9 @@
|
|||
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开 : </span>
|
||||
<input type="checkbox" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
|
||||
</div>
|
||||
<div class="orgRow mb10 mt5"><span>允许游客下载: </span>
|
||||
<input type="checkbox" name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />
|
||||
</div>
|
||||
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org(<%=@organization.id %>);">保存</a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddAllowGuestDownloadToOrganizations < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :organizations, :allow_guest_download, :boolean, :default => true
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160120032758) do
|
||||
ActiveRecord::Schema.define(:version => 20160121070232) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -1262,8 +1262,9 @@ ActiveRecord::Schema.define(:version => 20160120032758) do
|
|||
t.integer "home_id"
|
||||
t.string "domain"
|
||||
t.boolean "is_public"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.boolean "allow_guest_download", :default => true
|
||||
end
|
||||
|
||||
create_table "phone_app_versions", :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue