Module: HubHelper

Defined in:
app/helpers/hub_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) data_card(data)



29
30
31
32
33
34
35
36
# File 'app/helpers/hub_helper.rb', line 29

def data_card(data)
  (:div, class:  ['data_card', data.shared_css, data.application_css].flatten.join(' ')) do  
    (:div, "", 
                data.categories.inject({}){|hsh,c| hsh.merge!("data-category-#{c}" => "true") }.merge(class: [:filter_data, "#{data.status}"], "data-category-#{data.status}" => "true")
               ) + 
      data_link(data) 
  end
end


25
26
27
# File 'app/helpers/hub_helper.rb', line 25

def data_link(data)
  link_to(data.name, data.klass)
end

- (Object) task_card(task)

TODO FIX ON Turbolinks 5.0



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/hub_helper.rb', line 4

def task_card(task)
  (:div, '', class: 'task_card') { 
    link_to((:div,
      (:div,'' , class: "task_header status #{task.status}") {
        (:div, '') {
          task.categories.collect{|c| 
            (:div, c.humanize, class: "categories #{c}", "data-category-#{c}" => "true", "data-category-#{task.status}" => "true" )
          }.join().html_safe 
        } 
      } +      
      (:div, '', class: 'task-information') {
        (:div, task.name, class: 'task_name') +
        (:div, task.description, class: 'task_description') 
      }
    ),send(task.path), data: { turbolinks: false }) +
    (:div, '', class: 'fav-link') {
          favorite_page_link('tasks', task.prefix) 
    }       
  }
end