diff --git a/app/controllers/open_source_projects_controller.rb b/app/controllers/open_source_projects_controller.rb index 4feca7b27..52b81610f 100644 --- a/app/controllers/open_source_projects_controller.rb +++ b/app/controllers/open_source_projects_controller.rb @@ -57,7 +57,7 @@ class OpenSourceProjectsController < ApplicationController @memo = RelativeMemo.new(:open_source_project => @open_source_project) @topic_count = @open_source_project.topics.count - @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] + @topic_pages = Paginator.new @topic_count, 10, params['page'] @memos = @open_source_project.topics. reorder("#{RelativeMemo.table_name}.sticky DESC"). includes(:last_reply). @@ -73,11 +73,40 @@ class OpenSourceProjectsController < ApplicationController format.json { render json: @open_source_project } end end - - def search + + +def search end + +# added by yiang 暴力添加,请绕道 +def showmemo + @open_source_project = OpenSourceProject.find(params[:id]) + + sort_init 'updated_at', 'desc' + sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at", + 'replies' => "#{RelativeMemo.table_name}.replies_count", + 'updated_at' => "COALESCE (last_replies_relative_memos.created_at, #{RelativeMemo.table_name}.created_at)" + + @memo = RelativeMemo.new(:open_source_project => @open_source_project) + @topic_count = @open_source_project.topics.count + @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] + @memos = @open_source_project.topics. + reorder("#{RelativeMemo.table_name}.sticky DESC"). + includes(:last_reply). + limit(@topic_pages.per_page). + offset(@topic_pages.offset). + order(sort_clause). + all + + respond_to do |format| + format.html { + render :layout => "base_opensource_p" + } + format.json { render json: @open_source_project } + end +end # GET /open_source_projects/new # GET /open_source_projects/new.json def new diff --git a/app/views/open_source_projects/_show_memo.html.erb b/app/views/open_source_projects/_show_memo.html.erb new file mode 100644 index 000000000..0314bd3dc --- /dev/null +++ b/app/views/open_source_projects/_show_memo.html.erb @@ -0,0 +1,77 @@ + + + +
+ 共有 <%= link_to memos.count %> 个贴子 +
+ <% if memos.any? %> + <% memos.each do |topic| %> + + + + + + +
<%= 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%> + + + + + + + + + + + + + + + + + + + +
<%= link_to h(topic.subject), open_source_project_relative_memo_path(topic.open_source_project, topic) %> + + + + + + + +
<%= link_to (topic.replies_count), open_source_project_relative_memo_path(topic.open_source_project, topic) %>
回帖
+ + + + + + + +
<%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(topic.open_source_project, topic) %>
关注
+ + + + + + + +
<%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(topic.open_source_project, topic) %>
浏览
帖子来源:<%=link_to 'OSChina', topic.url %> + <%= no_use_link(topic, User.current) %>
+ + <% end %> + + <% else %> +

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

+ <% end %> +
\ No newline at end of file diff --git a/app/views/open_source_projects/_show_topics.html.erb b/app/views/open_source_projects/_show_topics.html.erb index 5d4f7b3d6..8e958101d 100644 --- a/app/views/open_source_projects/_show_topics.html.erb +++ b/app/views/open_source_projects/_show_topics.html.erb @@ -1,7 +1,360 @@ + -
- 共有 <%= link_to memos.count %> 个贴子 + + + + + +<%= javascript_include_tag "ichart.1.2.min" %> +<%= stylesheet_link_tag "sec-analysis.css" %> +<%= stylesheet_link_tag "buglist-ichart.css" %> +<%= stylesheet_link_tag "buglist.css" %> + +
+
+
+
+

+
+
+ +
+

项目安全态势

<%= link_to "More >>", :controller => "open_source_projects",:action => "showmemo", :id => @open_source_project.id %>
+
+
+ +
+
+
+
+
+ + + + +
+
+
+
+

+
+
+ +
+

技术创新趋势

<%= link_to "More >>", :controller => "open_source_projects",:action => "showmemo", :id => @open_source_project.id %> +
+
+
+ +
+
+
+
+ + +
+ +

全球热帖

+ <%= link_to "更多>>", :controller => "open_source_projects",:action => "showmemo", :id => @open_source_project.id %>
<% if memos.any? %> @@ -13,20 +366,31 @@ - + + + +
<%= link_to h(topic.subject), open_source_project_relative_memo_path(open_source_project, topic) %><%= link_to h(topic.subject), open_source_project_relative_memo_path(topic.open_source_project, topic) %> - + - +
<%= link_to (topic.replies_count), open_source_project_relative_memo_path(open_source_project, topic) %><%= link_to (topic.replies_count), open_source_project_relative_memo_path(topic.open_source_project, topic) %>
回答回帖
- + + + + + +
<%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(open_source_project, topic) %><%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(topic.open_source_project, topic) %>
关注
+ + + @@ -36,26 +400,20 @@ - + - - <% relation_memo = RelativeMemoToOpenSourceProject.where("osp_id = ? and relative_memo_id = ?", open_source_project.id, topic.id).first %> - + + - - - -
<%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(topic.open_source_project, topic) %>
浏览
帖子来源:<%= link_to topic.url, topic.url%> <%= no_use_link(relation_memo, User.current) %> 帖子来源:<%=link_to 'OSChina', topic.url %> + <%= no_use_link(topic, User.current) %>
<%= image_tag( "/images/sidebar/tags.png") %> - <%= render :partial => 'tags/tag_name', :locals => {:obj => topic,:object_flag => "9",:non_list_all => true }%>
- <% end %>