refactor gender avatar html.erb => helper
This commit is contained in:
parent
26d75af51a
commit
c4bf9a8f72
|
@ -105,6 +105,7 @@ module UsersHelper
|
|||
end
|
||||
content_tag('div', content, :class => "pagination")
|
||||
end
|
||||
|
||||
def user_course(state)
|
||||
content = ''.html_safe
|
||||
if @user != User.current
|
||||
|
@ -206,4 +207,11 @@ def sort_user(state, project_type)
|
|||
content = content_tag('ul', content)
|
||||
content_tag('div', content, :class => "tabs_enterprise")
|
||||
end
|
||||
|
||||
def gender_avatar_uri user
|
||||
img_uri = '/images/sidebar/female.png'
|
||||
return img_uri if user.user_extensions.blank?
|
||||
person_gender = user.user_extensions.gender
|
||||
img_uri = (person_gender == 1) ? '/images/sidebar/female.png' : '/images/sidebar/male.png'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,20 +55,8 @@
|
|||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= h @user.lastname<<@user.firstname %> <!-- added by bai -->
|
||||
<% img_path = '' %>
|
||||
<% unless @user.user_extensions.nil?%>
|
||||
<% unless @user.user_extensions.identity == 2 %>
|
||||
<% if @user.user_extensions.gender == 1 %>
|
||||
<% img_uri = '/images/sidebar/female.png' %>
|
||||
<% else %>
|
||||
<% img_uri = '/images/sidebar/male.png' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% img_uri = '/images/sidebar/female.png' %>
|
||||
<% end %> <!-- end --></td>
|
||||
<%= image_tag(img_uri, weight:"25px", height:"25px") %>
|
||||
<td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= h @user.lastname<<@user.firstname %> <!-- added by bai --></td>
|
||||
<%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"> <% unless User.current == @user %>
|
||||
|
|
Loading…
Reference in New Issue