Skip to content

Commit

Permalink
Misc interface updates. Controller and List model changes to support …
Browse files Browse the repository at this point in the history
…new interface updates.
  • Loading branch information
BrittTheIsh committed Jun 9, 2011
1 parent d80c2da commit c242808
Show file tree
Hide file tree
Showing 9 changed files with 853 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
BUNDLE_DISABLE_SHARED_GEMS: "1"
3 changes: 1 addition & 2 deletions app/controllers/tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ class TasksController < ApplicationController
# GET /tasks.xml
def index

@done_tasks = Task.where(:done => true)
@todo = Task.where(:done => false)
@task = Task.new
@lists = List.all
@current_list = @lists.first
@list = List.new

respond_to do |format|
format.html # index.html.erb
Expand Down
5 changes: 5 additions & 0 deletions app/models/list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
class List < ActiveRecord::Base
has_many :tasks

def done_tasks
tasks.where(:done => true)
end

end
5 changes: 2 additions & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@


<%= javascript_include_tag "jquery-1.5.1.min.js" %>
<%= javascript_include_tag "jquery-ui-1.8.13.js" %>

<%= javascript_include_tag "jquery_ujs.js" %>
<%= javascript_include_tag "jquery-ui-1.8.13.js" %>
<%= javascript_include_tag "jquery_ujs.js" %>



Expand Down
52 changes: 29 additions & 23 deletions app/views/tasks/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
<h1>Listing tasks</h1>
<div id='new_task_area'>

<%= simple_form_for(@task) do |f| %>

<%= f.input :name , :label => false %>

<%= f.input :done , :as => :hidden, :input_html => {:value => false }%>

<%= f.input :list_id , :as => :hidden, :input_html => {:value => @current_list.id }%>

<%= f.button :submit %>

<% end %>

</div>

<%= link_to 'New List', new_list_path %>


<div id='tabs'>
<ul>
<% @count = 1%>
Expand All @@ -27,13 +7,33 @@
</li>
<% @count += 1%>
<% end %>
<li>
<a href="#tabs-new-list">New +</a>
</li>
</ul>


<% @count = 1%>
<% @lists.each do |list| %>

<div id='tabs-<%= @count %>'>
<div id='tabs-<%= @count %>' class="tab">

<div class="new-task">
<%= simple_form_for(@task) do |f| %>

<%= f.input :done , :as => :hidden, :input_html => {:value => false }%>
<%= f.input :list_id , :as => :hidden, :input_html => {:value => list.id }%>

<div class="task-input">
<%= f.input :name , :label => false, :placeholder => "Enter a new task" %>
</div>
<div class="task-button">
<%= f.button :submit %>
</div>

<% end %>
</div>


<ul id='todo_list'>
<% list.tasks.each do |task| %>
Expand All @@ -54,9 +54,9 @@
<% end %>
</ul>

--Completed--
<h2>Finished</h2>
<ul>
<% @done_tasks.each do |task| %>
<% list.done_tasks.each do |task| %>
<li><%= task.name %> </li>
<% end %>
</ul>
Expand All @@ -66,6 +66,12 @@

<%end%>


<div id="tabs-new-list">
<%= render :partial => '/lists/form' %>
</div>


</div>


Expand Down
Binary file modified db/development.sqlite3
Binary file not shown.
804 changes: 804 additions & 0 deletions log/development.log

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions public/stylesheets/core.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
h1,h2,h3,h4,h5,h6 { font-weight:normal; letter-spacing:-1px;}
ul, ol {margin:0; padding:0; list-style-position:inside;}

#tabs div.new-task {overflow:auto;}
#tabs div.new-task form {overflow:auto;}
#tabs div.new-task form div.task-input {float:left; width:80%;}
#tabs div.new-task form div.task-button {float:right; width:18%;}

#tabs div.new-task form div.task-input input {width:100%;}
2 changes: 1 addition & 1 deletion tmp/pids/server.pid
Original file line number Diff line number Diff line change
@@ -1 +1 @@
36667
23111

0 comments on commit c242808

Please sign in to comment.