实现组织首页功能

This commit is contained in:
ouyangxuhua 2015-12-05 11:30:05 +08:00
parent 5b0bdb5069
commit 01b82e59d8
7 changed files with 134 additions and 35 deletions

View File

@ -14,6 +14,7 @@ class OrgSubfieldsController < ApplicationController
def update
@subfield = OrgSubfield.find(params[:id])
@organization = Organization.find(@subfield.organization_id)
@subfield.update_attributes(:name => params[:name])
end
end

View File

@ -94,7 +94,11 @@ class OrganizationsController < ApplicationController
end
@page = params[:page]
respond_to do |format|
format.html
format.html {
if !params[:show_homepage].nil?
render :layout => 'base_organization'
end
}
format.js
end
else
@ -102,6 +106,13 @@ class OrganizationsController < ApplicationController
end
end
def homepage
@organization = Organization.find(params[:id])
respond_to do |format|
format.html {render :layout => 'base_organization'}
end
end
def update
@organization = Organization.find(params[:id])
@organization.name = params[:organization][:name]

View File

@ -0,0 +1,113 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','org'%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>课程主页</title>
<link href="css/public.css" rel="stylesheet" type="text/css" />
<link href="css/leftside.css" rel="stylesheet" type="text/css" />
<link href="css/org.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script>
$(document).ready(function(){
h1 = $(".homepageLeft").height();
if ($("#orgMain").height()< h1) {$("#orgMain").height(h1-42);}
})
</script>
</head>
<body>
<div class="orgContainer">
<div class="orgNav">
<div class="navOrgLogo fl"><a href="javascript:void(0);"><img src="/images/home_logo.png" width="21" height="19" alt="确实Trustie" class="mt3" /></a></div>
<ul>
<li class="navOrgMenu fl"><a href="javascript:void(0);" class="linkGrey8 f14">首页</a></li>
<li class="navOrgMenu fr"><a href="javascript:void(0);" class="linkGrey8 f14">登录</a></li>
<li class="navOrgMenu fr"><a href="javascript:void(0);" class="linkGrey8 f14 mr15">注册</a></li>
</ul>
<!--<div class="navHomepageProfile">
<ul>
<li class="homepageProfileMenuIcon"><a href="javascript:void(0);">
<div class="mt5 mb8"><img src="images/homepageProfileImage.png" width="40" height="40" /></div>
</a>
<ul class="topnav_login_list" style="display:none;">
<li><a href="javascript:void(0);" class="menuGrey">修改资料</a> </li>
<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>
<li><a href="javascript:void(0);" class="menuGrey">退出</a></li>
</ul>
</li>
</ul>
</div>-->
</div>
</div>
<div class="homepageContentContainer">
<div class="homepageContent">
<div class="homepageLeft">
<div class="homepagePortraitContainer">
<!--<div class="pr_info_logo fl mr10 mb5">-->
<div class="pr_info_logo fl fl mr10 mb5" id="homepage_portrait_image">
<%= image_tag(url_to_avatar(@organization),width:"60", height: "60", :id=>'nh_user_tx') %>
<% if User.current.logged?%>
<% if User.current.id == @organization.creator_id %>
<div id="edit_org_file_btn" class="none">
<div class="homepageEditProfile">
<a href="<%= clear_org_avatar_temp_organization_path(@organization) %>" data-remote="true" class="homepageEditProfileIcon"></a>
</div>
</div>
<% end %>
<% end%>
</div>
<div class="orgName fl mb5 f14">
<%= link_to @organization.name, organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %>
<% if @organization.is_public? %>
<span class="img_private"><%= l(:label_public)%></span>
<% else %>
<span class="img_private"><%= l(:label_private)%></span>
<% end %>
</div>
<% if User.current.admin_of_org?(@organization) and params[:show_homepage].nil? %>
<a href="<%= setting_organization_path(@organization) %>" class="pr_join_a c_white"><span class="pr_setting"></span>配置</a>
<% end %>
<div class="cl"></div>
<div class="f12 fontGrey3">
<%= link_to '文章', organization_org_document_comments_path(@organization) %>&nbsp;(
<%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %>
)&nbsp;|&nbsp;
<%= link_to '成员', members_organization_path(@organization.id) %>&nbsp;<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>
</div>
</div>
<div class="homepageLeftMenuContainer" id="sub_field_left_lists">
<%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %>
</div>
</div>
<div class="homepageRight" style="margin-top:0px;">
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
</div>
</div>
</div>
<div class="cl"></div>
<div id="Footer">
<div class="footerAboutContainer">
<ul class="footerAbout">
<li class="fl"><a href="javascript:void:(0);" class=" f_grey mw20" target="_blank">关于我们</a>|</li>
<li class="fl"><a href="javascript:void:(0);" class=" f_grey mw20" target="_blank">服务协议</a>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
<li class="fl"><a href="javascript:void:(0);" class=" f_grey mw20" target="_blank">贴吧交流</a></li>
</ul>
</div>
<div class="cl"></div>
<ul class="copyright mt10">
<li class="fl mr30">Copyright&nbsp;&copy;&nbsp;2007-2015,&nbsp;All Rights Riserved</li>
<li>ICP备09019772</li>
</ul>
</div>
</body>
</html>

View File

@ -1 +1,3 @@
$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>");
$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");

View File

@ -1,49 +1,21 @@
<div class="homepageLeftMenuBlock">
<%= link_to "组织首页",organization_path(@organization, :show_homepage => 1), :class => 'homepageMenuText', :target => '_blank' %>
</div>
<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>
<%=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" id="homepageLeftMenuProjects">
<ul >
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
<!--<%#= organization.org_projects.each do |p|%>-->
<!--<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey"><%#= p.name%></a></li>-->
<!--<%# end %>-->
<!--<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>
<%=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" id="homepageLeftMenuCourses" style="display:<%= organization.courses.count == 0 ?'none':'' %>">
<ul >

View File

@ -12,6 +12,7 @@
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
.homepagePostReplyInputContainer .ke-container {float: left;}
</style>
<% if params[:show_homepage].nil? %>
<div class="homepageRightBanner">
<div class="NewsBannerName">最新动态</div>
<ul class="resourcesSelect">
@ -49,9 +50,8 @@
</ul>
</li>
</ul>
</div>
<% end %>
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
<script>
$(function() {

BIN
public/images/home_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB