├── MIT-LICENSE.txt ├── README.md ├── app ├── controllers │ └── extended_spent_time_controller.rb └── views │ └── my │ └── blocks │ ├── _log.html.erb │ └── _timelog.html.erb ├── assets └── stylesheets │ └── style.css ├── config ├── locales │ ├── de.yml │ ├── en.yml │ ├── es.yml │ ├── fr.yml │ └── pt.yml └── routes.rb ├── illustration-small.png ├── illustration.png └── init.rb /MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Pertimm 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Redmine plugin: extended_spent_time 2 | =================================== 3 | 4 | Redmine plugin used to extend spent time visualisation options located in "my page". 5 | 6 | Released under the MIT license. 7 | 8 | ![Plugin illustration](https://github.com/pertimm/redmine_extended_spent_time/raw/master/illustration.png) 9 | 10 | -- 11 | 12 | Mise en place d'options d'affichage sur le block "temps passé" de l'interface "Ma page". 13 | 14 | Les options d'affichage permettent d'étendre cette vue à 1, 2, 3, 4 ou 5 semaines. -------------------------------------------------------------------------------- /app/controllers/extended_spent_time_controller.rb: -------------------------------------------------------------------------------- 1 | class ExtendedSpentTimeController < ApplicationController 2 | unloadable 3 | 4 | def update 5 | @user = User.current 6 | @user.pref[:spent_time_period] = params[:period] 7 | @user.pref.save 8 | 9 | respond_to do |format| 10 | format.html { 11 | render :partial => "my/blocks/log", :locals => {:user => @user} 12 | } 13 | end 14 | end 15 | end -------------------------------------------------------------------------------- /app/views/my/blocks/_log.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <% 3 | if @user.pref.others[:spent_time_period].nil? 4 | period = 21 5 | else 6 | period = @user.pref.others[:spent_time_period].to_i 7 | end 8 | sql_period = period - 1 9 | %> 10 |

11 | <%=l(:label_spent_time)%> (<%= l(:label_last_n_days, period) %>) 12 | 25 |

26 | 27 | <% 28 | entries = TimeEntry.find(:all, 29 | :conditions => ["#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", @user.id, Date.today - sql_period, Date.today], 30 | :include => [:activity, :project, {:issue => [:tracker, :status]}], 31 | :order => "#{TimeEntry.table_name}.spent_on DESC, #{Project.table_name}.name ASC, #{Tracker.table_name}.position ASC, #{Issue.table_name}.id ASC") 32 | entries_by_day = entries.group_by(&:spent_on) 33 | %> 34 | 35 |
36 |

<%= l(:label_total) %>: <%= html_hours("%.2f" % entries.sum(&:hours).to_f) %>

37 |
38 | 39 | <% if entries.any? %> 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | <% entries_by_day.keys.sort.reverse.each do |day| %> 50 | 51 | 52 | 53 | 54 | 55 | 56 | <% entries_by_day[day].each do |entry| -%> 57 | 58 | 61 | 67 | 68 | 69 | 79 | 80 | <% end -%> 81 | <% end -%> 82 | 83 |
<%= l(:label_activity) %><%= l(:label_project) %><%= l(:field_comments) %><%= l(:field_hours) %>
<%= day == Date.today ? l(:label_today).titleize : format_date(day) %><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %>
59 | <%= entry.activity %> 60 | 62 | <%= entry.project %> 63 | <% if entry.issue %> 64 | - <%= link_to_issue(entry.issue, :truncate => 50) %> 65 | <% end %> 66 | <%=h entry.comments %><%= html_hours("%.2f" % entry.hours) %> 70 | <% if entry.editable_by?(@user) -%> 71 | <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry}, 72 | :title => l(:button_edit) %> 73 | <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry}, 74 | :confirm => l(:text_are_you_sure), 75 | :method => :delete, 76 | :title => l(:button_delete) %> 77 | <% end -%> 78 |
84 | <% end %> 85 |
86 | -------------------------------------------------------------------------------- /app/views/my/blocks/_timelog.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :header_tags do %> 2 | <%= stylesheet_link_tag 'style', :plugin => 'redmine_extended_spent_time' %> 3 | <% end %> 4 | 5 | <%= render :partial => 'my/blocks/log' %> 6 | 7 | 19 | -------------------------------------------------------------------------------- /assets/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | .clearfix:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;} 2 | .clearfix {display:block;} 3 | 4 | h3 span.select-link-label{ 5 | color:#888; 6 | font-size:11px; 7 | font-weight:normal; 8 | } 9 | h3 a.select-link{ 10 | font-size:11px; 11 | font-weight:normal; 12 | padding:1px 8px; 13 | } 14 | h3 a.select-link.current{ 15 | border:1px solid #bbb; 16 | background-color:#eee; 17 | -webkit-border-radius:10px; 18 | -moz-border-radius:10px; 19 | -o-border-radius:10px; 20 | border-radius:10px; 21 | text-shadow: 0 1px 0 #fff; 22 | box-shadow:0 0 2px rgba(0,0,0,.15) inset; 23 | } 24 | h3 .spent-time-options-container{ 25 | float:right; 26 | } 27 | -------------------------------------------------------------------------------- /config/locales/de.yml: -------------------------------------------------------------------------------- 1 | de: 2 | label_extended_spent_time_week: "Woche" 3 | label_extended_spent_time_weeks: "Wochen" 4 | label_extended_spent_time_options: "Anzeigeoptionen:" 5 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | label_extended_spent_time_week: "week" 3 | label_extended_spent_time_weeks: "weeks" 4 | label_extended_spent_time_options: "Display options:" 5 | -------------------------------------------------------------------------------- /config/locales/es.yml: -------------------------------------------------------------------------------- 1 | es: 2 | label_extended_spent_time_week: "semana" 3 | label_extended_spent_time_weeks: "semana" 4 | label_extended_spent_time_options: "Ver:" 5 | -------------------------------------------------------------------------------- /config/locales/fr.yml: -------------------------------------------------------------------------------- 1 | fr: 2 | label_extended_spent_time_week: "semaine" 3 | label_extended_spent_time_weeks: "semaines" 4 | label_extended_spent_time_options: "Options d'affichage :" 5 | -------------------------------------------------------------------------------- /config/locales/pt.yml: -------------------------------------------------------------------------------- 1 | pt: 2 | label_extended_spent_time_week: "semana" 3 | label_extended_spent_time_weeks: "semanas" 4 | label_extended_spent_time_options: "Opções de exibição:" 5 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | match "extended_spent_time", to: "extended_spent_time#update", as: "extended_spent_time" 2 | -------------------------------------------------------------------------------- /illustration-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pertimm/redmine_extended_spent_time/c3dcdf183961301f7ea278fd272494a36bea6300/illustration-small.png -------------------------------------------------------------------------------- /illustration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pertimm/redmine_extended_spent_time/c3dcdf183961301f7ea278fd272494a36bea6300/illustration.png -------------------------------------------------------------------------------- /init.rb: -------------------------------------------------------------------------------- 1 | Redmine::Plugin.register :redmine_extended_spent_time do 2 | name 'Redmine Extended Spent Time plugin' 3 | author 'Jean-Marie Vallet' 4 | description 'Redmine plugin used to extend spent time visualisation options located in "my page"' 5 | version '0.0.3' 6 | requires_redmine :version => ['2.2.1', '2.3'] 7 | url 'https://github.com/Pertimm/redmine_extended_spent_time' 8 | author_url 'http://jmvallet.net/' 9 | end 10 | --------------------------------------------------------------------------------