From 2db1067158a904bd51f0f0b677899bdbdd2cbf51 Mon Sep 17 00:00:00 2001 From: nieguanghui Date: Thu, 19 Dec 2013 19:54:39 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=09=E7=BD=91=E7=AB=99=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E6=90=9C=E7=B4=A2=E5=87=A0=E4=B9=8E=E9=83=BD=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=90=9C=E7=B4=A2=E5=90=8E=E7=9A=84=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=AD=EF=BC=8C=E8=BF=99=E9=87=8C=E5=BA=94=E8=AF=A5=E5=8A=A0?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD=EF=BC=8C=E6=8F=90=E7=A4=BA=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E6=90=9C=E7=B4=A2=E3=80=82=202=E3=80=81=09=E7=AB=9E?= =?UTF-8?q?=E8=B5=9B=E2=80=94=E5=85=B3=E6=B3=A8=20=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=20=E7=94=A8=E6=88=B7=E5=8F=8D=E9=A6=88=20?= =?UTF-8?q?=E8=BF=99=E8=A1=8C=E5=BA=94=E8=AF=A5=E5=8E=BB=E6=8E=89=E3=80=82?= =?UTF-8?q?=204.=20=E5=8E=BB=E6=8E=89=E7=AB=9E=E8=B5=9B=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=A1=B5=E9=9D=A2=E4=B8=AD=E2=80=9D=E5=8F=82?= =?UTF-8?q?=E4=B8=8E=E4=BA=86=E7=AB=9E=E8=B5=9B=E2=80=9D=E7=9A=84=20a=20?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E3=80=82=205=EF=BC=8E=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E6=98=BE=E7=A4=BA=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E7=BB=9F=E4=B8=80=E3=80=82=206.=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E4=BE=A7=E8=BE=B9=E6=A0=8F=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E7=9A=84bug.=E4=BF=AE=E5=A4=8D=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E5=8F=82=E4=B8=8E=E8=80=85=E9=83=A8=E5=88=86=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=8F=82=E4=B8=8E=E8=80=85=E4=B9=9F=E4=B8=8D=E4=BC=9A=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=8F=90=E7=A4=BA=E7=9A=84bug=E3=80=82=207.=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AB=9E=E8=B5=9B=E4=B8=AD=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E4=B8=80=E6=A0=8F=E7=9A=84=E2=80=9Dmore=E2=80=9D=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E3=80=82=207.=20=E9=87=8D=E6=9E=84=E7=AB=9E=E8=B5=9Bl?= =?UTF-8?q?ayouts=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 48 ++++++++++++--- app/views/bids/_list_projects.html.erb | 6 +- app/views/bids/contest.html.erb | 8 ++- app/views/bids/index.html.erb | 27 ++------- app/views/bids/show_bid_user.html.erb | 2 +- app/views/forums/index.html.erb | 7 ++- app/views/layouts/_no_content.html.erb | 10 ++++ app/views/layouts/base_contest.html.erb | 78 ++++++++----------------- app/views/projects/search.html.erb | 35 ++--------- app/views/users/search.html.erb | 2 +- config/locales/zh.yml | 4 +- 11 files changed, 102 insertions(+), 125 deletions(-) create mode 100644 app/views/layouts/_no_content.html.erb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ac0165f79..97e76a0c9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1378,6 +1378,39 @@ module ApplicationHelper html.html_safe end +#display bid project + def show_more_bid_project?(bid) + if bid.projects.where('is_public = 1').count > 12 + return true + else + return false + end + end + + def show_bid_project(bid) + html = '' + if bid.projects.where('is_public = 1').count == 0 + html << (content_tag "p", l(:label_no_bid_project), :class => "font_lighter") + else + bid.projects.where('is_public = 1').take(12).each do |project| + html << (link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name), project_path(project), :class => "avatar") + end + end + html.html_safe + end + + def show_bid_fans_picture(obj) + html = '' + if obj.watcher_users.count == 0 + html << (content_tag "span", l(:label_project_no_follow)) + else + obj.watcher_users.take(12).each do |user| + html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name) + end + end + html.html_safe + end + #display fans picture def show_more_fans?(obj) if obj.watcher_users.count > 12 @@ -1389,23 +1422,19 @@ module ApplicationHelper def show_fans_picture(obj) html = '' - count = 0 if obj.watcher_users.count == 0 html << (content_tag "span", l(:label_no_current_fans)) + else + obj.watcher_users.take(12).each do |user| + html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name) + end end - for user in obj.watcher_users - html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.show_name}") - count = count + 1 - if count >= 12 - break - end - end html.html_safe end # added by bai def show_more_participate?(obj) - if obj.join_in_contests.count > 0 + if obj.join_in_contests.count > 12 return true else return false @@ -1427,6 +1456,7 @@ module ApplicationHelper end html.html_safe end + #end # add by huang diff --git a/app/views/bids/_list_projects.html.erb b/app/views/bids/_list_projects.html.erb index 6663ab6e2..dafec4d77 100644 --- a/app/views/bids/_list_projects.html.erb +++ b/app/views/bids/_list_projects.html.erb @@ -32,15 +32,15 @@ <%= link_to(b_project.project.name, project_path(b_project.project)) %> - + <% if @bid.reward_type == 2 %> - <%= l(:label_join_contest)%> + <%= l(:label_joined_contest)%> <% end %> <% if @bid.reward_type == 1 %> <%= l(:label_join_bidding)%> <% end %> - + diff --git a/app/views/bids/contest.html.erb b/app/views/bids/contest.html.erb index 57aabf2b4..6cd3df16e 100644 --- a/app/views/bids/contest.html.erb +++ b/app/views/bids/contest.html.erb @@ -30,7 +30,7 @@ -<%= sort_contest(@s_state)%> + - +<% if @bids.size > 0%> +<%= sort_contest(@s_state)%>
<%= render :partial => 'contest_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
+<% else %> + <%= render :partial => "layouts/no_content"%> +<% end %> diff --git a/app/views/bids/index.html.erb b/app/views/bids/index.html.erb index 4c1daec49..bf405e6b5 100644 --- a/app/views/bids/index.html.erb +++ b/app/views/bids/index.html.erb @@ -27,27 +27,12 @@ <% end %> - - - - - <%= sort_bid(@s_state, @project_type)%> - - - - + <% if @bids.size > 0 %>
- <%= render :partial => 'bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %> + <%= sort_bid(@s_state, @project_type)%> + <%= render :partial => 'bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
+ <% else %> + <%= render :partial => "layouts/no_content"%> + <% end %> diff --git a/app/views/bids/show_bid_user.html.erb b/app/views/bids/show_bid_user.html.erb index 2fd6205d0..f4d7b2642 100644 --- a/app/views/bids/show_bid_user.html.erb +++ b/app/views/bids/show_bid_user.html.erb @@ -1,5 +1,5 @@
- <% for user in @users %> + <% for user in @bid.watcher_users %>
- -<%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %> +<% if @forums.size > 0 %> + <%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %> +<% else %> + <%= render :partial => "layouts/no_content" %> +<% end %> diff --git a/app/views/layouts/_no_content.html.erb b/app/views/layouts/_no_content.html.erb new file mode 100644 index 000000000..990b85bae --- /dev/null +++ b/app/views/layouts/_no_content.html.erb @@ -0,0 +1,10 @@ +
+

没有搜索到相关的内容!

+
+

建议您 :

+
重新设置搜索关键词
+
不要使用太长的关键词
+
不要使用特殊符号,如"^&%$#@*%"等
+
清除关键词之间的空格
+
+
diff --git a/app/views/layouts/base_contest.html.erb b/app/views/layouts/base_contest.html.erb index 44245fc9c..cbc2173b1 100644 --- a/app/views/layouts/base_contest.html.erb +++ b/app/views/layouts/base_contest.html.erb @@ -21,20 +21,19 @@
<%=render :partial => 'layouts/base_header'%>
-
- - + + @@ -46,9 +45,7 @@
创新竞赛社区<%= l(:label_user_location) %> : 创新竞赛社区<%= l(:label_user_location) %> :
- - +
<% if display_main_menu?(@bid) %>
diff --git a/app/views/projects/search.html.erb b/app/views/projects/search.html.erb index b3f5c22ea..2915c032f 100644 --- a/app/views/projects/search.html.erb +++ b/app/views/projects/search.html.erb @@ -1,36 +1,6 @@ <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> <% end %> - - -
<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %> <% if params[:project_type] == "1" %> @@ -85,10 +55,13 @@ <% end %>
- +<% if @projects.size == 0 %> +<%= render :partial => 'layouts/no_content'%> +<% else %>
<%= render_project_hierarchy(@projects)%>
+<% end %>