From aaf14d5d1a8ee9cd3d0dff622a5e4839c58f990d Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 23 Mar 2015 16:53:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=80=9A=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;} From d44bbe9de112372cf0755a2e94e7da6a1587d22d Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 23 Mar 2015 17:36:50 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=96=B0=E5=BB=BA=E9=80=9A=E7=9F=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_form.html.erb | 4 ++-- app/views/news/_course_news.html.erb | 8 ++++---- public/javascripts/course.js | 5 ++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index 6963ffe8e..0bea4b773 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -1,7 +1,7 @@ <%= error_messages_for @news %> -
+

<%= is_new ? l(:bale_news_notice):l(:bale_edit_notice)%> -

+

<%= f.text_field :title, :required => true, :size => 60, :style => "width:468px;", :onkeyup => "regexTitle();", :maxlength => 60 %> diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index 8dc1b2a89..75ea61e1d 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -70,8 +70,8 @@ <%= link_to(btn_tips,new_course_news_path(@course), :class => 'problem_new_btn fl c_dorange', :onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %> - -

diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 651013973..4204180d5 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -24,7 +24,10 @@ function show_more_msg() { $("#course_description").toggleClass("course_description_none"); } - +function news_show_more_des(id) +{ + $('#news_description_' + id).toggleClass("news_description_none"); +} function bid_show_more_des(id) { $("#bid_description_" + id).toggleClass("news_description_none"); From 64d208555e716867117b137e8e8e87f00f9ebb7d Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 24 Mar 2015 08:43:40 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_news.html.erb | 2 +- public/stylesheets/courses.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index 75ea61e1d..1757153e2 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -113,7 +113,7 @@ <% else %> <% @newss.each do |news| %>
- <%= link_to image_tag(url_to_avatar(news.author), :class => "problem_pic fl"), user_path(news.author) %> + <%= 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' %>
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 6848a98f2..730236d8e 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -50,7 +50,7 @@ a.problem_new_btn{ margin-left:10px; border:1px solid #ff7143; color:#ff7143; pa a:hover.problem_new_btn{ background:#ff7143; color:#fff;} .problem_p{ color:#535252; margin-top:5px;} .problem_p span{ color:#ff3e00;} -.problem_pic{ display:block; width:42px; height:42px; padding:3px; border:1px solid #e3e3e3;} +a.problem_pic{ display:block; width:42px; height:42px; padding:3px; border:1px solid #e3e3e3;} a:hover.problem_pic{border:1px solid #64bdd9;} .problem_txt{ width:610px; margin-left:10px; color:#777777;} a.problem_name{ color:#ff5722;} From e39007d96e2b8abb6f55b8e9285bd1488e6a56a9 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 24 Mar 2015 09:51:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_form.html.erb | 29 ++++++++++------------------ app/views/news/_course_news.html.erb | 6 ++++++ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index 0bea4b773..3b68bbf76 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -1,26 +1,17 @@ -<%= error_messages_for @news %> -

- <%= is_new ? l(:bale_news_notice):l(:bale_edit_notice)%> -

-
-

- <%= f.text_field :title, :required => true, :size => 60, :style => "width:468px;", :onkeyup => "regexTitle();", :maxlength => 60 %> -

-

- (60个字符以内) -

-

- <%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:470px;", :onkeyup => "regexDescription();" %> -

-

- -

+
  • + + +
  • +
  • + + +
  • +

    <%= render :partial => 'attachments/form', :locals => {:container => @news} %>

    -
    -<%= wikitoolbar_for 'news_description'%> + \ No newline at end of file diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index 1757153e2..45af13328 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -72,6 +72,11 @@ :onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %>
    <% end %>