增加显示组织显示模式字段,并且在新建组织和配置组织中能够选择

This commit is contained in:
ouyangxuhua 2016-03-28 11:24:31 +08:00
parent f0d6bb7fae
commit f4b4bf40de
5 changed files with 40 additions and 0 deletions

View File

@ -56,6 +56,7 @@ class OrganizationsController < ApplicationController
@organization.description = params[:organization][:description]
@organization.is_public = params[:organization][:is_public]
@organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0
@organization.show_mode = params[:show_mode]
@organization.creator_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.is_public = params[:organization][:is_public] == '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.save
respond_to do |format|

View File

@ -28,6 +28,13 @@
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
</p>
</li>
<li class=" mb5 ml45">
<span style="margin-left:10px;" >显示模式&nbsp;&nbsp;&nbsp;&nbsp;: </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">
<label >公开&nbsp;&nbsp;</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">

View File

@ -72,6 +72,20 @@
<!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
</div>
<div class="cl"></div>
<div class="orgRow mb10 mt5">
<span style="margin-left:10px;" >显示模式&nbsp;: </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;" >公开&nbsp;: </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" />
</div>

View File

@ -0,0 +1,5 @@
class AddCoulumnShowModeToOrganizations < ActiveRecord::Migration
def change
add_column :organizations, :show_mode, :integer, :default => 0
end
end

View File

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