Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course

This commit is contained in:
sw 2015-03-24 17:01:19 +08:00
commit 2ef10e89ac
5 changed files with 77 additions and 82 deletions

View File

@ -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 {

View File

@ -1,26 +1,17 @@
<%= error_messages_for @news %>
<div class="add_frame_header" >
<%= is_new ? l(:bale_news_notice):l(:bale_edit_notice)%>
</div>
<div class="box tabular">
<p>
<%= f.text_field :title, :required => true, :size => 60, :style => "width:468px;", :onkeyup => "regexTitle();", :maxlength => 60 %>
</p>
<P>
<span id="title_notice_span">(60个字符以内)</span>
</P>
<p>
<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:470px;", :onkeyup => "regexDescription();" %>
</p>
<P>
<span id="description_notice_span"></span>
</P>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;</label>
<input type="text" name="news[title]" class="hwork_input" id="news_title" size="60" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内">
</li>
<li class="ml45">
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<textarea id="news_description" name="news[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl" onkeyup="regexDescription();" ></textarea>
</li>
<div class="cl"></div>
<p id="attachments_form" style="margin-left:-10px;">
<label style="padding-right: 15px;">
<%= l(:label_attachment_plural) %>
</label>
<%= render :partial => 'attachments/form', :locals => {:container => @news} %>
</p>
</div>
<%= wikitoolbar_for 'news_description'%>
<!-- <#%= wikitoolbar_for 'news_description'%>-->

View File

@ -61,9 +61,37 @@
}
</script>
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
<%= label_tips %>
</span>
<div class="project_r_h">
<h2 class="project_h2"><%= label_tips %></h2>
</div>
<div class="talk_top">
<p class="fl"><%= l(:label_total_news) %><span><%= @news_count %></span><%= l(:label_course_news_count) %></p>
<% 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;') %>
<div class="cl"></div>
<div id="add-news" class="hwork_new" style="display:none;">
<%= error_messages_for @news %>
<p class="talk_top pl15" >
<%= l(:bale_news_notice)%>
</p>
<ul>
<%= labelled_form_for @news, :url => course_news_index_path(@course),
:html => {:id => 'news-form', :multipart => true} do |f| %>
<%= render :partial => 'news/course_form', :locals => {:f => f, :is_new => true} %>
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'ButtonColor m3p10' %>
<%#= preview_link preview_news_path, 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'ButtonColor m3p10' %>
<% end if @course %>
</ul>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<div class="cl"></div>
</div>
<% if @course && User.current.allowed_to?(:manage_news, @course) %>
<%= link_to(btn_tips, new_course_news_path(@course),
@ -82,6 +110,7 @@
<div id="preview" class="wiki"></div>
</div>
<% end %>
<div>
<% if @newss.empty? %>
<p class="nodata">
@ -89,63 +118,26 @@
</p>
<% else %>
<% @newss.each do |news| %>
<table class="content-text-list">
<tr>
<td colspan="2" valign="top" width="50">
<%= link_to image_tag(url_to_avatar(news.author), :class => "avatar"), user_path(news.author) %>
</td>
<td>
<table width="580px" border="0">
<tr>
<td colspan="2" valign="top">
<strong>
<%= link_to_user(news.author) if news.respond_to?(:author) %>
</strong>
<span style="margin-left: 4px;" class="font_lighter">
<%= l(:label_project_notice) %>
</span>
<span>
<%= link_to h(news.title), news_path(news) %>
</span>
<span style="float: right">
<%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @couese) %>
</span>
</td>
</tr>
<tr>
<td colspan="2" width="580px">
<span class="font_description">
<%= textilizable(news, :description) %>
</span>
</td>
</tr>
<tr>
<td align="left">
<span class="font_lighter">
<%= l :label_update_time %>
&nbsp;
<%= format_time(news.created_on) %>
</span>
</td>
<td width="350" align="right" class="a">
<%= link_to l(:label_project_newother), news_path(news) %>
<%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count >= 0 %>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5">
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<span class="fl"> <%= l(:label_release_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br />
<div class="cl mb5"></div>
<div id="news_description_<%= news.id %>" class="news_description mt5"><%= textilizable(news, :description) %><br /> <%= l(:label_create_time) %> <%= format_time(news.created_on) %></div>
<div class="news_foot" onclick="news_show_more_des(<%= news.id %>);"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>
</div>
<div class="cl"></div>
</div><!--problem_main end-->
<% end %>
<% end %>
</div>
<!--end-->
<div style="padding-right: 10px">
<div class="pagination">
<ul>
<%= pagination_links_full @news_pages %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
</div>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:course_id => @course, :key => User.current.rss_key} %>

View File

@ -73,4 +73,12 @@ zh:
#
label_file_upload: 资源文件
label_file_upload_error_messages: "上传出现错误,请您检查您的网络环境,并刷新页面重新上传。"
button_confirm: 确认
button_confirm: 确认
#news
#label_news_count: "共有%{count}个课程通知"
label_total_news: "共有"
label_course_news_count: "个课程通知"
label_release_news: "发布通知"
label_create_time: "创建时间"
#news end

View File

@ -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");