Skip to content
This repository has been archived by the owner on Jul 31, 2019. It is now read-only.

Commit

Permalink
Use haml templates
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Dec 17, 2013
1 parent be8f5f9 commit f52992d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'opal', :github => 'opal/opal'
gem 'opal-sprockets', :github => 'opal/opal-sprockets'
gem 'opal-jquery', :github => 'opal/opal-jquery'
gem 'vienna', :github => 'opal/vienna'
gem 'opal-haml'
3 changes: 1 addition & 2 deletions app/app.rb
@@ -1,7 +1,7 @@
require 'opal'
require 'jquery'
require 'opal-jquery'
require 'erb'
require 'opal-haml'
require 'vienna'

require 'views/app_view'
Expand All @@ -15,7 +15,6 @@
class Application
def run
@app_view = AppView.new

router.update
end

Expand Down
15 changes: 15 additions & 0 deletions app/templates/footer.haml
@@ -0,0 +1,15 @@
%span#todo-count
%strong= @active
= todo_count

%ul#filters
%li
%a(href="#/") All
%li
%a(href="#/active") Active
%li
%a(href="#/completed") Completed

- if show_completed?
%button#clear-completed
= "Clear completed (#@completed)"
11 changes: 0 additions & 11 deletions app/templates/footer.opalerb

This file was deleted.

6 changes: 6 additions & 0 deletions app/templates/todo.haml
@@ -0,0 +1,6 @@
.view
%input.toggle{type: "checkbox", checked: @todo.completed}
%label= @todo.title
%button.destroy

%input.edit{value: @todo.title}
6 changes: 0 additions & 6 deletions app/templates/todo.opalerb

This file was deleted.

9 changes: 9 additions & 0 deletions app/views/app_view.rb
Expand Up @@ -47,4 +47,13 @@ def render

@footer.html = @template.render(self)
end

def todo_count
prefix = @active == 1 ? 'item' : 'items'
prefix + " left"
end

def show_completed?
@completed > 0
end
end

0 comments on commit f52992d

Please sign in to comment.