增加显示组织显示模式字段,并且在新建组织和配置组织中能够选择
This commit is contained in:
parent
f0d6bb7fae
commit
f4b4bf40de
|
@ -56,6 +56,7 @@ class OrganizationsController < ApplicationController
|
||||||
@organization.description = params[:organization][:description]
|
@organization.description = params[:organization][:description]
|
||||||
@organization.is_public = params[:organization][:is_public]
|
@organization.is_public = params[:organization][:is_public]
|
||||||
@organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0
|
@organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0
|
||||||
|
@organization.show_mode = params[:show_mode]
|
||||||
@organization.creator_id = User.current.id
|
@organization.creator_id = User.current.id
|
||||||
member = OrgMember.new(:user_id => User.current.id)
|
member = OrgMember.new(:user_id => User.current.id)
|
||||||
|
|
||||||
|
@ -120,6 +121,7 @@ class OrganizationsController < ApplicationController
|
||||||
# @organization.domain = params[:organization][:domain]
|
# @organization.domain = params[:organization][:domain]
|
||||||
@organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
|
@organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
|
||||||
@organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0
|
@organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0
|
||||||
|
@organization.show_mode = params[:show_mode]
|
||||||
#@organization.name = params[:organization][:name]
|
#@organization.name = params[:organization][:name]
|
||||||
@organization.save
|
@organization.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
@ -28,6 +28,13 @@
|
||||||
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
|
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
<li class=" mb5 ml45">
|
||||||
|
<span style="margin-left:10px;" >显示模式 : </span>
|
||||||
|
<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:2px;" checked />
|
||||||
|
<label for="show_mode_ordinary">社区模式一</label>
|
||||||
|
<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" />
|
||||||
|
<label for="show_mode_special">社区模式二</label>
|
||||||
|
</li>
|
||||||
<li class=" mb5 ml80">
|
<li class=" mb5 ml80">
|
||||||
<label >公开 :</label>
|
<label >公开 :</label>
|
||||||
<input id="organization_is_public" name="organization[is_public]" onclick="disable_down($(this), $('#organization_alow_download'), $('#allow_down_hint'));" type="checkbox" value="1" checked="checked">
|
<input id="organization_is_public" name="organization[is_public]" onclick="disable_down($(this), $('#organization_alow_download'), $('#allow_down_hint'));" type="checkbox" value="1" checked="checked">
|
||||||
|
|
|
@ -72,6 +72,20 @@
|
||||||
<!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
|
<!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
<div class="orgRow mb10 mt5">
|
||||||
|
<span style="margin-left:10px;" >显示模式 : </span>
|
||||||
|
<% if @organization.show_mode == 0 %>
|
||||||
|
<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:5px;" checked />
|
||||||
|
<label for="show_mode_ordinary">社区模式一</label>
|
||||||
|
<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" />
|
||||||
|
<label for="show_mode_special">社区模式二</label>
|
||||||
|
<% else %>
|
||||||
|
<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:5px;" />
|
||||||
|
<label for="show_mode_ordinary">社区模式一</label>
|
||||||
|
<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" checked />
|
||||||
|
<label for="show_mode_special">社区模式二</label>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开 : </span>
|
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开 : </span>
|
||||||
<input type="checkbox" id="is_public" onclick="disable_down($(this), $('#allow_download'),$('#allow_down_hint'));" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
|
<input type="checkbox" id="is_public" onclick="disable_down($(this), $('#allow_download'),$('#allow_down_hint'));" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddCoulumnShowModeToOrganizations < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :organizations, :show_mode, :integer, :default => 0
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
class SetShowModeForOrganizations < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
Organization.transaction do
|
||||||
|
Organization.all.each do |org|
|
||||||
|
org.update_attribute(:show_mode, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue