项目名称导航;问题跟踪页面项目导航到问题列表页面;IE问题跟踪页面缩略图显示
This commit is contained in:
parent
229d8007fe
commit
88bbd70102
|
@ -329,12 +329,12 @@ module ApplicationHelper
|
||||||
imagesize = attachment.thumbnail(:size => "200*200")
|
imagesize = attachment.thumbnail(:size => "200*200")
|
||||||
imagepath = named_attachment_path(attachment, attachment.filename)
|
imagepath = named_attachment_path(attachment, attachment.filename)
|
||||||
if imagesize
|
if imagesize
|
||||||
link_to image_tag(thumbnail_path(attachment), height: '73', width: '100', name: 'issue_attachment_picture'),
|
link_to image_tag(thumbnail_path(attachment), height: '73', width: '100', class: 'issue_attachment_picture'),
|
||||||
imagepath,
|
imagepath,
|
||||||
:title => attachment.filename
|
:title => attachment.filename
|
||||||
|
|
||||||
else
|
else
|
||||||
link_to image_tag(imagepath , height: '73', width: '100', name: 'issue_attachment_picture'),
|
link_to image_tag(imagepath , height: '73', width: '100', class: 'issue_attachment_picture'),
|
||||||
imagepath,
|
imagepath,
|
||||||
:title => attachment.filename
|
:title => attachment.filename
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,62 +1,28 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.addEventListener('DOMContentLoaded',function(){
|
|
||||||
var img = document.getElementsByName('issue_attachment_picture');
|
|
||||||
|
|
||||||
|
|
||||||
function getImgNaturalStyle(img, callback) {
|
|
||||||
var nWidth, nHeight;
|
|
||||||
if (typeof img.naturalWidth == "undefined"|| img.naturalWidth == 0) {
|
|
||||||
var image = new Image();
|
|
||||||
image.src = img.src;
|
|
||||||
if (image.complete) {
|
|
||||||
callback(image);
|
|
||||||
} else {
|
|
||||||
image.onload = function () {
|
|
||||||
callback(image);
|
|
||||||
image.onload = null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
jQuery(window).load(function () {
|
||||||
|
jQuery(".issue_attachment_picture").each(function () {
|
||||||
|
DrawImage(this, 100, 73);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function DrawImage(ImgD, FitWidth, FitHeight) {
|
||||||
|
var image = new Image();
|
||||||
|
image.src = ImgD.src;
|
||||||
|
if (image.width > 100 || image.height > 73)
|
||||||
|
{
|
||||||
|
rateWidth = image.width / 100;
|
||||||
|
rateHeight = image.height / 73;
|
||||||
|
if (rateWidth > rateHeight) {
|
||||||
|
ImgD.width = 100;
|
||||||
|
ImgD.height = Math.round(image.height/rateWidth);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (img.complete) {
|
ImgD.width = Math.round(image.width/rateHeight);
|
||||||
nWidth = img.naturalWidth;
|
ImgD.height = 73;
|
||||||
nHeight = img.naturalHeight;
|
|
||||||
} else {
|
|
||||||
img.onload = function () {
|
|
||||||
nWidth = img.naturalWidth;
|
|
||||||
nHeight = img.naturalHeight;
|
|
||||||
image.onload = null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
return [nWidth, nHeight];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function UpdateImageInformation(image) {
|
|
||||||
return [image.width,image.height];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for(i=0;i<img.length;i++)
|
|
||||||
{
|
|
||||||
imgNatural = getImgNaturalStyle(img[i],UpdateImageInformation);
|
|
||||||
var width = imgNatural[0];
|
|
||||||
var height = imgNatural[1];
|
|
||||||
if (width<100)
|
|
||||||
{
|
|
||||||
img[i].width = width;
|
|
||||||
}
|
|
||||||
if (height<73) {
|
|
||||||
img[i].height = height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="attachments" style="font-weight:normal;">
|
<div class="attachments" style="font-weight:normal;">
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
<style type="text/css">
|
||||||
|
#preview{width:360px;height:360px;border:1px solid #000;overflow:hidden;}
|
||||||
|
#imghead {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);}
|
||||||
|
</style>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function previewImage(file)
|
||||||
|
{
|
||||||
|
var MAXWIDTH = 360;
|
||||||
|
var MAXHEIGHT = 360;
|
||||||
|
var div = document.getElementById('preview');
|
||||||
|
if (file.files && file.files[0])
|
||||||
|
{
|
||||||
|
div.innerHTML = '<img id=imghead>';
|
||||||
|
var img = document.getElementById('imghead');
|
||||||
|
img.onload = function(){
|
||||||
|
var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
|
||||||
|
img.width = rect.width;
|
||||||
|
img.height = rect.height;
|
||||||
|
img.style.marginLeft = rect.left+'px';
|
||||||
|
img.style.marginTop = rect.top+'px';
|
||||||
|
}
|
||||||
|
var reader = new FileReader();
|
||||||
|
reader.onload = function(evt){img.src = evt.target.result;}
|
||||||
|
reader.readAsDataURL(file.files[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
|
||||||
|
file.select();
|
||||||
|
var src = document.selection.createRange().text;
|
||||||
|
div.innerHTML = '<img id=imghead>';
|
||||||
|
var img = document.getElementById('imghead');
|
||||||
|
img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
|
||||||
|
var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
|
||||||
|
status =('rect:'+rect.top+','+rect.left+','+rect.width+','+rect.height);
|
||||||
|
div.innerHTML = "<div id=divhead style='width:"+rect.width+"px;height:"+rect.height+"px;margin-top:"+rect.top+"px;margin-left:"+rect.left+"px;"+sFilter+src+"\"'></div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function clacImgZoomParam( maxWidth, maxHeight, width, height ){
|
||||||
|
var param = {top:0, left:0, width:width, height:height};
|
||||||
|
if( width>maxWidth || height>maxHeight )
|
||||||
|
{
|
||||||
|
rateWidth = width / maxWidth;
|
||||||
|
rateHeight = height / maxHeight;
|
||||||
|
|
||||||
|
if( rateWidth > rateHeight )
|
||||||
|
{
|
||||||
|
param.width = maxWidth;
|
||||||
|
param.height = Math.round(height / rateWidth);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
param.width = Math.round(width / rateHeight);
|
||||||
|
param.height = maxHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
param.left = Math.round((maxWidth - param.width) / 2);
|
||||||
|
param.top = Math.round((maxHeight - param.height) / 2);
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<div id="preview">
|
||||||
|
<img id="imghead" width=100 height=100 border=0 src="file:///C:/Users/whimlex/Downloads/1.jpg">
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<input type="file" onchange="previewImage(this)" />
|
|
@ -4,7 +4,7 @@
|
||||||
<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %>
|
<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %>
|
||||||
<div class="pro_page_box">
|
<div class="pro_page_box">
|
||||||
<div class="pro_page_top break_word">
|
<div class="pro_page_top break_word">
|
||||||
<a href="javascript:void(0)"><%= @issue.project.name %></a> >
|
<%= link_to "#{@issue.project.name}"+">", project_issues_path(@issue.project) %>
|
||||||
<a href="javascript:void(0)"><%= "#" + @issue.project_index %></a>
|
<a href="javascript:void(0)"><%= "#" + @issue.project_index %></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="problem_main">
|
<div class="problem_main">
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
<%=l(:label_project_hosting_platform) %>
|
<%=l(:label_project_hosting_platform) %>
|
||||||
</a>
|
</a>
|
||||||
>
|
>
|
||||||
<%= link_to @project.name, nil %>
|
<%= link_to @project.name, project_path(@project.id) %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="search fl">
|
<div class="search fl">
|
||||||
|
@ -122,13 +122,12 @@
|
||||||
<!-- 项目得分 -->
|
<!-- 项目得分 -->
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div>
|
<div>
|
||||||
<a class="pr_info_name fl c_dark fb break_word" href="javascript:void(0)" target="_blank" >
|
<%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %>
|
||||||
<%= l(:label_project_name) %><%= @project.name %>
|
|
||||||
<% if @project.is_public? %>
|
<% if @project.is_public? %>
|
||||||
<span class="img_private"><%= l(:label_public)%></span>
|
<span class="img_private"><%= l(:label_public)%></span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span class="img_private"><%= l(:label_private)%></span>
|
<span class="img_private"><%= l(:label_private)%></span>
|
||||||
<% end %></a>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -87,7 +87,7 @@ a.pro_mes_w{ height:20px; float:left;display:block; color:#999999;}
|
||||||
.pro_page_top{ font-size:14px; border-bottom:2px solid #64bdd9; margin-bottom:10px; padding-bottom:5px;}
|
.pro_page_top{ font-size:14px; border-bottom:2px solid #64bdd9; margin-bottom:10px; padding-bottom:5px;}
|
||||||
.pro_page_tit{color:#3e4040; font-weight:bold;width:480px; float:left; font-size:14px; margin-bottom:5px;}
|
.pro_page_tit{color:#3e4040; font-weight:bold;width:480px; float:left; font-size:14px; margin-bottom:5px;}
|
||||||
.pro_pic_box{ margin-left:60px; }
|
.pro_pic_box{ margin-left:60px; }
|
||||||
.pro_pic{ width:100px; height:73px;line-height:73px;border:2px solid #CCC; margin:10px 0;}
|
.pro_pic{ width:100px; height:75px;line-height:73px;border:2px solid #CCC; margin:10px 0; text-align: center;}
|
||||||
.pro_info_box{ margin-left:60px; background:#f0fbff; height:80px; padding:10px 0;}
|
.pro_info_box{ margin-left:60px; background:#f0fbff; height:80px; padding:10px 0;}
|
||||||
.pro_info_box ul{}
|
.pro_info_box ul{}
|
||||||
.pro_info_box ul li{ margin-bottom:10px;}
|
.pro_info_box ul li{ margin-bottom:10px;}
|
||||||
|
@ -338,7 +338,6 @@ a:hover.st_add{ color:#ff8e15;}
|
||||||
.newpro_box input{ height:26px; float:left; margin-bottom:10px;}
|
.newpro_box input{ height:26px; float:left; margin-bottom:10px;}
|
||||||
.newpro_box textarea{ height:150px; float:left; margin-bottom:10px;}
|
.newpro_box textarea{ height:150px; float:left; margin-bottom:10px;}
|
||||||
.newpro_box select{ height:29px; float:left; margin-bottom:10px;}
|
.newpro_box select{ height:29px; float:left; margin-bottom:10px;}
|
||||||
.label{ width:80px; text-align:right; font-size:14px; background-image: url(../images/true.png); }
|
|
||||||
.icon-reload { background-image: url(../images/reload.png); }
|
.icon-reload { background-image: url(../images/reload.png); }
|
||||||
.icon {
|
.icon {
|
||||||
background-position: 0% 50%;
|
background-position: 0% 50%;
|
||||||
|
|
Loading…
Reference in New Issue