From a89d34cc5f8740ba3b7f7ed3b47b49852134fb7a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 17 Jul 2019 19:05:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- app/views/libraries/_library_list.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3145308c..39298061 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4381,7 +4381,7 @@ module ApplicationHelper elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses course = attachment.container.courses.first candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1) - elsif attachment.container_type == "Library" || attachment.container.class.to_s == "Library" #教学案例允许下载 + elsif attachment.container_type == "Library" #教学案例允许下载 candown = true elsif attachment.container_type == "ProjectPackage" #教学案例允许下载 candown = true diff --git a/app/views/libraries/_library_list.html.erb b/app/views/libraries/_library_list.html.erb index 2b142b44..fc0e6e62 100644 --- a/app/views/libraries/_library_list.html.erb +++ b/app/views/libraries/_library_list.html.erb @@ -2,7 +2,7 @@ <% if @libraries.present? %> <% @libraries.each do |library| %>
  • - <% image_url = library.cover.present? ? named_attachment_path(library.cover.id, library.cover.filename) : 'educoder/library-default-cover.png' %> + <% image_url = library.cover.present? ? download_attachment_path(library.cover.id) : 'educoder/library-default-cover.png' %> <%= image_tag(image_url, width: 120, height: 90, class: 'mr15 mt3 radius4') %>

    From f300ff1ae0341815d9dda98fdddab6ebfb8f8887 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 17 Jul 2019 19:07:03 +0800 Subject: [PATCH 2/2] fix not method id --- app/api/mobile/entities/project_package.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/entities/project_package.rb b/app/api/mobile/entities/project_package.rb index 278e9b85..50d4ff69 100644 --- a/app/api/mobile/entities/project_package.rb +++ b/app/api/mobile/entities/project_package.rb @@ -17,8 +17,8 @@ module Mobile expose :bidding_users_count, if: { type: :index } expose :min_price expose :max_price - expose :contact_name, if: ->(package, opts){ opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business? } - expose :contact_phone, if: ->(package, opts){ opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business? } + expose :contact_name, if: ->(package, opts){ opts[:user].present? && (opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business?) } + expose :contact_phone, if: ->(package, opts){ opts[:user].present? && (opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business?) } expose :updated_at do |package, _| package.updated_at.strftime('%Y-%m-%d %H:%M:%S') @@ -65,6 +65,7 @@ module Mobile expose :operation, if: { type: :show } do |package, opts| user = opts[:user] + return {} if user.blank? is_creator = user.id == package.creator_id is_admin = user.admin? || user.business?