如何让redmine中问题或论坛中图片附件自动预览
来源:互联网 发布:word软件 编辑:程序博客网 时间:2024/06/05 01:55
最近公司在推行redmine用做项目管理的工具来使用,但是在新增加任务或者论坛消息时候有个问题,新增加图片的话,在查看问题或消息的时候,无法预览,必须点击一次,在新窗口打开,非常费事,所以考虑是不是有什么方法可以解决这个问题,于是就看到了“redmine_lightbox”有相关的代码,于是将之复制到redmine里面,一实验,果然可以,贡献:
修改 app\views\attachments\_links.rhtml这个文件,如果显示全图的话,增加以下代码即可:
<SPAN style="FONT-SIZE: medium"><% images = attachments.select { |a| a.image? } %><% unless images.empty? %><div class='images'><% images.each do |attachment| %><%= link_to image_tag(url_for({:controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename })),{:controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename }, :class => 'lightbox', :rel => 'attachments', :title => "#{attachment.filename}#{ ('-' + attachment.description) unless attachment.description.blank? }" %><% end -%></div><% end -%></SPAN>
如果希望先显示的 预览图片,则需要增加:多了一个参数“width => '180'”180就是你设置的宽度
<SPAN style="FONT-SIZE: medium"><% images = attachments.select { |a| a.image? } %><% unless images.empty? %><div class='images'><% images.each do |attachment| %><%= link_to image_tag(url_for({:controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename }), :width => '180'),{:controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename }, :class => 'lightbox', :rel => 'attachments', :title => "#{attachment.filename}#{ ('-' + attachment.description) unless attachment.description.blank? }" %><% end -%></div><% end -%></SPAN>
- 如何让redmine中问题或论坛中图片附件自动预览
- 如何让redmine中问题或论坛中图片附件自动预览
- Redmine:自动预览附件图片
- 在<table>或<div>中如何让传入的文本自动换行
- 在<table>或<div>中如何让传入的文本自动换行
- 如何让sublime Text 2支持在浏览器中预览
- 如何在博客或论坛中插入公式
- WinForms中如何让Label自动换行
- 如何运用CSS在HTML中让图片自动适应屏幕大小的问题
- AE中如何预览音乐
- 在SQL2008中,如何让id自动生成并自动递增?如何让时间默认生成?
- 让sublime可以在浏览器中预览
- 如何让window服务进程中自动加载MYSQL服务
- Android中如何让Service关闭后又自动启动
- 如何让MFC中listctrl自动填充整个对话框窗口
- 如何让table表格中td的内容自动换行
- 论文中如何让页眉上自动显示章节标题
- 【Wn8中如何关闭或开启自动播放功能】
- 数据库的导入
- 关于WEB项目部署时TOMCAT和JDK的使用的方法
- 给定一个数组,写个程序构造一个最矮的二叉树
- Twitter Storm: DRPC学习
- 《Python 第四章》字典
- 如何让redmine中问题或论坛中图片附件自动预览
- checkbox
- printf 和 scanf
- OnPreferenceChangeListener分析,以及与OnPreferenceClickListener的区别
- 用 document.readyState == "complete" 判断页面是否加载完成
- 游戏程序中的骨骼插件
- case when 用法
- python学习
- UIImageView和UIWebView的详细讲解