Skip to content
This repository has been archived by the owner on Jan 30, 2018. It is now read-only.

Fixes an issue with no saving user_id into comments table #26

Open
wants to merge 27 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
36c3336
Fixes an issue with no saving user_id into comments table when task i…
Jun 4, 2011
8126b81
Allow tasks to be included in the task list reply via ?include=
jamesu Aug 18, 2011
47d2aaf
Filter out objects from archived projects on global api routes
jamesu Aug 19, 2011
2ee6a49
#447452: add urgent flags to tasks and comments
tokland Aug 19, 2011
9030825
#447452: models: manager urgent flag (transitions, previous setting, …
tokland Aug 19, 2011
7028917
#447452: add urgent flag in task form
tokland Aug 19, 2011
51ab841
#447452: navitation: show urgent in today tasks
tokland Aug 19, 2011
2101ebd
web_steps.rb: [fix] make xpath selector relative to scope node
tokland Aug 19, 2011
08678bf
#447452: add basic urgent feature
tokland Aug 19, 2011
70b59ea
#447452: fix urgent task order + styles for calendar
tokland Aug 19, 2011
1033a20
#447452: styles for urgent flag in tasks and calendar_date_select
tokland Aug 19, 2011
0b2f8b4
#447452: Task: Add urgent flag in API response
tokland Aug 19, 2011
6d04558
#447452: move urgent edit to task_edit and add story to task_create
tokland Aug 19, 2011
f609b2f
#447452: use char ! as the urgent task badge
tokland Aug 19, 2011
25d80ca
#447452: refactor TasksHelper#comment_task_due_on
tokland Aug 21, 2011
3d3f09a
A bit of extra margin for the Urgent checkbox
Aug 22, 2011
50b3cb7
#447452: show urgent flag box for conversation to task conversion form
tokland Aug 22, 2011
0746151
#447452: convert_to_task: set urgent flag to false by default
tokland Aug 22, 2011
dcb9e48
Better upload insertion in the activity stream
jamesu Aug 22, 2011
61d9dab
Add a "More..." dropdown by files in comments
Aug 23, 2011
2daac7d
fix project digests when args are encoded in JSON
jrom Aug 24, 2011
39b4791
Added project route for tasks#create, adds tasks to the Inbox
jamesu Aug 24, 2011
e33d704
#458071: redraw calendar box to show it nearer to the link
tokland Aug 24, 2011
5c2206d
Change name limits for project and organization names
jamesu Aug 24, 2011
9481a2b
When deleting a project, associated watchable tag should be removed. …
unixcharles Aug 25, 2011
b947e3f
Fixes an issue with no saving user_id into comments table when task i…
Jun 4, 2011
13ec6c9
Merge branch 'patches/new-task' of github.com:denisnovikov/teambox in…
Aug 26, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#447452: add urgent flag in task form
  • Loading branch information
tokland committed Aug 22, 2011
commit 70289177212b9e6c0b302bdabe1f1ca9862201ef
27 changes: 22 additions & 5 deletions app/helpers/tasks_helper.rb
Original file line number Diff line number Diff line change
@@ -62,6 +62,13 @@ def comment_task_due_on(comment)
end
end

def comment_task_urgent(comment)
if comment.urgent_change?
text = comment.urgent? ? t('tasks.urgent.set') : t('tasks.urgent.unset')
content_tag(:p, text, :class => "urgent_transition")
end
end

def task_status(task,status_type)
status_for_column = status_type == :column ? "task_status_#{task.status_name}" : "task_counter"
out = %(<span data-task-id=#{task.id} class='task_status #{status_for_column}'>)
@@ -127,12 +134,22 @@ def time_tracking_doc
end

def date_picker(f, field, options = {}, html_options = {})
selected_date = f.object.send(field.to_sym) ? localize(f.object.send(field.to_sym), :format => :long) : ''

content_tag :div, :class => "date_picker", :id => "#{f.object.class.to_s.underscore}_#{f.object.id}_#{field}" do
selected_date = f.object.send(field.to_sym) ? localize(f.object.send(field.to_sym), :format => :long) : ''
show_urgent_flag = f.object.is_a?(Task)
datepicker_info = if show_urgent_flag && f.object.urgent?
t('date_picker.urgent.short')
elsif selected_date.blank?
t('date_picker.no_date_assigned')
else
selected_date
end

classes = ["date_picker", ("show_urgent" if show_urgent_flag)].compact
content_tag :div, :class => classes.join(" "), :id => "#{f.object.class.to_s.underscore}_#{f.object.id}_#{field}" do
[ image_tag('/images/calendar_date_select/calendar.gif', :class => :calendar_date_select_popup_icon),
content_tag(:span, selected_date.blank? ? t('date_picker.no_date_assigned') : selected_date, :class => 'localized_date'),
f.hidden_field(field, html_options.reverse_merge!(:class => :datepicker))
content_tag(:span, datepicker_info, :class => 'datepicker_info'),
f.hidden_field(field, html_options.reverse_merge!(:class => :datepicker)),
(f.hidden_field("urgent", :class => "urgent") if show_urgent_flag),
].join.html_safe
end
end
61 changes: 54 additions & 7 deletions app/javascripts/date_picker.js
Original file line number Diff line number Diff line change
@@ -2,12 +2,15 @@ document.on('click', 'div.date_picker', function(e, element) {
var field = element.down('input')
var label = element.down('span')
var parentDiv = element.up('div')
DatePicker.initialize(field, label, parentDiv)
})
var date_picker = DatePicker.initialize(field, label, parentDiv);
if (element.hasClassName("show_urgent")) {
DatePicker.add_urgent_box(date_picker, element, field, label, parentDiv);
}
});

DatePicker = {
initialize: function(field, label, parentDiv) {
new CalendarDateSelect(field, {
return(new CalendarDateSelect(field, {
buttons: true,
time: false,
year_range: 10,
@@ -26,9 +29,53 @@ DatePicker = {
} else {
localized_time = this.value
}
label.update(localized_time || I18n.translations.date_picker.no_date_assigned);
}
}));
},

add_urgent_box: function(date_picker, element, field, label, parentDiv) {
// Render custom urgent box on calendar's top DIV
var urgent_field = field.parentNode.down("input.urgent");
var html = Mustache.to_html(Templates.tasks.calendar_date_select_urgent_header, {
task_id: element.id.split("_")[1]
});
date_picker.top_div.update(html);

label.update(localized_time)
// Link toggler for help info
date_picker.top_div.down(".show-help").observe("click", function(event) {
date_picker.top_div.down(".help").toggle();
event.stop();
});

// On urgent checkbox changes update task[urgent] and show/hide sections accordingly
var update_urgent_box = function (date_picker, input_urgent, user_action) {
urgent_field.value = input_urgent.checked ? "1" : "0";

if (input_urgent.checked) {
label.update(I18n.translations.date_picker.urgent.short);
} else {
date_picker.clearDate();
date_picker.callback("onchange");
label.update(I18n.translations.date_picker.no_date_assigned);
}
})
}
}

if (user_action && input_urgent.checked) {
date_picker.close();
} else {
date_picker.calendar_div.select("> div").each(function(div) {
if (!div.hasClassName("cds_top")) {
div[input_urgent.checked ? "hide" : "show"]();
}
});
}
}

var input_urgent = date_picker.top_div.down("input.urgent")
input_urgent.checked = (urgent_field.value == "1");
update_urgent_box(date_picker, input_urgent, false);
input_urgent.observe("click", function() {
update_urgent_box(date_picker, this, true);
});
}
}
7 changes: 7 additions & 0 deletions app/templates/tasks/calendar_date_select_urgent_header.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.urgent
%input.urgent{:type => 'checkbox', :value => '1', :id => 'task_{{task_id}}_urgent'}
%label{:for => 'task_{{task_id}}_urgent'}
=t('date_picker.urgent.long')
%a{:href => '#', :class => 'show-help text_actions'} [?]
.help{:style => 'display: none'}
=t('date_picker.urgent.info')
1 change: 1 addition & 0 deletions app/views/comments/_comment.haml
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@
= t('tasks.assigned.assigned_to', :user => comment.assigned.user.name)
- else
= t('tasks.assigned.unassigned')
= comment_task_urgent(comment)

~raw comment.body_html

7 changes: 7 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -920,6 +920,9 @@ en:
due_on_html: Needs to be done before... <i>optional</i>
assigned_to: Who is responsible?
assigned_to_nobody: Nobody
urgent:
set: Urgent flag set
unset: Urgent flag unset
assigned:
assigned_to: "Assigned to %{user}"
myself: "Assign to myself (%{user})"
@@ -2033,6 +2036,10 @@ en:

date_picker:
no_date_assigned: No date assigned
urgent:
long: "Urgent, to be done as soon as possible"
short: "Urgent"
info: Will show up on "tasks due for today" for the assigned user

oauth:
authentication_failure: Authentication failure, '%{message}'
1 change: 1 addition & 0 deletions config/teambox.yml
Original file line number Diff line number Diff line change
@@ -144,6 +144,7 @@ defaults: &defaults
- "*.tasks"
- "*.projects"
- "*.conversations"
- "*.date_picker"

development:
<<: *defaults