From aaf14d5d1a8ee9cd3d0dff622a5e4839c58f990d Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 23 Mar 2015 16:53:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/news_controller.rb | 14 ++-- app/views/news/_course_news.html.erb | 96 ++++++++++++---------------- config/locales/courses/zh.yml | 10 ++- public/stylesheets/courses.css | 2 +- 4 files changed, 58 insertions(+), 64 deletions(-) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index b44e8a348..e00121d97 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -68,14 +68,14 @@ class NewsController < ApplicationController elsif @course if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) scope = @course ? @course.news.course_visible : News.course_visible - + scope_page = paginateHelper scope,10 @news_count = scope.count - @news_pages = Paginator.new @news_count, @limit, params['page'] - @offset ||= @news_pages.offset - @newss = scope.all(:include => [:author, :course], - :order => "#{News.table_name}.created_on DESC", - :offset => @offset, - :limit => @limit) + #@news_pages = Paginator.new @news_count, @limit, params['page'] + #@offset ||= scope_page.offset + @newss = scope_page.all(:include => [:author, :course], + :order => "#{News.table_name}.created_on DESC") + # :offset => @offset, + # :limit => @limit) respond_to do |format| format.html { diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index 346fff8b4..8dc1b2a89 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -61,9 +61,31 @@ } - - <%= label_tips %> - +
+

<%= 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', + :onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %> + + + <% end %> +
+
+ <% if @course && User.current.allowed_to?(:manage_news, @course) %> <%= link_to(btn_tips, new_course_news_path(@course), @@ -82,6 +104,7 @@
<% end %> +
<% if @newss.empty? %>

@@ -89,63 +112,26 @@

<% else %> <% @newss.each do |news| %> - - - - - -
- <%= link_to image_tag(url_to_avatar(news.author), :class => "avatar"), user_path(news.author) %> - - - - - - - - - - - - -
- - <%= link_to_user(news.author) if news.respond_to?(:author) %> - - - <%= l(:label_project_notice) %> - - - <%= link_to h(news.title), news_path(news) %> - - - <%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @couese) %> - -
- - <%= textilizable(news, :description) %> - -
- - <%= l :label_update_time %> - :  - <%= format_time(news.created_on) %> - - - <%= link_to l(:label_project_newother), news_path(news) %> - <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count >= 0 %> -
-
+
+ <%= link_to image_tag(url_to_avatar(news.author), :class => "problem_pic fl"), user_path(news.author) %> +
+ <%= 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' %>
+
+

<%= textilizable(news, :description) %>
<%= l(:label_create_time) %> : <%= format_time(news.created_on) %>

+
<%= l(:label_expend_information) %>
+
+
+
+ <% end %> <% end %>
-
- <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => {:course_id => @course, :key => User.current.rss_key} %> diff --git a/config/locales/courses/zh.yml b/config/locales/courses/zh.yml index 81abf7266..c99f4ed55 100644 --- a/config/locales/courses/zh.yml +++ b/config/locales/courses/zh.yml @@ -73,4 +73,12 @@ zh: # label_file_upload: 资源文件 label_file_upload_error_messages: "上传出现错误,请您检查您的网络环境,并刷新页面重新上传。" - button_confirm: 确认 \ No newline at end of file + button_confirm: 确认 + + #news + #label_news_count: "共有%{count}个课程通知" + label_total_news: "共有" + label_course_news_count: "个课程通知" + label_release_news: "发布通知" + label_create_time: "创建时间" + #news end \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 54d30cdb5..8f8364761 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -55,7 +55,7 @@ .problem_p span{ color:#ff3e00;} .problem_pic{ display:block; width:42px; height:42px; padding:3px; border:1px solid #e3e3e3;} .problem_pic:hover{border:1px solid #64bdd9;} -.problem_txt{ width:610px; margin-left:10px; color:#777777;} +.problem_txt{ width:610px; margin-left:10px; color:#777777;word-break: break-all;word-wrap: break-word;} .problem_name{ color:#ff5722;} .problem_name:hover{ color:#d33503;} .problem_tit{ color:#0781b4; width:430px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}