mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-04 20:10:16 +01:00
auto-fill of default tags & contexts from project
This commit is contained in:
parent
48f7f25702
commit
195a58174b
8 changed files with 41 additions and 26 deletions
|
|
@ -130,14 +130,6 @@ class ApplicationController < ActionController::Base
|
|||
RedCloth.new(text).to_html
|
||||
end
|
||||
|
||||
def build_default_project_context_name_map(projects)
|
||||
Hash[*projects.reject{ |p| p.default_context.nil? }.map{ |p| [p.name, p.default_context.name] }.flatten].to_json
|
||||
end
|
||||
|
||||
def build_default_project_tags_map(projects)
|
||||
Hash[*projects.reject{ |p| p.default_tags.nil? }.map{ |p| [p.name, p.default_tags] }.flatten].to_json
|
||||
end
|
||||
|
||||
# Here's the concept behind this "mobile content negotiation" hack: In
|
||||
# addition to the main, AJAXy Web UI, Tracks has a lightweight low-feature
|
||||
# 'mobile' version designed to be suitablef or use from a phone or PDA. It
|
||||
|
|
|
|||
|
|
@ -218,8 +218,6 @@ class ContextsController < ApplicationController
|
|||
@projects = current_user.projects
|
||||
|
||||
@count = @not_done_todos.size
|
||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
||||
@default_project_tags_map = build_default_project_tags_map(@projects).to_json
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,6 @@ class ProjectsController < ApplicationController
|
|||
@down_count = @count + @deferred.size
|
||||
@next_project = current_user.projects.next_from(@project)
|
||||
@previous_project = current_user.projects.previous_from(@project)
|
||||
@default_project_context_name_map = build_default_project_context_name_map(current_user.projects).to_json
|
||||
@default_project_tags_map = build_default_project_tags_map(current_user.projects).to_json
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.m &render_project_mobile
|
||||
|
|
|
|||
|
|
@ -251,8 +251,6 @@ class RecurringTodosController < ApplicationController
|
|||
@xth_day = [['first',1],['second',2],['third',3],['fourth',4],['last',5]]
|
||||
@projects = current_user.projects.find(:all, :include => [:default_context])
|
||||
@contexts = current_user.contexts.find(:all)
|
||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
||||
@default_project_tags_map = build_default_project_tags_map(@projects).to_json
|
||||
end
|
||||
|
||||
def get_recurring_todo_from_param
|
||||
|
|
@ -265,4 +263,4 @@ class RecurringTodosController < ApplicationController
|
|||
recurring_todos.each { |rt| rt.toggle_completion! if rt.todos.not_completed.count == 0}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -358,8 +358,6 @@ class TodosController < ApplicationController
|
|||
@not_done_todos = current_user.deferred_todos
|
||||
@count = @not_done_todos.size
|
||||
@down_count = @count
|
||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
||||
@default_project_tags_map = build_default_project_tags_map(@projects).to_json
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
|
@ -428,10 +426,7 @@ class TodosController < ApplicationController
|
|||
@down_count = @count
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
||||
@default_project_tags_map = build_default_project_tags_map(@projects).to_json
|
||||
}
|
||||
format.html
|
||||
format.m {
|
||||
cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']}
|
||||
render :action => "mobile_tag"
|
||||
|
|
@ -465,8 +460,6 @@ class TodosController < ApplicationController
|
|||
@page_title = "TRACKS::Calendar"
|
||||
|
||||
@projects = current_user.projects.find(:all)
|
||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
||||
@default_project_tags_map = build_default_project_tags_map(@projects).to_json
|
||||
|
||||
due_today_date = Time.zone.now
|
||||
due_this_week_date = Time.zone.now.end_of_week
|
||||
|
|
@ -751,9 +744,6 @@ class TodosController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
||||
@default_project_tags_map = build_default_project_tags_map(@projects).to_json
|
||||
|
||||
render
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue