Sha256: 1826fa3c3ec71e11c5f35697dfa632376f460e4c559569683d137dc0d0561c6f
Contents?: true
Size: 880 Bytes
Versions: 52
Compression:
Stored size: 880 Bytes
Contents
class Footer include React::Component def clear_completed Todo.completed.each { |t| t.destroy } end def render footer(id: "footer") do span(id: "todo-count") do strong { Todo.active.size } span { Todo.active.size == 1 ? ' item left' : ' items left' } end ul(id: "filters") do filters = [{href: "#/", filter: "all"}, {href: "#/active", filter: "active"}, {href: "#/completed", filter: "completed"}] filters.map do |item| li { a(href: item[:href], class_name: {selected: params[:selected_filter] == item[:filter]}) { item[:filter].capitalize } } end end completed = Todo.completed.size if completed > 0 button(id: "clear-completed") { "Clear completed (#{completed})" }.on(:click) { clear_completed } end end end end
Version data entries
52 entries across 52 versions & 3 rubygems