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

203 lines
9.3 KiB
Plaintext
Raw Normal View History

<% @nav_dispaly_forum_label = 1 %>
2014-10-23 18:49:14 +08:00
<%= stylesheet_link_tag 'welcome' %>
<%= javascript_include_tag 'welcome' %>
<script type="text/javascript" language="javascript">
2015-01-30 14:11:35 +08:00
$(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 );
}
2014-10-23 18:49:14 +08:00
// 给主页用户弹新页面
$(document).ready(function($) {
$("#loggedas").find("a").attr("target", "_blank");
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
2015-01-30 14:11:35 +08:00
});
2014-10-23 18:49:14 +08:00
</script>
<div class='top_bar'>
2015-01-30 14:11:35 +08:00
<%#= render partial: 'wei_xin' %>
2014-10-23 18:49:14 +08:00
<div class="main-content-bar" id="main-content-bar">
<div style="float: left;padding-left:15px ">
2015-01-30 14:11:35 +08:00
<!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> -->
2015-01-31 15:43:35 +08:00
<% if @organization.nil? %>
2015-01-30 14:11:35 +08:00
<% if get_avatar?(@first_page) %>
<%= image_tag(url_to_avatar(@first_page), width:@first_page.image_width,height: @first_page.image_height) %>
<% else %>
<%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %>
<% end %>
<% else %>
<%= image_tag '/images/avatars/Project/0', width:@first_page.image_width,height: @first_page.image_height %>
<% end %>
2014-10-23 18:49:14 +08:00
</div>
<div class="welcome_left" id="welcome_left" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
2015-01-31 15:43:35 +08:00
<% if @organization.nil? %>
2015-01-30 14:11:35 +08:00
<% unless @first_page.nil? %>
<%= @first_page.description.html_safe %>
<% end %>
<% else %>
<span class="font_welcome_school" style="color: #E8770D">
<%= link_to @organization, options={:action => 'index', :enterprise => @organization}, html_options={ :method => 'get', :style => "color: #E8770D"} %>
</span>
<br/>
<span class="font_welcome_trustie">
<%= @first_page.title %>
</span>
2015-01-30 14:11:35 +08:00
<% end %>
</div>
<div class="search-bar" id="search-bar">
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
</div>
<div style="clear: both;"></div>
2014-10-23 18:49:14 +08:00
</div>
</div>
2015-01-30 14:11:35 +08:00
<div style="clear:both"></div>
2014-10-23 18:49:14 +08:00
<div id="J_Slide" class="d-p-index-box d-p-index-hot">
2015-01-30 14:11:35 +08:00
<h3 style="margin-left: 5px; color: #e8770d;"><strong> <%= l(:lable_hot_projects)%> </strong></h3>
<span style="margin-top: -20px;float: right; display: block;"> <% if User.current.logged? %>
<%= link_to(l(:label_project_new), {:controller => 'projects',
:action => 'new',
:course => 0,
:project_type =>( @project_type||=0)},
:class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to l(:label_join_project), join_project_projects_path ,:remote => true, :class => 'icon icon-add' %>
&nbsp;&nbsp;&nbsp;&nbsp;
<% end %> </span>
2014-10-23 18:49:14 +08:00
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
2015-01-30 14:11:35 +08:00
<!-- 如果企业版参数正确,这进入企业版页面 -->
2015-01-31 15:43:35 +08:00
<% if @organization.nil? %>
2015-01-30 14:11:35 +08:00
<% @projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end; reset_cycle %>
<!-- 企业版项目 -->
<% else %>
<% if @e_count == 0 %>
<p id="errorExplanation"><%= l(:label_enterprise_tips) %></p>
<% @projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
2015-01-30 14:11:35 +08:00
<% elsif @e_count < 10 %>
2015-01-31 15:43:35 +08:00
<% @organization_projects.map do |project| %>
2015-01-30 14:11:35 +08:00
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<p id="errorExplanation"><%= l(:label_part_enterprise_tips) %></p>
<% @part_projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<% else %>
<% @part_projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<% end %>
<% end %>
2014-10-23 18:49:14 +08:00
</ul>
</div>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-Dynamic">
<ul class="user-welcome-message-list">
<h3 style="color: rgb(21, 188, 207)">
<strong>
<%= l(:lable_user_active)%>
</strong>
</h3>
2014-10-23 18:49:14 +08:00
<div class="user-message-box-list" style="margin-top: 10px;">
2015-01-07 09:27:44 +08:00
<% cache("activities") do %>
2014-10-23 18:49:14 +08:00
<%activities = find_all_activities%>
<% activities.each do |event| %>
2015-01-07 09:27:44 +08:00
<% cache event do %>
2014-10-23 18:49:14 +08:00
<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%; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" >
<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) %>
2015-01-07 09:27:44 +08:00
<%= format_time event.event_datetime %>
2015-01-31 10:48:09 +08:00
<%#= l(:field_time_ago) %>
</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="float: right; color: rgb(172, 174, 177);">
<%= show_event_reply event %>
</span>
</p>
2014-10-23 18:49:14 +08:00
</div>
</li>
2015-01-07 09:27:44 +08:00
<% end %>
2014-10-23 18:49:14 +08:00
<% end %>
2015-01-07 09:27:44 +08:00
<% end %>
2014-10-23 18:49:14 +08:00
</div>
</ul>
</div>
2015-01-30 14:11:35 +08:00
<div class="right" style="float: right; width: 48%; ">
2014-10-23 18:49:14 +08:00
<ul class="welcome-message-list">
2015-01-30 14:11:35 +08:00
<!--<%# cache 'forum_links' do %> -->
2014-10-23 18:49:14 +08:00
<div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;">
2015-01-30 14:11:35 +08:00
<h3 style="color: rgb(21, 188, 207);"><strong> <%= l(:lable_bar_active)%> </strong> <%= link_to l(:label_my_question) , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
<%= link_to l(:label_my_feedback) , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> </h3>
<span style="margin-top: -30px;float: right; display: block;"> <%= link_to l(:label_more), forums_path %> </span>
2014-10-23 18:49:14 +08:00
</div>
<div class="welcome-box-list-new memo_activity">
2015-01-07 09:27:44 +08:00
<% cache("forums") do %>
<% topics = find_new_forum_topics(6) %>
2014-10-23 18:49:14 +08:00
<% topics.includes(:forum, :last_reply, :author).each do |topic|%>
2015-01-07 09:27:44 +08:00
<% cache topic do %>
2015-01-31 10:48:09 +08:00
<li class="message-brief-intro" style="line-height:1.4em;">
2014-10-23 18:49:14 +08:00
<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'>
2015-01-07 09:27:44 +08:00
<%#= "#{l(:field_updated_on, value: format_time(topic_last_time topic))}" %>
<%= l(:field_updated_on) %>
<%= format_time topic_last_time topic %>
2014-10-23 18:49:14 +08:00
</span>
<span class="memo_author">
<%= l(:label_question_sponsor)%>
<%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
</span>
<span class="memo_last_person">
<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %>
<%= l(:label_final_reply)%>
2014-10-23 18:49:14 +08:00
<%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
<% end %>
</span>
<span class="memo_reply">
<%= l(:label_reply)%>
(<%= link_to topic.try(:replies_count), topic.event_url %>)
</span>
</div>
</li>
2015-01-07 09:27:44 +08:00
<%end %>
<% end %>
<% end %>
2015-01-30 14:45:33 +08:00
2014-10-23 18:49:14 +08:00
</div>
</ul>
2015-01-30 14:11:35 +08:00
</div>
2014-10-23 18:49:14 +08:00
<div class="clearfix"></div>
<%= render partial: 'link_to_another' %>