From bae775ec34c57e02f1805e7c96d1d02a2f7e93dc Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 3 Aug 2016 14:06:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=98=E5=BA=93=E7=9A=84=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users/_homework_repository_list.html.erb | 7 ++++- .../_homework_repository_search.html.erb | 16 ++-------- .../users/_homework_repository_sort.html.erb | 13 +++++++++ app/views/users/user_homeworks.html.erb | 29 ++++++++----------- app/views/users/user_search_homeworks.js.erb | 2 +- 5 files changed, 35 insertions(+), 32 deletions(-) create mode 100644 app/views/users/_homework_repository_sort.html.erb diff --git a/app/views/users/_homework_repository_list.html.erb b/app/views/users/_homework_repository_list.html.erb index 24fd0a52c..aa45f2115 100644 --- a/app/views/users/_homework_repository_list.html.erb +++ b/app/views/users/_homework_repository_list.html.erb @@ -1,4 +1,8 @@ -<% homeworks.each do |homework| %> +<% if homeworks.empty? %> +
+

暂无可显示的内容~

+<% else %> + <% homeworks.each do |homework| %> +<% end %> <% end %> \ No newline at end of file diff --git a/app/views/users/_homework_repository_search.html.erb b/app/views/users/_homework_repository_search.html.erb index 4bd6f49d0..26f598a8e 100644 --- a/app/views/users/_homework_repository_search.html.erb +++ b/app/views/users/_homework_repository_search.html.erb @@ -1,16 +1,6 @@ -排序: -<%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%> -<% if order == "publish_time" %> - <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort), :class => "#{@r_sort == 'asc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %> -<% else %> - <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort), :class => "sortdownbtn sort_no mt15 fl", :remote => true %> -<% end %> -<%= link_to "引用数",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%> -<% if order == "quotes" %> - <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort), :class => "#{@r_sort == 'asc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %> -<% else %> - <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort), :class => "sortdownbtn sort_no mt15 fl", :remote => true %> -<% end %> +
+ <%= render :partial => 'users/homework_repository_sort', :locals => {:type => type,:is_import => is_import,:property => property,:order => @order,:search => search} %> +
- <% if @homeworks.empty? %> -
-

暂无可显示的内容~

- <% else %> -
- <%=render :partial=>'homework_repository_search', :locals=>{:type => '1',:is_import => 0,:property => nil,:order => @order, :b_sort => @b_sort, :search => ''} %> -
+
+ <%=render :partial=>'homework_repository_search', :locals=>{:type => '1',:is_import => 0,:property => nil,:order => @order, :search => ''} %> +
-
- <%=render :partial => 'homework_repository_list', :locals => {:homeworks => @homeworks,:type=>'1',:is_import => 0,:property => @property,:search=>''} %> -
+
+ <%=render :partial => 'homework_repository_list', :locals => {:homeworks => @homeworks,:type=>'1',:is_import => 0,:property => @property,:search=>''} %> +
-
-
    - <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%> -
-
-
- <% end %> +
+
    + <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%> +
+
+
\ No newline at end of file diff --git a/app/views/users/user_search_homeworks.js.erb b/app/views/users/user_search_homeworks.js.erb index d344d8cd7..fbf73f6e2 100644 --- a/app/views/users/user_search_homeworks.js.erb +++ b/app/views/users/user_search_homeworks.js.erb @@ -5,5 +5,5 @@ $("#homework_detail_information").html("<%=escape_javascript(render :partial => <% else %> $("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>@search})%>'); $("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>'); -$("#homework_search_input").html('<%= escape_javascript(render :partial => 'users/homework_repository_search', :locals => {:type => @type,:is_import => @is_import,:property => @property,:order => @order, :b_sort => @b_sort, :search => @search})%>'); +$("#homework_repository_sort").html('<%= escape_javascript(render :partial => 'users/homework_repository_sort', :locals => {:type => @type,:is_import => @is_import,:property => @property,:order => @order, :search => @search})%>'); <% end %> \ No newline at end of file