Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bsag/tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
lrbalt committed Mar 8, 2010
2 parents 6f21890 + 42c4c19 commit 36f44f9
Show file tree
Hide file tree
Showing 14 changed files with 419 additions and 32 deletions.
4 changes: 2 additions & 2 deletions app/controllers/recurring_todos_controller.rb
Expand Up @@ -2,7 +2,7 @@ class RecurringTodosController < ApplicationController

helper :todos, :recurring_todos

append_before_filter :init, :only => [:index, :new, :edit]
append_before_filter :init, :only => [:index, :new, :edit, :create]
append_before_filter :get_recurring_todo_from_param, :only => [:destroy, :toggle_check, :toggle_star, :edit, :update]

def index
Expand Down Expand Up @@ -243,7 +243,7 @@ def context_specified_by_name?

private

def init
def init
@days_of_week = [ ['Sunday',0], ['Monday',1], ['Tuesday', 2], ['Wednesday',3], ['Thursday',4], ['Friday',5], ['Saturday',6]]
@months_of_year = [
['January',1], ['Februari',2], ['March', 3], ['April',4], ['May',5], ['June',6],
Expand Down
20 changes: 10 additions & 10 deletions app/helpers/todos_helper.rb
Expand Up @@ -24,14 +24,12 @@ def remote_star_icon
:class => "icon star_item", :title => "star the action '#{@todo.description}'")
end

def remote_edit_menu_item(parameters, todo)
return link_to_remote(
image_tag("edit_off.png", :mouseover => "edit_on.png", :alt => "Edit", :align => "absmiddle", :id => 'edit_icon_todo_'+todo.id.to_s)+" Edit",
:url => {:controller => 'todos', :action => 'edit', :id => todo.id},
:method => 'get',
:with => "'#{parameters}'",
:before => todo_start_waiting_js(todo),
:complete => todo_stop_waiting_js(todo))
def remote_edit_button
link_to(
image_tag("blank.png", :alt => "Edit", :align => "absmiddle", :id => 'edit_icon_todo_'+@todo.id.to_s, :class => 'edit_item'),
{:controller => 'todos', :action => 'edit', :id => @todo.id},
:class => "icon edit_item",
:title => "Edit the action '#{@todo.description}'")
end

def remote_delete_menu_item(parameters, todo)
Expand Down Expand Up @@ -121,8 +119,10 @@ def successors_span
def grip_span
unless @todo.completed?
image_tag('grip.png', :width => '7', :height => '16', :border => '0',
:title => 'Drag onto another action to make it depend on that action',
:class => 'grip')
:title => 'Drag onto another action to make it depend on that action',
:class => 'grip') +
image_tag('blank.png', :width => 16, :height => 16, :border => 0,
:title => "Drop an action to make it depend on this action", :class => 'successor_target')
end
end

Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/standard.html.erb
Expand Up @@ -30,6 +30,7 @@
var defaultTags = <%= default_tags_for_autocomplete %>;
var tagNames = <%= tag_names_for_autocomplete %>;
var dateFormat = '<%= date_format_for_date_picker %>';
var weekStart = '<%= current_user.prefs.week_starts %>';
<% end -%>
<% if @prefs.refresh != 0 -%>
setup_auto_refresh(<%= @prefs["refresh"].to_i*60000 %>);
Expand Down
5 changes: 2 additions & 3 deletions app/views/recurring_todos/_recurring_todo_form.erb
Expand Up @@ -2,8 +2,7 @@
<% form_remote_tag(
:url => recurring_todos_path, :method => :post,
:html=> { :id=>'recurring-todo-form-new-action', :name=>'recurring_todo', :class => 'inline-form' },
:before => "$('#recurring_todo_new_action_submit').block({message: null})",
:complete => "$('#recurring_todo_new_action_submit').unblock();$('#recurring-todo-form-new-action').clearForm();") do
:before => "$('#recurring_todo_new_action_submit').block({message: null})") do
-%>
<div id="new_status"><%= error_messages_for("item", :object_name => 'action') %></div>

Expand All @@ -18,7 +17,7 @@
<div class="page_name_auto_complete" id="project_list" style="display:none"></div>

<label for="recurring_todo_context_name">Context</label>
<input id="recurring_todo_context_name" name="context_name" autocomplete="off" tabindex="4" size="30" type="text" value="" />
<input id="recurring_todo_context_name" name="context_name" autocomplete="off" tabindex="4" size="30" type="text" value="<%= current_user.contexts.first.name unless current_user.contexts.first.nil?%>" />
<div class="page_name_auto_complete" id="context_list" style="display:none"></div>
<label for="tag_list">Tags (separate with commas)</label>
<%= text_field_tag "tag_list", nil, :size => 30, :tabindex => 5 -%>
Expand Down
3 changes: 1 addition & 2 deletions app/views/recurring_todos/create.js.rjs
Expand Up @@ -4,8 +4,7 @@ page.replace_html 'new_status', "#{error_messages_for('recurring_todo')}"
page.notify :notice, @message, 5.0
if @recurring_saved
# reset form
page << "TracksForm.hide_all_recurring(); $('#recurring_daily').show();"
page << "$('#recurring_todo_new_action_submit').unblock();$('#recurring-todo-form-new-action').clearForm();"
page['new-recurring-todo'].replace_html :partial => 'recurring_todo_form'
# hide overlayed edit form
page << "TracksForm.toggle_overlay();"
# insert new recurring todo
Expand Down
6 changes: 3 additions & 3 deletions app/views/todos/_todo.html.erb
Expand Up @@ -11,12 +11,12 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
<div id="<%= dom_id(todo, 'line') %>" class="item-show">
<%= remote_star_icon %>
<%= remote_toggle_checkbox unless source_view_is :deferred %>
<% unless suppress_edit_button %>
<%= remote_edit_button %>
<% end %>
<ul class="sf-menu sf-item-menu">
<li style="z-index:<%=@z_index_counter%>"><%= image_tag "downarrow.png", :alt=> "" %>
<ul id="ul<%= dom_id(todo) %>">
<% unless suppress_edit_button %>
<li><%= remote_edit_menu_item(parameters, todo) %></li>
<% end %>
<li><%= remote_delete_menu_item(parameters, todo) %></li>
<% unless todo.completed? || todo.deferred? %>
<li><%= remote_defer_menu_item(1, todo) %></li>
Expand Down
7 changes: 7 additions & 0 deletions app/views/todos/add_predecessor.js.rjs
Expand Up @@ -9,6 +9,13 @@ if @saved
# regenerate predecessor to add arrow
page[@predecessor].replace_html :partial => 'todos/todo', :locals => { :todo => @predecessor, :parent_container_type => parent_container_type }

# regenerate predecessors of predecessor
parents = @predecessor.predecessors
parents.each do |parent|
puts parent.description
page[parent].replace_html :partial => 'todos/todo', :locals => { :todo => parent, :parent_container_type => parent_container_type }
end

# show in tickler box in project view
if source_view_is_one_of :project, :tag
page['tickler-empty-nd'].hide
Expand Down
7 changes: 7 additions & 0 deletions app/views/todos/remove_predecessor.js.rjs
Expand Up @@ -5,6 +5,13 @@ if @removed
# replace old predecessor with one without the successor
page.replace dom_id(@predecessor), :partial => 'todos/todo', :locals => {
:todo => @predecessor, :parent_container_type => parent_container_type }

# regenerate predecessors of predecessor
parents = @predecessor.predecessors
parents.each do |parent|
puts parent.description
page[parent].replace_html :partial => 'todos/todo', :locals => { :todo => parent, :parent_container_type => parent_container_type }
end

# update display if pending->active
if @successor.active?
Expand Down
179 changes: 179 additions & 0 deletions artwork/add_successor_on.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 36f44f9

Please sign in to comment.