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?
condition = "%#{params[:name].strip}%".gsub(" ","")
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)
@added_course_ids = @organization.projects.map(&:id)
@projects = []

View File

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