Module: HubHelper

Defined in:
app/helpers/hub_helper.rb

Instance Method Summary collapse

Instance Method Details

#data_card(data) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'app/helpers/hub_helper.rb', line 38

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


34
35
36
# File 'app/helpers/hub_helper.rb', line 34

def data_link(data)
  link_to(data.name, data.klass, tabindex: 0)
end

#hub_jsonObject



26
27
28
29
30
31
32
# File 'app/helpers/hub_helper.rb', line 26

def hub_json
  return  {
    tasks: UserTasks.hub_tasks.inject([]){|ary, t| ary.push(t.to_h.merge(path: send(t.path))) ; ary},
    data: Hub::Data::CONFIG_DATA,
    favourites: sessions_current_user.hub_favorites[sessions_current_project_id.to_s]
  }
end

#task_card(task) ⇒ Object

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
24
# File 'app/helpers/hub_helper.rb', line 4

def task_card(task)
  return nil if task.nil?
  (: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 }, tabindex: 0) +
    (:div, '', class: 'fav-link') {
      favorite_page_link('tasks', task.prefix) 
    }       
  }
end