<% reply_allow = JournalsForMessage.create_by_user? User.current %>
diff --git a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb
index 1f4c867ba..d5f91ebf8 100644
--- a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb
+++ b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb
@@ -16,7 +16,8 @@ module RailsKindeditor
input_html = input_html.merge(style: 'display:none')
output_buffer = ActiveSupport::SafeBuffer.new
output_buffer << build_text_area_tag(name, method, self, options, input_html)
- output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true')))
+ output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true',
+ afterCreate: 'eval(function(){enablePasteImg(self);})')))
end
def kindeditor_upload_json_path(*args)
@@ -52,12 +53,12 @@ module RailsKindeditor
"var old_onload_#{random_name};
if(typeof window.onload == 'function') old_onload_#{random_name} = window.onload;
window.onload = function() {
- #{editor_id}KindEditor.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste');
+ #{editor_id}KindEditor.create('##{dom_id}', #{get_options(options).to_json});
if(old_onload_#{random_name}) old_onload_#{random_name}();
}"
else
"KindEditor.ready(function(K){
- #{editor_id}K.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste');
+ #{editor_id}K.create('##{dom_id}', #{get_options(options).to_json});
});"
end
end
diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js
index 1695b10f7..a9633861e 100644
--- a/public/assets/kindeditor/kindeditor.js
+++ b/public/assets/kindeditor/kindeditor.js
@@ -5097,6 +5097,9 @@ KEditor.prototype = {
}
self.afterCreate();
if (self.options.afterCreate) {
+ if (typeof self.options.afterCreate == 'string'){
+ self.options.afterCreate = eval(self.options.afterCreate);
+ }
self.options.afterCreate.call(self);
}
}
diff --git a/public/assets/kindeditor/pasteimg.js b/public/assets/kindeditor/pasteimg.js
new file mode 100644
index 000000000..c413bbcb9
--- /dev/null
+++ b/public/assets/kindeditor/pasteimg.js
@@ -0,0 +1,385 @@
+// Generated by CoffeeScript 1.9.0
+
+/*
+paste.js is an interface to read data ( text / image ) from clipboard in different browsers. It also contains several hacks.
+https://github.com/layerssss/paste.js
+ */
+
+(function() {
+ var $, Paste, createHiddenEditable, dataURLtoBlob;
+
+ $ = window.jQuery;
+
+ $.paste = function(pasteContainer) {
+ var pm;
+ if (typeof console !== "undefined" && console !== null) {
+ console.log("DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead.");
+ }
+ pm = Paste.mountNonInputable(pasteContainer);
+ return pm._container;
+ };
+
+ $.fn.pastableNonInputable = function() {
+ var el, _i, _len;
+ for (_i = 0, _len = this.length; _i < _len; _i++) {
+ el = this[_i];
+ Paste.mountNonInputable(el);
+ }
+ return this;
+ };
+
+ $.fn.pastableTextarea = function() {
+ var el, _i, _len;
+ for (_i = 0, _len = this.length; _i < _len; _i++) {
+ el = this[_i];
+ Paste.mountTextarea(el);
+ }
+ return this;
+ };
+
+ $.fn.pastableContenteditable = function() {
+ var el, _i, _len;
+ for (_i = 0, _len = this.length; _i < _len; _i++) {
+ el = this[_i];
+ Paste.mountContenteditable(el);
+ }
+ return this;
+ };
+
+ dataURLtoBlob = function(dataURL, sliceSize) {
+ var b64Data, byteArray, byteArrays, byteCharacters, byteNumbers, contentType, i, m, offset, slice, _ref;
+ if (sliceSize == null) {
+ sliceSize = 512;
+ }
+ if (!(m = dataURL.match(/^data\:([^\;]+)\;base64\,(.+)$/))) {
+ return null;
+ }
+ _ref = m, m = _ref[0], contentType = _ref[1], b64Data = _ref[2];
+ byteCharacters = atob(b64Data);
+ byteArrays = [];
+ offset = 0;
+ while (offset < byteCharacters.length) {
+ slice = byteCharacters.slice(offset, offset + sliceSize);
+ byteNumbers = new Array(slice.length);
+ i = 0;
+ while (i < slice.length) {
+ byteNumbers[i] = slice.charCodeAt(i);
+ i++;
+ }
+ byteArray = new Uint8Array(byteNumbers);
+ byteArrays.push(byteArray);
+ offset += sliceSize;
+ }
+ return new Blob(byteArrays, {
+ type: contentType
+ });
+ };
+
+ createHiddenEditable = function() {
+ return $(document.createElement('div')).attr('contenteditable', true).css({
+ width: 1,
+ height: 1,
+ position: 'fixed',
+ left: -100,
+ overflow: 'hidden'
+ });
+ };
+
+ Paste = (function() {
+ Paste.prototype._target = null;
+
+ Paste.prototype._container = null;
+
+ Paste.mountNonInputable = function(nonInputable) {
+ var paste;
+ paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);
+ $(nonInputable).on('click', (function(_this) {
+ return function() {
+ return paste._container.focus();
+ };
+ })(this));
+ paste._container.on('focus', (function(_this) {
+ return function() {
+ return $(nonInputable).addClass('pastable-focus');
+ };
+ })(this));
+ return paste._container.on('blur', (function(_this) {
+ return function() {
+ return $(nonInputable).removeClass('pastable-focus');
+ };
+ })(this));
+ };
+
+ Paste.mountTextarea = function(textarea) {
+ var ctlDown, paste;
+ if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {
+ return this.mountContenteditable(textarea);
+ }
+ paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);
+ ctlDown = false;
+ $(textarea).on('keyup', function(ev) {
+ var _ref;
+ if ((_ref = ev.keyCode) === 17 || _ref === 224) {
+ return ctlDown = false;
+ }
+ });
+ $(textarea).on('keydown', function(ev) {
+ var _ref;
+ if ((_ref = ev.keyCode) === 17 || _ref === 224) {
+ ctlDown = true;
+ }
+ if (ctlDown && ev.keyCode === 86) {
+ return paste._container.focus();
+ }
+ });
+ $(paste._target).on('pasteImage', (function(_this) {
+ return function() {
+ return $(textarea).focus();
+ };
+ })(this));
+ $(paste._target).on('pasteText', (function(_this) {
+ return function() {
+ return $(textarea).focus();
+ };
+ })(this));
+ $(textarea).on('focus', (function(_this) {
+ return function() {
+ return $(textarea).addClass('pastable-focus');
+ };
+ })(this));
+ return $(textarea).on('blur', (function(_this) {
+ return function() {
+ return $(textarea).removeClass('pastable-focus');
+ };
+ })(this));
+ };
+
+ Paste.mountContenteditable = function(contenteditable) {
+ var paste;
+ paste = new Paste(contenteditable, contenteditable);
+ $(contenteditable).on('focus', (function(_this) {
+ return function() {
+ return $(contenteditable).addClass('pastable-focus');
+ };
+ })(this));
+ return $(contenteditable).on('blur', (function(_this) {
+ return function() {
+ return $(contenteditable).removeClass('pastable-focus');
+ };
+ })(this));
+ };
+
+ function Paste(_at__container, _at__target) {
+ this._container = _at__container;
+ this._target = _at__target;
+ this._container = $(this._container);
+ this._target = $(this._target).addClass('pastable');
+ this._container.on('paste', (function(_this) {
+ return function(ev) {
+ var clipboardData, file, item, reader, text, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3, _results;
+ if (((_ref = ev.originalEvent) != null ? _ref.clipboardData : void 0) != null) {
+ clipboardData = ev.originalEvent.clipboardData;
+ if (clipboardData.items) {
+ _ref1 = clipboardData.items;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ item = _ref1[_i];
+ if (item.type.match(/^image\//)) {
+ reader = new FileReader();
+ reader.onload = function(event) {
+ return _this._handleImage(event.target.result);
+ };
+ reader.readAsDataURL(item.getAsFile());
+ }
+ if (item.type === 'text/plain') {
+ item.getAsString(function(string) {
+ return _this._target.trigger('pasteText', {
+ text: string
+ });
+ });
+ }
+ }
+ } else {
+ if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {
+ text = clipboardData.getData('Text');
+ _this._target.trigger('pasteText', {
+ text: text
+ });
+ }
+ _this._checkImagesInContainer(function(src) {
+ return _this._handleImage(src);
+ });
+ }
+ }
+ if (clipboardData = window.clipboardData) {
+ if ((_ref2 = (text = clipboardData.getData('Text'))) != null ? _ref2.length : void 0) {
+ return _this._target.trigger('pasteText', {
+ text: text
+ });
+ } else {
+ _ref3 = clipboardData.files;
+ _results = [];
+ for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
+ file = _ref3[_j];
+ _this._handleImage(URL.createObjectURL(file));
+ _results.push(_this._checkImagesInContainer(function() {}));
+ }
+ return _results;
+ }
+ }
+ };
+ })(this));
+ }
+
+ Paste.prototype._handleImage = function(src) {
+ var loader;
+ loader = new Image();
+ loader.onload = (function(_this) {
+ return function() {
+ var blob, canvas, ctx, dataURL;
+ canvas = document.createElement('canvas');
+ canvas.width = loader.width;
+ canvas.height = loader.height;
+ ctx = canvas.getContext('2d');
+ ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);
+ dataURL = null;
+ try {
+ dataURL = canvas.toDataURL('image/png');
+ blob = dataURLtoBlob(dataURL);
+ } catch (_error) {}
+ if (dataURL) {
+ return _this._target.trigger('pasteImage', {
+ blob: blob,
+ dataURL: dataURL,
+ width: loader.width,
+ height: loader.height
+ });
+ }
+ };
+ })(this);
+ return loader.src = src;
+ };
+
+ Paste.prototype._checkImagesInContainer = function(cb) {
+ var img, timespan, _i, _len, _ref;
+ timespan = Math.floor(1000 * Math.random());
+ _ref = this._container.find('img');
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ img = _ref[_i];
+ img["_paste_marked_" + timespan] = true;
+ }
+ return setTimeout((function(_this) {
+ return function() {
+ var _j, _len1, _ref1, _results;
+ _ref1 = _this._container.find('img');
+ _results = [];
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
+ img = _ref1[_j];
+ if (!img["_paste_marked_" + timespan]) {
+ cb(img.src);
+ }
+ _results.push($(img).remove());
+ }
+ return _results;
+ };
+ })(this), 1);
+ };
+
+ return Paste;
+
+ })();
+
+}).call(this);
+
+function enablePasteImg(_editor) {
+ var editor = _editor,
+ name = 'paste';
+ //òƶ༭Ͳͻ
+ if(editor.edit == undefined || editor.edit.iframe == undefined){
+ return;
+ }
+ var contentWindow = editor.edit.iframe[0].contentWindow;
+ //var contentWindow = editor.iframeDoc;
+ //var contentWindow = document.getElementsByTagName('iframe')[0].contentWindow;
+ var nodeBody = contentWindow.document.getElementsByTagName('body')[0];
+ console.log(nodeBody);
+ $(nodeBody).pastableContenteditable();
+
+ dataURItoBlob = function(dataURI) {
+ // convert base64/URLEncoded data component to raw binary data held in a string
+ var byteString;
+ if (dataURI.split(',')[0].indexOf('base64') >= 0)
+ byteString = atob(dataURI.split(',')[1]);
+ else
+ byteString = unescape(dataURI.split(',')[1]);
+
+ // separate out the mime component
+ var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
+
+ // write the bytes of the string to a typed array
+ var ia = new Uint8Array(byteString.length);
+ for (var i = 0; i < byteString.length; i++) {
+ ia[i] = byteString.charCodeAt(i);
+ }
+
+ return new Blob([ia], {type:mimeString});
+ };
+
+ $(nodeBody).on('pasteImage', function(ev, data) {
+ console.log('pasteImage');
+ console.log("dataURL: " + data.dataURL);
+ console.log("width: " + data.width);
+ console.log("height: " + data.height);
+ console.log(data.blob);
+ var blob = dataURItoBlob(data.dataURL);
+ if (data.blob !== null) {
+ var data = new FormData();
+ data.append("imgFile",blob, "imageFilename.png");
+ console.log(data);
+ $.ajax({
+ url: '/kindeditor/upload?dir=image',
+ contentType: false,
+ type: 'POST',
+ data: data,
+ processData: false,
+ success: function(data) {
+ editor.exec('insertimage', JSON.parse(data).url);
+ }
+ });
+ }
+
+ });
+ return;
+ contentWindow.document.getElementsByTagName('body')[0].onpaste = function(event) {
+ // use event.originalEvent.clipboard for newer chrome versions
+ var items = (event.clipboardData || event.originalEvent.clipboardData).items;
+ console.log(JSON.stringify(items)); // will give you the mime types
+ // find pasted image among pasted items
+ var blob = null;
+ for (var i = 0; i < items.length; i++) {
+ if (items[i].type.indexOf("image") === 0) {
+ blob = items[i].getAsFile();
+ }
+ }
+ // load image if there is a pasted image
+ if (blob !== null) {
+ var reader = new FileReader();
+ reader.onload = function(event) {
+ console.log(event.target.result); // data url!
+ var data = new FormData();
+ data.append("imgFile", blob, "imageFilename.png");
+ console.log(blob);
+ $.ajax({
+ url: '/kindeditor/upload?dir=image',
+ contentType: false,
+ type: 'POST',
+ data: data,
+ processData: false,
+ success: function(data) {
+ editor.exec('insertimage', JSON.parse(data).url);
+ }
+ });
+ };
+ reader.readAsDataURL(blob);
+ }
+ }
+};
From 23a1f84ae70e61fa6b40fc1368272b5a953af3e5 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 17 Jun 2015 20:59:43 +0800
Subject: [PATCH 20/30] =?UTF-8?q?kindeditor=20js=E9=A1=BA=E5=BA=8F?=
=?UTF-8?q?=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/base_forums.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb
index fdeb609c8..eae133184 100644
--- a/app/views/layouts/base_forums.html.erb
+++ b/app/views/layouts/base_forums.html.erb
@@ -12,10 +12,10 @@
<%= csrf_meta_tag %>
<%= favicon %>
- <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
+ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
From f58b5304843e5ce91e572e2faf7d43bab5dfda95 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Thu, 18 Jun 2015 09:13:20 +0800
Subject: [PATCH 21/30] =?UTF-8?q?=E7=BB=99=E8=AF=BE=E7=A8=8B=E6=B4=BB?=
=?UTF-8?q?=E5=8A=A8=E6=85=A2=E5=8A=A0=E4=B8=8A=E7=BC=93=E5=AD=98=EF=BC=8C?=
=?UTF-8?q?=E5=B9=B6=E4=B8=94=E5=8A=A0=E5=85=A5=E4=BA=86=E5=BC=80=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 33 +++++++++++++--------
app/helpers/application_helper.rb | 7 +++++
app/models/activity.rb | 2 ++
app/models/forge_activity.rb | 1 +
app/views/courses/show.html.erb | 2 +-
app/views/files/_course_list.html.erb | 6 ++--
app/views/files/_project_file_list.html.erb | 6 ++--
config/settings.yml | 3 +-
lib/trustie/cache/clear_course_event.rb | 17 +++++++++++
9 files changed, 58 insertions(+), 19 deletions(-)
create mode 100644 lib/trustie/cache/clear_course_event.rb
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 61354add7..524bde9d7 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -695,21 +695,28 @@ class CoursesController < ApplicationController
# 显示老师和助教的活动
# @authors = searchTeacherAndAssistant(@course)
@authors = course_all_member(@course)
+ Dir.glob("#{Rails.root}/app/models/*.rb").sort.each { |file| require file }
events = []
- @authors.each do |author|
- @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
- :with_subprojects => false,
- :author => author.user)
-
- @activity.scope_select {|t| has["show_#{t}"]}
- # modify by nwb
- # 添加私密性判断
- if User.current.member_of_course?(@course)|| User.current.admin?
- events += @activity.events(@days, @course.created_at)
- else
- events += @activity.events(@days, @course.created_at, :is_public => 1)
+ key = "course_events_#{@course.id}".to_sym
+ if Rails.env.production? && Setting.course_cahce_enabled?
+ events = Rails.cache.read(key) || []
+ end
+ if events.empty?
+ @authors.each do |author|
+ @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
+ :with_subprojects => false,
+ :author => author.user)
+
+ @activity.scope_select {|t| has["show_#{t}"]}
+ # modify by nwb
+ # 添加私密性判断
+ if User.current.member_of_course?(@course)|| User.current.admin?
+ events += @activity.events(@days, @course.created_at)
+ else
+ events += @activity.events(@days, @course.created_at, :is_public => 1)
+ end
end
-
+ Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled?
end
else
# @author = @course.teacher
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 5ae70fd7c..5af4e2038 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2330,4 +2330,11 @@ module ApplicationHelper
def cur_user_works_for_homework homework
homework.student_works.where("user_id = ?",User.current).first
end
+
+ def file_preview_tag(file, html_options={})
+ if %w(pdf pptx doc docx xls xlsx).any?{|x| file.filename.downcase.end_with?(x)}
+ link_to '预览', download_named_attachment_path(file.id, file.filename, preview: true),html_options
+ end
+ end
+
end
diff --git a/app/models/activity.rb b/app/models/activity.rb
index e871ae735..5ec778641 100644
--- a/app/models/activity.rb
+++ b/app/models/activity.rb
@@ -5,4 +5,6 @@ class Activity < ActiveRecord::Base
validates :act_id, presence: true
validates :act_type, presence: true
validates :user_id, presence: true
+
+ include Trustie::Cache::ClearCourseEvent
end
diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb
index e94a29867..6b75552c0 100644
--- a/app/models/forge_activity.rb
+++ b/app/models/forge_activity.rb
@@ -19,4 +19,5 @@ class ForgeActivity < ActiveRecord::Base
validates :project_id,presence: true
validates :forge_act_id,presence: true
validates :forge_act_type, presence: true
+
end
diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb
index 09d1aa27d..654c25a42 100644
--- a/app/views/courses/show.html.erb
+++ b/app/views/courses/show.html.erb
@@ -126,4 +126,4 @@
});
nh_new_notify_count_show();
});
-
\ No newline at end of file
+
diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb
index 7f3e426fc..8bb6f8970 100644
--- a/app/views/files/_course_list.html.erb
+++ b/app/views/files/_course_list.html.erb
@@ -25,7 +25,9 @@
<% if file.is_public? || User.current.member_of_course?(course) %>
- <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename, preview: true),:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
<% if User.current.logged? %>
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
@@ -40,7 +42,7 @@
<% else %>
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% end %>
- <%= link_to_attachment file, text: '下载', class: 'f_l re_open' %>
+ <%= file_preview_tag(file, class: 'f_l re_open') %>
<% else %>
<% end %>
diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb
index 81b69d754..9f9e86cff 100644
--- a/app/views/files/_project_file_list.html.erb
+++ b/app/views/files/_project_file_list.html.erb
@@ -18,7 +18,9 @@
<% project_attachments.each do |file| %>
- <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename, preview: true),:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
<% if User.current.logged? %>
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
@@ -30,7 +32,7 @@
<% else %>
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
<% end %>
- <%= link_to_attachment file, text: '下载', class: 'f_l re_open' %>
+ <%= file_preview_tag(file, class: 'f_l re_open') %>
<% end %>
diff --git a/config/settings.yml b/config/settings.yml
index f952e23bf..d0af6d7a1 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -66,7 +66,8 @@ upload_avatar_max_size:
### delayjob for send email.
delayjob_enabled:
default: 1
-
+course_cahce_enabled:
+ default: 1
bcc_recipients:
default: 1
plain_text_mail:
diff --git a/lib/trustie/cache/clear_course_event.rb b/lib/trustie/cache/clear_course_event.rb
new file mode 100644
index 000000000..98ec8b4fd
--- /dev/null
+++ b/lib/trustie/cache/clear_course_event.rb
@@ -0,0 +1,17 @@
+#coding=utf-8
+
+module Trustie
+ module Cache
+ module ClearCourseEvent
+ def self.included(base)
+ base.class_eval{
+ after_create :clear_course_events
+ }
+ end
+ def clear_course_events
+ Rails.cache.delete("course_events_#{self.act.course_id}".to_sym) if Rails.env.production? && Setting.course_cahce_enabled?
+ end
+ end
+ end
+end
+
From 2f8f07aa31d3b663874259c86a683ee64d1b69b3 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 18 Jun 2015 09:24:19 +0800
Subject: [PATCH 22/30] =?UTF-8?q?403=E5=90=8E=E9=80=80=E4=B8=80=E6=AD=A5?=
=?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=B7=AF=E7=94=B1=E6=97=B6=E7=BD=AE=E7=81=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/common/403.html | 46 +++++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 19 deletions(-)
diff --git a/app/views/common/403.html b/app/views/common/403.html
index a89be932d..d063b315e 100644
--- a/app/views/common/403.html
+++ b/app/views/common/403.html
@@ -1,25 +1,33 @@
-
-
没有访问权限
-
+ .error_content{ width:550px; height:200px; margin:0 auto; padding:10px 0;}
+ .error_left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;}
+ .error_right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 17px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; }
+ .error_link{ margin-top:8px;}
+ .error_link a{ display:block; width:80px; height:28px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;}
+ .error_link a:hover{ background:#ff8417;}
+
+
@@ -31,7 +39,7 @@ a:hover{ }
没有访问权限!建议您
From d76aa7cab2c5ae6b87c400f5315ff12a93e77851 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 18 Jun 2015 09:31:31 +0800
Subject: [PATCH 23/30] =?UTF-8?q?=E9=9D=9E=E8=AF=BE=E7=A8=8B=E6=88=90?=
=?UTF-8?q?=E5=91=98=E4=B8=8D=E5=8F=AF=E8=AE=BF=E9=97=AE=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 06bc1fd38..d5e62127d 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -3,6 +3,7 @@ class HomeworkCommonController < ApplicationController
before_filter :find_course, :only => [:index,:new,:create]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
+ before_filter :member_of_course, :only => [:index]
def index
homeworks = @course.homework_commons.order("created_at desc")
@@ -203,6 +204,11 @@ class HomeworkCommonController < ApplicationController
render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
end
+ #当前用户是不是课程的成员
+ def member_of_course
+ render_403 unless User.current.member_of_course?(@course) || User.current.admin?
+ end
+
def get_assigned_homeworks(student_works, n, index)
student_works += student_works
student_works[index + 1 .. index + n]
From 9a4e0d6be75b83b1515a499cf4082708d86dc75a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 18 Jun 2015 10:11:04 +0800
Subject: [PATCH 24/30] =?UTF-8?q?=E6=89=B9=E9=98=85=E7=BB=93=E6=9E=9C?=
=?UTF-8?q?=E9=99=84=E4=BB=B6=E6=98=BE=E7=A4=BA=E9=95=BF=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/stylesheets/courses.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 769136f2d..f4e72019f 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -666,7 +666,7 @@ input#score{ width:40px;}
.ui-slider .ui-slider-handle:active{background-image:none;}
.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;}
-.filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px;}
+.filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;}
.evaluation{position: relative;}
.evaluation_submit{position: absolute;right: 0px;bottom: 5px;}
.student_work_search{background-color: #64bdd9;color: white !important;padding: 2px 7px;margin-left: 10px;cursor: pointer; }
From 7a9b5712c06d4a359a00b6f5ef9997da1fa11746 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Thu, 18 Jun 2015 10:54:28 +0800
Subject: [PATCH 25/30] =?UTF-8?q?message=E7=9A=84=E5=8A=A8=E6=80=81?=
=?UTF-8?q?=E5=8D=95=E7=8B=AC=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/trustie/cache/clear_course_event.rb | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/lib/trustie/cache/clear_course_event.rb b/lib/trustie/cache/clear_course_event.rb
index 98ec8b4fd..a5f44bf45 100644
--- a/lib/trustie/cache/clear_course_event.rb
+++ b/lib/trustie/cache/clear_course_event.rb
@@ -8,9 +8,23 @@ module Trustie
after_create :clear_course_events
}
end
+
def clear_course_events
- Rails.cache.delete("course_events_#{self.act.course_id}".to_sym) if Rails.env.production? && Setting.course_cahce_enabled?
+ if Rails.env.production? && Setting.course_cahce_enabled?
+ Rails.cache.delete(cache_key)
+ end
+ end
+
+ def cache_key
+ course_id = nil
+ if Message === self.act
+ course_id = self.act.board.course_id
+ elsif self.act.respond_to?(:course_id)
+ course_id = self.act.course_id
+ end
+ "course_events_#{course_id}".to_sym
end
+
end
end
end
From 8a3a0af20f897710454077d2729f2e3aaa1eac13 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 18 Jun 2015 10:59:18 +0800
Subject: [PATCH 26/30] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=A7=AF=E5=88=86=E5=BC=B9=E6=A1=86=E5=86=85?=
=?UTF-8?q?=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/member.rb | 10 ++++++++++
app/views/courses/_show_member_score.html.erb | 7 ++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/app/models/member.rb b/app/models/member.rb
index 5b1e277d7..057ea9570 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -129,6 +129,16 @@ class Member < ActiveRecord::Base
StudentWork.select("homework_commons.name, student_works.final_score").joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}")
end
+ #当前课程的作业列表
+ def homework_common_list
+ HomeworkCommon.where(:course_id => self.course_id)
+ end
+
+ #当前学生在指定作业内的得分
+ def homework_common_score homework_common
+ StudentWork.select("final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
+ end
+
def student_work_score_avg
StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
end
diff --git a/app/views/courses/_show_member_score.html.erb b/app/views/courses/_show_member_score.html.erb
index 0fd1248c6..b471bc17f 100644
--- a/app/views/courses/_show_member_score.html.erb
+++ b/app/views/courses/_show_member_score.html.erb
@@ -17,13 +17,14 @@
<%= @member_score.user.name %> 历次作业积分
- 作业名称得分
- <% @member_score.student_work_score.each do |homework_score| %>
+ <% @member_score.homework_common_list.each do |homework_common| %>
-
- <%= homework_score.name %>
+ <%= homework_common.name %>
- <%= format("%0.2f",homework_score.final_score.nil? ? 0 : homework_score.final_score) %>
+ <% final_score = @member_score.homework_common_score(homework_common).first%>
+ <%= final_score.nil? || final_score.final_score.nil? ? "--" : format("%0.2f", final_score.final_score) %>
<% end %>
From 43363e8bcb89021e5e7ad5eaa2de8e596d3c3813 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 18 Jun 2015 17:56:28 +0800
Subject: [PATCH 27/30] =?UTF-8?q?=E7=BC=BA=E8=AF=84=E6=83=85=E5=86=B5?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 11 +++-
app/helpers/student_work_helper.rb | 10 ++++
app/views/student_work/index.html.erb | 2 +-
.../student_work_absence_penalty.html.erb | 54 +++++++++++++++++++
config/routes.rb | 1 +
public/stylesheets/courses.css | 6 ++-
public/stylesheets/public.css | 1 +
7 files changed, 82 insertions(+), 3 deletions(-)
create mode 100644 app/views/student_work/student_work_absence_penalty.html.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 30fd0ff50..3dd5e9890 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -2,7 +2,7 @@ class StudentWorkController < ApplicationController
layout "base_courses"
include StudentWorkHelper
require 'bigdecimal'
- before_filter :find_homework, :only => [:new, :index, :create]
+ before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work]
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
@@ -233,6 +233,15 @@ class StudentWorkController < ApplicationController
end
end
+ #评价列表显示
+ def student_work_absence_penalty
+ render_403 unless User.current.allowed_to?(:as_teacher,@course)
+ @stundet_works = @homework.student_works
+ respond_to do |format|
+ format.html
+ end
+ end
+
private
#获取作业
def find_homework
diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb
index 990a563c4..7c85dc5c4 100644
--- a/app/helpers/student_work_helper.rb
+++ b/app/helpers/student_work_helper.rb
@@ -60,4 +60,14 @@ module StudentWorkHelper
def is_praise_homework user_id, obj_id
PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").empty?
end
+
+ #获取指定学生在指定作业内应匿评的数量
+ def all_evaluation_count user,homework
+ StudentWorksEvaluationDistribution.joins(:student_work).where("student_works_evaluation_distributions.user_id = #{user.id} AND student_works.homework_common_id = #{homework.id}").count
+ end
+
+ #获取指定学生在指定作业内已匿评的数量
+ def has_evaluation_count user,homework
+ StudentWorksScore.joins(:student_work).where("student_works_scores.user_id = #{user.id} AND student_works.homework_common_id = #{homework.id}").count
+ end
end
\ No newline at end of file
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index c9e8cd4c6..09d1c8f60 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -18,7 +18,6 @@
返
回
顶
部
-
@@ -37,6 +36,7 @@
<% if @show_all%>
搜索
+ <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank"%>
<% end%>
<% if @is_teacher%>
diff --git a/app/views/student_work/student_work_absence_penalty.html.erb b/app/views/student_work/student_work_absence_penalty.html.erb
new file mode 100644
index 000000000..a0d6cdc04
--- /dev/null
+++ b/app/views/student_work/student_work_absence_penalty.html.erb
@@ -0,0 +1,54 @@
+
+
+ 缺评情况
+
+
+
+
+
+
+
+
+ <% @stundet_works.each do |student_work|%>
+
" id="student_work_<%= student_work.id%>">
+ -
+
+ <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
+
+
+ -
+ <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
+
+ <%
+ all_count = all_evaluation_count student_work.user,@homework
+ has_count = has_evaluation_count student_work.user,@homework
+ absence = all_count - has_count
+ %>
+ -
+ <%= all_count%>
+
+ -
+ <%= has_count%>
+
+ -
+ <%= absence%>
+
+
+ <% end%>
+
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index c92c732d2..b5a244345 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -97,6 +97,7 @@ RedmineApp::Application.routes.draw do
collection do
post 'add_score_reply'
get 'destroy_score_reply'
+ get 'student_work_absence_penalty'
end
end
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index f4e72019f..b2e68085a 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -635,6 +635,8 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
.mr18{ margin-right:18px;}
a.hwork_center{ display:block; width:60px; margin-right:5px;overflow: hidden; white-space: nowrap; text-overflow:ellipsis;}
.hwork_name{ display:block;width:80px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
+.absence_penalty{ display:block;width:45px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
+.border_ce {border: 1px solid #e4e4e4;}
.show_hwork{ border:2px solid #64bdd9; width:646px; padding:10px; color:#666666; padding-bottom:0px; }
.show_hwork ul li{ margin-bottom:5px;}
.show_hwork_arrow{ position:relative; top:2px; left:25px;background:url(../images/course/arrow_up.jpg) 0 0 no-repeat; width:20px; height:11px;}
@@ -657,7 +659,9 @@ a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;}
/*返回顶部*/
.to_top{width: 19px;height: 74px;position: fixed;top: 50px;right: 1px;color: white;background: #15bccf; line-height: 1.2; padding-top: 10px;padding-left: 5px;font-size: 14px;cursor: pointer;}
-
+.hwork_num_ab{ width:120px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
+.hwork_name_ab{ display:block;width:340px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
+.absence{width: 50px;text-align: center;}
/* 评分插件 */
input#score{ width:40px;}
.ui-slider{position:relative;width:200px;float:left;margin-right:10px;height:14px; margin-top:2px;background:#e2e2e2; }
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css
index 0ed497127..cdcde2559 100644
--- a/public/stylesheets/public.css
+++ b/public/stylesheets/public.css
@@ -69,6 +69,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.ml90{ margin-left:90px;}
.ml100{ margin-left:100px;}
.ml110{ margin-left:110px;}
+.ml320{ margin-left:320px;}
.mr5{ margin-right:5px;}
.mr10{ margin-right:10px;}
.mr20{ margin-right:20px;}
From 4aeac1bd649c0f0412453c7498f9de7153e6a5cf Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Thu, 18 Jun 2015 21:39:12 +0800
Subject: [PATCH 28/30] =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=97=B6=EF=BC=8C?=
=?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=AC=A1=E6=95=B0=E4=B8=8D=E7=B4=AF=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 4ecff7a40..09ca29178 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -68,6 +68,7 @@ class AttachmentsController < ApplicationController
end
def direct_download
+ @attachment.increment_download
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
:disposition => 'attachment' #inline can open in browser
@@ -78,7 +79,6 @@ class AttachmentsController < ApplicationController
# 下载添加权限设置
candown = attachment_candown @attachment
if candown || User.current.admin? || User.current.id == @attachment.author_id
- @attachment.increment_download
if stale?(:etag => @attachment.digest)
if params[:preview] == 'true'
convered_file = @attachment.diskfile
From c64b761f46dba724f713c636afde9da4a0532e6d Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 19 Jun 2015 09:56:39 +0800
Subject: [PATCH 29/30] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=BA=E8=AF=84?=
=?UTF-8?q?=E6=8E=92=E5=BA=8F=EF=BC=8C=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E5=B7=B2=E8=AF=84=E3=80=81=E6=9C=AA=E8=AF=84=E3=80=81=E7=BC=BA?=
=?UTF-8?q?=E8=AF=84=E7=9A=84=E6=95=B0=E9=87=8F=E7=9A=84=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 12 +++++++++++-
.../student_work_absence_penalty.html.erb | 16 ++++++----------
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 3dd5e9890..c8cbde626 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -236,7 +236,17 @@ class StudentWorkController < ApplicationController
#评价列表显示
def student_work_absence_penalty
render_403 unless User.current.allowed_to?(:as_teacher,@course)
- @stundet_works = @homework.student_works
+ order = params[:order] || "desc"
+ work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
+ @stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM(
+ SELECT * ,
+ (SELECT COUNT(*) FROM `student_works_evaluation_distributions` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS all_count,
+ (SELECT COUNT(*) FROM `student_works_scores` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS has_count
+ FROM `student_works`
+ WHERE homework_common_id = 213
+ ) AS table_1
+ ORDER BY absence #{order}")
+ @order = order == "desc" ? "asc" : "desc"
respond_to do |format|
format.html
end
diff --git a/app/views/student_work/student_work_absence_penalty.html.erb b/app/views/student_work/student_work_absence_penalty.html.erb
index a0d6cdc04..e9054561f 100644
--- a/app/views/student_work/student_work_absence_penalty.html.erb
+++ b/app/views/student_work/student_work_absence_penalty.html.erb
@@ -20,7 +20,8 @@
实评
-
- 缺评
+ <%= link_to "缺评",student_work_absence_penalty_student_work_index_path(:homework => @homework.id,:order => @order)%>
+
@@ -35,19 +36,14 @@
-
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
- <%
- all_count = all_evaluation_count student_work.user,@homework
- has_count = has_evaluation_count student_work.user,@homework
- absence = all_count - has_count
- %>
-
- <%= all_count%>
+ <%= student_work.all_count%>
-
- <%= has_count%>
+ <%= student_work.has_count%>
-
-
- <%= absence%>
+
-
+ <%= student_work.absence%>
<% end%>
From 1f4f1b4eb65915d9fb20fabc627d0d956318f10a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 19 Jun 2015 09:59:06 +0800
Subject: [PATCH 30/30] =?UTF-8?q?=E8=80=81=E5=B8=88=E6=89=8D=E5=8F=AF?=
=?UTF-8?q?=E4=BB=A5=E6=9F=A5=E7=9C=8B=E7=BC=BA=E8=AF=84=E6=83=85=E5=86=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/index.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 09d1c8f60..6325abc09 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -36,7 +36,7 @@
<% if @show_all%>
搜索
- <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank"%>
+ <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher%>
<% end%>
<% if @is_teacher%>