Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better view with new Redmine version for mobile phone in issues + Commenting some deprecated Gems #1138

Open
wants to merge 5 commits into
base: feature/redmine3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile
Expand Up @@ -8,7 +8,7 @@ redmine_version_major = version_file.match(/MAJOR =/).post_match.match(/\d/)[0].

gem "holidays", "~>1.0.3"
gem "icalendar"
gem "nokogiri"
#gem "nokogiri"
gem "open-uri-cached"
gem "prawn"
gem 'json'
Expand All @@ -25,7 +25,7 @@ group :test do
gem 'cucumber-rails', require: false
gem "culerity"
gem "cucumber"
gem "capybara", "~> 1"
#gem "capybara", "~> 1"
#gem "faye-websocket"
gem "poltergeist"
gem "database_cleaner"
Expand Down
7 changes: 7 additions & 0 deletions app/views/backlogs/_settings.html.erb
Expand Up @@ -130,6 +130,13 @@
<%= radio_button_tag("settings[scrum_stats_menu_position]", 'application', Backlogs.setting[:scrum_stats_menu_position] == 'application') %><%= l(:backlogs_scrum_stats_menu_application) %>
<%= radio_button_tag("settings[scrum_stats_menu_position]", 'none', Backlogs.setting[:scrum_stats_menu_position] == 'none') %><%= l(:backlogs_scrum_stats_menu_none) %>
</p>


<p>
<%= content_tag(:label, l(:rb_remaining_hours_in_stories)) %>
<%= check_box_tag("settings[remaining_hours_in_stories]",'enabled',Backlogs.setting[:remaining_hours_in_stories]) %>
</p>

</fieldset>

<fieldset>
Expand Down
1 change: 0 additions & 1 deletion app/views/rb_stories/_story.html.erb
Expand Up @@ -2,7 +2,6 @@
<div class="fff-wrapmiddle">
<div class="story_field fff-middle">
<span class="editable subject" fieldname="subject" fieldlabel="<%=l(:field_subject)%>" fieldtype="textarea"><%=h story.subject %></span>
<span class="story_field">(<%= story.estimated_hours.to_f %> est h, <%= story.priority.name %> )</span>
</div>
</div>
<div class="fff-left">
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Expand Up @@ -198,6 +198,7 @@ en:
rb_show_project_name: "Show project name in backlogs"
rb_task_cards_stories_then_tasks: "First all stories, then all tasks"
rb_task_cards_story_follows_tasks: "Tasks followed by their story"
rb_remaining_hours_in_stories: "Remaining hours in stories ?"
rb_task_cards_tasks_follow_story: "Story followed by their tasks"
rb_taskboard_card_order: "Card print order"
rb_timelog_from_taskboard: "Timelog from taskboard"
Expand Down
30 changes: 14 additions & 16 deletions lib/backlogs_hooks.rb
Expand Up @@ -91,24 +91,20 @@ def view_issues_show_details_bottom(context={ })
project = context[:project]

if issue.is_story?
snippet += "<tr><th>#{l(:field_story_points)}</th><td>#{RbStory.find(issue.id).points_display}</td>"
unless issue.remaining_hours.nil?
snippet += "<th>#{l(:field_remaining_hours)}</th><td>#{l_hours(issue.remaining_hours)}</td>"
end
snippet += "</tr>"
snippet += '<div class="attribute"><div class="label">'+l(:field_story_points)+':</div> <div class="value">'+RbStory.find(issue.id).points_display+'</div></div>'
vbe = issue.velocity_based_estimate
snippet += "<tr><th>#{l(:field_velocity_based_estimate)}</th><td>#{vbe ? vbe.to_s + ' days' : '-'}</td></tr>"
snippet += '<div class="attribute"><div class="label">'+l(:field_velocity_based_estimate)+':</div> <div class="value">'+(vbe ? vbe.to_s + ' days' : '-')+'</div></div>'

unless issue.release_id.nil?
release = RbRelease.find(issue.release_id)
snippet += "<tr><th>#{l(:field_release)}</th><td>#{link_to(release.name, url_for_prefix_in_hooks + url_for({:controller => 'rb_releases', :action => 'show', :release_id => release}))}</td>"
snippet += '<div class="attribute"><div class="label">'+l(:field_release)+':</div> <div class="value">'+link_to(release.name, url_for_prefix_in_hooks + url_for({:controller => 'rb_releases', :action => 'show', :release_id => release}))+'</div></div>'
relation_translate = l("label_release_relationship_#{RbStory.find(issue.id).release_relationship}")
snippet += "<th>#{l(:field_release_relationship)}</th><td>#{relation_translate}</td></tr>"
snippet += '<div class="attribute"><div class="label">'+l(:field_release_relationship)+':</div> <div class="value">'+relation_translate+'</div></div>'
end
end

if issue.is_task? && User.current.allowed_to?(:update_remaining_hours, project) != nil
snippet += "<tr><th>#{l(:field_remaining_hours)}</th><td>#{issue.remaining_hours}</td></tr>"
if (issue.is_story? or issue.is_task?) && User.current.allowed_to?(:update_remaining_hours, project) != nil
snippet += '<div class="attribute"><div class="label">'+l(:field_remaining_hours)+':</div> <div class="value">'+l_hours(issue.remaining_hours)+'</div></div>'
end

return snippet
Expand Down Expand Up @@ -179,9 +175,9 @@ def view_issues_form_details_bottom(context={ })
snippet += "#{radio_button_tag('copy_tasks', 'all:' + params[:copy_from], false)} #{l(:rb_label_copy_tasks_all)}</p>"
end

if issue.is_task? && !issue.new_record?
if issue.allow_remaining_hours? && !issue.new_record?
snippet += "<p><label for='remaining_hours'>#{l(:field_remaining_hours)}</label>"
snippet += text_field_tag('remaining_hours', issue.remaining_hours, :size => 3)
snippet += text_field_tag('remaining_hours', issue.remaining_hours, :size => 3, :disabled => if issue.is_story? and issue.children? then true else false end)
snippet += '</p>'
end

Expand Down Expand Up @@ -362,7 +358,7 @@ def controller_issues_edit_before_save(context={ })
params = context[:params]
issue = context[:issue]

if issue.is_task? && params.include?(:remaining_hours)
if issue.allow_remaining_hours? && params.include?(:remaining_hours)
begin
issue.remaining_hours = Float(params[:remaining_hours])
rescue ArgumentError, TypeError
Expand Down Expand Up @@ -396,10 +392,12 @@ def view_timelog_edit_form_bottom(context={ })
snippet=''

begin
if issue.is_task? && User.current.allowed_to?(:update_remaining_hours, time_entry.project) != nil
if issue.allow_remaining_hours? && User.current.allowed_to?(:update_remaining_hours, time_entry.project) != nil
remaining_hours = issue.remaining_hours
snippet += "<p><label for='remaining_hours'>#{l(:field_remaining_hours)}</label>"
snippet += text_field_tag('remaining_hours', remaining_hours, :size => 6)
if issue.allow_remaining_hours? then
snippet += text_field_tag('remaining_hours', remaining_hours, :size => 6, :disabled => if issue.is_story? and issue.children? then true else false end)
end
snippet += '</p>'
end
return snippet
Expand All @@ -420,7 +418,7 @@ def controller_timelog_edit_before_save(context={ })
return unless Backlogs.configured?(issue.project) &&
Backlogs.setting[:timelog_from_taskboard]=='enabled'

if issue.is_task? && User.current.allowed_to?(:update_remaining_hours, time_entry.project) != nil
if issue.allow_remaining_hours? && User.current.allowed_to?(:update_remaining_hours, time_entry.project) != nil
if params.include?("remaining_hours")
remaining_hours = params[:remaining_hours].gsub(',','.').to_f
if remaining_hours != issue.remaining_hours
Expand Down
21 changes: 21 additions & 0 deletions lib/backlogs_issue_patch.rb
Expand Up @@ -16,6 +16,7 @@ def self.included(base) # :nodoc:
has_one :backlogs_history, :class_name => RbIssueHistory, :dependent => :destroy
has_many :rb_release_burnchart_day_cache, :dependent => :delete_all

alias_method_chain :total_estimated_hours, :story

validates_inclusion_of :release_relationship, :in => RbStory::RELEASE_RELATIONSHIP

Expand All @@ -40,6 +41,14 @@ def release_burnchart_day_caches(release_id)
RbReleaseBurnchartDayCache.where(:issue_id => self.id, :release_id => release_id)
end

def remaining_hours
if is_story? and super.nil? then total_estimated_hours else super end
end

def total_estimated_hours_with_story
if is_story? and not leaf? then estimated_hours else total_estimated_hours_without_story end
end

def is_story?
RbStory.trackers_include?(tracker_id)
end
Expand All @@ -48,6 +57,12 @@ def is_task?
RbTask.tracker?(tracker_id)
end

def allow_remaining_hours?
return true if is_task?
return true if Backlogs.setting[:remaining_hours_in_stories] and is_story?
return false
end

def backlogs_issue_type
return "story" if self.is_story?
return "impediment" if self.blocks(true).any?
Expand Down Expand Up @@ -159,6 +174,12 @@ def backlogs_after_save
p.update_attribute(:remaining_hours, r)
p.history.save
end

r = p.leaves.sum("COALESCE(estimated_hours, 0)").to_f
if r != p.estimated_hours
p.update_attribute(:estimated_hours, r)
p.history.save
end
}

return unless Backlogs.configured?(self.project)
Expand Down