Module: Capybarista::Extensions::Session
Instance Method Summary collapse
-
#new_label_list ⇒ Object
this method returns a list of labels that are sorted from bottom up, right to left.
Methods included from Base
Instance Method Details
#new_label_list ⇒ Object
this method returns a list of labels that are sorted from bottom up, right to left
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/capybarista/extensions.rb', line 55 def new_label_list fields = all_fields(visible:true).map{|f| {f: f, pos: f.top_left} } list_of_lists = fields.map{ |i| i[:pos] } sorted_list = list_of_lists.sort {|item1, item2| item2[1]<=>item1[1]} labels_list = Array.new sorted_list.each do |item| label = fields.find { |h| h[:pos] == item }[:f] labels_list.push(label) end labels_list end |