Last active
December 20, 2015 18:29
-
-
Save ktat/6176076 to your computer and use it in GitHub Desktop.
patch for backlogs plugin v0.9.26
add start date, due date, progress when creating task.
change progress to 100% and due_date is current date if empty when task is finished.
start_date is null when task is created.
start_date is set as current date when task's start date is null and task is moved to in progress.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/models/rb_task.rb b/app/models/rb_task.rb | |
index fae445f..f64a748 100644 | |
--- a/app/models/rb_task.rb | |
+++ b/app/models/rb_task.rb | |
@@ -36,7 +36,9 @@ class RbTask < Issue | |
task = new(attribs) | |
if params['parent_issue_id'] | |
parent = Issue.find(params['parent_issue_id']) | |
- task.start_date = parent.start_date | |
+ if ! task.start_date | |
+ # task.start_date = parent.start_date | |
+ end | |
end | |
task.save! | |
@@ -75,6 +77,13 @@ class RbTask < Issue | |
attribs = RbTask.rb_safe_attributes(params) | |
+ if (params[:status_id].to_i == 5 || params[:status_id].to_i == 6) | |
+ attribs[:done_ratio] = 100 | |
+ if (! self.due_date) | |
+ attribs[:due_date] = Time.now.strftime("%Y-%m-%d") | |
+ end | |
+ end | |
+ | |
# Auto assign task to current user when | |
# 1. the task is not assigned to anyone yet | |
# 2. task status changed (i.e. Updating task name or remaining hours won't assign task to user) | |
diff --git a/app/views/hooks/_rb_include_scripts.html.erb b/app/views/hooks/_rb_include_scripts.html.erb | |
index 0bfc1de..8b9d0f2 100644 | |
--- a/app/views/hooks/_rb_include_scripts.html.erb | |
+++ b/app/views/hooks/_rb_include_scripts.html.erb | |
@@ -2,6 +2,7 @@ | |
<%= javascript_include_tag 'jquery/jquery-1.6.2.min.js', :plugin => 'redmine_backlogs' %> | |
<%= javascript_include_tag 'jquery/jquery-ui-1.8.16.custom.min.js', :plugin => 'redmine_backlogs' %> | |
+<%= javascript_include_tag 'jquery/jquery-ui-timepicker-addon.js', :plugin => 'redmine_backlogs' %> | |
<%= javascript_include_tag 'jquery/jquery.jeditable.mini.js', :plugin => 'redmine_backlogs' %> | |
<%= javascript_include_tag 'jquery/jquery.scrollfollow.js', :plugin => 'redmine_backlogs' %> | |
diff --git a/app/views/rb_tasks/_task.html.erb b/app/views/rb_tasks/_task.html.erb | |
index 5ab6fd4..d90cbbc 100644 | |
--- a/app/views/rb_tasks/_task.html.erb | |
+++ b/app/views/rb_tasks/_task.html.erb | |
@@ -6,6 +6,9 @@ | |
</div> | |
<div class="subject editable" fieldtype="textarea" fieldname="subject" fieldlabel="<%=l(:field_subject)%>"><%= h task.subject %></div> | |
<div class="description editable" style="display: none" fieldtype="textarea" fieldname="description" fieldlabel="<%=l(:field_description)%>"><%= h task.description %></ | |
+ <div style="margin-top: -10px"> | |
+ <%= task.start_date ? task.start_date.strftime("%m-%d") : '' =%> - <%= task.due_date ? task.due_date.strftime("%m-%d") : '' =%> | |
+ </div> | |
<div class="assigned_to_id editable" fieldtype="select" fieldname="assigned_to_id" fieldlabel="<%=l(:field_assigned_to)%>"> | |
<div class="t"><%= assignee_name_or_empty(task) %></div> | |
<div class="v"><%= assignee_id_or_empty(task) %></div> | |
@@ -19,6 +22,9 @@ | |
<% if User.current.allowed_to?(:update_remaining_hours, @project) %> | |
<div class="remaining_hours editable" fieldname="remaining_hours" fieldlabel="<%=l(:field_remaining_hours)%>"><%= remaining_hours(task) %></div> | |
<% end %> | |
+ <div class="done_ratio editable" style="display: none" fieldtype="input" fieldname="done_ratio" fieldlabel="<%=l(:field_done_ratio)%>"><%= h task.done_ratio %></div> | |
+ <div class="start_date editable aaa" style="display: none" fieldtype="input" fieldname="start_date" fieldlabel="<%=l(:field_start_date)%>"><%= h task.start_date %></div | |
+ <div class="due_date editable" style="display: none" fieldtype="input" fieldname="due_date" fieldlabel="<%=l(:field_due_date)%>"><%= h task.due_date %></div> | |
<% if User.current.allowed_to?(:log_time, @project) && @settings[:timelog_from_taskboard]=='enabled' %> | |
<div class="time_entry_hours editable" style="display: none" fieldname="time_entry_hours" fieldlabel="<%=l(:field_time_entry_hours)%>"></div> | |
<% if User.current.allowed_to?(:edit_time_entries, @project) %> | |
diff --git a/assets/javascripts/model.js b/assets/javascripts/model.js | |
index c527671..3cb49ff 100644 | |
--- a/assets/javascripts/model.js | |
+++ b/assets/javascripts/model.js | |
@@ -195,6 +195,14 @@ RB.Model = RB.Object.create({ | |
var editor = model.edit(); | |
editor.find('.' + RB.$(event.currentTarget).attr('fieldname') + '.editor').focus(); | |
} | |
+ | |
+ jQuery('.start_date.editor,.due_date.editor').datepicker({ | |
+ dateFormat: 'yy-mm-dd', | |
+ changeYear: true, | |
+ changeMonth: true, | |
+ numberOfMonths: [1,2] , | |
+ minDate : 0, | |
+ }); | |
}, | |
handleSelect: function(event){ | |
diff --git a/assets/javascripts/taskboard.js b/assets/javascripts/taskboard.js | |
index b708d1a..36db5a7 100644 | |
--- a/assets/javascripts/taskboard.js | |
+++ b/assets/javascripts/taskboard.js | |
@@ -98,6 +98,15 @@ RB.Taskboard = RB.Object.create(RB.Model, { | |
handleAddNewTaskClick: function(event){ | |
var row = RB.$(this).parents("tr").first(); | |
RB.$('#taskboard').data('this').newTask(row); | |
+ | |
+ jQuery('.start_date.editor,.due_date.editor').datepicker({ | |
+ dateFormat: 'yy-mm-dd', | |
+ timeFormat: 'hh:mm:00', | |
+ changeYear: true, | |
+ changeMonth: true, | |
+ numberOfMonths: [1,2] , | |
+ minDate : 0, | |
+ }); | |
}, | |
loadColWidthPreference: function(){ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment