From 5f27519c6754babbc1bec5cf52ceb8a7a4b65bb2 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 27 May 2016 14:44:32 +0800 Subject: [PATCH] =?UTF-8?q?table=E5=8F=AF=E6=8B=96=E6=8B=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student_work/_evaluation_title.html.erb | 2 +- .../_evaluation_un_title.html.erb | 4 +- app/views/student_work/index.html.erb | 1 + public/javascripts/resizeable_table.js | 76 +++++++++++++++++++ public/stylesheets/courses.css | 6 +- 5 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 public/javascripts/resizeable_table.js diff --git a/app/views/student_work/_evaluation_title.html.erb b/app/views/student_work/_evaluation_title.html.erb index 064444f04..73bd5d4f2 100644 --- a/app/views/student_work/_evaluation_title.html.erb +++ b/app/views/student_work/_evaluation_title.html.erb @@ -1,4 +1,4 @@ - +
diff --git a/app/views/student_work/_evaluation_un_title.html.erb b/app/views/student_work/_evaluation_un_title.html.erb index 98e9f1f64..f25edc5ce 100644 --- a/app/views/student_work/_evaluation_un_title.html.erb +++ b/app/views/student_work/_evaluation_un_title.html.erb @@ -1,4 +1,4 @@ -
序号  
+
@@ -17,7 +17,7 @@ <% end%> <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> - <% end %> diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 8e7d87302..3c077c6ea 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -1,5 +1,6 @@ <% content_for :header_tags do %> <%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %> +<%= javascript_include_tag "resizeable_table" %> <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> <% end %> diff --git a/public/javascripts/resizeable_table.js b/public/javascripts/resizeable_table.js new file mode 100644 index 000000000..eac4a1f36 --- /dev/null +++ b/public/javascripts/resizeable_table.js @@ -0,0 +1,76 @@ +/** + * Created by ttang on 2016/5/24. + */ + $(document).ready(function(){ + resizeable_table = function(colS,colE,padding){ + var headerTds = document.getElementById("homework_table").rows[0].cells; + var mousedown = false; + var resizeable = false; + var targetTd; + var screenXStart =0; + var tdWidth = 0; + var headerWidth = 0; + var tblObj = document.getElementById("homework_table"); + var tblWidth = tblObj.offsetWidth; + for(var i = colS;i 0){//实际改变前一单元格列宽,但是表格左边框线不可拖动 + targetTd=trObj.cells[srcObj.cellIndex - 1]; + resizeable = true; + srcObj.style.cursor='col-resize'; + }else{ + resizeable = false; + srcObj.style.cursor='default'; + } + } + } + document.onmouseup = function(event){ + tartgetTd = null; + resizeable = false; + mousedown = false; + document.body.style.cursor='default'; + } + function getTarget(evt){ + return evt.target || evt.srcElement; + } + function addListener(element,type,listener,useCapture){ + element.addEventListener?element.addEventListener(type,listener,useCapture):element.attachEvent("on" + type,listener); + } + } + }); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 49f87416c..a76ec5464 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -59,7 +59,7 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} .hworkList100 {width:100px; text-align:center;} .hworkList130 {width:130px; text-align:center;} .hworkList160 {width:160px; text-align:center;} -.hworkList220 {width:220px; text-align:center;} +.hworkList210 {width:210px; text-align:center;} .hworkList260 {width:260px; text-align:left;} .codeList{ float:right; font-size:12px; color:#484848; padding:0px 3px; width:714px; margin-bottom:10px; } .hworkName {width:80px; float:left; line-height:18px;} @@ -103,7 +103,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re .pr10{padding-right: 10px;} /*20160520作品列表table*/ -.hwork-table-wrap {width:720px; border-collapse:collapse; vertical-align:middle;} +.hwork-table-wrap {width:720px; border-collapse:collapse; vertical-align:middle; table-layout:fixed;} .hwork-table-wrap th {font-size:14px; color:#2d2d2d;} /*作业信息*/ @@ -1252,7 +1252,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;} .tac {text-align:center;} .proHelp {background:url(/images/course/hwork_icon.png) -5px -124px no-repeat; display:inline-block; width:15px; height:15px; display:inline-block;} .hworkPrName {width:160px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;} -.hworkPrName2 {width:220px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;} +.hworkPrName2 {width:210px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;} .mr150 {margin-right:150px;} .relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;} .captainName {max-width:75px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}
序号   + 关联项目