dev_aliyun
daiao 5 years ago
commit bd44bb9e5a

@ -17,8 +17,8 @@ module Mobile
expose :bidding_users_count, if: { type: :index } expose :bidding_users_count, if: { type: :index }
expose :min_price expose :min_price
expose :max_price expose :max_price
expose :contact_name, 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].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, _| expose :updated_at do |package, _|
package.updated_at.strftime('%Y-%m-%d %H:%M:%S') package.updated_at.strftime('%Y-%m-%d %H:%M:%S')
@ -65,6 +65,7 @@ module Mobile
expose :operation, if: { type: :show } do |package, opts| expose :operation, if: { type: :show } do |package, opts|
user = opts[:user] user = opts[:user]
return {} if user.blank?
is_creator = user.id == package.creator_id is_creator = user.id == package.creator_id
is_admin = user.admin? || user.business? is_admin = user.admin? || user.business?

@ -4381,7 +4381,7 @@ module ApplicationHelper
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
course = attachment.container.courses.first course = attachment.container.courses.first
candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1) 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 candown = true
elsif attachment.container_type == "ProjectPackage" #教学案例允许下载 elsif attachment.container_type == "ProjectPackage" #教学案例允许下载
candown = true candown = true

@ -2,7 +2,7 @@
<% if @libraries.present? %> <% if @libraries.present? %>
<% @libraries.each do |library| %> <% @libraries.each do |library| %>
<li class="library_list_item"> <li class="library_list_item">
<% 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') %> <%= image_tag(image_url, width: 120, height: 90, class: 'mr15 mt3 radius4') %>
<div class="flex1"> <div class="flex1">
<p class="clearfix mb15 lineh-40 mt10"> <p class="clearfix mb15 lineh-40 mt10">

Loading…
Cancel
Save