socialforge/app/views/welcome/index.html.erb

176 lines
8.3 KiB
Plaintext

<%= stylesheet_link_tag 'welcome' %>
<%= javascript_include_tag 'welcome' %>
<script type="text/javascript" language="javascript">
$(function(){
$("#main").find("a").attr("target", "_blank");
setCss();
});
//设置div居中
function setCss()
{
var mainBar = $('#main-content-bar')[0];
var topHeight = mainBar.offsetHeight;
var welcomeLeft = $('#welcome_left')[0];
var leftHeight = welcomeLeft.offsetHeight;
var searchbar = $('#search-bar')[0];
var searchHeight = searchbar.offsetHeight;
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
//alert((topHeight - leftHeight)/2 );
}
// 给主页用户弹新页面
$(document).ready(function($) {
$("#loggedas").find("a").attr("target", "_blank");
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
});
</script>
<div class='top_bar'>
<div id="identifier-pannel" style="display:none">
<%= link_to image_tag('/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" ), home_path %>
<div class="weixin-content">微信扫码</div>
</div>
<div class="main-content-bar" id="main-content-bar">
<div style="float: left">
<%= image_tag '/images/transparent.png', size: "75x75" %>
</div>
<div class="welcome_left" id="welcome_left">
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_project) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_project_description) %></span>
</div>
<div class="search-bar" id="search-bar">
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
</div>
<div style="clear: both;"></div>
</div>
</div>
<div style="clear:both"></div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h3 style="margin-left: 5px; color: #e8770d;"><strong>热门项目</strong></h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", { :controller => 'projects', :action => 'index', :project_type => 0, :host => Setting.project_domain}, :target => "_blank" %></span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% projects = find_miracle_project(10, 3) %>
<% projects.map do |project| %>
<!--<% cache cache_key_for_project(project) do %> -->
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div style="float: left;">
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div style="float: left; margin-left: 10px; width: 380px;">
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
</div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; width: 380px;">
<span class='font_lighter' title =<%=project.description.to_s%>><%=project.description.truncate(50, omission: '...')%></span>
</div>
<div style="position:absolute; bottom:0;right:0;margin:5px 10px 5px 5px ;">
<% issue_count = project.issues.count %>
<% issue_journal_count = project.issue_changes.count %>
<% issue_score = issue_count * 0.2 %>
<% issue_journal_score = issue_journal_count * 0.1 %>
<% finall_issue_score = issue_score + issue_journal_score %>
<% new_count = project.news.count %>
<% new_score = new_count * 0.1 %>
<% finall_new_score = new_score %>
<% document_count = project.documents.count %>
<% file_score = document_count * 0.1 %>
<% finall_file_score = file_score %>
<% changeset_count = project.changesets.count %>
<% code_submit_score = changeset_count * 0.3 %>
<% finall_code_submit_score = code_submit_score %>
<% board_message_count = 0 %>
<% project.boards.each do |board| %>
<% board_message_count += board.messages_count %>
<% end %>
<% topic_score = board_message_count * 0.1 %>
<% finall_topic_score = topic_score %>
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
<%= content_tag "span", l(:label_project_score)+ ":" + format("%.2f" , finall_project_score ),
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ",
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
:class => "tooltip",
:id => "tooltip-#{project.id}" %>
</div>
</li>
<!--<%end %> -->
<% end; reset_cycle %>
</ul>
</div>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<ul class="user-welcome-message-list">
<h3 style="color: rgb(21, 188, 207)"><strong>用户动态</strong></h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", { :controller => 'users', :action => 'index'}, :target => "_blank" %></span>
<div class="user-message-box-list" style="margin-top: 10px;">
<%activities = find_all_activities%>
<% activities.each do |event| %>
<!--<% cache cache_key_for_event(event) do %> -->
<li style="display: block;height:60px; padding-bottom: 4px;">
<div class="inner-right" style="float: left; height: 100%; ">
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
</div>
<div class="inner-right" style="float: right; width:86%; height: 100%; ">
<span style="color: green;"><%= link_to event.event_author, (user_path(event.event_author) if event.event_author), :style => "color:green;", :target => "_blank" %></span><%= show_user_content event %>
<p style="margin-top: 4px;"><span style="color: rgb(172, 174, 177)"><%= l(:field_updated_on) %><%= time_tag_welcome event.event_datetime %>前</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="float: right; color: rgb(172, 174, 177);"><%= show_event_reply event %></span></p>
</div>
</li>
<!--<%end %> --><!-- cache -->
<% end %>
</div>
</ul>
</div>
<div class="right" style="float: right; width: 48%; ">
<ul class="welcome-message-list">
<!--<% cache 'forum_links' do %> -->
<div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;">
<h3 style="color: rgb(21, 188, 207);">
<strong>贴吧动态</strong>
<%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
<%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%></h3>
<span style="margin-top: -30px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
</div>
<!--<%end %> -->
<div class="welcome-box-list-new memo_activity">
<% topics = find_new_forum_topics(7) %>
<% topics.includes(:forum, :last_reply, :author).each do |topic|%>
<!--<% cache cache_key_for_topic(topic) do %> -->
<li class="message-brief-intro">
<div class='memo_title text_nowrap'>
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url,title: topic.subject %>
</div>
<div class='memo_attr'>
<span class='memo_timestamp'>
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
</span>
<span class="memo_author">
楼主: <%= link_to_user(topic.author) %>
</span>
<span class="memo_last_person">
最后回复:<%=link_to_user topic.last_reply.try(:author) %>
</span>
<span class="memo_reply">
回复(<%= link_to topic.try(:replies_count), topic.event_url %>)
</span>
</div>
</li>
<!--<%end %> --> <!-- cache -->
<% end %>
</div>
</ul>
</div>
<div class="clearfix"></div>
<%= render partial: 'link_to_another' %>