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

Version Path
reactrb-0.8.8 example/todos/app/components/footer.react.rb
reactrb-0.8.7 example/todos/app/components/footer.react.rb
reactrb-0.8.6 example/todos/app/components/footer.react.rb
reactrb-0.8.5 example/todos/app/components/footer.react.rb
reactrb-0.8.4 example/todos/app/components/footer.react.rb
reactrb-0.8.3 example/todos/app/components/footer.react.rb
reactrb-0.8.1 example/todos/app/components/footer.react.rb
reactrb-0.8.0 example/todos/app/components/footer.react.rb
reactrb-0.7.42 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.41 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.40 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.39 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.38 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.36 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.35 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.34 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.33 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.32 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.31 example/todos/app/components/footer.react.rb
reactive-ruby-0.7.30 example/todos/app/components/footer.react.rb