Merge branch 'hjq_beidou' into develop

This commit is contained in:
huang 2016-03-31 17:06:30 +08:00
commit 6af8c48d3b
18 changed files with 483 additions and 104 deletions

View File

@ -130,6 +130,12 @@ class OrgSubfieldsController < ApplicationController
@organization = @org_subfield.organization @organization = @org_subfield.organization
end end
def update_status
@subfield = OrgSubfield.find(params[:id])
@organization = Organization.find(@subfield.organization_id)
@subfield.update_attributes(:status => params[:status])
end
def show_attachments obj def show_attachments obj
@attachments = [] @attachments = []
obj.each do |container| obj.each do |container|

View File

@ -34,6 +34,7 @@ class OrganizationsController < ApplicationController
end end
def new def new
@organization = Organization.new @organization = Organization.new
render :layout => 'new_base' render :layout => 'new_base'
@ -74,10 +75,12 @@ class OrganizationsController < ApplicationController
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
@subfield_content = @organization.org_subfields.order("priority") @subfield_content = @organization.org_subfields.order("priority")
# 项目两种动态 # 项目两种动态
@project_acts = get_project_activities_org @organization
@project_issue_acts = get_project_issue_activities_org @organization @project_issue_acts = get_project_issue_activities_org @organization
@project_message_acts = get_project_message_activities_org @organization @project_message_acts = get_project_message_activities_org @organization
# 磕碜动态 # 磕碜动态
#@project_acts_issues = get_project_activities_org @organization #@project_acts_issues = get_project_activities_org @organization
@course_acts = get_course_activities_org @organization
@course_acts_homework = get_course_homework_activities_org @organization @course_acts_homework = get_course_homework_activities_org @organization
@course_acts_message = get_course_message_activities_org @organization @course_acts_message = get_course_message_activities_org @organization
@course_acts_news = get_course_news_activities_org @organization @course_acts_news = get_course_news_activities_org @organization
@ -153,6 +156,29 @@ class OrganizationsController < ApplicationController
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;") #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;")
end end
# 获取整过项目的动态
def get_project_activities_org org
project_ids = org.projects.map{|project| project.id}.join(",")
unless project_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' order by updated_at desc limit 8;")
else
project_acts = nil
end
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;")
end
# 获取整过课程的动态
def get_course_activities_org org
course_ids = org.courses.map{|course| course.id}.join(",")
unless course_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' order by updated_at desc limit 8;")
else
project_acts = nil
end
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' order by updated_at desc limit 5;")
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 1;")
end
def get_course_homework_activities_org org def get_course_homework_activities_org org
course_ids = org.courses.map{|course| course.id}.join(",") course_ids = org.courses.map{|course| course.id}.join(",")
unless course_ids.blank? unless course_ids.blank?
@ -228,11 +254,6 @@ class OrganizationsController < ApplicationController
end end
end end
def clear_org_avatar_temp
end
def set_homepage def set_homepage
@org = Organization.find(params[:id]) @org = Organization.find(params[:id])
@org.home_id = params[:home_id] @org.home_id = params[:home_id]

View File

@ -30,7 +30,7 @@ module OrganizationsHelper
end end
def get_message_org(org_id, field_id) def get_message_org(org_id, field_id)
OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and org_subfield_id = #{field_id} and parent_id is null order by updated_at desc limit 2;") OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and org_subfield_id = #{field_id} and parent_id is null order by updated_at desc limit 8;")
end end
def get_message_reply_org(org_id, ids) def get_message_reply_org(org_id, ids)
@ -59,4 +59,18 @@ module OrganizationsHelper
end end
end end
#排列下拉框
def subfield_status_option
type = []
option1 = []
option1 << "列表"
option1 << "1"
type << option1
option2 = []
option2 << "图片"
option2 << "0"
type << option2
type
end
end end

View File

@ -77,7 +77,7 @@
<% @subfield_content.each do |field| %> <% @subfield_content.each do |field| %>
<% if is_default_field?(field) %> <% if is_default_field?(field) %>
<% case field.name %> <% case field.name %>
<% when 'activity' %> <% when 'activity' %>
<%= link_to "首页", organization_path(@organization), :class => "fl navact" %> <%= link_to "首页", organization_path(@organization), :class => "fl navact" %>
<% when 'course' %> <% when 'course' %>
<a href="#course_<%= field.id %>" class="fl"> 课程动态</a> <a href="#course_<%= field.id %>" class="fl"> 课程动态</a>
@ -92,6 +92,9 @@
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
<% if User.current.admin_of_org?(@organization) %>
<a href="<%= setting_organization_path(@organization) %>" class="fl">配置</a>
<% end %>
</div> </div>
</div><!--nav end--> </div><!--nav end-->
@ -107,114 +110,169 @@
<% if is_default_field?(field) %> <% if is_default_field?(field) %>
<% case field.name %> <% case field.name %>
<% when 'course' %> <% when 'course' %>
<div class="box1 bg-grey"> <div class="box1 bg-grey" style="display:<%= field.hide == 0?'block':'none' %>;">
<% if field.status == 0 %>
<div class="content"> <div class="content">
<div class="box-top" id="course_<%= field.id %>"><h2 class="box-title">课程动态</h2><p class="box-title-p">course activities</p></div> <div class="box-top" id="course_<%= field.id %>"><h2 class="box-title">课程动态</h2></div>
<div class="course-list"> <% if @course_acts.nil? %>
<ul class="clearfix"> <p class="nocontent">暂无内容,敬请期待!</p>
<% unless @course_acts_homework.nil? %> <% else %>
<li > <div class="course-list">
<% @course_acts_homework.each do |act| %> <ul class="clearfix">
<%= render :partial => 'org_new_course_homework', :locals => {:activity => HomeworkCommon.find(act.org_act_id),:user_activity_id =>act.id, :course_activity => 0} %> <% unless @course_acts_homework.nil? %>
<% end %> <li >
</li> <% @course_acts_homework.each do |act| %>
<% end %> <%= render :partial => 'org_new_course_homework', :locals => {:activity => HomeworkCommon.find(act.org_act_id),:user_activity_id =>act.id, :course_activity => 0} %>
<% end %>
</li>
<% end %>
<% unless @course_acts_message.nil? %> <% unless @course_acts_message.nil? %>
<li > <li >
<% @course_acts_message.each do |act| %> <% @course_acts_message.each do |act| %>
<%= render :partial => 'org_new_course_message', :locals => {:activity => Message.find(act.org_act_id), :user_activity_id =>act.id} %> <%= render :partial => 'org_new_course_message', :locals => {:activity => Message.find(act.org_act_id), :user_activity_id =>act.id} %>
<% end %> <% end %>
</li> </li>
<% end %> <% end %>
<% unless @course_acts_news.nil? %> <% unless @course_acts_news.nil? %>
<li > <li >
<% @course_acts_news.each do |act| %> <% @course_acts_news.each do |act| %>
<%= render :partial => 'org_new_course_news', :locals => {:activity => News.find(act.org_act_id), :user_activity_id =>act.id} %> <%= render :partial => 'org_new_course_news', :locals => {:activity => News.find(act.org_act_id), :user_activity_id =>act.id} %>
<% end %> <% end %>
</li> </li>
<% end %> <% end %>
<div class="cl"></div>
</ul>
</div>
<div class="cl"></div> <div class="cl"></div>
</ul> <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
</div> <div class="cl"></div>
<% end %>
</div><!--content end--> </div><!--content end-->
<% else %>
<div class="content">
<div class="box-top" id="course_<%= field.id %>"><h2 class="box-title">课程动态</h2></div>
<% if @course_acts.nil? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<% else %>
<div class="row">
<%= render :partial => 'organizations/org_new_course_act_list', :locals =>{:activities => @course_acts, :field => field, :organization => @organization} %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<% end %>
</div><!--box1 end--> </div><!--box1 end-->
<% when 'project' %> <% when 'project' %>
<div class="box1"> <div class="box1" style="display:<%= field.hide == 0?'block':'none' %>;">
<div class="content"> <% if field.status == 0 %>
<div class="box-top" id="project_<%= field.id %>"><h2 class="box-title">项目动态</h2><p class="box-title-p">project activities</p></div> <div class="content ">
<div class="row"> <div class="box-top" id="project_<%= field.id %>"><h2 class="box-title">项目动态</h2><p class="box-title-p"></p></div>
<% unless @project_message_acts.nil? %> <% if @project_acts.nil? %>
<div class="row-l fl"> <p class="nocontent">暂无内容,敬请期待!</p>
<!-- text --> <% else %>
<% @project_message_acts.each do |act| %> <div class="course-list">
<%= render :partial => 'organizations/org_new_project_message', :locals => {:activity => Message.find(act.org_act_id)} %> <ul class="clearfix">
<% end %> <% unless @project_acts.nil? %>
<%= link_to "More", organization_path(@organization, :type => 1), :class => "more-btn mt30 fr", :target => "_blank" %> <%= render :partial => 'organizations/org_new_project_pic', :locals => {:activities => @project_acts.first(3)} %>
<div class="cl"></div> <% end %>
</div> <div class="cl"></div>
<% end %> <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<!-- row-l end --> <div class="cl"></div>
<% unless @project_issue_acts.nil? %> </ul>
<div class="row-r fr"> </div>
<% @project_issue_acts.each do |act| %> <% end %>
<%= render :partial => 'organizations/org_new_project_issues', :locals => {:activity => Issue.find(act.org_act_id)} %>
<% end %>
<%= link_to "More", organization_path(@organization, :type => 1), :class => "more-btn mt30 fr", :target => "_blank" %>
<div class="cl"></div>
</div>
<% end %>
<!-- article-rwrap end -->
</div>
<div class="cl"></div>
</div><!--content end--> </div><!--content end-->
</div><!--box2 end--> <% else %>
<div class="content">
<div class="box-top" style="display:<%= field.hide == 0?'block':'none' %>;" id="project_<%= field.id %>"><h2 class="box-title">项目动态</h2><p class="box-title-p"></p></div>
<% if @project_acts.nil? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<% else %>
<div class="row">
<%= render :partial => 'organizations/org_new_project_act_list', :locals =>{:activities => @project_acts, :field => field, :organization => @organization} %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<% end %>
</div>
<% end %> <% end %>
<% else %> <% else %>
<% if field.field_type == "Post" %> <%# 讨论类型 %> <% if field.field_type == "Post" %> <%# 讨论类型 %>
<% message_ats = get_message_org(@organization.id, field.id) %> <% message_ats = get_message_org(@organization.id, field.id) %>
<% ids = field.org_document_comments.map{|o| o.id}.join(",") %> <% ids = field.org_document_comments.map{|o| o.id}.join(",") %>
<div class="box1 bg-grey" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>"> <div class="box1 bg-grey" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<div class="content"> <% if field.status == 0 %>
<div class="box-top" id="message_<%= field.id %>"><h2 class="box-title"><%= field.name %><%= field.id %></h2><p class="box-title-p">discussion zone</p></div> <div class="content">
<div class="row"> <div class="box-top" id="message_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
<div class="con-left fl"> <% if message_ats.blank? %>
<% message_ats.each do |act| %> <p class="nocontent">暂无内容,敬请期待!</p>
<%= render :partial => 'organizations/org_new_forum', :locals => {:activity => act, :field => field, :organization => @organization} %> <% else %>
<% end %> <div class="course-list">
<%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn mt30 fr", :target => "_blank" %> <ul class="clearfix">
<div class="cl"></div>
</div><!--con-left end-->
<% unless ids.blank? %>
<% message_reply_ats = get_message_reply_org(@organization.id, ids) %>
<div class="con-right fr">
<% message_reply_ats.each do |act| %>
<%= render :partial => 'organizations/org_new_forum_reply', :locals => {:activity => act, :field => field, :organization => @organization} %>
<% end %>
<div class="cl"></div>
</div><!--con-right end--->
<% end %> <% message_ats.first(3).each do |act| %>
</div> <%= render :partial => 'organizations/org_new_forum_pic', :locals => {:activity => act, :field => field, :organization => @organization} %>
</div><!-content end--> <% end %>
<div class="cl"></div> <div class="cl"></div>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> </ul>
<div class="cl"></div> <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
</div>
<% end %>
</div><!--content end-->
<% else %>
<div class="content">
<div class="box-top" id="resource_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
<% if message_ats.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<% else %>
<div class="row">
<% message_ats.each do |act| %>
<%= render :partial => 'organizations/org_new_forum_list', :locals => {:activity => act, :field => field, :organization => @organization} %>
<% end %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<div class="cl"></div>
<% end %>
</div><!--box1 end--> </div><!--box1 end-->
<% elsif field.field_type == "Resource" %> <% elsif field.field_type == "Resource" %>
<% org_attachs = get_attach_org2(field) %> <% org_attachs = get_attach_org2(field) %>
<div class="box1" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>"> <div class="box1" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<div class="content"> <div class="content">
<div class="box-top" id="resource_<%= field.id %>"><h2 class="box-title"><%= field.name %><%= field.id %></h2><p class="box-title-p">resource dwonload</p></div> <div class="box-top" id="resource_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
<div class="row"> <% if org_attachs.blank? %>
<%= render :partial => 'organizations/org_new_resource', :locals => {:org_attachs => org_attachs} %> <p class="nocontent">暂无内容,敬请期待!</p>
<!--row-ziyuan end--> <% else %>
</div> <div class="row">
<%= render :partial => 'organizations/org_new_resource', :locals => {:org_attachs => org_attachs} %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% end %>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
</div><!--row end--> </div><!--row end-->
<div class="cl"></div> <div class="cl"></div>
</div><!--box1 end--> </div><!--box1 end-->

View File

@ -0,0 +1,3 @@
$("#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

@ -0,0 +1,48 @@
<% activities.each do |act| %>
<% if act.org_act_type == "HomeworkCommon" %>
<% activity = HomeworkCommon.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.user),:width => "40", :height => "40"), user_path(activity.user), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="ziyuan-box fl">
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_at %></span>
<span> 作者:<%= activity.try(:user).try(:realname).nil? ? activity.try(:user).try(:login) : activity.try(:user).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.journals_for_messages.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="ziyuan-box fl">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<% end %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_on %></span>
<span> 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.children.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.creator),:width => "40", :height => "40"), user_path(activity.creator), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="ziyuan-box fl">
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_at %></span>
<span> 作者:<%= activity.try(:creator).try(:realname).nil? ? activity.try(:creator).try(:login) : activity.try(:creator).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.children.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% end %>
<% end %>

View File

@ -0,0 +1,14 @@
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.creator),:width => "40", :height => "40"), user_path(activity.creator), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="ziyuan-box fl">
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_at %></span>
<span> 作者:<%= activity.try(:creator).try(:realname).nil? ? activity.try(:creator).try(:login) : activity.try(:creator).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.children.count %></span> </p>
</div>
</div><!--row-ziyuan end-->

View File

@ -0,0 +1,24 @@
<li>
<a href="/#" title="" >
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.content) %>
<% if iamge_path.nil? %>
<img width="370" height="220" alt="#" src="/images/org_new_style/default-img.jpg">
<% else %>
<img width="370" height="220" src="/files/uploads/image<%= iamge_path %>" alt="" />
<% end %>
</div>
<h5>
<span><%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %></span>
</h5>
<div class="item-btm clearfix">
<a class="publisher-name fl" href="#" target="_blank"><%= activity.try(:creator).try(:realname).nil? ? activity.try(:creator).try(:login) : activity.try(:creator).try(:realname) %></a>
<p class="pass-time fl"><span><%= format_date activity.created_at %></span></p>
<div class="fr right-info"> <span> <%= activity.children.count %></span></div>
</div>
</a>
</li>

View File

@ -0,0 +1,49 @@
<% activities.each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = Issue.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="ziyuan-box fl">
<%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<%#= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_on %></span>
<span> 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.journals.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="ziyuan-box fl">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<% end %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_on %></span>
<span> 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.children.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.creator),:width => "40", :height => "40"), user_path(activity.creator), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="ziyuan-box fl">
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_at %></span>
<span> 作者:<%= activity.try(:creator).try(:realname).nil? ? activity.try(:creator).try(:login) : activity.try(:creator).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.children.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% end %>
<% end %>

View File

@ -0,0 +1,77 @@
<% activities.each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = Issue.find(act.org_act_id) %>
<li>
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.description) %>
<% if iamge_path.nil? %>
<img width="370" height="220" alt="#" src="/images/org_new_style/default-img.jpg">
<% else %>
<img width="370" height="220" src="/files/uploads/image<%= iamge_path %>" alt="" />
<% end %>
</div>
<h5>
<%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank' %>
</h5>
<div class="item-btm clearfix">
<a class="publisher-name fl" href="#" target="_blank"><%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></a>
<p class="pass-time fl"><span><%= format_date activity.updated_on %></span></p>
<div class="fr right-info"> <span> <%= activity.journals.count %></span></div>
</div>
</a>
</li>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<li>
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.content) %>
<% if iamge_path.nil? %>
<img width="370" height="220" alt="#" src="/images/org_new_style/default-img.jpg">
<% else %>
<img width="370" height="220" src="/files/uploads/image<%= iamge_path %>" alt="" />
<% end %>
</div>
<h5>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% end %>
</h5>
<div class="item-btm clearfix">
<a class="publisher-name fl" href="#" target="_blank"><%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></a>
<p class="pass-time fl"><span><%= format_date activity.updated_on %></span></p>
<div class="fr right-info"> <span> <%= activity.children.count %></span></div>
</div>
</a>
</li>
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
<li>
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.description) %>
<% if iamge_path.nil? %>
<img width="370" height="220" alt="#" src="/images/org_new_style/default-img.jpg">
<% else %>
<img width="370" height="220" src="/files/uploads/image<%= iamge_path %>" alt="" />
<% end %>
</div>
<h5>
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %>
</h5>
<div class="item-btm clearfix">
<a class="publisher-name fl" href="#" target="_blank"><%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></a>
<p class="pass-time fl"><span><%= format_date activity.created_on %></span></p>
<div class="fr right-info"> <span> <%= activity.comments.count %></span></div>
</div>
</a>
</li>
<% end %>
<% end %>

View File

@ -2,6 +2,7 @@
<li class="orgOrder fb">顺序</li> <li class="orgOrder fb">顺序</li>
<li class="orgListUser fb">已有栏目</li> <li class="orgListUser fb">已有栏目</li>
<li class="orgListStatus fb">状态</li> <li class="orgListStatus fb">状态</li>
<li class="orgListStatusList fb fb">排列</li>
<li class="orgListStatus fb">类型</li> <li class="orgListStatus fb">类型</li>
<li class="orgListUser fb">域名目录</li> <li class="orgListUser fb">域名目录</li>
<div class="cl"></div> <div class="cl"></div>
@ -21,8 +22,18 @@
</li> </li>
<li class="orgListUser"><%= name %></li> <li class="orgListUser"><%= name %></li>
<li class="orgListStatus">默认</li> <li class="orgListStatus">默认</li>
<li class="orgListStatusList">
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
<div class="update_status_class"><span style="width: 35px; text-align: center; float: left;" class="hidden"><%=field.status== 1 ? "列表" : "图片" %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
</div>
<%= select( :name,:group_id, subfield_status_option,
{ :include_blank => false,:selected => field.status},
{:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:30px;"}) %>
<% end %>
</li>
<li class="orgListStatus">默认</li> <li class="orgListStatus">默认</li>
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a> <a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"隐藏":"可见" %></a>
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<% else %> <% else %>
@ -42,6 +53,21 @@
</div> </div>
</li> </li>
<li class="orgListStatus">新增</li> <li class="orgListStatus">新增</li>
<li class="orgListStatusList">
<% if field.field_type == "Resource" %>
列表
<% else %>
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
<div class="update_status_class"><span style="width: 35px; text-align: center; float: left;" class="hidden"><%=field.status== 1 ? "列表" : "图片" %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
</div>
<%= select( :name,:group_id, subfield_status_option,
{ :include_blank => false,:selected => field.status},
{:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:40px;"}) %>
<% end %>
<% end %>
</li>
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li> <li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
<li class="orgListUser hidden"> <li class="orgListUser hidden">
<% if Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 %> <% if Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 %>
@ -58,7 +84,7 @@
</div> </div>
</li> </li>
<%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %> <%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %>
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a> <a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"隐藏":"可见" %></a>
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %> <%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a> <a href="javascript:void(0);" class="linkBlue fr mr10" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
@ -68,6 +94,34 @@
<% end %> <% end %>
<script> <script>
$(document).ready(function(){
$(".pic_edit2").click(function(){
$(this).parent().hide();
$(this).parent().next().show();
});
$(".class-edit").blur(function(){
$(this).hide();
$(this).prev().show();
var editValue = $(this).children("option:selected").text();
$(this).prev().children(":first").text(editValue);
});
function stopPropagation(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
};
$(document).bind('click',function(){
$('.class-edit').css('display','none');
$('.update_status_class').show();
});
$('.class-edit,.pic_edit2').bind('click',function(e){
stopPropagation(e);
});
});
function update_status(id){
$(id).submit();
}
function edit(show_id, edit_id) { function edit(show_id, edit_id) {
$(show_id).toggle(); $(show_id).toggle();
$(edit_id).toggle(); $(edit_id).toggle();
@ -146,7 +200,7 @@
$(edit_id).hide(); $(edit_id).hide();
} }
function hide(content, id){ function hide(content, id){
if (content.text() == '设为隐藏') if (content.text() == '隐藏')
$.ajax({ $.ajax({
url: "/organizations/hide_org_subfield?org_subfield_id=" + id, url: "/organizations/hide_org_subfield?org_subfield_id=" + id,
type: "post" type: "post"

View File

@ -1,2 +1,2 @@
$("#hide_<%= @org_subfield.id %>").text("设为可见"); $("#hide_<%= @org_subfield.id %>").text("可见");
$("#org_subfield_<%= @org_subfield.id %>").css("display", "none"); $("#org_subfield_<%= @org_subfield.id %>").css("display", "none");

View File

@ -1,2 +1,2 @@
$("#hide_<%= @org_subfield.id %>").text("设为隐藏"); $("#hide_<%= @org_subfield.id %>").text("隐藏");
$("#org_subfield_<%= @org_subfield.id %>").css("display", "block"); $("#org_subfield_<%= @org_subfield.id %>").css("display", "block");

View File

@ -112,6 +112,7 @@ RedmineApp::Application.routes.draw do
member do member do
match 'update_sub_dir', :via => [:put] match 'update_sub_dir', :via => [:put]
match 'update_priority', :via => [:put] match 'update_priority', :via => [:put]
match 'update_status', :via => [:post]
end end
resource :boards resource :boards
end end

View File

@ -0,0 +1,5 @@
class AddStatusToOrgSubfields < ActiveRecord::Migration
def change
add_column :org_subfields, :status, :integer, :default => true
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160328022623) do ActiveRecord::Schema.define(:version => 20160331063938) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -1289,6 +1289,7 @@ ActiveRecord::Schema.define(:version => 20160328022623) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "field_type" t.string "field_type"
t.integer "hide", :default => 0 t.integer "hide", :default => 0
t.integer "status", :default => 1
end end
create_table "organizations", :force => true do |t| create_table "organizations", :force => true do |t|

View File

@ -18,12 +18,12 @@
.orgUrlInput {width:200px; outline:none; border:1px solid #eaeaea; height:22px;} .orgUrlInput {width:200px; outline:none; border:1px solid #eaeaea; height:22px;}
a.saveBtn {padding:3px 5px; background-color:#269ac9; color:#ffffff;} a.saveBtn {padding:3px 5px; background-color:#269ac9; color:#ffffff;}
a.saveBtn:hover {background-color:#297fb8;} a.saveBtn:hover {background-color:#297fb8;}
.orgMemberList {width:460px; float:left;} .orgMemberList {width:480px; float:left;}
.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px;} .orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px;}
.orgListUser {width:85px; float:left;} .orgListUser {width:85px; float:left;}
.orgListRole {width:180px; float:left;} .orgListRole {width:180px; float:left;}
.orgOrder {width:30px; float:left;margin-right:10px;text-align:center;} .orgOrder {width:30px; float:left;margin-right:10px;text-align:center;}
.orgMemContainer {width:228px;} .orgMemContainer {width:208px;}
.orgMemberAdd {float:right;} .orgMemberAdd {float:right;}
.orgAddSearch {border:1px solid #dddddd; outline:none; width:180px; height:22px; color:#9b9b9b;} .orgAddSearch {border:1px solid #dddddd; outline:none; width:180px; height:22px; color:#9b9b9b;}
.undis {display:none;} .undis {display:none;}
@ -75,7 +75,8 @@ a.linkGrey8:hover {color:#585858;}
#orgUserName {display:inline-block;} #orgUserName {display:inline-block;}
.org_login_list a {color:#269ac9;} .org_login_list a {color:#269ac9;}
.orgListStatus {width:55px; float:left;} .orgListStatus {width:40px; float:left;}
.orgListStatusList {width:55px; float:left;}
.personalUrl {border:1px solid #dddddd; width:75px; outline:none; white-space:nowrap; padding-left:2px;} .personalUrl {border:1px solid #dddddd; width:75px; outline:none; white-space:nowrap; padding-left:2px;}
.reCon{ margin:5px; width:710px;} .reCon{ margin:5px; width:710px;}
.retop{width:710px; height:40px; background:#eaeaea; padding:5px;} .retop{width:710px; height:40px; background:#eaeaea; padding:5px;}

View File

@ -95,7 +95,7 @@ a.pre-back{ background:#888;}
.footer-con ul{ display:block; width:430px; height:50px; margin:0 auto; } .footer-con ul{ display:block; width:430px; height:50px; margin:0 auto; }
.footer-con ul li a{font-size:18px; color:#fff; margin-right:35px; font-weight:bold;} .footer-con ul li a{font-size:18px; color:#fff; margin-right:35px; font-weight:bold;}
/** download **/ /** download **/
.row-ziyuan{ width:570px; border-bottom:1px solid #f0f0f0; padding:15px 0;margin: 0px 15px;} .row-ziyuan{ width:570px; border-bottom:1px solid #e6e6e6; padding:15px 0;margin: 0px 15px;}
.ziyuan-box{ width:420px; margin-right:20px;} .ziyuan-box{ width:420px; margin-right:20px;}
.ziyuan-box span{ margin-right:5px;} .ziyuan-box span{ margin-right:5px;}
.ziyuan-title{ display:block; width:420px; font-size:16px;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} .ziyuan-title{ display:block; width:420px; font-size:16px;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
@ -177,11 +177,14 @@ a:hover.read-more{ text-decoration:underline;}
a.more-btn{ display:block; background:#ccc; color:#fff; margin-top:10px; width:100px; height:38px;font-size:14px; -webkit-border-radius: 5px;border-radius:5px;text-align:center; line-height:38px;} a.more-btn{ display:block; background:#ccc; color:#fff; margin-top:10px; width:100px; height:38px;font-size:14px; -webkit-border-radius: 5px;border-radius:5px;text-align:center; line-height:38px;}
a.more-btn-center{ display:block; background:#ccc; color:#fff; margin-top:10px; width:100px; height:38px;font-size:14px; -webkit-border-radius: 5px;border-radius:5px;text-align:center; line-height:38px;width:100px; margin:0px auto;margin-top: 15px;} a.more-btn{ display:block; border:1px solid #ccc; color:#000; margin-top:10px; width:120px; height:38px;font-size:14px; -webkit-border-radius: 25px;border-radius:25px;text-align:center; line-height:38px; margin:0 auto; margin-top:30px;}
a.more-btn-center{ display:block; border:1px solid #ccc; color:#000; margin-top:10px; width:120px; height:38px;font-size:14px; -webkit-border-radius: 25px;border-radius:25px;text-align:center; line-height:38px; margin:0 auto; margin-top:30px;}
a:hover.more-btn{ background:#29146f; color:#fff;} a:hover.more-btn{ background:#29146f; color:#fff;}
a:hover.more-btn-center{ background:#29146f; color:#fff;} a:hover.more-btn-center{ background:#29146f; color:#fff;}
.mt30{ margin-top:30px;} .mt30{ margin-top:30px;}
.nocontent{ font-size:30px; color:#888; margin:150px auto; text-align:center;}