Class: UserPresenter
- Inherits:
-
BasePresenter
- Object
- BasePresenter
- UserPresenter
- Defined in:
- app/presenters/user_presenter.rb
Instance Attribute Summary
Attributes inherited from BasePresenter
Instance Method Summary (collapse)
- - (Object) admin_buttons
- - (Object) authentication_icons
- - (Object) avatar
- - (Object) header
- - (Object) location
- - (Object) summary
Methods inherited from BasePresenter
Constructor Details
This class inherits a constructor from BasePresenter
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BasePresenter
Instance Method Details
- (Object) admin_buttons
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/presenters/user_presenter.rb', line 46 def if user_signed_in? && current_user.role?(:maintainer) content_tag( :p, ( 'details', I18n.translate("userlist.detail"), details_user_path(user), :remote => true) + ( 'edit', I18n.translate(:edit_role), edit_role_user_path(user)) + ( 'cancel', I18n.translate(:cancel_this_account), user_path(user), :confirm => t(:sure?), :method => :delete) ) + content_tag( :div, :class=>'user_detail admin', :id => "user_information_#{ user.id.to_s }", :style => 'display: none; margin-top: 20px') {''} end end |
- (Object) authentication_icons
36 37 38 39 40 41 42 43 44 |
# File 'app/presenters/user_presenter.rb', line 36 def authentication_icons if user.authentications.any? content_tag( :p, :style => 'margin-left: -140px; clear: both;' ) { user.authentications.map { |a| image_tag("/images/#{a.provider}_thirtytwo.png",:class => 'omniauth_mini_icons') }.join().html_safe }.html_safe end end |
- (Object) avatar
14 15 16 17 18 19 20 |
# File 'app/presenters/user_presenter.rb', line 14 def avatar link_to_function( image_tag( w3c_url(user.avatar_url(:thumb) )), "image_popup('#{w3c_url(user.avatar_url(:popup))}')", :class => 'avatar' ) end |
- (Object) header
22 23 24 25 26 27 |
# File 'app/presenters/user_presenter.rb', line 22 def header content_tag( :address, :id=>"user_roles_#{user.name}") { user.role.to_s.humanize + ", " + I18n.translate(:last_login_at,:time => distance_of_time_in_words(Time.now(),user.last_sign_in_at||Time.at(0))) } end |
- (Object) location
5 6 7 8 9 10 11 12 |
# File 'app/presenters/user_presenter.rb', line 5 def location unless user.location_token.blank? content_tag :div, :class => 'user-location', :id => user.id.to_s do user.location_token javascript_tag "loadUserLocation('#{user.id.to_s}','#{user.location_token}');" end end end |
- (Object) summary
29 30 31 32 33 34 |
# File 'app/presenters/user_presenter.rb', line 29 def summary content_tag :div, :style => 'display: block-inline; margin-left: 140px;' do content_tag :b, link_to( user.name, user ) content_tag :p, authentication_icons end end |