Module: People::NumbersHelper
- Defined in:
- app/helpers/people/numbers_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) aa_name(aaid)
-
- (Object) almost_breadcrumbs(path, filterobject)
this is honestly a bit absurd.
- - (Object) link_number_to_userlist(number, options = {}, htmloptions = {})
- - (Object) link_to_item(item, itemtype, filtered)
- - (Object) link_to_object_numbers_action(linkobject)
- - (Object) link_to_userlist(text, options = {}, htmloptions = {})
- - (Object) nilhash_number_with_delimiter(hash, key)
- - (Object) url_for_itemlist(itemlist, filteredparameters, params = {})
Instance Method Details
- (Object) aa_name(aaid)
19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/people/numbers_helper.rb', line 19 def aa_name(aaid) if(aaid.nil? or aaid == 0) return 'all' elsif(aa = ActivityApplication.find(aaid)) return aa.shortname else return 'unknown' end end |
- (Object) almost_breadcrumbs(path, filterobject)
this is honestly a bit absurd
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'app/helpers/people/numbers_helper.rb', line 79 def (path,filterobject) = link_to("Numbers",:controller => '/people/numbers', :action => :index ) if(filterobject.nil?) += " >> " += "#{path.capitalize}" else objectklass = filterobject.class.name objectid = filterobject.id += " >> " += link_to("#{objectklass.pluralize}",:controller => '/people/numbers', :action => objectklass.downcase.pluralize ) if(objectklass.downcase.pluralize != path) += " >> " += link_to("#{filterobject.name}",:controller => '/people/numbers', :action => objectklass.downcase, :id => objectid ) += " >> " += "#{path.capitalize}" else += " >> " += "#{filterobject.name}" end end return end |
- (Object) link_number_to_userlist(number, options = {}, htmloptions = {})
74 75 76 |
# File 'app/helpers/people/numbers_helper.rb', line 74 def link_number_to_userlist(number,={},={}) link_to_userlist(number,.merge({:bycount => true}),={}) end |
- (Object) link_to_item(item, itemtype, filtered)
42 43 44 |
# File 'app/helpers/people/numbers_helper.rb', line 42 def link_to_item(item,itemtype,filtered) return link_by_count(item.usercount,item.name, url_for(:action => itemtype, :id => item.id)) end |
- (Object) link_to_object_numbers_action(linkobject)
29 30 31 32 |
# File 'app/helpers/people/numbers_helper.rb', line 29 def link_to_object_numbers_action(linkobject) urlparams = {:action => :summary, linkobject.class.name.downcase.to_sym => linkobject.id} return link_to(linkobject.name, url_for(urlparams)) end |
- (Object) link_to_userlist(text, options = {}, htmloptions = {})
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/helpers/people/numbers_helper.rb', line 46 def link_to_userlist(text,={},={}) filteredparameters_list = [:community,:forcecacheupdate] filteredparameters_list += Activity.filteredparameters filteredparameters = ParamsFilter.new(filteredparameters_list,params) filter_params = filteredparameters.option_values_hash community = [:community] || nil bycount = ([:bycount].nil? ? false : [:bycount]) if(community) urlparams = {:controller => '/people/communities', :action => :userlist, :id => community.id, :connectiontype => 'joined'} .delete(:communitytype) else urlparams = {:controller => '/people/colleagues', :action => :list} end urlparams.merge!(filteredparameters.option_values_hash) urlparams.merge!() # must be logged in! if(@currentuser.nil?) return "#{text}" else if(bycount) return link_by_count(text,"#{text}",url_for(urlparams),) else return link_to("#{text}",url_for(urlparams),) end end end |
- (Object) nilhash_number_with_delimiter(hash, key)
10 11 12 13 14 15 16 |
# File 'app/helpers/people/numbers_helper.rb', line 10 def nilhash_number_with_delimiter(hash,key) if(hash.blank?) return 0 else return number_with_delimiter(hash[key]) end end |
- (Object) url_for_itemlist(itemlist, filteredparameters, params = {})
34 35 36 37 38 39 40 |
# File 'app/helpers/people/numbers_helper.rb', line 34 def url_for_itemlist(itemlist,filteredparameters,params={}) filter_params = filteredparameters.option_values_hash = {:controller => '/people/numbers', :action => itemlist} .merge!(filter_params) .merge!(params) return url_for() end |