2012-10-27 08:30:56 +00:00
|
|
|
module ApplicationHelper
|
2015-09-19 12:17:56 +00:00
|
|
|
def get_metacodeset
|
|
|
|
@m = user.settings.metacodes
|
|
|
|
set = @m[0].include?("metacodeset") ? MetacodeSet.find(@m[0].sub("metacodeset-","").to_i) : false
|
|
|
|
return set
|
|
|
|
end
|
|
|
|
|
|
|
|
def user_metacodes
|
|
|
|
@m = user.settings.metacodes
|
|
|
|
set = get_metacodeset
|
|
|
|
if set
|
2015-11-04 09:22:46 +00:00
|
|
|
@metacodes = set.metacodes.to_a
|
2015-09-19 12:17:56 +00:00
|
|
|
else
|
|
|
|
@metacodes = Metacode.where(id: @m).to_a
|
|
|
|
end
|
|
|
|
@metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1)
|
|
|
|
end
|
2012-09-23 02:39:12 +00:00
|
|
|
end
|