From 589a21204cbbfe96c65a526b9c40bdd5a8f78ef9 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 14 Apr 2014 15:54:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=94=E7=94=A8=E4=B8=8B=E8=BD=BD=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/softapplications_controller.rb | 4 ++++ app/models/attachment.rb | 4 ++++ app/views/softapplications/show.html.erb | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index a1410722f..9ac62f928 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -19,6 +19,10 @@ class SoftapplicationsController < ApplicationController @softapplication.attachments.each do |f| f.image? ? @image_results << f : @image_results end + @app_items = [] + @softapplication.attachments.each do |f| + f.pack? ? @app_items << f : @app_items + end @limit = 10 @feedback_count = @jours.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 8e607a685..919760ee3 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -180,6 +180,10 @@ class Attachment < ActiveRecord::Base !!(self.filename =~ /\.(bmp|gif|jpg|jpe|jpeg|png)$/i) end + def pack? + !!(self.filename =~ /\.(zip|rar|tar|gz)$/i) + end + def thumbnailable? image? end diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index c5ecac2c1..053de150e 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -28,7 +28,12 @@ 系统支持:<%= @softapplication.android_min_version_available %> - 应用下载: + 应用下载: + <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current) } %> + <%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> + + + 开发人员:<%= @softapplication.application_developers %>