修改主页展示部分

This commit is contained in:
fanqiang 2014-05-29 21:42:56 +08:00
parent 0335e06df0
commit 9e05ecf5b4
8 changed files with 111 additions and 10 deletions

View File

@ -78,6 +78,19 @@ class OpenSourceProjectsController < ApplicationController
format.json { render json: @open_source_project }
end
end
def allbug
@bugs = BugToOsp.visible
@bug_count = @bugs.count
@bug_pages = Paginator.new @bug_count, per_page_option, params['page']
@bugs = @bugs.includes(:bug).reorder("#{RelativeMemo.table_name}.created_at DESC").limit(@bug_pages.per_page).offset(@bug_pages.offset).all
respond_to do |format|
format.html
format.json { render json: @open_source_project }
end
end
def search

View File

@ -5,4 +5,8 @@ class BugToOsp < ActiveRecord::Base
validates_presence_of :osp_id, :relative_memo_id
scope :visible, lambda {|*args|
nil
}
end

View File

@ -1,4 +1,4 @@
<!--added by yiang -->
<!--added by fq -->
<!--display the board-->
<div class="borad-topic-count" style="margin-top:10px">
@ -59,7 +59,7 @@
</span></td>
</tr>
<tr>
<td align="left">帖子来源:<span class="font_lighter" style="color: #068d9c"><%=link_to topic.topic_resource, topic.url %>
<td align="left">帖子来源:<span class="font_lighter" style="color: #068d9c"><%=link_to topic.topic_resource, topic.url, :target => '_blank' %>
</span></td>
<td colspan="3" align="center"><%= no_use_link(topic, User.current) %> </td>
</tr>

View File

@ -18,7 +18,7 @@
<% if topic.url.nil? || topic.url == '' %>
<%= link_to h(topic.subject), open_source_project_relative_memo_path(open_source_project, topic) %>
<% else %>
<%= link_to h(topic.subject), topic.url %>
<%= link_to h(topic.subject), topic.url, :target => '_blank' %>
<% end %></td>
<td align="right" rowspan="3">
<table class="borad-count">

View File

@ -0,0 +1,89 @@
<!-- added by fq -->
<div class="contextual-borad">
<div class="borad-topic-count" style="margin-top:10px">
<span>共有 <%= link_to @bug_count %> 个安全贴子 </span>
</div>
<div style="padding-top: 10px">
<% if @bugs.any? %>
<% @bugs.each do |bug| %>
<% topic = bug.bug %>
<table class="content-text-list">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%>
<%= image_tag('../images/avatars/User/0', :class => "avatar") unless topic.author%> </td>
<td>
<table width="630px" border="0">
<tr>
<td valign="top" width="500px" class="<%= topic.sticky ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>">
<% if topic.url.nil? || topic.url == '' %>
<%= link_to h(topic.subject), open_source_project_relative_memo_path(bug.open_source_project, topic) %>
<% else %>
<%= link_to h(topic.subject), topic.url, :target => '_blank' %>
<% end %></td>
<td align="right" rowspan="3">
<table class="borad-count">
<tr>
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), topic.url, :target => '_blank' %></td>
</tr>
<tr>
<td align="center">回帖</td>
</tr>
</table></td>
<td align="right" rowspan="3">
<table class="borad-count">
<tr>
<td align="center" class="borad-count-digit"><%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %></td>
</tr>
<tr>
<td align="center">关注</td>
</tr>
</table></td>
<td align="right" rowspan="3">
<table class="borad-count">
<tr>
<td align="center" class="borad-count-digit"><%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %></td>
</tr>
<tr>
<td align="center">浏览</td>
</tr>
</table></td>
</tr>
<tr>
<td><span class="font_description"> <%= topic.short_content(100) %></span></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"><%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %>
<br />
</span></td>
</tr>
<tr>
<td align="left">帖子来源:<span class="font_lighter" style="color: #068d9c"><%=link_to topic.topic_resource, topic.url, :target => '_blank' %>
</span></td>
</tr>
</table></td>
</tr>
</table>
<% end %>
<div class="pagination">
<%= pagination_links_full @bug_pages, @bug_count %>
</div>
<% else %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% end %>
</div>
<%#= render :partial => 'open_source_projects/show_memo', :locals => {:memos => @memos, :open_source_project => @open_source_project} %>
</div>

View File

@ -144,7 +144,7 @@ li {
</div>
<div class="col2">
<div> <span> <h1 style="fontsize:19px">软件安全态势</h1></span><span style="margin-top: -30px; margin-right:70px;float: right; display: block;"><a href="#" hover="text-decoration: underline;" >More >></span></a></div>
<div> <span> <h1 style="fontsize:19px">软件安全态势</h1></span><span style="margin-top: -30px; margin-right:70px;float: right; display: block;"><%= link_to '更多 >>', allbug_open_source_projects_path %></span></div>
<div class="fixed"></div>
<div id ="buglist" class="li_list" style="margin-top:10px;margin-left:10px">
<ul style="list-style-type: square;">

View File

@ -29,12 +29,6 @@
<% end %>
<% end %>
</div>
<!--modified by huang-->
<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
<span>
<%#= link_to l(:label_memo_new_from_forum), new_open_source_project_relative_memo_path(@open_source_project), :class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
</span>
<div class="contextual-borad">
<%#= link_to(

View File

@ -35,6 +35,7 @@ RedmineApp::Application.routes.draw do
collection do
match 'search', via: [:get, :post]
match 'remove_condition', via: [:get, :post]
match 'allbug', via: [:get, :post]
end
resources :relative_memos
member do