Merge branch 'szzh' into develop

This commit is contained in:
yanxd 2014-05-20 15:56:51 +08:00
commit c4bd9aaabd
6 changed files with 24 additions and 9 deletions

View File

@ -182,11 +182,27 @@ module ApplicationHelper
end end
def thumbnail_tag(attachment) def thumbnail_tag(attachment)
link_to image_tag(thumbnail_path(attachment)), imagepath = named_attachment_path(attachment, attachment.filename)
named_attachment_path(attachment, attachment.filename), link_to image_tag(imagepath),
imagepath ,
:title => attachment.filename :title => attachment.filename
end end
# 图片缩略图链接
def thumbnail_small_tag(attachment)
imagesize = attachment.thumbnail(:size => "200*200")
imagepath = named_attachment_path(attachment, attachment.filename)
if imagesize
link_to image_tag(imagesize),
imagepath,
:title => attachment.filename
else
link_to image_tag(imagepath , height: '200', width: '250'),
imagepath,
:title => attachment.filename
end
end
def toggle_link(name, id, options={}) def toggle_link(name, id, options={})
onclick = "$('##{id}').toggle(); " onclick = "$('##{id}').toggle(); "
onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ") onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ")

View File

@ -228,7 +228,6 @@ class Attachment < ActiveRecord::Base
end end
size = 100 unless size > 0 size = 100 unless size > 0
target = File.join(self.class.thumbnails_storage_path, "#{id}_#{digest}_#{size}.thumb") target = File.join(self.class.thumbnails_storage_path, "#{id}_#{digest}_#{size}.thumb")
begin begin
Redmine::Thumbnail.generate(self.diskfile, target, size) Redmine::Thumbnail.generate(self.diskfile, target, size)
rescue => e rescue => e

View File

@ -33,7 +33,7 @@
<% if images.any? %> <% if images.any? %>
<div class="thumbnails"> <div class="thumbnails">
<% images.each do |attachment| %> <% images.each do |attachment| %>
<div><%= thumbnail_tag(attachment) %></div> <div><%= thumbnail_small_tag(attachment) %></div>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>

View File

@ -110,8 +110,7 @@
<%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %> <%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %>
</td> </td>
<td class="comments"> <td class="comments">
<div class="reply_content" ><%=h reply.content.html_safe %></div> <div class="reply_content" ><%=h sanitize(reply.content.html_safe) %></div>
<!-- <div class="wiki">< %=h reply.content.html_safe %></div> -->
<p> <p>
<% if reply.attachments.any?%> <% if reply.attachments.any?%>
<% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %> <% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %>
@ -144,6 +143,7 @@
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
transpotUrl('#main'); transpotUrl('.lz');
transpotUrl('.replies');
}); });
</script> </script>

View File

@ -45,7 +45,7 @@
<%= content_tag('span', l(:label_x_data,:count => files_count)) %> <%= content_tag('span', l(:label_x_data,:count => files_count)) %>
</p> </p>
<p class="stats"> <p class="stats">
<%= content_tag('span', link_to("#{@project.members.count}", member_project_path(@project)), :class => "info") %> <%= content_tag('span', "#{@project.members.count}", :class => "info") %>
<%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %> <%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>
</p> </p>

View File

@ -12,7 +12,7 @@
<% end %> <% end %>
<% else %> <% else %>
<p> <p>
<span><%=l(:label_course_doing)%>(<%=@memberships_doing.count%>)</span> <span><%=l(:label_course_doing)%>(<%=@memberships_doing.count%>)</span>
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' if @user == User.current %> <%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' if @user == User.current %>
</p> </p>
<p> <p>