mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
Added caching properly this time. Caches todo/list page quite well, then list action of context and projects controllers.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@32 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
7776931d69
commit
49b2ad4dc7
8 changed files with 24 additions and 11 deletions
|
|
@ -4,8 +4,7 @@ class ContextController < ApplicationController
|
|||
helper :context
|
||||
model :project
|
||||
before_filter :login_required
|
||||
# caches_action :list, :show
|
||||
|
||||
caches_action :list
|
||||
layout "standard"
|
||||
|
||||
|
||||
|
|
@ -22,6 +21,7 @@ class ContextController < ApplicationController
|
|||
# Parameters from form fields should be passed to create new context
|
||||
#
|
||||
def add_context
|
||||
expire_action(:controller => "context", :action => "list")
|
||||
context = Context.new
|
||||
context.attributes = @params["new_context"]
|
||||
|
||||
|
|
@ -36,6 +36,7 @@ class ContextController < ApplicationController
|
|||
|
||||
|
||||
def edit
|
||||
expire_action(:controller => "context", :action => "list")
|
||||
@context = Context.find(@params['id'])
|
||||
@page_title = "Edit context: #{@context.name.capitalize}"
|
||||
end
|
||||
|
|
@ -70,6 +71,7 @@ class ContextController < ApplicationController
|
|||
# Parameters from form fields are passed to create new action
|
||||
# in the selected context.
|
||||
def add_item
|
||||
expire_action(:controller => "context", :action => "list")
|
||||
item = Todo.new
|
||||
item.attributes = @params["new_item"]
|
||||
|
||||
|
|
@ -89,6 +91,7 @@ class ContextController < ApplicationController
|
|||
# If the context contains actions, you'll get a warning dialogue.
|
||||
# If you choose to go ahead, any actions in the context will also be deleted.
|
||||
def destroy
|
||||
expire_action(:controller => "context", :action => "list")
|
||||
context = Context.find(@params['id'])
|
||||
if context.destroy
|
||||
flash["confirmation"] = "Succesfully deleted context"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class ProjectController < ApplicationController
|
|||
model :todo
|
||||
|
||||
before_filter :login_required
|
||||
# caches_action :list, :show
|
||||
caches_action :list
|
||||
layout "standard"
|
||||
|
||||
# Main method for listing projects
|
||||
|
|
@ -30,6 +30,7 @@ class ProjectController < ApplicationController
|
|||
|
||||
|
||||
def edit
|
||||
expire_action(:controller => "project", :action => "list")
|
||||
@project = Project.find(@params['id'])
|
||||
@page_title = "Edit project: #{@project.name.capitalize}"
|
||||
end
|
||||
|
|
@ -52,6 +53,7 @@ class ProjectController < ApplicationController
|
|||
# Parameters from form fields should be passed to create new project
|
||||
#
|
||||
def add_project
|
||||
expire_action(:controller => "project", :action => "list")
|
||||
project = Project.new
|
||||
project.name = @params["new_project"]["name"]
|
||||
|
||||
|
|
@ -69,6 +71,7 @@ class ProjectController < ApplicationController
|
|||
# Parameters from form fields should be passed to create new item
|
||||
#
|
||||
def add_item
|
||||
expire_action(:controller => "project", :action => "list")
|
||||
item = Todo.new
|
||||
item.attributes = @params["new_item"]
|
||||
|
||||
|
|
@ -85,6 +88,7 @@ class ProjectController < ApplicationController
|
|||
|
||||
|
||||
def destroy
|
||||
expire_action(:controller => "project", :action => "list")
|
||||
project = Project.find( @params['id'] )
|
||||
if project.destroy
|
||||
flash["confirmation"] = "Succesfully deleted project"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class TodoController < ApplicationController
|
|||
model :context, :project
|
||||
|
||||
before_filter :login_required
|
||||
# caches_action :list, :completed
|
||||
caches_action :list, :completed, :completed_archive
|
||||
layout "standard"
|
||||
|
||||
# Main method for listing tasks
|
||||
|
|
@ -54,6 +54,7 @@ class TodoController < ApplicationController
|
|||
# Parameters from form fields should be passed to create new item
|
||||
#
|
||||
def add_item
|
||||
expire_action(:controller => "todo", :action => "list")
|
||||
@item = Todo.new
|
||||
@item.attributes = @params["item"]
|
||||
|
||||
|
|
@ -68,6 +69,7 @@ class TodoController < ApplicationController
|
|||
|
||||
|
||||
def edit
|
||||
expire_action(:controller => "todo", :action => "list")
|
||||
@item = Todo.find(@params['id'])
|
||||
@belongs = @item.project_id
|
||||
@projects = Project.find_all
|
||||
|
|
@ -77,6 +79,7 @@ class TodoController < ApplicationController
|
|||
|
||||
|
||||
def update
|
||||
expire_action(:controller => "todo", :action => "list")
|
||||
@item = Todo.find(@params['item']['id'])
|
||||
@item.attributes = @params['item']
|
||||
if @item.save
|
||||
|
|
@ -90,6 +93,7 @@ class TodoController < ApplicationController
|
|||
|
||||
|
||||
def destroy
|
||||
expire_action(:controller => "todo", :action => "list")
|
||||
item = Todo.find(@params['id'])
|
||||
if item.destroy
|
||||
flash["confirmation"] = "Next action was successfully deleted"
|
||||
|
|
@ -103,6 +107,9 @@ class TodoController < ApplicationController
|
|||
# Toggles the 'done' status of the action
|
||||
#
|
||||
def toggle_check
|
||||
expire_action(:controller => "todo", :action => "list")
|
||||
expire_action(:controller => "todo", :action => "completed")
|
||||
expire_action(:controller => "todo", :action => "completed_archive")
|
||||
item = Todo.find(@params['id'])
|
||||
|
||||
item.toggle!('done')
|
||||
|
|
|
|||
|
|
@ -9,10 +9,9 @@
|
|||
</div><!- End of display_box -->
|
||||
|
||||
<div id="input_box">
|
||||
<h2>Add next action to this context</h2>
|
||||
<%= form_tag( :controller => "context", :action => "add_item") %>
|
||||
<%= hidden_field( "new_item", "context_id", "value" => "#{@context.id}") %>
|
||||
<label for="new_item_description">Next action</label><br />
|
||||
<label for="new_item_description">Next action in this context</label><br />
|
||||
<%= text_field( "new_item", "description" ) %>
|
||||
<br />
|
||||
<label for="new_item_notes">Notes</label><br />
|
||||
|
|
|
|||
|
|
@ -31,6 +31,5 @@ border-color: #FC9 #630 #330 #F96; padding:0px 3px 0px 3px; margin:0px;\">TXT</s
|
|||
</ul>
|
||||
</div>
|
||||
<%= @content_for_layout %>
|
||||
<div id="footer">made with <a href="http://rubyonrails.org">Ruby on Rails</a></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -16,10 +16,9 @@
|
|||
</div><!-- End of display box -->
|
||||
|
||||
<div id="input_box">
|
||||
<h2>Add next action to this project</h2>
|
||||
<%= form_tag( :controller => "project", :action => "add_item") %>
|
||||
<%= hidden_field( "new_item", "project_id", "value" => "#{@project.id}") %>
|
||||
<label for="new_item_description">Next action</label><br />
|
||||
<label for="new_item_description">Next action in this project</label><br />
|
||||
<%= text_field( "new_item", "description" ) %>
|
||||
<br />
|
||||
<label for="new_item_notes">Notes</label><br />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
Dependencies.mechanism = :load
|
||||
ActionController::Base.consider_all_requests_local = true
|
||||
ActionController::Base.perform_caching = false
|
||||
BREAKPOINT_SERVER_PORT = 42531
|
||||
BREAKPOINT_SERVER_PORT = 42531
|
||||
ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::MemoryStore.new
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
Dependencies.mechanism = :require
|
||||
ActionController::Base.consider_all_requests_local = false
|
||||
ActionController::Base.perform_caching = true
|
||||
ActionController::Base.perform_caching = true
|
||||
ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::MemoryStore.new
|
||||
Loading…
Add table
Add a link
Reference in a new issue