mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 00:00:12 +01:00
Try the cache_digests gem for Tracks
cache_digests will be part of Rails 4
This commit is contained in:
parent
8b1fc99b72
commit
8a8dc47ab8
9 changed files with 134 additions and 105 deletions
3
Gemfile
3
Gemfile
|
|
@ -16,6 +16,8 @@ gem "aasm"
|
|||
gem "htmlentities"
|
||||
gem "swf_fu"
|
||||
gem "rails_autolink"
|
||||
gem "cache_digests" #, :git => 'git://github.com/rails/cache_digests.git'
|
||||
gem "rack-mini-profiler"
|
||||
|
||||
# Gems used only for assets and not required
|
||||
# in production environments by default.
|
||||
|
|
@ -44,6 +46,7 @@ group :development do
|
|||
end
|
||||
gem "yard"
|
||||
gem "tolk"
|
||||
gem "bullet"
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
|
|
|||
10
Gemfile.lock
10
Gemfile.lock
|
|
@ -41,6 +41,10 @@ GEM
|
|||
bcrypt-ruby (3.0.1)
|
||||
bluecloth (2.2.0)
|
||||
builder (3.0.0)
|
||||
bullet (4.1.6)
|
||||
uniform_notifier (~> 1.0.0)
|
||||
cache_digests (0.1.0)
|
||||
actionpack (>= 3.2)
|
||||
capybara (1.1.2)
|
||||
mime-types (>= 1.16)
|
||||
nokogiri (>= 1.3.3)
|
||||
|
|
@ -111,6 +115,8 @@ GEM
|
|||
rack (1.4.1)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
rack-mini-profiler (0.1.10)
|
||||
rack (>= 1.1.3)
|
||||
rack-ssl (1.3.2)
|
||||
rack
|
||||
rack-test (0.6.1)
|
||||
|
|
@ -178,6 +184,7 @@ GEM
|
|||
uglifier (1.2.7)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (~> 1.3)
|
||||
uniform_notifier (1.0.2)
|
||||
will_paginate (3.0.3)
|
||||
xpath (0.1.4)
|
||||
nokogiri (~> 1.3)
|
||||
|
|
@ -193,6 +200,8 @@ DEPENDENCIES
|
|||
acts_as_list
|
||||
aruba
|
||||
bcrypt-ruby
|
||||
bullet
|
||||
cache_digests
|
||||
capybara
|
||||
coffee-rails
|
||||
cucumber-rails
|
||||
|
|
@ -203,6 +212,7 @@ DEPENDENCIES
|
|||
jquery-rails
|
||||
mongrel (>= 1.2.0.pre2)
|
||||
mysql2
|
||||
rack-mini-profiler
|
||||
rails
|
||||
rails_autolink
|
||||
sanitize
|
||||
|
|
|
|||
|
|
@ -50,23 +50,20 @@ class ContextsController < ApplicationController
|
|||
@pending = @context.todos.pending.includes(Todo::DEFAULT_INCLUDES)
|
||||
|
||||
@projects = current_user.projects
|
||||
@contexts = current_user.contexts
|
||||
|
||||
@count = @not_done_todos.count + @deferred.count + @pending.count
|
||||
end
|
||||
|
||||
@contexts = current_user.contexts(true)
|
||||
if @context.nil?
|
||||
respond_to do |format|
|
||||
format.html { render :text => 'Context not found', :status => 404 }
|
||||
format.xml { render :xml => '<error>Context not found</error>', :status => 404 }
|
||||
end
|
||||
else
|
||||
@page_title = "TRACKS::Context: #{@context.name}"
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.m &render_context_mobile
|
||||
format.xml { render :xml => @context.to_xml( :except => :user_id ) }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :text => 'Context not found', :status => 404 }
|
||||
format.xml { render :xml => '<error>Context not found</error>', :status => 404 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ class Todo < ActiveRecord::Base
|
|||
after_save :save_predecessors
|
||||
|
||||
# associations
|
||||
belongs_to :context
|
||||
belongs_to :project
|
||||
belongs_to :context, :touch => true
|
||||
belongs_to :project, :touch => true
|
||||
belongs_to :user
|
||||
belongs_to :recurring_todo
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<% @not_done = @not_done_todos.select {|t| t.context_id == context.id } -%>
|
||||
<div id="c<%= context.id %>" class="container context" style="display:<%= (collapsible && @not_done.empty?) ? "none" : "block" %>">
|
||||
<%
|
||||
@not_done = @not_done_todos.select {|t| t.context_id == context.id }
|
||||
cache context do
|
||||
%>
|
||||
<div id="c<%= context.id %>" class="container context" style="display:<%= (collapsible && @not_done.empty?) ? "none" : "block" %>">
|
||||
<h2>
|
||||
<% if collapsible -%>
|
||||
<a href="#" class="container_toggle" id="toggle_c<%= context.id %>"><%= image_tag("collapse.png") %></a>
|
||||
|
|
@ -17,4 +20,5 @@
|
|||
</div>
|
||||
<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "context" } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
<div class="container">
|
||||
<% cache project do %>
|
||||
<div class="container">
|
||||
<h2 id="project_name_container">
|
||||
<% if collapsible -%>
|
||||
<a href="#" class="container_toggle" id="toggle_p<%= project.id %>"><%= image_tag("collapse.png") %></a>
|
||||
|
|
@ -8,9 +9,9 @@
|
|||
<div id="<%= dom_id(project, "container")%>" class="list">
|
||||
<%= render :partial => "projects/project_settings", :object => project, :locals => { :collapsible => collapsible } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="container">
|
||||
<h2><%= t('projects.actions_in_project_title') %></h2>
|
||||
<div id="p<%= project.id %>items" class="items toggle_target">
|
||||
<div id="p<%= project.id %>empty-nd" style="display:<%= @not_done.empty? ? 'block' : 'none'%>;">
|
||||
|
|
@ -18,4 +19,5 @@
|
|||
</div>
|
||||
<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "project" } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
@ -6,8 +6,10 @@ parameters = "_source_view=#{@source_view}"
|
|||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
||||
@z_index_counter = @z_index_counter - 1 # for IE z-index bug
|
||||
@rec_depth ||= 0
|
||||
|
||||
cache successor do
|
||||
%>
|
||||
<div id="<%= dom_id(successor, 'successor') %>" class="item-container">
|
||||
<div id="<%= dom_id(successor, 'successor') %>" class="item-container">
|
||||
<div id="<%= dom_id(successor, 'successor_line') %>">
|
||||
<div class="description<%= staleness_class( successor ) %>" style="margin-left: 20px">
|
||||
<span class="todo.descr"><%= h sanitize(successor.description) %></span>
|
||||
|
|
@ -32,4 +34,5 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
|||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
@ -6,8 +6,10 @@ parameters = "_source_view=#{@source_view}"
|
|||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
||||
@z_index_counter = @z_index_counter - 1 # for IE z-index bug
|
||||
@rec_depth=0 # to prevent stack overflow on large dependency trees, see _successor.html.erb
|
||||
|
||||
cache todo do
|
||||
%>
|
||||
<div id="<%= dom_id(todo) %>" class="item-container">
|
||||
<div id="<%= dom_id(todo) %>" class="item-container">
|
||||
<div id="<%= dom_id(todo, 'line') %>" class="item-show">
|
||||
<%= remote_star_icon(todo) %>
|
||||
<%= remote_toggle_checkbox(todo) %>
|
||||
|
|
@ -42,4 +44,5 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
|||
<% #note: edit form will load here remotely -%>
|
||||
<div class="placeholder"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
7
config/initializers/bullet.rb
Normal file
7
config/initializers/bullet.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# config for bullet gem
|
||||
|
||||
if defined? Bullet
|
||||
Bullet.enable = false
|
||||
Bullet.alert = false
|
||||
Bullet.bullet_logger = true
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue