From 096320d04cb7ab3a81f2968b4b11550cd2e0a4db Mon Sep 17 00:00:00 2001
From: cxt
Date: Sat, 20 Feb 2016 10:50:46 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=97=AE=E5=8D=B7?=
=?UTF-8?q?=E6=97=B6=E9=BB=98=E8=AE=A4=E9=80=89=E4=B8=AD=E2=80=9C=E5=85=81?=
=?UTF-8?q?=E8=AE=B8=E5=AD=A6=E7=94=9F=E6=9F=A5=E7=9C=8B=E8=B0=83=E6=9F=A5?=
=?UTF-8?q?=E7=BB=93=E6=9E=9C=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/poll_controller.rb | 1 +
app/views/poll/_poll_form.html.erb | 8 ++++++--
db/schema.rb | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb
index 78babc43c..1d7b4117d 100644
--- a/app/controllers/poll_controller.rb
+++ b/app/controllers/poll_controller.rb
@@ -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)
diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb
index e6b667075..e08b13033 100644
--- a/app/views/poll/_poll_form.html.erb
+++ b/app/views/poll/_poll_form.html.erb
@@ -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)%>
-
+
diff --git a/db/schema.rb b/db/schema.rb
index be876fa7b..003d99c0f 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1219,7 +1219,6 @@ ActiveRecord::Schema.define(:version => 20160202034530) do
create_table "org_members", :force => true do |t|
t.integer "user_id"
t.integer "organization_id"
- t.string "role"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
@@ -1374,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
From 1e13279440c9338a67512bbb20aada364f4810be Mon Sep 17 00:00:00 2001
From: cxt
Date: Sat, 20 Feb 2016 10:51:26 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=9F=A5=E7=9C=8B?=
=?UTF-8?q?=E9=97=AE=E5=8D=B7=E8=B0=83=E6=9F=A5=E7=BB=93=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/poll/_poll.html.erb | 7 +++++++
app/views/poll/_poll_submit.html.erb | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb
index c03570072..75b07557e 100644
--- a/app/views/poll/_poll.html.erb
+++ b/app/views/poll/_poll.html.erb
@@ -58,4 +58,11 @@
<%end%>
<% end%>
<%= format_date poll.created_at.to_date%>
+ <% if poll.show_result == 1 %>
+ <% if has_commit%>
+ <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr mr10"%>
+ <%else%>
+ 统计结果
+ <%end%>
+ <% end %>
<% end%>
\ No newline at end of file
diff --git a/app/views/poll/_poll_submit.html.erb b/app/views/poll/_poll_submit.html.erb
index af3ca2d42..41e402dca 100644
--- a/app/views/poll/_poll_submit.html.erb
+++ b/app/views/poll/_poll_submit.html.erb
@@ -15,7 +15,7 @@
是否确定发布该问卷?
- <%= 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();" %>
取 消
From 534d93de77db40d481a747d26c9acfba9c06cdac Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 20 Feb 2016 10:59:49 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E5=BC=B9=E6=A1=86=E4=BD=8D=E7=BD=AE?=
=?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 2 +-
app/views/attachments/_show_attachment_history.html.erb | 4 +++-
app/views/attachments/attachment_versions.js.erb | 2 +-
app/views/users/user_resource.html.erb | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 23fe19333..0f3ea3754 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -212,7 +212,7 @@ class AttachmentsController < ApplicationController
@history.version = @old_history.nil? ? 1 : @old_history.version + 1
@history.save #历史记录保存完毕
#将最新保存的记录 数据替换到 需要修改的文件记录
- @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public")
+ @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads")
@old_attachment.save
#删除当前记录
@attachment.delete
diff --git a/app/views/attachments/_show_attachment_history.html.erb b/app/views/attachments/_show_attachment_history.html.erb
index c1a6464e8..a04b5a89d 100644
--- a/app/views/attachments/_show_attachment_history.html.erb
+++ b/app/views/attachments/_show_attachment_history.html.erb
@@ -14,7 +14,9 @@
<% @attachment_histories.each do |history| %>
-
+ <%= link_to truncate(history.filename,length: 35, omission: '...'),
+ download_named_attachment_path(history.attachment.id, history.filename),
+ :title => history.filename+"\n"+history.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %>
版本号:<%= history.version %>
diff --git a/app/views/attachments/attachment_versions.js.erb b/app/views/attachments/attachment_versions.js.erb
index 4f3bf41c3..a5bb6672b 100644
--- a/app/views/attachments/attachment_versions.js.erb
+++ b/app/views/attachments/attachment_versions.js.erb
@@ -2,6 +2,6 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/sh
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("
");
-$('#ajax-modal').parent().css("top","40%").css("left","46%");
+$('#ajax-modal').parent().css("top","40%").css("left","50%");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
\ No newline at end of file
diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb
index daecc5d59..5abadfb29 100644
--- a/app/views/users/user_resource.html.erb
+++ b/app/views/users/user_resource.html.erb
@@ -21,7 +21,7 @@
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("
");
- $('#ajax-modal').parent().css("top","40%").css("left","46%");
+ $('#ajax-modal').parent().css("top","50%").css("left","50%");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
}
From e04e80d64d952ab145b9a856d73883e5eeaf066a Mon Sep 17 00:00:00 2001
From: cxt
Date: Sat, 20 Feb 2016 16:18:28 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=E8=B7=A8=E8=B6=8A=E5=A4=9A=E4=B8=AA?=
=?UTF-8?q?=E5=AD=A6=E6=9C=9F=E7=9A=84=E8=AF=BE=E7=A8=8B=E5=AD=A6=E6=9C=9F?=
=?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/courses_helper.rb | 37 ++++++++++++++++++++++--
app/views/layouts/_user_courses.html.erb | 2 +-
app/views/layouts/base_courses.html.erb | 2 +-
3 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 1e4cedf14..40ed4a21a 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -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
diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb
index 1ba7e9483..7aa591aae 100644
--- a/app/views/layouts/_user_courses.html.erb
+++ b/app/views/layouts/_user_courses.html.erb
@@ -2,7 +2,7 @@