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_form.html.erb b/app/views/news/_course_form.html.erb index 6963ffe8e..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 346fff8b4..45af13328 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -61,9 +61,37 @@ } - - <%= 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 +110,7 @@
    <% end %> +
    <% if @newss.empty? %>

    @@ -89,63 +118,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),: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' %>
    +
    +
    <%= 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/javascripts/course.js b/public/javascripts/course.js index 2bd85093f..f3faf749d 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -26,6 +26,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");