mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-15 19:58:08 +01:00
Remove trailing whitespace and tabs
This commit is contained in:
parent
863d780ad0
commit
aa41e20e46
84 changed files with 407 additions and 407 deletions
|
|
@ -276,7 +276,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def done_todos_for(object)
|
||||
object_name = object.class.name.downcase # context or project
|
||||
@source_view = "done"
|
||||
@source_view = "done"
|
||||
eval("@#{object_name} = object")
|
||||
@page_title = t("#{object_name.pluralize}.completed_tasks_title", "#{object_name}_name".to_sym => object.name)
|
||||
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ class ContextsController < ApplicationController
|
|||
format.autocomplete &render_autocomplete
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
set_context_from_params
|
||||
|
||||
|
||||
unless @context.nil?
|
||||
@max_completed = current_user.prefs.show_number_completed
|
||||
@done = @context.todos.completed.limit(@max_completed).reorder("todos.completed_at DESC, todos.created_at DESC").includes(Todo::DEFAULT_INCLUDES)
|
||||
|
|
@ -42,7 +42,7 @@ class ContextsController < ApplicationController
|
|||
|
||||
@deferred_todos = @context.todos.deferred.includes(Todo::DEFAULT_INCLUDES)
|
||||
@pending_todos = @context.todos.pending.includes(Todo::DEFAULT_INCLUDES)
|
||||
|
||||
|
||||
@projects = current_user.projects
|
||||
@contexts = current_user.contexts
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ class ContextsController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
if params[:format] == 'application/xml' && params['exception']
|
||||
render_failure "Expected post format is valid xml like so: <context><name>context name</name></context>.", 400
|
||||
|
|
@ -95,7 +95,7 @@ class ContextsController < ApplicationController
|
|||
|
||||
@context.attributes = context_params
|
||||
@saved = @context.save
|
||||
@state_saved = set_state_for_update(@new_state)
|
||||
@state_saved = set_state_for_update(@new_state)
|
||||
@saved = @saved && @state_saved
|
||||
|
||||
if @saved
|
||||
|
|
@ -215,7 +215,7 @@ class ContextsController < ApplicationController
|
|||
render
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def render_autocomplete
|
||||
lambda do
|
||||
render :text => for_autocomplete(current_user.contexts, params[:term])
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
class DataController < ApplicationController
|
||||
|
||||
|
||||
require 'csv'
|
||||
|
||||
|
||||
def index
|
||||
@page_title = "TRACKS::Export"
|
||||
end
|
||||
|
||||
def import
|
||||
|
||||
|
||||
end
|
||||
|
||||
def csv_map
|
||||
if params[:file].blank?
|
||||
flash[:notice] = "File can't be blank"
|
||||
redirect_to :back
|
||||
else
|
||||
else
|
||||
@import_to = params[:import_to]
|
||||
|
||||
begin
|
||||
begin
|
||||
#get column headers and format as [['name', column_number]...]
|
||||
i = -1
|
||||
@headers = import_headers(params[:file].path).collect { |v| [v, i+=1] }
|
||||
@headers.unshift ['',i]
|
||||
@headers.unshift ['',i]
|
||||
rescue Exception => e
|
||||
flash[:error] = "Invalid CVS: could not read headers: #{e}"
|
||||
redirect_to :back
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
#save file for later
|
||||
begin
|
||||
uploaded_file = params[:file]
|
||||
|
|
@ -85,12 +85,12 @@ class DataController < ApplicationController
|
|||
def export
|
||||
# Show list of formats for export
|
||||
end
|
||||
|
||||
|
||||
# Thanks to a tip by Gleb Arshinov
|
||||
# <http://lists.rubyonrails.org/pipermail/rails/2004-November/000199.html>
|
||||
def yaml_export
|
||||
all_tables = {}
|
||||
|
||||
|
||||
all_tables['todos'] = current_user.todos.includes(:tags).load
|
||||
all_tables['contexts'] = current_user.contexts.load
|
||||
all_tables['projects'] = current_user.projects.load
|
||||
|
|
@ -114,12 +114,12 @@ class DataController < ApplicationController
|
|||
all_tables['taggings'] = taggings.load
|
||||
all_tables['notes'] = current_user.notes.load
|
||||
all_tables['recurring_todos'] = current_user.recurring_todos.load
|
||||
|
||||
|
||||
result = all_tables.to_yaml
|
||||
result.gsub!(/\n/, "\r\n") # TODO: general functionality for line endings
|
||||
send_data(result, :filename => "tracks_backup.yml", :type => 'text/plain')
|
||||
end
|
||||
|
||||
|
||||
# export all actions as csv
|
||||
def csv_actions
|
||||
content_type = 'text/csv'
|
||||
|
|
@ -163,7 +163,7 @@ class DataController < ApplicationController
|
|||
end
|
||||
send_data(result, :filename => "notes.csv", :type => content_type)
|
||||
end
|
||||
|
||||
|
||||
def xml_export
|
||||
todo_tag_ids = Tag.find_by_sql([
|
||||
"SELECT DISTINCT tags.id "+
|
||||
|
|
@ -191,7 +191,7 @@ class DataController < ApplicationController
|
|||
result << "</tracks_data>"
|
||||
send_data(result, :filename => "tracks_data.xml", :type => 'text/xml')
|
||||
end
|
||||
|
||||
|
||||
def yaml_form
|
||||
# Draw the form to input the YAML text data
|
||||
end
|
||||
|
|
@ -206,7 +206,7 @@ class DataController < ApplicationController
|
|||
end
|
||||
|
||||
def yaml_import
|
||||
raise "YAML loading is disabled"
|
||||
raise "YAML loading is disabled"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,27 +4,27 @@ class FeedlistController < ApplicationController
|
|||
|
||||
def index
|
||||
@page_title = 'TRACKS::Feeds'
|
||||
|
||||
|
||||
unless mobile?
|
||||
init_data_for_sidebar
|
||||
else
|
||||
@projects = current_user.projects
|
||||
@contexts = current_user.contexts
|
||||
end
|
||||
|
||||
|
||||
@active_projects = current_user.projects.active
|
||||
@hidden_projects = current_user.projects.hidden
|
||||
@completed_projects = current_user.projects.completed
|
||||
|
||||
|
||||
@active_contexts = current_user.contexts.active
|
||||
@hidden_contexts = current_user.contexts.hidden
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.m
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_feeds_for_context
|
||||
get_feeds_for(@context = current_user.contexts.find(params[:context_id]))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
class IntegrationsController < ApplicationController
|
||||
require 'mail'
|
||||
|
||||
|
||||
skip_before_filter :login_required, :only => [:cloudmailin, :search_plugin, :google_gadget]
|
||||
|
||||
|
||||
def index
|
||||
@page_title = 'TRACKS::Integrations'
|
||||
end
|
||||
|
||||
|
||||
def rest_api
|
||||
@page_title = 'TRACKS::REST API Documentation'
|
||||
end
|
||||
|
||||
|
||||
def get_quicksilver_applescript
|
||||
get_applescript('quicksilver_applescript')
|
||||
end
|
||||
|
|
@ -31,20 +31,20 @@ class IntegrationsController < ApplicationController
|
|||
def google_gadget
|
||||
render :layout => false, :content_type => Mime::XML
|
||||
end
|
||||
|
||||
|
||||
def cloudmailin
|
||||
if !verify_cloudmailin_signature
|
||||
render :text => "Message signature verification failed.", :status => 403
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
if process_message(params[:message])
|
||||
render :text => 'success', :status => 200
|
||||
else
|
||||
render :text => "No user found or other error", :status => 404
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def process_message(message)
|
||||
|
|
@ -56,10 +56,10 @@ class IntegrationsController < ApplicationController
|
|||
signature = Digest::MD5.hexdigest(request.request_parameters.sort{|a,b| a[0].to_s <=> b[0].to_s}.map{|k,v| v}.join + SITE_CONFIG['cloudmailin'])
|
||||
return provided == signature
|
||||
end
|
||||
|
||||
|
||||
def get_applescript(partial_name)
|
||||
context = current_user.contexts.find params[:context_id]
|
||||
render :partial => partial_name, :locals => { :context => context }
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class NotesController < ApplicationController
|
|||
def destroy
|
||||
@note = current_user.notes.find(params['id'])
|
||||
@note.destroy
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js { @down_count = current_user.notes.size }
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ private
|
|||
|
||||
def prefs_params
|
||||
params.require(:prefs).permit(
|
||||
:date_format, :week_starts, :show_number_completed,
|
||||
:show_completed_projects_in_sidebar, :show_hidden_contexts_in_sidebar,
|
||||
:staleness_starts, :due_style, :locale, :title_date_format, :time_zone,
|
||||
:show_hidden_projects_in_sidebar, :show_project_on_todo_done,
|
||||
:review_period, :refresh, :verbose_action_descriptors,
|
||||
:date_format, :week_starts, :show_number_completed,
|
||||
:show_completed_projects_in_sidebar, :show_hidden_contexts_in_sidebar,
|
||||
:staleness_starts, :due_style, :locale, :title_date_format, :time_zone,
|
||||
:show_hidden_projects_in_sidebar, :show_project_on_todo_done,
|
||||
:review_period, :refresh, :verbose_action_descriptors,
|
||||
:mobile_todos_per_page, :sms_email, :sms_context_id)
|
||||
end
|
||||
|
||||
|
|
@ -52,5 +52,5 @@ private
|
|||
notify :notice, t('preferences.updated')
|
||||
redirect_to :action => 'index'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class ProjectsController < ApplicationController
|
|||
def set_reviewed
|
||||
@project.last_reviewed = Time.zone.now
|
||||
@project.save
|
||||
|
||||
|
||||
case @source_view
|
||||
when "project"
|
||||
redirect_to :action => 'show'
|
||||
|
|
@ -219,7 +219,7 @@ class ProjectsController < ApplicationController
|
|||
update_state_counts
|
||||
init_data_for_sidebar
|
||||
init_project_hidden_todo_counts(['project'])
|
||||
|
||||
|
||||
template = 'projects/update'
|
||||
|
||||
# TODO: are these params ever set? or is this dead code?
|
||||
|
|
@ -318,7 +318,7 @@ class ProjectsController < ApplicationController
|
|||
@show_hidden_projects = @hidden_projects_count > 0
|
||||
@show_completed_projects = @completed_projects_count > 0
|
||||
end
|
||||
|
||||
|
||||
def set_project_from_params
|
||||
@project = current_user.projects.find_by_params(params)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ class RecurringTodosController < ApplicationController
|
|||
@recurring_todo = builder.saved_recurring_todo
|
||||
todo_saved = TodoFromRecurringTodo.new(current_user, @recurring_todo).create.nil? == false
|
||||
|
||||
@status_message =
|
||||
t('todos.recurring_action_saved') + " / " +
|
||||
@status_message =
|
||||
t('todos.recurring_action_saved') + " / " +
|
||||
t("todos.new_related_todo_#{todo_saved ? "" : "not_"}created_short")
|
||||
|
||||
@down_count = current_user.recurring_todos.active.count
|
||||
|
|
@ -144,30 +144,30 @@ class RecurringTodosController < ApplicationController
|
|||
def recurring_todo_params
|
||||
params.require(:recurring_todo).permit(
|
||||
# model attributes
|
||||
:context_id, :project_id, :description, :notes, :state, :start_from,
|
||||
:ends_on, :end_date, :number_of_occurences, :occurences_count, :target,
|
||||
:show_from_delta, :recurring_period, :recurrence_selector, :every_other1,
|
||||
:every_other2, :every_other3, :every_day, :only_work_days, :every_count,
|
||||
:context_id, :project_id, :description, :notes, :state, :start_from,
|
||||
:ends_on, :end_date, :number_of_occurences, :occurences_count, :target,
|
||||
:show_from_delta, :recurring_period, :recurrence_selector, :every_other1,
|
||||
:every_other2, :every_other3, :every_day, :only_work_days, :every_count,
|
||||
:weekday, :show_always, :context_name, :project_name, :tag_list,
|
||||
# form attributes
|
||||
:recurring_period, :daily_selector, :monthly_selector, :yearly_selector,
|
||||
:recurring_target, :daily_every_x_days, :monthly_day_of_week,
|
||||
:monthly_every_x_day, :monthly_every_x_month2, :monthly_every_x_month,
|
||||
:monthly_every_xth_day, :recurring_show_days_before,
|
||||
:recurring_period, :daily_selector, :monthly_selector, :yearly_selector,
|
||||
:recurring_target, :daily_every_x_days, :monthly_day_of_week,
|
||||
:monthly_every_x_day, :monthly_every_x_month2, :monthly_every_x_month,
|
||||
:monthly_every_xth_day, :recurring_show_days_before,
|
||||
:recurring_show_always, :weekly_every_x_week, :weekly_return_monday,
|
||||
:yearly_day_of_week, :yearly_every_x_day, :yearly_every_xth_day,
|
||||
:yearly_day_of_week, :yearly_every_x_day, :yearly_every_xth_day,
|
||||
:yearly_month_of_year2, :yearly_month_of_year,
|
||||
# derived attribues
|
||||
:weekly_return_monday, :weekly_return_tuesday, :weekly_return_wednesday,
|
||||
:weekly_return_monday, :weekly_return_tuesday, :weekly_return_wednesday,
|
||||
:weekly_return_thursday, :weekly_return_friday, :weekly_return_saturday, :weekly_return_sunday
|
||||
)
|
||||
end
|
||||
|
||||
def all_recurring_todo_params
|
||||
def all_recurring_todo_params
|
||||
# move context_name, project_name and tag_list into :recurring_todo hash for easier processing
|
||||
{
|
||||
context_name: :context_name,
|
||||
project_name: :project_name,
|
||||
{
|
||||
context_name: :context_name,
|
||||
project_name: :project_name,
|
||||
tag_list: :tag_list
|
||||
}.each do |target,source|
|
||||
move_into_recurring_todo_param(params, target, source)
|
||||
|
|
@ -181,15 +181,15 @@ class RecurringTodosController < ApplicationController
|
|||
# Same goes for start_from and end_date
|
||||
params['recurring_todo']['recurring_period'] = params['recurring_edit_todo']['recurring_period']
|
||||
|
||||
{
|
||||
context_name: :context_name,
|
||||
project_name: :project_name,
|
||||
{
|
||||
context_name: :context_name,
|
||||
project_name: :project_name,
|
||||
tag_list: :edit_recurring_todo_tag_list,
|
||||
end_date: :recurring_todo_edit_end_date,
|
||||
start_from: :recurring_todo_edit_start_from
|
||||
}.each do |target,source|
|
||||
move_into_recurring_todo_param(params, target, source)
|
||||
end
|
||||
end
|
||||
|
||||
# make sure that we set weekly_return_xxx to empty (space) when they are
|
||||
# not checked (and thus not present in params["recurring_todo"])
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
class SearchController < ApplicationController
|
||||
|
||||
helper :todos, :application, :notes, :projects, :contexts
|
||||
|
||||
|
||||
def results
|
||||
@source_view = params['_source_view'] || 'search'
|
||||
@page_title = "TRACKS::Search Results for #{params[:search]}"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class StatsController < ApplicationController
|
|||
@hidden_contexts = current_user.contexts.hidden
|
||||
@stats = Stats::UserStats.new(current_user)
|
||||
end
|
||||
|
||||
|
||||
def actions_done_last12months_data
|
||||
# get actions created and completed in the past 12+3 months. +3 for running
|
||||
# - outermost set of entries needed for these calculations
|
||||
|
|
@ -19,7 +19,7 @@ class StatsController < ApplicationController
|
|||
# convert to array and fill in non-existing months
|
||||
@actions_done_last12months_array = put_events_into_month_buckets(actions_last12months, 13, :completed_at)
|
||||
@actions_created_last12months_array = put_events_into_month_buckets(actions_last12months, 13, :created_at)
|
||||
|
||||
|
||||
# find max for graph in both arrays
|
||||
@max = (@actions_done_last12months_array + @actions_created_last12months_array).max
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ class StatsController < ApplicationController
|
|||
|
||||
def actions_done_lastyears_data
|
||||
actions_last_months = current_user.todos.select("completed_at,created_at")
|
||||
|
||||
|
||||
month_count = difference_in_months(@today, actions_last_months.minimum(:created_at))
|
||||
# because this action is not scoped by date, the minimum created_at should always be
|
||||
# less than the minimum completed_at, so no reason to check minimum completed_at
|
||||
|
|
@ -101,10 +101,10 @@ class StatsController < ApplicationController
|
|||
# convert to array and fill in non-existing weeks with 0
|
||||
@max_weeks = @actions_completion_time.last ? difference_in_weeks(@today, @actions_completion_time.last.completed_at) : 1
|
||||
@actions_completed_per_week_array = convert_to_weeks_running_array(@actions_completion_time, @max_weeks+1)
|
||||
|
||||
|
||||
# stop the chart after 10 weeks
|
||||
@count = [10, @max_weeks].min
|
||||
|
||||
|
||||
# convert to new array to hold max @cut_off elems + 1 for sum of actions after @cut_off
|
||||
@actions_completion_time_array = cut_off_array_with_sum(@actions_completed_per_week_array, @count)
|
||||
@max_actions = @actions_completion_time_array.max
|
||||
|
|
@ -124,14 +124,14 @@ class StatsController < ApplicationController
|
|||
|
||||
# cut off chart at 52 weeks = one year
|
||||
@count = [52, @max_weeks].min
|
||||
|
||||
|
||||
# convert to new array to hold max @cut_off elems + 1 for sum of actions after @cut_off
|
||||
@actions_running_time_array = cut_off_array_with_sum(@actions_running_per_week_array, @count)
|
||||
@max_actions = @actions_running_time_array.max
|
||||
|
||||
# get percentage done cumulative
|
||||
@cum_percent_done = convert_to_cumulative_array(@actions_running_time_array, @actions_running_time.count )
|
||||
|
||||
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ class StatsController < ApplicationController
|
|||
|
||||
# cut off chart at 52 weeks = one year
|
||||
@count = [52, @max_weeks].min
|
||||
|
||||
|
||||
# convert to new array to hold max @cut_off elems + 1 for sum of actions after @cut_off
|
||||
@actions_running_time_array = cut_off_array_with_sum(@actions_running_per_week_array, @count)
|
||||
@max_actions = @actions_running_time_array.max
|
||||
|
|
@ -163,21 +163,21 @@ class StatsController < ApplicationController
|
|||
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
|
||||
def actions_open_per_week_data
|
||||
@actions_started = current_user.todos.created_after(@today-53.weeks).
|
||||
select("todos.created_at, todos.completed_at").
|
||||
reorder("todos.created_at DESC")
|
||||
|
||||
|
||||
@max_weeks = difference_in_weeks(@today, @actions_started.last.created_at)
|
||||
|
||||
# cut off chart at 52 weeks = one year
|
||||
@count = [52, @max_weeks].min
|
||||
|
||||
|
||||
@actions_open_per_week_array = convert_to_weeks_running_from_today_array(@actions_started, @max_weeks+1)
|
||||
@actions_open_per_week_array = cut_off_array(@actions_open_per_week_array, @count)
|
||||
@max_actions = (@actions_open_per_week_array.max or 0)
|
||||
|
||||
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ class StatsController < ApplicationController
|
|||
selected_todo_ids = get_ids_from(@actions_running_time, week_from, week_to, params['id']=='art_end')
|
||||
@selected_actions = selected_todo_ids.size == 0 ? [] : current_user.todos.where("id in (#{selected_todo_ids.join(",")})")
|
||||
@count = @selected_actions.size
|
||||
|
||||
|
||||
render :action => "show_selection_from_chart"
|
||||
else
|
||||
# render error
|
||||
|
|
@ -380,7 +380,7 @@ class StatsController < ApplicationController
|
|||
records.each { |r| (yield r).each { |i| a[i] += 1 if a[i] } }
|
||||
a
|
||||
end
|
||||
|
||||
|
||||
def put_events_into_month_buckets(records, array_size, date_method_on_todo)
|
||||
convert_to_array(records.select { |x| x.send(date_method_on_todo) }, array_size) { |r| [difference_in_months(@today, r.send(date_method_on_todo))]}
|
||||
end
|
||||
|
|
@ -400,7 +400,7 @@ class StatsController < ApplicationController
|
|||
def convert_to_weeks_running_from_today_array(records, array_size)
|
||||
return convert_to_array(records, array_size) { |r| week_indexes_of(r) }
|
||||
end
|
||||
|
||||
|
||||
def week_indexes_of(record)
|
||||
a = []
|
||||
start_week = difference_in_weeks(@today, record.created_at)
|
||||
|
|
@ -408,7 +408,7 @@ class StatsController < ApplicationController
|
|||
end_week.upto(start_week) { |i| a << i };
|
||||
return a
|
||||
end
|
||||
|
||||
|
||||
# returns a new array containing all elems of array up to cut_off and
|
||||
# adds the sum of the rest of array to the last elem
|
||||
def cut_off_array_with_sum(array, cut_off)
|
||||
|
|
@ -418,7 +418,7 @@ class StatsController < ApplicationController
|
|||
a[cut_off] += array.inject(:+) - a.inject(:+)
|
||||
return a
|
||||
end
|
||||
|
||||
|
||||
def cut_off_array(array, cut_off)
|
||||
return Array.new(cut_off){|i| array[i]||0}
|
||||
end
|
||||
|
|
@ -441,7 +441,7 @@ class StatsController < ApplicationController
|
|||
def difference_in_days(date1, date2)
|
||||
return ((date1.utc.at_midnight-date2.utc.at_midnight)/SECONDS_PER_DAY).to_i
|
||||
end
|
||||
|
||||
|
||||
# assumes date1 > date2
|
||||
def difference_in_weeks(date1, date2)
|
||||
return difference_in_days(date1, date2) / 7
|
||||
|
|
@ -458,7 +458,7 @@ class StatsController < ApplicationController
|
|||
# sets "null" on first column and - if necessary - cleans up last two columns, which may have insufficient data
|
||||
def compute_running_avg_array(set, upper_bound)
|
||||
result = set_three_month_avg(set, upper_bound)
|
||||
result[upper_bound-1] = result[upper_bound-1] * 3 if upper_bound == set.length
|
||||
result[upper_bound-1] = result[upper_bound-1] * 3 if upper_bound == set.length
|
||||
result[upper_bound-2] = result[upper_bound-2] * 3 / 2 if upper_bound > 1 and upper_bound == set.length
|
||||
result[0] = "null"
|
||||
result
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ module Todos
|
|||
@attributes = todo_params(params)
|
||||
end
|
||||
@attributes = {} if @attributes.nil? # make sure there is at least an empty hash
|
||||
end
|
||||
end
|
||||
|
||||
def filter_tags
|
||||
def filter_tags
|
||||
if @attributes[:tags]
|
||||
# for single tags, @attributed[:tags] returns a hash. For multiple tags,
|
||||
# it with return an array of hashes. Make sure it is always an array of hashes
|
||||
|
|
@ -38,13 +38,13 @@ module Todos
|
|||
@attributes[:add_tags] = @attributes[:tags]
|
||||
@attributes.delete :tags
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def filter_starred
|
||||
def filter_starred
|
||||
if @params[:new_todo_starred]
|
||||
@attributes["starred"] = (@params[:new_todo_starred]||"").include? "true"
|
||||
@attributes["starred"] = (@params[:new_todo_starred]||"").include? "true"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def attributes
|
||||
@attributes
|
||||
|
|
@ -121,10 +121,10 @@ module Todos
|
|||
private
|
||||
|
||||
def todo_params(params)
|
||||
# keep :predecessor_dependencies from being filterd (for XML API).
|
||||
# keep :predecessor_dependencies from being filterd (for XML API).
|
||||
# The permit cannot handle multiple precessors
|
||||
if params[:todo][:predecessor_dependencies]
|
||||
deps = params[:todo][:predecessor_dependencies][:predecessor]
|
||||
deps = params[:todo][:predecessor_dependencies][:predecessor]
|
||||
end
|
||||
|
||||
# accept empty :todo hash
|
||||
|
|
@ -133,8 +133,8 @@ module Todos
|
|||
end
|
||||
|
||||
filtered = params.require(:todo).permit(
|
||||
:context_id, :project_id, :description, :notes,
|
||||
:due, :show_from, :state,
|
||||
:context_id, :project_id, :description, :notes,
|
||||
:due, :show_from, :state,
|
||||
# XML API
|
||||
:tags => [:tag => [:name]],
|
||||
:context => [:name],
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class TodosController < ApplicationController
|
|||
end
|
||||
format.xml do
|
||||
@xml_todos = params[:limit_to_active_todos] ? @not_done_todos : @todos
|
||||
render :xml => @xml_todos.to_xml( *todo_xml_params )
|
||||
render :xml => @xml_todos.to_xml( *todo_xml_params )
|
||||
end
|
||||
format.any(:rss, :atom) { @feed_title, @feed_description = 'Tracks Actions', "Actions for #{current_user.display_name}" }
|
||||
format.ics
|
||||
|
|
@ -110,7 +110,7 @@ class TodosController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
redirect_to :action => "index"
|
||||
redirect_to :action => "index"
|
||||
end
|
||||
format.m do
|
||||
@return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path
|
||||
|
|
@ -598,7 +598,7 @@ class TodosController < ApplicationController
|
|||
get_params_for_tag_view
|
||||
@page_title = t('todos.tagged_page_title', :tag_name => @tag_title)
|
||||
@source_view = params['_source_view'] || 'tag'
|
||||
|
||||
|
||||
init_data_for_sidebar unless mobile?
|
||||
|
||||
todos_with_tag_ids = find_todos_with_tag_expr(@tag_expr)
|
||||
|
|
@ -751,7 +751,7 @@ class TodosController < ApplicationController
|
|||
items.
|
||||
includes(:context, :project).
|
||||
reorder('description ASC').
|
||||
limit(10)
|
||||
limit(10)
|
||||
end
|
||||
|
||||
def auto_complete_for_predecessor
|
||||
|
|
@ -1195,7 +1195,7 @@ end
|
|||
|
||||
def update_date_for_update(key)
|
||||
params['todo'][key] = params["todo"].has_key?(key) ? parse_date_for_update(params["todo"][key], t("todos.error.invalid_#{key}_date")) : ""
|
||||
end
|
||||
end
|
||||
|
||||
def update_due_and_show_from_dates
|
||||
%w{ due show_from }.each {|date| update_date_for_update(date) }
|
||||
|
|
@ -1233,7 +1233,7 @@ end
|
|||
def update_attributes_of_todo
|
||||
# TODO: duplication with todo_create_params_helper
|
||||
@todo.attributes = params.require(:todo).permit(
|
||||
:context_id, :project_id, :description, :notes,
|
||||
:context_id, :project_id, :description, :notes,
|
||||
:due, :show_from, :state)
|
||||
end
|
||||
|
||||
|
|
@ -1329,6 +1329,6 @@ end
|
|||
else
|
||||
redirect_to(uri.path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class UsersController < ApplicationController
|
||||
|
||||
|
||||
before_filter :admin_login_required, :only => [ :index, :show, :destroy ]
|
||||
skip_before_filter :login_required, :only => [ :new, :create ]
|
||||
skip_before_filter :check_for_deprecated_password_hash,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue