导航权限控制
This commit is contained in:
parent
09ff5954bd
commit
a8b68d64ee
|
@ -30,7 +30,7 @@ class OrganizationsController < ApplicationController
|
|||
include UsersHelper
|
||||
include OrganizationsHelper
|
||||
before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers, :students, :projects, :courses]
|
||||
before_filter :allow_as_admin, :only => [:students, :teachers, :projects, :courses, :acts]
|
||||
# before_filter :allow_as_admin, :only => [:students, :teachers, :projects, :courses, :acts]
|
||||
layout 'base_org'
|
||||
def index
|
||||
|
||||
|
@ -180,7 +180,7 @@ class OrganizationsController < ApplicationController
|
|||
q = params[:search].nil? ? "" : "#{params[:search].strip}"
|
||||
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comptec").first : OrgSubfield.find(params[:org_subfield_id])
|
||||
@type = params[:type]
|
||||
if @type == "courses" || @type.nil?
|
||||
if @type.blank?
|
||||
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
|
||||
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
|
||||
elsif @type == "famous"
|
||||
|
@ -204,7 +204,7 @@ class OrganizationsController < ApplicationController
|
|||
q = params[:search].nil? ? "" : "#{params[:search].strip}"
|
||||
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id])
|
||||
@type = params[:type]
|
||||
if @type == "courses" || @type.nil?
|
||||
if @type.blank?
|
||||
@org_students = User.find_by_sql("select u.*, ue.student_id, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
|
||||
from users u, user_extensions ue where u.id = ue.user_id and ue.identity= 1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
|
||||
elsif @type == "famous"
|
||||
|
@ -240,7 +240,7 @@ class OrganizationsController < ApplicationController
|
|||
q = params[:search].nil? ? "" : "#{params[:search].strip}"
|
||||
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comppro").first : OrgSubfield.find(params[:org_subfield_id])
|
||||
@type = params[:type]
|
||||
if @type.nil?
|
||||
if @type.blank?
|
||||
@containers = Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count
|
||||
from projects p where p.status =1 and p.is_public =1 and name like '%#{q}%' order by project_count desc;")
|
||||
elsif @type == "famous"
|
||||
|
@ -254,7 +254,7 @@ class OrganizationsController < ApplicationController
|
|||
q = params[:search].nil? ? "" : "#{params[:search].strip}"
|
||||
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id])
|
||||
@type = params[:type]
|
||||
if @type.nil?
|
||||
if @type.blank?
|
||||
@containers = Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count
|
||||
from courses c where c.is_delete =0 and c.is_public =1 and name like '%#{q}%' order by course_count desc;")
|
||||
elsif @type == "famous"
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
<div class="block-title">资源</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="javascript:void(0);" class="fr teacher-select" onclick="admin_hide_org($(this),'<%= container.id %>');" id="hide_<%= container.id %>"><%= container.class == Course ? (container.is_excellent == 0 ? "设为精品" : "取消精品") : (container.hot ==0 ? "设为热门" : "取消热门") %></a>
|
||||
<% if User.current.admin? %>
|
||||
<a href="javascript:void(0);" class="fr teacher-select" onclick="admin_hide_org($(this),'<%= container.id %>');" id="hide_<%= container.id %>"><%= container.class == Course ? (container.is_excellent == 0 ? "设为精品" : "取消精品") : (container.hot ==0 ? "设为热门" : "取消热门") %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -65,19 +65,19 @@
|
|||
</div>
|
||||
<% elsif field.field_type == "Comptec" %>
|
||||
<li>
|
||||
<%= link_to "#{field.name}", teachers_organization_path(@organization, :org_subfield_id => field.id, :type => "famous"), :class => "sn-link-white", :target => "_blank" %>
|
||||
<%= link_to "#{field.name}", teachers_organization_path(@organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "sn-link-white", :target => "_blank" %>
|
||||
</li>
|
||||
<% elsif field.field_type == "Compstu" %>
|
||||
<li>
|
||||
<%= link_to "#{field.name}", students_organization_path(@organization, :org_subfield_id => field.id, :type => "famous"), :class => "sn-link-white", :target => "_blank" %>
|
||||
<%= link_to "#{field.name}", students_organization_path(@organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "sn-link-white", :target => "_blank" %>
|
||||
</li>
|
||||
<% elsif field.field_type == "Comppro" %>
|
||||
<li>
|
||||
<%= link_to "#{field.name}", projects_organization_path(@organization, :org_subfield_id => field.id, :type => "famous"), :class => "sn-link-white", :target => "_blank" %>
|
||||
<%= link_to "#{field.name}", projects_organization_path(@organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "sn-link-white", :target => "_blank" %>
|
||||
</li>
|
||||
<% elsif field.field_type == "Compcou" %>
|
||||
<li>
|
||||
<%= link_to "#{field.name}", courses_organization_path(@organization, :org_subfield_id => field.id, :type => "famous"), :class => "sn-link-white", :target => "_blank" %>
|
||||
<%= link_to "#{field.name}", courses_organization_path(@organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "sn-link-white", :target => "_blank" %>
|
||||
</li>
|
||||
<% elsif field.field_type == "Compact" %>
|
||||
<li>
|
||||
|
|
|
@ -117,23 +117,23 @@
|
|||
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="$('#PostDomain_<%= field.id %>').slideToggle();" style="border-bottom: 1px solid #ddd;"></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% elsif field.field_type == "Comptec" && User.current.admin? %>
|
||||
<% elsif field.field_type == "Comptec" %>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
|
||||
<%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
|
||||
</div>
|
||||
<% elsif field.field_type == "Compstu" && User.current.admin? %>
|
||||
<% elsif field.field_type == "Compstu" %>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
|
||||
<%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
|
||||
</div>
|
||||
<% elsif field.field_type == "Comppro" && User.current.admin? %>
|
||||
<% elsif field.field_type == "Comppro" %>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to "#{field.name}", projects_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
|
||||
<%= link_to "#{field.name}", projects_organization_path(organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
|
||||
</div>
|
||||
<% elsif field.field_type == "Compcou" && User.current.admin? %>
|
||||
<% elsif field.field_type == "Compcou" %>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to "#{field.name}", courses_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
|
||||
<%= link_to "#{field.name}", courses_organization_path(organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
|
||||
</div>
|
||||
<% elsif field.field_type == "Compact" && User.current.admin? %>
|
||||
<% elsif field.field_type == "Compact" %>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to "#{field.name}", acts_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
|
||||
</div>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<div class="block-title">资源数</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if User.current.admin_of_org?(@organization) %>
|
||||
<% if User.current.admin? %>
|
||||
<a href="javascript:void(0);" class="fr teacher-select" onclick="hide($(this),'<%= org_student.id %>');" id="hide_<%= org_student.id %>"><%= org_student.excellent_student ==0 ? "设为学霸" : "取消设置" %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -28,15 +28,8 @@
|
|||
<div class="block-title">资源数</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if User.current.admin_of_org?(@organization) %>
|
||||
<% if User.current.admin? %>
|
||||
<a href="javascript:void(0);" class="fr teacher-select" onclick="hide($(this),'<%= org_teacher.id %>');" id="hide_<%= org_teacher.id %>"><%= org_teacher.excellent_teacher==0?"设为名师":"取消设置" %></a>
|
||||
<!--<a href="javascript:void(0);" class="fr teacher-select">设为名师</a>-->
|
||||
<% else %>
|
||||
<!--<%# if(org_teacher.watched_by?(User.current)) %>-->
|
||||
<!--<%#= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>org_teacher.id,:target_id=>org_teacher.id),:class => "fr teacher-select", :method => "delete",:remote => "true", :title => "取消关注"%>-->
|
||||
<!--<%# else %>-->
|
||||
<!--<%#= link_to "添加关注",watch_path(:object_type=> 'user',:object_id=>org_teacher.id,:target_id=>org_teacher.id),:class => "fr teacher-select", :method => "post",:remote => "true", :title => "添加关注"%>-->
|
||||
<!--<%# end %>-->
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
Loading…
Reference in New Issue