diff --git a/app/controllers/open_source_projects_controller.rb b/app/controllers/open_source_projects_controller.rb index 43a5e3d9..ee3af10c 100644 --- a/app/controllers/open_source_projects_controller.rb +++ b/app/controllers/open_source_projects_controller.rb @@ -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 diff --git a/app/models/bug_to_osp.rb b/app/models/bug_to_osp.rb index 5471bd3f..9cd1d735 100644 --- a/app/models/bug_to_osp.rb +++ b/app/models/bug_to_osp.rb @@ -5,4 +5,8 @@ class BugToOsp < ActiveRecord::Base validates_presence_of :osp_id, :relative_memo_id + scope :visible, lambda {|*args| + nil + } + end diff --git a/app/views/open_source_projects/_show_bug.html.erb b/app/views/open_source_projects/_show_bug.html.erb index adccff83..43ea2eac 100644 --- a/app/views/open_source_projects/_show_bug.html.erb +++ b/app/views/open_source_projects/_show_bug.html.erb @@ -1,4 +1,4 @@ - +
@@ -59,7 +59,7 @@ - 帖子来源:<%=link_to topic.topic_resource, topic.url %> + 帖子来源:<%=link_to topic.topic_resource, topic.url, :target => '_blank' %> <%= no_use_link(topic, User.current) %> diff --git a/app/views/open_source_projects/_show_memo.html.erb b/app/views/open_source_projects/_show_memo.html.erb index 616ff9bf..c5448a59 100644 --- a/app/views/open_source_projects/_show_memo.html.erb +++ b/app/views/open_source_projects/_show_memo.html.erb @@ -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 %> diff --git a/app/views/open_source_projects/allbug.html.erb b/app/views/open_source_projects/allbug.html.erb new file mode 100644 index 00000000..1f714286 --- /dev/null +++ b/app/views/open_source_projects/allbug.html.erb @@ -0,0 +1,89 @@ + + + + +
+ +
+ 共有 <%= link_to @bug_count %> 个安全贴子 +
+
+ <% if @bugs.any? %> + <% @bugs.each do |bug| %> + <% topic = bug.bug %> +
+ + + + + +
<%= 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%> + + + + + + + + + + + + + + + + + + + + + +
+ <% 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 %> + + + + + + + +
<%= link_to (topic.replies_count), topic.url, :target => '_blank' %>
回帖
+ + + + + + + +
<%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %>
关注
+ + + + + + + +
<%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %>
浏览
<%= topic.short_content(100) %>
<%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %> +
+
帖子来源:<%=link_to topic.topic_resource, topic.url, :target => '_blank' %> +
+ + <% end %> + + <% else %> +

+ <%= l(:label_no_data) %> +

+ <% end %> +
+ +<%#= render :partial => 'open_source_projects/show_memo', :locals => {:memos => @memos, :open_source_project => @open_source_project} %> + \ No newline at end of file diff --git a/app/views/open_source_projects/index.html.erb b/app/views/open_source_projects/index.html.erb index f0b69bd4..04df580b 100644 --- a/app/views/open_source_projects/index.html.erb +++ b/app/views/open_source_projects/index.html.erb @@ -144,7 +144,7 @@ li {
-

软件安全态势

More >>
+

软件安全态势

<%= link_to '更多 >>', allbug_open_source_projects_path %>
- -<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %> - - <%#= 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? %> -
<%#= link_to( diff --git a/config/routes.rb b/config/routes.rb index 5206dfd5..bbb95d36 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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