Module: People::ColleaguesHelper
- Defined in:
- app/helpers/people/colleagues_helper.rb
Overview
COPYRIGHT:
Copyright (c) 2005-2009 North Carolina State University
Developed with funding for the National eXtension Initiative.
LICENSE:
BSD(-compatible)
see LICENSE file or view at http://about.extension.org/wiki/LICENSE
Instance Method Summary (collapse)
- - (Object) colleague_community_connection_link(container, community, showuser, label, connectaction, title, confirm = nil)
- - (Object) colleague_community_connection_links(container, community, showuser, connectaction)
- - (Object) makeusercsvstring(user)
Instance Method Details
- (Object) colleague_community_connection_link(container, community, showuser, label, connectaction, title, confirm = nil)
40 41 42 43 44 45 46 47 48 49 |
# File 'app/helpers/people/colleagues_helper.rb', line 40 def colleague_community_connection_link(container,community,showuser,label,connectaction,title,confirm = nil) = {:controller => '/people/colleagues', :action => :modify_community_connection, :id => showuser.id, :communityid => community.id } .merge!({:connectaction => connectaction}) progress = "<img src='/images/common/ajax-loader-white.gif' /> Saving..." loading = update_page{|p| p.replace_html(container,progress)} = {:url => , :loading => loading} .merge!({:confirm => confirm}) if(!confirm.nil?) = {:title => title} return link_to_remote(label,,) end |
- (Object) colleague_community_connection_links(container, community, showuser, connectaction)
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'app/helpers/people/colleagues_helper.rb', line 51 def colleague_community_connection_links(container,community,showuser,connectaction) remove_leader_link = colleague_community_connection_link(container,community,showuser,(community.is_institution? ? 'remove from inst. team' : 'remove leadership'),'removeleader',(community.is_institution? ? 'Remove from the Institutional Team' : 'Remove user from leadership')) remove_member_link = colleague_community_connection_link(container,community,showuser,'remove','removemember',"Remove user from this community","Are you sure you want to remove this person from the community?") add_member_link = colleague_community_connection_link(container,community,showuser,'make member','addmember',"Make user a member") add_leader_link = colleague_community_connection_link(container,community,showuser,(community.is_institution? ? 'add to inst. team' : 'make leader'),'addleader',(community.is_institution? ? 'Add to Institutional Team' : 'Make user a community leader')) sendagain_invite_link = colleague_community_connection_link(container,community,showuser,'send again','invitereminder',"Send an invitation reminder") rescind_invite_link = colleague_community_connection_link(container,community,showuser,'rescind','rescindinvitation',"Rescind community invitation","Are you sure you want rescind this invitation?") invite_member_link = colleague_community_connection_link(container,community,showuser,'invite as member','invitemember',"Invite user to be a community member") # special cases if(connectaction == 'invitereminder') returnstring = 'Sent Reminder' else connection = showuser.connection_with_community(community) case connection when 'invitedleader' returnstring = "#{rescind_invite_link} #{sendagain_invite_link} #{add_leader_link}" when 'invitedmember' returnstring = "#{rescind_invite_link} #{sendagain_invite_link} #{add_member_link}" when 'wantstojoin' returnstring = "#{add_member_link}" when 'interest' returnstring = "#{invite_member_link}" when 'leader' returnstring = "#{remove_leader_link}" when 'member' returnstring = "#{add_leader_link} #{remove_member_link}" when 'none' returnstring = '' else returnstring = '' end end returnstring end |
- (Object) makeusercsvstring(user)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/helpers/people/colleagues_helper.rb', line 10 def makeusercsvstring(user) #eXtensionID,First Name,Last Name,Email,Title,Position,Institution,Affiliation,Location,County,Agreement Status,Account Created csvstring = user.login+',' csvstring += user.first_name.tr(',',' ')+',' csvstring += user.last_name.tr(',',' ')+',' csvstring += user.email+',' csvstring += ((user.phonenumber.nil? or user.phonenumber == '') ? 'not specified' : number_to_phone(user.phonenumber,:area_code => true))+',' csvstring += ((user.title.nil? or user.title == '') ? 'not specified' : user.title.tr(',',' '))+',' csvstring += ((user.position.nil? or user.position == '') ? 'not specified' : user.position.name.tr(',',' '))+',' csvstring += user.primary_institution_name.tr(',',' ')+',' csvstring += ((user.affiliation.blank?) ? 'not specified' : user.affiliation.tr(',',' '))+',' csvstring += ((user.location.nil? or user.location == '') ? 'not specified' : user.location.name.tr(',',' '))+',' csvstring += ((user.county.nil? or user.county == '') ? 'not specified' : user.county.name.tr(',',' '))+',' if !user.contributor_agreement.nil? if user.contributor_agreement csvstring += 'Accepted' else csvstring += 'Did Not Accept' end else csvstring += 'Not Yet Reviewed' end csvstring += ',' csvstring += user.created_at.strftime("%Y/%m/%d %H:%M:%S") return csvstring end |