1.修改组织中关联项目和课程的内容和样式

This commit is contained in:
ouyangxuhua 2015-11-27 12:34:02 +08:00
parent 4aa827eb4a
commit e0f4050779
4 changed files with 36 additions and 28 deletions

View File

@ -225,7 +225,7 @@ class OrganizationsController < ApplicationController
if !params[:name].nil? if !params[:name].nil?
condition = "%#{params[:name].strip}%".gsub(" ","") condition = "%#{params[:name].strip}%".gsub(" ","")
end end
sql = "select projects.* from projects inner join members on projects.id = members.course_id where members.user_id = #{User.current.id} and projects.name like '#{condition}'" sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'"
user_projects = Course.find_by_sql(sql) user_projects = Course.find_by_sql(sql)
@added_course_ids = @organization.projects.map(&:id) @added_course_ids = @organization.projects.map(&:id)
@projects = [] @projects = []

View File

@ -85,19 +85,21 @@
<div class="homepageLeftMenuBlock"> <div class="homepageLeftMenuBlock">
<%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %> <%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %>
</div> </div>
<div class="homepageLeftMenuBlock"><a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a> <div class="homepageLeftMenuBlock">
<div class="courseMenu" id="projectMenu"> <a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>
<ul> <%=link_to "", join_project_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%>
<li class="courseMenuIcon" id="projectMenuIcon"> <!--<div class="courseMenu" id="projectMenu">-->
<ul class="topnav_course_menu" id="topnav_project_menu" style="line-height:1;"> <!--<ul>-->
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>--> <!--<li class="courseMenuIcon" id="projectMenuIcon">-->
<li> <!--<ul class="topnav_course_menu" id="topnav_project_menu" style="line-height:1;">-->
<%= link_to "加入项目",join_project_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%> <!--&lt;!&ndash;<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>&ndash;&gt;-->
</li> <!--<li>-->
</ul> <!--<%#= link_to "关联项目",join_project_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>-->
</li> <!--</li>-->
</ul> <!--</ul>-->
</div> <!--</li>-->
<!--</ul>-->
<!--</div>-->
<!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>--> <!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>-->
</div> </div>
<div class="homepageLeftMenuCourses borderBottomNone" id="homepageLeftMenuProjects"> <div class="homepageLeftMenuCourses borderBottomNone" id="homepageLeftMenuProjects">
@ -109,19 +111,22 @@
<!--<li class="homepageLeftMenuMore"><a href="javascript:void(0);" class="homepageLeftMenuMoreIcon"></a></li>--> <!--<li class="homepageLeftMenuMore"><a href="javascript:void(0);" class="homepageLeftMenuMoreIcon"></a></li>-->
</ul> </ul>
</div> </div>
<div class="homepageLeftMenuBlock"><a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a> <div class="homepageLeftMenuBlock">
<div class="courseMenu" id="courseMenu"> <a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
<ul> <%=link_to "", join_course_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%>
<li class="courseMenuIcon" id="courseMenuIcon"> <%#= link_to "关联课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>
<ul class="topnav_course_menu" id="topnav_course_menu" style="line-height:1;"> <!--<div class="courseMenu" id="courseMenu">-->
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>--> <!--<ul>-->
<li> <!--<li class="courseMenuIcon" id="courseMenuIcon">-->
<%= link_to "加入课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%> <!--<ul class="topnav_course_menu" id="topnav_course_menu" style="line-height:1;">-->
</li> <!--&lt;!&ndash;<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>&ndash;&gt;-->
</ul> <!--<li>-->
</li> <!--<%#= link_to "关联课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>-->
</ul> <!--</li>-->
</div> <!--</ul>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>--> <!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>-->
</div> </div>
<div class="homepageLeftMenuCourses borderBottomNone" id="homepageLeftMenuCourses"> <div class="homepageLeftMenuCourses borderBottomNone" id="homepageLeftMenuCourses">

View File

@ -0,0 +1,3 @@
//$("#homepageLeftMenuProjects").html("");
//$("#homepageLeftMenuProjects").append("<ul>");
//$("#homepageLeftMenuProjects").append("<%#= escape_javascript %>")

View File

@ -3,7 +3,7 @@ class DeleteUselessOrgActivities < ActiveRecord::Migration
OrgActivity.all.each do |act| OrgActivity.all.each do |act|
if act.container_type == 'Course' if act.container_type == 'Course'
if CourseActivity.where("course_act_type=? and course_act_id =? and course_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0 if CourseActivity.where("course_act_type=? and course_act_id =? and course_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0
puts "course" act.destroy
end end
else else
if act.container_type == 'Project' and ForgeActivity.where("forge_act_type=? and forge_act_id =? and project_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0 if act.container_type == 'Project' and ForgeActivity.where("forge_act_type=? and forge_act_id =? and project_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0