I am surprised how easy that change was. However, someone please review the code and give it a try.
Changes: * added the review functionality as part of projects instead of todos * don't mess with staleness of todos anymore * add preference settings for a review period * add CSS for reviewneeded in the project * add db migrate scripts What is missing is to check in projects_helper in function needsreview_class to check whether the project is active. Can someone provide the code snippet? Sebastian On Thu, Sep 15, 2011 at 2:18 PM, Christian Frank <[email protected]> wrote: > Yep, that's why I suspected helpers/todos_helper.rb will have to change as > well. Quick grep for 'stale' shows: > [cfrank@devel app]$ grep stale * -iR > helpers/todos_helper.rb: # Uses the 'staleness_starts' value from > settings.yml (in days) to colour the > helpers/todos_helper.rb: # * l1: created more than 1 x staleness_starts, > but < 2 x staleness_starts > helpers/todos_helper.rb: # * l2: created more than 2 x staleness_starts, > but < 3 x staleness_starts > helpers/todos_helper.rb: # * l3: created more than 3 x staleness_starts > helpers/todos_helper.rb: def staleness_class(item) > helpers/todos_helper.rb: elsif item.created_at < current_user.time - > (prefs.staleness_starts * 3).days > helpers/todos_helper.rb: return " stale_l3" > helpers/todos_helper.rb: elsif item.created_at < current_user.time - > (prefs.staleness_starts * 2).days > helpers/todos_helper.rb: return " stale_l2" > helpers/todos_helper.rb: elsif item.created_at < current_user.time - > (prefs.staleness_starts).days > helpers/todos_helper.rb: return " stale_l1" > views/preferences/edit.html.erb: <li><strong>staleness starts:</strong> > the number of days before items with no due date get marked as stale (with a > yellow highlight)</li> > views/preferences/edit.html.erb: <%= > row_with_text_field('staleness_starts', true) %> > views/preferences/index.html.erb: <li>Staleness starts after <span > class="highlight"><%= prefs.staleness_starts %></span> days</li> > views/todos/_successor.html.erb: <div class="description<%= > staleness_class( successor ) %>" style="margin-left: 20px"> > views/todos/_todo.html.erb: <div class="description<%= staleness_class( > todo ) %>"> > Best > Christian > > > On Thu, Sep 15, 2011 at 12:58 PM, Sebastian Fischmeister > <[email protected]> wrote: >> >> I see now that it messes up the statistics. My major problem is that I >> have zero experience with ruby, rails, JS, etc. I was happy to hack >> this together. >> >> Creating a new field then clashes with the staleness notification. >> >> Sebastian >> >> On Thu, Sep 15, 2011 at 10:44 AM, Christian Frank <[email protected]> >> wrote: >> > Sebastian, >> > sounds like a very useful feature. I can't test it right away, but I >> > think >> > changing the creation date of the todo will mess up the statistics in >> > tracks/stats as well as change the sort order in some views. >> > If that's the case, you could instead add a 'last_reviewed_date' to the >> > database, have it default to the creation date and base the staleness >> > calculation on this new field. (I think that'll require changes to >> > helpers/todos_helper.rb as well) >> > If you haven't messed with a rails database before, couple pointers >> > (just >> > since you said you're new to rails, don't mean to patronize) >> > - Adding fields to the database is done using migrations. Examples can >> > be >> > found under tracks/db/migrate, especially at >> > '026_add_project_timestamps.rb' >> > and '043_add_updated_at_to_todos.rb' may help in this case >> > - After you create a migration you have to run 'rake db:migrate' >> > (specifying >> > the right RAILS_ENV (development or production)), and it'll modify the >> > database >> > Lastly, it may be that the field todo.updated_at can do what you need >> > already, but I'm not sure where it's used. >> > Christian >> > On Thu, Sep 15, 2011 at 8:34 AM, Sebastian Fischmeister >> > <[email protected]> wrote: >> >> >> >> Hi, >> >> >> >> I've implemented a review feature for tracks. The functionality is as >> >> follows: >> >> >> >> * Staleness of todos implies that you should review the project >> >> * Go to the project, click on edit project, click on the 'reviewed' >> >> button >> >> >> >> It essentially takes all the todos in the current project and updates >> >> their creation date to the current date to remove staleness. This now >> >> permits to use staleness to set how often one wants review projects. >> >> >> >> git clone git://github.com/Popsch/tracks.git implement_review_button >> >> >> >> Reinier, please review the implementation, because it's my first try. >> >> The icon is under CC BY 3.0. >> >> >> >> Sebastian >> >> _______________________________________________ >> >> Tracks-discuss mailing list >> >> [email protected] >> >> http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss >> > >> > > > _______________________________________________ Tracks-discuss mailing list [email protected] http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss
