diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index a75a0e698..ae1119609 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -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" diff --git a/app/views/organizations/_org_container.html.erb b/app/views/organizations/_org_container.html.erb index 59ac4d95c..d91ed649e 100644 --- a/app/views/organizations/_org_container.html.erb +++ b/app/views/organizations/_org_container.html.erb @@ -16,7 +16,9 @@
资源
- <%= container.class == Course ? (container.is_excellent == 0 ? "设为精品" : "取消精品") : (container.hot ==0 ? "设为热门" : "取消热门") %> + <% if User.current.admin? %> + <%= container.class == Course ? (container.is_excellent == 0 ? "设为精品" : "取消精品") : (container.hot ==0 ? "设为热门" : "取消热门") %> + <% end %>
diff --git a/app/views/organizations/_org_custom_header.html.erb b/app/views/organizations/_org_custom_header.html.erb index 7d2043904..91ca5aafb 100644 --- a/app/views/organizations/_org_custom_header.html.erb +++ b/app/views/organizations/_org_custom_header.html.erb @@ -65,19 +65,19 @@ <% elsif field.field_type == "Comptec" %>
  • - <%= 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" %>
  • <% elsif field.field_type == "Compstu" %>
  • - <%= 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" %>
  • <% elsif field.field_type == "Comppro" %>
  • - <%= 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" %>
  • <% elsif field.field_type == "Compcou" %>
  • - <%= 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" %>
  • <% elsif field.field_type == "Compact" %>
  • diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index c1cc3a20f..ddc504640 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -117,23 +117,23 @@
  • <% end %> - <% elsif field.field_type == "Comptec" && User.current.admin? %> + <% elsif field.field_type == "Comptec" %>
    - <%= 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();" %>
    - <% elsif field.field_type == "Compstu" && User.current.admin? %> + <% elsif field.field_type == "Compstu" %>
    - <%= 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();" %>
    - <% elsif field.field_type == "Comppro" && User.current.admin? %> + <% elsif field.field_type == "Comppro" %>
    - <%= 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();" %>
    - <% elsif field.field_type == "Compcou" && User.current.admin? %> + <% elsif field.field_type == "Compcou" %>
    - <%= 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();" %>
    - <% elsif field.field_type == "Compact" && User.current.admin? %> + <% elsif field.field_type == "Compact" %>
    <%= link_to "#{field.name}", acts_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
    diff --git a/app/views/organizations/_org_students_list.html.erb b/app/views/organizations/_org_students_list.html.erb index d3db6fbf6..482447c56 100644 --- a/app/views/organizations/_org_students_list.html.erb +++ b/app/views/organizations/_org_students_list.html.erb @@ -21,7 +21,7 @@
    资源数
    - <% if User.current.admin_of_org?(@organization) %> + <% if User.current.admin? %> <%= org_student.excellent_student ==0 ? "设为学霸" : "取消设置" %> <% end %> diff --git a/app/views/organizations/_org_teachers_list.html.erb b/app/views/organizations/_org_teachers_list.html.erb index f2523fb9f..90467d870 100644 --- a/app/views/organizations/_org_teachers_list.html.erb +++ b/app/views/organizations/_org_teachers_list.html.erb @@ -28,15 +28,8 @@
    资源数
    - <% if User.current.admin_of_org?(@organization) %> + <% if User.current.admin? %> <%= org_teacher.excellent_teacher==0?"设为名师":"取消设置" %> - - <% else %> - - - - - <% end %>