From b148f75dc9815e7ff46e22933ce7ef01a3533367 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 22 Jul 2015 10:22:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=BB=E9=A2=98=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_news.html.erb | 79 +++++++---------------- app/views/news/_course_news_list.html.erb | 47 ++++++++++++++ app/views/news/index.js.erb | 1 + 3 files changed, 72 insertions(+), 55 deletions(-) create mode 100644 app/views/news/_course_news_list.html.erb create mode 100644 app/views/news/index.js.erb diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index c89f0af26..f801aff87 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -2,70 +2,39 @@ btn_tips = l(:label_news_notice) label_tips = l(:label_course_news) %> +

<%= label_tips %>

-

- <%= l(:label_total_news) %> - <%= @news_count %> - <%= l(:label_course_news_count) %> -

- <% if @course && User.current.allowed_to?(:manage_news, @course) %> - <%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%> -
- - <% end %> -
-
- -
- <% if @newss.empty? %> -

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

+

+ <%= l(:label_total_news) %> + <%= @news_count %> + <%= l(:label_course_news_count) %>

- <% else %> - <% @newss.each do |news| %> -
- <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> -
- <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> - - <%= l(:label_release_news) %>: - - <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> - <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %> -
-
- -
-
- <%= news.description.html_safe %> -
-
-
- -
- <%= l(:label_create_time)%>:<%= format_time(news.created_on)%> - <%= link_to_attachments_course news %> -
- <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %> -
-
-
+ <% if @course && User.current.allowed_to?(:manage_news, @course) %> + <%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%> +
<% end %> - <% end %> +
+ +
- - +
+ <%= render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count} %> +
<% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> <%= stylesheet_link_tag 'scm' %> diff --git a/app/views/news/_course_news_list.html.erb b/app/views/news/_course_news_list.html.erb new file mode 100644 index 000000000..da963b3cd --- /dev/null +++ b/app/views/news/_course_news_list.html.erb @@ -0,0 +1,47 @@ +
+<% if newss.empty? %> +

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

+<% else %> + <% newss.each do |news| %> +
+ <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> +
+ <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> + + <%= l(:label_release_news) %>: + + <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> + <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %> +
+
+ +
+
+ <%= news.description.html_safe %> +
+
+
+ +
+ <%= l(:label_create_time)%>:<%= format_time(news.created_on)%> + <%= link_to_attachments_course news %> +
+ <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %> +
+
+
+ + <% end %> +<% end %> +
+ + + \ No newline at end of file diff --git a/app/views/news/index.js.erb b/app/views/news/index.js.erb new file mode 100644 index 000000000..04671917b --- /dev/null +++ b/app/views/news/index.js.erb @@ -0,0 +1 @@ +$("#news_list").html("<%= escape_javascript(render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count})%>"); \ No newline at end of file