-
Notifications
You must be signed in to change notification settings - Fork 0
/
EntriesController.rb
44 lines (36 loc) · 1.11 KB
/
EntriesController.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class EntriesController
def awakeFromNib
@entries ||= []
end
def numberOfRowsInTableView(view)
@entries.size
end
def tableView(view, objectValueForTableColumn:column, row:index)
@entries[index].send column.identifier, column.dataCellForRow(index)
end
def displayEntries(entries)
@entries = entries.map.with_index { |entry, index| Status.new entry, index }
end
def tableView(tableView, heightOfRow:row)
73
end
def tableView(view, willDisplayCell:cell, forTableColumn:column, row:row)
case column.identifier
when "button"
if cell.image.name == "NSUser"
status = @entries[row]
status.download do |data|
status.image = NSImage.alloc.initWithData data
view.reloadDataForRowIndexes NSIndexSet.indexSetWithIndex(row), columnIndexes:NSIndexSet.indexSetWithIndex(0)
end
end
when "text"
cell.setFocusRingType NSFocusRingTypeNone
cell.setAllowsEditingTextAttributes true
cell.setSelectable true
end
end
def tableView(view, shouldTrackCell:cell, forTableColumn:column, row:index)
true
end
end