Merge branch 'develop' into szzh

This commit is contained in:
sw 2015-04-28 13:35:06 +08:00
commit e676636e2e
18 changed files with 87 additions and 65 deletions

View File

@ -444,14 +444,15 @@ class HomeworkAttachController < ApplicationController
homework = @homework
is_teacher = @is_teacher ? 1 : 0
#保存评分@homework.rate(@m_score.to_i,User.current.id,:quality, (@is_teacher ? 1 : 0))
if @m_score
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
if @m_score && (@is_teacher || @is_anonymous_comments)
rate = @homework.rates(:quality).where(:rater_id => User.current.id, :is_teacher_score => is_teacher).first
if rate
rate.stars = @m_score
rate.save!
else
@homework.rates(:quality).new(:stars => @m_score, :rater_id => User.current.id, :is_teacher_score => is_teacher).save!
rate = @homework.rates(:quality).new(:stars => @m_score, :rater_id => User.current.id, :is_teacher_score => is_teacher)
end
rate.save!
if homework.is_teacher_score == 0
if is_teacher == 1
@ -469,14 +470,26 @@ class HomeworkAttachController < ApplicationController
end
end
homework.save!
end
end
#保存评论
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
if params[:new_form] && params[:new_form][:user_message] #有没有留言
@homework.addjours(User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation) if @is_teacher
else
@homework.addjours User.current.id, "",0,@is_comprehensive_evaluation if @is_teacher
if params[:new_form] && params[:new_form][:user_message] #有没有留言
jour = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{User.current.id}").order("created_on DESC").first
if params[:new_form][:user_message] == ""
if @is_teacher
unless jour
jour = @homework.addjours User.current.id, "",0,@is_comprehensive_evaluation
end
end
else
jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation
end
end
if jour
jour.save_attachments(params[:attachments])
render_attachment_warning_if_needed(jour)
jour.save
end
@teacher_stars = @stars_reates.where("is_teacher_score = 1") #老师评分列表

View File

@ -152,6 +152,9 @@ class NewsController < ApplicationController
end
def edit
if @course
render :layout => "base_courses"
end
end
def update

View File

@ -52,7 +52,7 @@ class JournalsForMessage < ActiveRecord::Base
:permission => :view_course_journals_for_messages,
:timestamp => "#{self.table_name}.updated_on",
:find_options => {:include => :course }
acts_as_attachable
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy

View File

@ -18,7 +18,7 @@
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %>
@ -37,14 +37,6 @@
<% end %>
<% end %>
</span>
<script type='text/javascript'>
// function CompatibleSend()
// {
// var obj=document.getElementById("_file");
// var file= $(obj).clone();
// file.click();
// }
</script>
<% project = project %>
<span class="add_attachment" style="font-weight:normal;">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>

View File

@ -0,0 +1,17 @@
<div class="attachments" style="font-weight:normal;">
<% for attachment in attachments %>
<div title="<%= attachment.filename%>" id = "attachment_" style="max-width: 300px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;float: left;">
<%= link_to_short_attachment attachment, :class => 'link_file', :download => true, :length => 100 -%>
</div>
<% if attachment.is_text? %>
<div style="float: left;">
<%= link_to image_tag('magnifier.png'),
{:controller => 'attachments',
:action => 'show',
:id => attachment,
:filename => attachment.filename},
:target => "_blank"%>
</div>
<% end %>
<% end %>
</div>

View File

@ -1,16 +1,5 @@
<%= render_flash_messages %>
<div id="put-bid-form" style="display: none">
<%= form_for HomeworkAttach.new, :url => {:controller => 'bids', :action => 'add_homework'}, :update => "bidding_project_list", :complete => '$("#put-bid-form").hide();', :html => {:multipart => true, :id => 'add_homework_form'} do |f| %>
<fieldset>
<legend>
<%= l(:label_attachment_plural) %>
</legend>
<p id="put-bid-form-partial">
<%= render :partial => 'attachments/form' %>
</p>
</fieldset>
<%= submit_tag l(:button_create), :onclick => "return true" %>
<% end %>
<script type="text/javascript">
function j_submit () {
alert('start');

View File

@ -57,7 +57,6 @@
<div class="dis" id="tbc_01">
<%= render :partial => 'homework_attach/homeworks_list',
:locals => {:homeworks => @homework_list,
:homework_count => @obj_count,
:remote => false,
:not_batch_homework => @not_batch_homework,:is_student_batch_homework => @is_student_batch_homework}%>
</div>

View File

@ -52,6 +52,16 @@
:style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250),
:maxlength => 250 %>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<div class="cl"></div>
<% if @is_anonymous_comments || @is_teacher %>
<strong style="float: left;">
文件:
</strong>
<div id="homework_attach_jour_attachment">
<%= render :partial => 'attachments/form' %>
</div>
<div class="cl"></div>
<% end %>
<div style="float:right">
<a href="javascript:" class="ping_sub1" id="jours_submit" onclick="submit_jours(<%= @is_teacher%>);">
<%= l(:label_confirmation) %>

View File

@ -9,7 +9,7 @@
<span>
<%= l(:label_homework_list)%>
(<font color="#CC0000">
<%= homework_count%>
<%= homeworks.count%>
</font>)
<%
url= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id) if is_batch_homeworks

View File

@ -13,7 +13,7 @@
<%= format_time(jour.created_on) %>
</span>
<div class="cl"></div>
<p><%= textilizable jour.notes%></p>
<%= textilizable jour.notes%>
</div>
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ jour.id.to_s%>

View File

@ -15,7 +15,7 @@
<div class="ping_distop">
<span>
<% if show_name %>
<%= link_to user, user_path(user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;", :target => "_blank"%>
<%= link_to user, user_path(user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;max-width: 40px;overflow: hidden;", :target => "_blank", title: user%>
<% else%>
<span style=" font-weight:bold; color:#15bccf; margin-right:5px; background:none;">
<%= l(:label_anonymous) %>
@ -39,7 +39,15 @@
<% notes = textilizable(jour.nil? ? "" : jour.notes)%>
<%= notes.empty? ? "<p></p>".html_safe : notes%>
</div>
<div class="cl"></div>
<% unless jour.nil? %>
<% unless jour.attachments.empty?%>
<% options = {:author => true, :deletable => attach_delete(jour)} %>
<%= render :partial => 'attachments/homework_jour_link',
:locals => {:attachments => jour.attachments, :options => options} %>
<% end %>
<div class="cl"></div>
<% ids = 'project_respond_form_'+ jour.id.to_s%>
<div class="ping_disfoot">
<span>

View File

@ -3,11 +3,13 @@
HoverLi(4);
$('#jour_count_4').html('<%= @teacher_stars.count %>');
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/review',:locals => {:review_list => @teacher_stars,:show_name => true,:show_jour => true})) %>');
$("#homework_attach_jour_attachment").html('<%= escape_javascript(render :partial => 'attachments/form') %>');
//匿评
<% elsif @is_anonymous_comments %>
HoverLi(5);
$('#jour_count_5').html('<%= @student_stars.count %>');
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/review',:locals => {:review_list => @student_stars,:show_name => false || @is_teacher, :show_jour => false})) %>');
$("#homework_attach_jour_attachment").html('<%= escape_javascript(render :partial => 'attachments/form') %>');
//留言
<% else %>
HoverLi(3);

View File

@ -18,6 +18,7 @@
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= javascript_include_tag "attachments" %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>

View File

@ -1,10 +1,10 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<li class="ml45">
<li>
<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个字符以内" value="<%= is_new ? '' : @news.title %>">
<p id="title_notice_span" class="ml55"></p>
</li>
<li class="ml45 mb10">
<li class="mb10">
<% if is_new %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
@ -18,12 +18,12 @@
</li>
<div class="cl"></div>
<li class="ml45">
<label class="fl">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<li>
<label class="fl mt5">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<%= render :partial => 'attachments/new_form', :locals => {:container => @news} %>
<div class="cl"></div>
</li>
<li class=" ml90" >
<li class="ml40" >
<% if is_new %>
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>

View File

@ -8,16 +8,6 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_course_news) %></h2>
</div>
<% if authorize_for_course('news', 'edit') %>
<div id="edit-news" style="display:none;">
<%= labelled_form_for :news, @news, :url => news_path(@news),
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %>
<% end %>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<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">
@ -26,9 +16,7 @@
</h4>
<%= link_to(l(:button_edit),
edit_news_path(@news),
:class => 'talk_edit fr',
:accesskey => accesskey(:edit),
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @course) %>
:class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %>
<%= delete_link(news_path(@news),:class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %>
<div class="cl"></div>
<div class="mb5 upload_img">

View File

@ -1,12 +1,11 @@
<h3><%=l(:label_news)%></h3>
<%= labelled_form_for @news, :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_save) %>
<%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form' %>
<% end %>
<div id="preview" class="wiki"></div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_course_news) %></h2>
</div>
<div id="edit-news">
<%= labelled_form_for :news, @news, :url => news_path(@news),
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %>
<% end %>
<div id="preview" class="wiki"></div>
</div>

View File

@ -10,6 +10,7 @@ h4 {border-bottom: 1px dotted #bbb;}
/*上传图片处理*/
.upload_img img{max-width: 100%;}
.link_file{ background:url(../images/pic_file.png) 0 0px no-repeat !important; padding-left:20px !important; color:#64bdd9 !important; }
/****翻页***/
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }

View File

@ -246,7 +246,7 @@ a:hover.tijiao{ background:#0f99a9;}
/* 创建作品 homework */
.hwork_new{ color:#4c4c4c;}
.c_red{ color:#F00;}
.hwork_input{ border:1px solid #64bdd9; height:22px; width:555px; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_input{ border:1px solid #64bdd9; height:22px; width:88%; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_input02{ border:1px solid #64bdd9; height:15px; width:140px; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_text{ border:1px solid #64bdd9; height:100px;width:555px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
.hwork_new ul li{ }