Merge branch 'develop' of http://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
huang 2016-02-20 16:19:53 +08:00
commit 212b37ef84
10 changed files with 54 additions and 10 deletions

View File

@ -214,6 +214,7 @@ class PollController < ApplicationController
def publish_poll
@poll.polls_status = 2
@poll.published_at = Time.now
@poll.show_result = params[:show_result]
if @poll.save
if params[:is_remote]
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)

View File

@ -116,6 +116,34 @@ module CoursesHelper
@course.journals_for_messages.where('m_parent_id IS NULL').count
end
#当前学期
def current_time_and_term course
str = ""
term = cur_course_term
if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
str = course.time.to_s + course.term.to_s
elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
str = course.time.to_s + course.term.to_s
elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
str = course.end_time.to_s + course.end_term.to_s
else
str = Time.now.year.to_s + cur_course_term.to_s
end
str
end
def set_term_value term
val = 0
if term == "春季学期"
val = 1
elsif term == "夏季学期"
val = 2
elsif term == "秋季学期"
val = 3
end
val
end
# 返回学生数量即roles表中定义的Reporter
#def studentCount project
# searchStudent(project).count
@ -562,7 +590,7 @@ module CoursesHelper
type = []
month = Time.now.month
now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year)
year = month < 3 && now_year >=Time.now.year ? now_year - 1 : now_year
year = month < 2 && now_year >=Time.now.year ? now_year - 1 : now_year
for i in (year..year + 10)
option = []
option << i
@ -592,8 +620,10 @@ module CoursesHelper
def cur_course_term
month = Time.now.month
if month >= 9 || month < 3
if month >= 9 || month < 2
term = "秋季学期"
elsif (month >= 7 && Time.now.day >= 15) || month == 8
term = "夏季学期"
else
term = "春季学期"
end
@ -603,7 +633,7 @@ module CoursesHelper
def course_in_current_or_next_term course
is_current_term = false
is_next_term = false
year_now = Time.now.month < 3 ? Time.now.year - 1:Time.now.year
year_now = Time.now.month < 2 ? Time.now.year - 1:Time.now.year
if course.time == year_now && course.term == cur_course_term
is_current_term = true
end
@ -612,6 +642,7 @@ module CoursesHelper
elsif cur_course_term == "春季学期" && course.time == year_now && course.term == "夏季学期"
is_next_term = true
elsif cur_course_term == "夏季学期" && course.time == year_now && course.term == "秋季学期"
is_next_term = true
end
is_current_term || is_next_term
end

View File

@ -2,7 +2,7 @@
<li class="homepageLeftMenuCoursesLine pr">
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
:id => "show_course_#{course.id}",:title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+""+course.time.to_s+course.term+""%>
:id => "show_course_#{course.id}",:title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+""+current_time_and_term(course)+""%>
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
<li>

View File

@ -56,7 +56,7 @@
<ul>
<li><%= l(:label_main_teacher)%> :&nbsp;&nbsp;<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li>
<li><%= l(:label_class_period)%> :&nbsp;&nbsp;<span ><%= @course.class_period %> <%= l(:label_class_hour) %></span></li>
<li><%= l(:label_main_term)%> :&nbsp;&nbsp;<span><%= @course.time %> <%= @course.term %></span></li>
<li><%= l(:label_main_term)%> :&nbsp;&nbsp;<span><%= current_time_and_term @course %></span></li>
<% if @course.school%>
<li><%= l(:label_course_organizers)%> :&nbsp;&nbsp;<%= @course.school%></li>
<% end%>

View File

@ -7,7 +7,7 @@
<% if defined?(container) && container && container.saved_attachments %>
<% container.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;") %><span class="ispublic-label"><%= l(:field_is_public) %>:</span>
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_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;") %><span class="ispublic-label"><%= l(:field_is_public) %>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %>
<%= if attachment.id.nil?
#待补充代码

View File

@ -58,4 +58,11 @@
<%end%>
<% end%>
<li class="polls_date fr mr10"><%= format_date poll.created_at.to_date%></li>
<% if poll.show_result == 1 %>
<% if has_commit%>
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr mr10"%></li>
<%else%>
<li class="pollsbtn fr mr10 pollsbtn_grey">统计结果</li>
<%end%>
<% end %>
<% end%>

View File

@ -315,7 +315,11 @@ function insert_MCQ(quest_type,quest_num,quest_id){
alert("问卷标题不能为空");
}
else{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>');
if($("#show_result").is(":checked")) {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false,:show_result=> 1}) %>');
} else{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false,:show_result=> 0}) %>');
}
showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove();
@ -377,7 +381,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
<%= l(:label_memo_create)%>
</a>
<div class="polls_cha">
<input type="checkbox" name="" value="" >
<input id="show_result" type="checkbox" checked name="show_result" value="1" >
<label for="">允许学生查看调查结果</label>
</div>
</div>

View File

@ -15,7 +15,7 @@
是否确定发布该问卷?
</p>
<div class="polls_btn_box">
<%= link_to "确 定",publish_poll_poll_path(poll.id,:is_remote => is_remote), :class => "upload_btn", :onclick => "clickCanel();" %>
<%= link_to "确 定",publish_poll_poll_path(poll.id,:is_remote => is_remote,:show_result => show_result), :class => "upload_btn", :onclick => "clickCanel();" %>
<a class="upload_btn upload_btn_grey" onclick="clickCanel();">
取&nbsp;&nbsp;消
</a>

View File

@ -1373,6 +1373,7 @@ ActiveRecord::Schema.define(:version => 20160202034530) do
t.integer "changeset_num", :default => 0
t.integer "board_message_num", :default => 0
t.integer "board_num", :default => 0
t.integer "act_num", :default => 0
t.integer "attach_num", :default => 0
t.datetime "commit_time"
end

View File

@ -91,7 +91,7 @@ function addFile_board(inputEl, file, eagerUpload, id,btnId) {
function addFile(inputEl, file, eagerUpload,btnId) {
var attachments_frame = '#attachments_fields';
if ($(attachments_frame).children().length < 30) {
if (true) {
deleteallfiles = $(inputEl).data('deleteAllFiles');
var attachmentId = addFile.nextAttachmentId++;