Sha256: 68d67c2d13d261337928a47873910693efa51720bab3e00d27870a06eecd1ff5

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 KB

Contents

<%= grid(@tasks_grid) do |g|
  g.after_row do |task, number_of_columns|
    if task.priority == Priority.urgent
      content_tag(:tr,
        content_tag(:td,
          content_tag(:button, "Panic! \"#{task.title}\" is urgent!", class: "btn btn-danger"),
        colspan: number_of_columns),
       class: 'extra-row')
    else
      nil
    end
  end
  g.last_row do |number_of_columns|
    content_tag(:tr,
      content_tag(:td,
        content_tag(:button, "Don't panic", class: "btn btn-info"),
        colspan: 9),
     class: 'last-row')
  end
  g.row_attributes do |task|
    if task.priority == Priority.urgent
      {class: 'urgent'}
    end
  end
  g.column name: 'ID', attribute: 'id', filter: false
  g.column name: 'Title', attribute: 'title'
  g.column name: 'Priority', attribute: 'priority_id', custom_filter: Priority.to_dropdown do |task|
    task.priority.name if task.priority
  end
  g.column name: 'Status', attribute: 'status_id', custom_filter: Status.to_dropdown  do |task|
    task.status.name if task.status
  end
  g.column name: 'Project Name', attribute: 'project_id', custom_filter: Project.to_dropdown do |task|
    task.project.name if task.project
  end
  g.column  name: 'Archived', attribute: 'archived' do |task|
    task.archived? ? 'Yes' : 'No'
  end
  g.column name: 'Added', attribute: 'created_at' do |task|
    task.created_at.to_fs(:short)
  end
  g.column   do |task|
    link_to('Edit', edit_task_path(task))
  end
end
-%>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wice_grid-7.1.4 spec/support/test_app/app/views/adding_rows/_grid.html.erb
wice_grid-7.1.3 spec/support/test_app/app/views/adding_rows/_grid.html.erb
wice_grid-7.1.2 spec/support/test_app/app/views/adding_rows/_grid.html.erb
wice_grid-7.1.1 spec/support/test_app/app/views/adding_rows/_grid.html.erb
wice_grid-7.1.0 spec/support/test_app/app/views/adding_rows/_grid.html.erb