Merge remote-tracking branch 'origin/develop' into develop

dev_aliyun
杨树明 5 years ago
commit a412dba662

@ -8,6 +8,7 @@ module Mobile
expose :title expose :title
expose :content expose :content
expose :category expose :category
expose :category_name
expose :category_id do |p, _| expose :category_id do |p, _|
p.project_package_category_id p.project_package_category_id
end end

@ -3,8 +3,6 @@ class ProjectPackage < ActiveRecord::Base
acts_as_attachable acts_as_attachable
CATEGORY_VALUES = %w(front backend mobile database cloud_compute_and_big_data devops_and_test ai other)
attr_accessible :title, :content, :project_package_category_id, :deadline_at, :contact_name, :contact_phone, :min_price, :max_price attr_accessible :title, :content, :project_package_category_id, :deadline_at, :contact_name, :contact_phone, :min_price, :max_price
belongs_to :creator, class_name: 'User' belongs_to :creator, class_name: 'User'
@ -57,6 +55,10 @@ class ProjectPackage < ActiveRecord::Base
end end
def category def category
project_package_category.en_name
end
def category_name
project_package_category.name project_package_category.name
end end
@ -91,7 +93,7 @@ class ProjectPackage < ActiveRecord::Base
end end
def category_text def category_text
I18n.t("project_package.category.#{category}") I18n.t("project_package.category.#{category_name}")
end end
def status_text def status_text

@ -1,5 +1,20 @@
class ProjectPackageCategory < ActiveRecord::Base class ProjectPackageCategory < ActiveRecord::Base
default_scope order: 'position asc' default_scope order: 'position asc'
EN_NAMES_MAP = {
1 => 'front',
2 => 'backend',
3 => 'mobile',
4 => 'database',
5 => 'cloud_compute_and_big_data',
6 => 'devops_and_test',
7 => 'ai',
8 => 'other'
}
has_many :project_packages, dependent: :destroy has_many :project_packages, dependent: :destroy
def en_name
EN_NAMES_MAP[id]
end
end end

@ -1,3 +1,8 @@
<%
image_name_map = {
"前端开发" => 'front',
}
%>
<% if @type == 'p_package' && User.current == @user %> <% if @type == 'p_package' && User.current == @user %>
<div class="edu-back-white padding20-30 clearfix secondNav educontent bor-top-greyE"> <div class="edu-back-white padding20-30 clearfix secondNav educontent bor-top-greyE">
<li class="<%= @p == 'a' ? 'active' : '' %>"><%= link_to "全部", user_path(@user, :type => @type), :remote => true %></li> <li class="<%= @p == 'a' ? 'active' : '' %>"><%= link_to "全部", user_path(@user, :type => @type), :remote => true %></li>
@ -49,7 +54,7 @@
</div> </div>
</div> </div>
<div class="item-category"> <div class="item-category">
<div class="item-category-item"><%= object.category_text %></div> <div class="item-category-item"><%= object.category_name %></div>
</div> </div>
<div class="item-other"> <div class="item-other">
<div class="item-group item-other-visit"> <div class="item-group item-other-visit">

Loading…
Cancel
Save