Commit 673c2e5d by Nguyen Vo Huy Hoang

new workload

parent 15216523
......@@ -617,11 +617,11 @@ class IssuesController < ApplicationController
exclude_project_ids = [106, 107, 108, 109, 110, 111] #2zigexn
return if exclude_project_ids.include?(issue.project_id)
subtask_titles = %w(Requirement Design Coding Code\ review Create\ Test\ case Testing Bug\ fixing Release)
subtask_titles = %w(1.\ Requirement 2.\ Design 3.\ Coding 4.\ Testing 5.\ Bug\ fixing 6.\ Release)
subtask_titles.each do |subtask_title|
subtask = Issue.new(issue.attributes.except('id', 'created_on', 'updated_on'))
subtask.subject = subtask_title + ' - ' + subtask.subject
subtask.tracker_id = 8 #Task
subtask.tracker_id = subtask_title == "4. Testing" ? 9 : 8 #Task
subtask.parent_issue_id = @issue.id
subtask.estimated_hours = nil
subtask.save!
......
......@@ -98,6 +98,8 @@ module IssuesHelper
content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') +
content_tag('td', link_to_issue(child, :project => (issue.project_id != child.project_id)), :class => 'subject', :style => 'width: 50%') +
content_tag('td', select_tag("status", options_from_collection_for_select(IssueStatus.all, "id", "name", child.status.id), id: "status_#{child.id}", class: "select_status"), :class => 'status') +
content_tag('td', text_field_tag('esitmated_hours', child.estimated_hours, disabled: true, size: 10), :class => 'esitmated_hours') +
content_tag('td', datetime_field_tag('due_date', child.due_date, disabled: true), :class => 'due_date') +
content_tag('td', link_to_user(child.assigned_to), :class => 'assigned_to') +
content_tag('td', child.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(child.done_ratio), :class=> 'done_ratio'),
:class => css)
......
......@@ -39,11 +39,25 @@ module TimelogHelper
end
collection += case @issue&.tracker&.name
when 'Task'
@issue.is_task_with_target? ?
activities.collect { |a| [a.name, a.id] if a.is_task_with_target? } :
if @issue.is_task_with_target?
activities.collect { |a| [a.name, a.id] if a.is_task_with_target? }
elsif @issue.parent&.tracker&.name == 'User story'
activities.collect { |a| [a.name, a.id] if a.name[0,1].to_i != 0 && @issue.subject.include?(a.name[0, 2]) }
else
activities.collect { |a| [a.name, a.id] if a.is_activity_for_task? }
end
when 'Test'
if @issue.parent&.tracker&.name == 'User story'
activities.collect { |a| [a.name, a.id] if a.name[0,1].to_i != 0 && @issue.subject.include?(a.name[0, 2]) }
else
activities.collect { |a| [a.name, a.id] if a.is_activity_for_task? }
end
when 'Bug'
activities.collect { |a| [a.name, a.id] if a.is_activity_for_task? }
if @issue.parent&.tracker&.name == 'User story'
activities.collect { |a| [a.name, a.id] if a.name[0,1].to_i != 0 && @issue.subject.include?(a.name[0, 2]) }
else
activities.collect { |a| [a.name, a.id] if a.is_activity_for_task? }
end
when 'User story'
[]
when 'Support'
......
......@@ -21,11 +21,11 @@ class TimeEntryActivity < Enumeration
OptionName = :enumeration_activities
TASK_BUGS_ACTIVITIES= [
"Estimation", "Communication",
"Coding", "Code Review", "Requirement",
"Design", "Release", "Reworking",
"Create Test-case", "Testing",
"Research - Investigate "
"2. Estimation", "1. Communication",
"3. Coding", "3. Code Review", "1. Requirement",
"Design", "6. Release", "Reworking",
"4. Create Test-case", "4. Testing",
"2. Research - Investigate"
].freeze
TASK_WITH_TARGET_ACTIVITIES = [
......@@ -57,10 +57,10 @@ class TimeEntryActivity < Enumeration
end
def is_activity_for_support?
SUPPORT_ACTIVITIES.include? name
SUPPORT_ACTIVITIES.include? name&.strip
end
def is_task_with_target?
TASK_WITH_TARGET_ACTIVITIES.include? name
TASK_WITH_TARGET_ACTIVITIES.include? name&.strip
end
end
......@@ -117,6 +117,52 @@
</li>
<% end %>
<% if @safe_attributes.include?('start_date') || @safe_attributes.include?('due_date') %>
<li><%= context_menu_link "#{l(:field_start_date)} / #{l(:field_due_date)}", '#', :onclick => "showModal('bulk_update_date', '350px'); return false;" %></li>
<div id="bulk_update_date" style="display:none;">
<h3 class="title"><%= "#{l(:field_start_date)}/#{l(:field_due_date)}" %></h3>
<%= form_tag(bulk_update_issues_path(:ids => @issue_ids, :back_url => @back), :id => 'bulk_update_date') do %>
<% if @safe_attributes.include?('start_date') %>
<p>
<label for='issue_start_date'><%= l(:field_start_date) %></label>
<%= date_field_tag 'issue[start_date]', '', :value => (@issue ? @issue.start_date : nil), :size => 10 %><%= calendar_for('issue_start_date') %>
<label class="inline"><%= check_box_tag 'issue[start_date]', 'none', false, :id => nil, :data => {:disables => '#issue_start_date'} %><%= l(:button_clear) %></label>
</p>
<% end %>
<% if @safe_attributes.include?('due_date') %>
<p>
<label for='issue_due_date'><%= l(:field_due_date) %></label>
<%= date_field_tag 'issue[due_date]', '', :value => (@issue ? @issue.due_date : nil), :size => 10 %><%= calendar_for('issue_due_date') %>
<label class="inline"><%= check_box_tag 'issue[due_date]', 'none', false, :id => nil, :data => {:disables => '#issue_due_date'} %><%= l(:button_clear) %></label>
</p>
<% end %>
<p class="buttons">
<%= button_tag l(:button_submit), :name => nil, :onclick => "hideModal(this);$('form#bulk_update_date').submit();", :data => { :disable_with => false } %>
<%= link_to_function l(:button_cancel), "hideModal(this);" %>
</p>
<% end %>
</div>
<% end %>
<% if @issue.tracker.name != 'User story' && @safe_attributes.include?('estimated_hours') %>
<li><%= context_menu_link "#{l(:field_estimated_hours)}", '#', :onclick => "showModal('bulk_update_estimation', '350px'); return false;" %></li>
<div id="bulk_update_estimation" style="display:none;">
<h3 class="title"><%= "#{l(:field_estimated_hours)}" %></h3>
<%= form_tag(bulk_update_issues_path(:ids => @issue_ids, :back_url => @back), :id => 'bulk_update_estimation') do %>
<% if @safe_attributes.include?('estimated_hours') %>
<p>
<label for='issue_estimated_hours'><%= l(:field_estimated_hours) %></label>
<%= text_field_tag 'issue[estimated_hours]', '', :value => (@issue ? @issue.estimated_hours : nil), :size => 10 %>
</p>
<% end %>
<p class="buttons">
<%= button_tag l(:button_submit), :name => nil, :onclick => "hideModal(this);$('form#bulk_update_estimation').submit();", :data => { :disable_with => false } %>
<%= link_to_function l(:button_cancel), "hideModal(this);" %>
</p>
<% end %>
</div>
<% end %>
<% if @can[:add_watchers] %>
<li class="folder">
<a href="#" class="submenu"><%= l(:label_issue_watchers) %></a>
......@@ -154,3 +200,13 @@
<%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
</ul>
<%= javascript_tag do %>
$('input[data-disables]').change(function() {
if ($(this).prop('checked')){
$($(this).data('disables')).attr('disabled', true).val('');
} else {
$($(this).data('disables')).attr('disabled', false);
}
});
<% end %>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment