不同的组织定制是否允许设置名师榜

This commit is contained in:
huang 2016-05-13 10:29:22 +08:00
parent 37ee03374e
commit 83ac35cc94
4 changed files with 13 additions and 1 deletions

View File

@ -279,6 +279,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.allow_teacher = params[:organization][:allow_teacher] == 'on' ? 1 : 0
@organization.show_mode = params[:show_mode]
#@organization.name = params[:organization][:name]
@organization.save

View File

@ -87,6 +87,11 @@
&nbsp;<span>允许游客下载</span>
<span class="c_green f12" id="allow_down_hint"><%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %></span>
</div>
<% if User.current.admin? %>
<div class="orgRow mb10 mt5"><span style="margin-left:10px;">允许设置名师榜&nbsp;: </span>
<input id="allow_set_excellent_teachers" type="checkbox" style="margin-top:5px;" name="organization[allow_teacher]" <%= @organization.allow_teacher==1 ? 'checked': ''%> class="ml3" />
</div>
<% end %>
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org('<%=@organization.id %>','<%= @organization.name %>', $('#organization_name'));">保存</a>
<% end %>
</div>

View File

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

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160513012705) do
ActiveRecord::Schema.define(:version => 20160513021204) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1614,6 +1614,7 @@ ActiveRecord::Schema.define(:version => 20160513012705) do
t.boolean "allow_guest_download", :default => true
t.integer "visits", :default => 0
t.integer "show_mode", :default => 0
t.integer "allow_teacher", :default => 0
end
create_table "permissions", :force => true do |t|