fernandokosh / redmine_time_tracker

A time tracker plugin for Redmine
Other
203 stars 139 forks source link

The label "not working" on the menu is not appearing when viewing pages that are not inside a project #12

Closed supergarotinho closed 14 years ago

supergarotinho commented 14 years ago

The label "not working" on the menu is not appearing when viewing pages that are not inside a project.

Pages like: home, ...

Solved including an "else" before the last "end" in the app/views/time_trackers/_embed_menu.rhtml:

<% time_tracker = time_tracker_for(User.current) %> <% if !time_tracker.nil? %> <%= link_to '#' + time_tracker.issue_id.to_s, { :controller => 'issues', :action => 'show', :id => time_tracker.issue_id }, { :class => 'icon icon-clock' } %> (<%= time_tracker.time_spent_to_s %> / <%= link_to l(:stop_time_tracker), { :controller => 'time_trackers', :action => 'stop' } %>) <% elsif !@project.nil? and User.current.allowed_to?(:log_time, @project) %> <% if !(@issue.nil? || @issue.new_record?) %> <%= link_to_remote l(:start_time_tracker) + ' #' + @issue.id.to_s, :url => { :controller => 'time_trackers', :action => 'start', :issue_id => @issue.id }, :html => { :class => 'icon icon-time-add' }, :update => 'time-tracker-menu' %> <% else %> <%= l(:time_tracker_not_running) %> <% end %> <% else %> <%= l(:time_tracker_not_running) %> <% end %>

delaitre commented 14 years ago

Well, it's not a bug, it's a feature :)

However, I'm happy with neither the current behavior, nor your one.

The current behavior avoid to display a useless "Not running" entry if the user as no right to log time at all (in all projects). However, user having the ability to track time on some project could want to have the "Not running" entry just to remember no time tracker is running.

In your behavior, anonymous users and others with no time tracking capability will always have a "Not running" entry which can be misleading as they will never be capable to track time...

I choose the first solution as I found it less misleading.

What do you think?

supergarotinho commented 14 years ago

First, sorry for the "solved" that leaded to a misunderstood that the issue was about a bug and not for a feature.

And, you a right. The label depends on the Project permissions of the user. But, as you said, we can check if the user has the tracking permission in, at least, one of his projects, and then show the label.

What you think now?

supergarotinho commented 14 years ago

Coorection: The label will only show if:

delaitre commented 14 years ago

I knew you would say that :D Well, I think this is the solution. I have no time for that right now however. To be implemented in the future...

delaitre commented 14 years ago

This is implemented in master.