Commit Graph
49 Commits
Author SHA1 Message Date
Eric Davis 0d90144c0e Fixed a bug where Rates on a project were being selected by the default
rate finder.  #1921
2009-01-20 15:57:24 -08:00
Eric Davis 8c5e58de04 Changed the API so Rate#for will return a Rate object and Rate#amount_for
will return the rate amount.

  #1921
2009-01-20 15:26:01 -08:00
Eric Davis 8e89e69532 Added several more Rate#for specs using full stack specs. #1918 2009-01-20 15:07:36 -08:00
Eric Davis 5e774eb378 Fixed a bug where default rate wasn't getting used. #1918 2009-01-20 14:55:00 -08:00
Eric Davis 2b7cfa4dbc Added specs to cover if Rate.for doesn't find anything. #1918 2009-01-20 14:16:28 -08:00
Eric Davis 6f0666d854 Implemented pending rate spec 2009-01-20 14:13:26 -08:00
Eric Davis b21430a7f2 Caught a bug on the exception path of redirect_back_or_default. #1916 2009-01-20 14:07:54 -08:00
Eric Davis 099e87fda8 Overrode redirect_back_or_default to check the back_url against a whitelist
of valid urls to redirect back_to.  #1916
2009-01-20 13:58:11 -08:00
Eric Davis fcd8f24b69 Changed back_url so it's always set and added a test for it. #1916 2009-01-20 12:55:56 -08:00
Eric Davis 158969e359 Added an error message when a locked rate is tried to be deleted. #1919 2009-01-20 11:33:08 -08:00
Eric Davis dc8dd4abe4 Redirect to a back_url when deleting a rate also. #1919 2009-01-20 11:29:33 -08:00
Eric Davis a294ff0154 Once deleting a Rate, the user should be redirected back to the user rate list. #1919 2009-01-20 11:27:40 -08:00
Eric Davis 3fccd98102 Added hints to the edit form so a user will not edit a locked Rate. #1919 2009-01-20 11:17:37 -08:00
Eric Davis a52afb7a2b Protect locked rates from being updated.
* Locked rates will fail to save
* Attempting to save a Locked rates will display an error and reload the
  Rate from the database so the update parameters are thrown away

  #1919
2009-01-20 11:05:19 -08:00
Eric Davis 1cd24e451b Sorting the Project column by project name now
* Including projects in Rate.history_for_user
* Moved the valid sort options to a constant on the RatesController
* Changed the ValidSortOptions to use the Project name for project_id
* Updated admin view to use RatesController::ValidSortOptions instead of a
  duplicated string.

  #1915
2009-01-20 10:46:16 -08:00
Eric Davis f870a6019e Hacked some column sorting onto RatesController
* Added SortHelper to RatesController
* Init and updating the sorting (pre 0.8 sort_update)
* RatesController#index will only render the layout on non-xhr requests
* Changed Rate.history_for_user to take an order clause
* Added rate_sort_header_tag and rate_sort_link to the SortHelper in order
  to get the correct parameters for sorting Rates
* Added rate_sort_header_tags to the Rate lists

  #1915
2009-01-19 14:43:54 -08:00
Eric Davis 3f4ea96777 Changed RatesController#update to redirect to:
* Rate list for user or
* the back_url if provided

  #1914
2009-01-19 11:54:54 -08:00
Eric Davis 22ec6f56b7 Added a back_url field to the Rate for that will store the redirect path.
* Used in the User Administration panel so RatesController can redirect back to
  the panel as needed.

  #1914
2009-01-19 11:32:27 -08:00
Eric Davis cc063768b6 Once saving a rate, the user is redirected to the rate list. #1914 2009-01-19 11:22:42 -08:00
Eric Davis 86c1990faa Require a user_id on the new action. #1914 2009-01-19 11:14:57 -08:00
Eric Davis c178f616d5 Integrated views into the controller specs. #1916 2009-01-19 10:56:39 -08:00
Eric Davis c3250c882a Blocked all non-admins from using the RatesController. #1916 2009-01-19 10:40:42 -08:00
Eric Davis a2e77e8182 Converted RatesController#index to require a user_id parameter
* This action will turn into the Rate History screen

  #1916
2009-01-19 10:25:04 -08:00
Eric Davis 441a86e7a6 Added generated RESTful RatesController. #1916 2009-01-19 09:53:47 -08:00
Eric Davis 2950051383 Checking date input for Rate#for. #1920 2009-01-16 16:59:49 -08:00
Eric Davis 7bca02b511 Instead of returning nil, which could get confused with No Rate, passing
incorrect objects to Rate#for will now throw a Rate::InvalidParameterException
back to the caller.

Normally you don't need to be this strict but this is a public API that will
be consumed by several third parties so we need to be very clear what happened.

  #1920
2009-01-16 16:53:00 -08:00
Eric Davis 94e8aad493 Rate#for should handle invalid projects. #1920 2009-01-16 16:43:26 -08:00
Eric Davis 08b267741b Rate#for should handle invalid users. #1920 2009-01-16 16:40:50 -08:00
Eric Davis bab1fa7763 Singular rate 2009-01-16 16:35:05 -08:00
Eric Davis da891cc607 Refactored Rate#for_user_project_and_date to allow nil projects. #1920 2009-01-16 16:34:38 -08:00
Eric Davis 4599e21dfb More spec refactoring, duplicated mocks. #1920 2009-01-16 16:26:08 -08:00
Eric Davis 8b2022fa98 Removed a bunch of custom finders from the specs due to the private method refactoring and stubs. #1920 2009-01-16 16:24:38 -08:00
Eric Davis 82cf412560 Removed duplication 2009-01-16 16:22:45 -08:00
Eric Davis 24c445cce9 Extracted specs from Rate#for for Rate#for_user_project_and_date #1920 2009-01-16 16:21:45 -08:00
Eric Davis 68b7df3237 Added specs to test for using the default (today) date. #1920 2009-01-16 16:13:57 -08:00
Eric Davis 69d922a029 Refactored Rate#for to only get one record. #1920 2009-01-16 16:08:13 -08:00
Eric Davis 6a211c3e5e Rate#for will now return the most current rate for the user matching the parameters. #1920 2009-01-16 16:06:12 -08:00
Eric Davis b59c87b1f6 Implementing Rate#for's internal logic. #1920 2009-01-16 16:03:15 -08:00
Eric Davis 0d9c7e50de Added specs for the Rate#for parameter. #1920 2009-01-16 15:54:14 -08:00
Eric Davis 4ea018b304 Reworded spec descriptions. 2009-01-16 15:34:40 -08:00
Eric Davis 0e8bd2153c Prevent Rates from being destroyed if they are locked. #1919 2009-01-16 15:33:42 -08:00
Eric Davis 3ffb31fafc Require that a Rate be unlocked before saving it. #1919 2009-01-16 15:28:34 -08:00
Eric Davis 9b0332bf78 Added a Rate#locked? check. #1919 2009-01-16 15:23:30 -08:00
Eric Davis 931ecae4d1 Renamed the Rates tab to Rate History to match the comp. #1915 2009-01-16 15:17:34 -08:00
Eric Davis e1278bcb69 Patched UsersHelper#user_settings_tabs to add a new Rates tab
* Wrapped UsersHelper#user_settings_tabs with an alias_method_chain
* Added the new Rate element to the return of user_settings_tabs
* Added RSpecs to confirm the change works without breaking
* Added a partial view for users/rates which will be used by Redmine
  when it renders the user edit panel

  #1913
2009-01-16 14:42:33 -08:00
Eric Davis 48d394704a Added data validation for Rates. #1917 2009-01-16 14:14:21 -08:00
Eric Davis 3f39bdaa6b Added associations to Rate. #1917 2009-01-16 14:00:11 -08:00
Eric Davis a3c12fed19 Added basic rate model and it's database schema 2009-01-16 13:56:04 -08:00
Eric Davis f2b85945b4 Added cucumber and rspec testing support 2009-01-16 13:40:12 -08:00