Module: HubHelper
- Defined in:
- app/helpers/hub_helper.rb
Instance Method Summary collapse
- #data_card(data) ⇒ Object
- #data_link(data) ⇒ Object
- #hub_json ⇒ Object
-
#task_card(task) ⇒ Object
TODO FIX ON Turbolinks 5.0.
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) content_tag(:div, class: 'data_card') do content_tag(:div, '') + content_tag(: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 |
#data_link(data) ⇒ Object
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_json ⇒ Object
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? content_tag(:div, '', class: 'task_card') { link_to(content_tag(:div, content_tag(:div,'' , class: "task_header status #{task.status}") { content_tag(:div, '') { task.categories.collect{|c| content_tag(:div, c.humanize, class: "categories #{c}", "data-category-#{c}" => 'true', "data-category-#{task.status}" => 'true' ) }.join().html_safe } } + content_tag(:div, '', class: 'task-information') { content_tag(:div, task.name, class: 'task_name') + content_tag(:div, task.description, class: 'task_description') } ),send(task.path), data: { turbolinks: false }, tabindex: 0) + content_tag(:div, '', class: 'fav-link') { favorite_page_link('tasks', task.prefix) } } end |