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