195 Commits

Author SHA1 Message Date
Eric Davis
8ea912be4b First run at a data checking task for the Budget plugin. #1924 2009-01-23 14:09:21 -08:00
Eric Davis
6aa00eeeb9 Added a helper method to TimeEntry that will encapsulate the rate API for a TimeEntry.
* TimeEntry#cost will return the amount the TimeEntry costs based on:
** logged hours times the assigned rate amount
** logged hours times the effective project rate for the user
** logged hours times the effective default rate for the user
** 0 if the user has no rates at all

  #1924
2009-01-21 15:11:35 -08:00
Eric Davis
2d3fbf02b0 Added TODO 2009-01-21 13:34:45 -08:00
Eric Davis
b6bffb2c05 Added the rest of the form for setting a rate on a project. #1923 2009-01-21 12:35:55 -08:00
Eric Davis
aab2d83d48 Update the value for the emapy project so it will set the default rate. #1923 2009-01-21 12:35:33 -08:00
Eric Davis
dc6acf5031 Changed the create.rjs so it will replace the td on the admin and project panel.
* td's are now id'ed like rate_project_user

  #1923
2009-01-21 12:20:17 -08:00
Eric Davis
05501f3eb6 Ported the basics for the Rate form from the Budget plugin. #1923 2009-01-21 12:15:44 -08:00
Eric Davis
256627d2a3 Ported the table header from the Budget plugin hook. #1923 2009-01-21 11:23:15 -08:00
Eric Davis
82e480b77b Minor bug when a user doesn't have any rates yet 2009-01-20 17:11:27 -08:00
Eric Davis
363e8c0c5a Converted the Membership rate form to an Ajax remote form.
* Changed the form_for to be a remote_form_for
* Changed the url to use the js format
* Added RJS to add the Saved rate to the rate cell
* Added id to the table cell so the rate cell can be replaced on success
* Added an Error RJS to flash an error message

  #1921
2009-01-20 16:37:23 -08:00
Eric Davis
7930144e8c Require amount to be a number. 2009-01-20 16:35:00 -08:00
Eric Davis
0806bf13df Added a standard form for adding a new rate based on the membership row. #1921 2009-01-20 15:58:55 -08:00
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
cfd6e09df5 Added a duplicate of the Redmine _membership partial but with 'hooks' for setting Rates. #1921 2009-01-20 15:38:29 -08:00
Eric Davis
6141554976 Added some boolean tests to see if a Rate is a default rate. #1921 2009-01-20 15:37:53 -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
ace208da8a Replaced all custom back_url redirection with Redmine's redirect_back_or_default. #1916 2009-01-20 13:06:39 -08:00
Eric Davis
2c752210ae Refactored params[:back_url] to @back_url. #1916 2009-01-20 12:57:42 -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
56298bc867 Added a link to delete a Rate. #1919 2009-01-20 11:34:43 -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
05dd3649f6 Fixed the sorts by updated to 0.8 to use the new sort API and fixing the update element id. #1915 2009-01-19 15:00:43 -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
e97a68be0d Show different buttons based on if the Rate is new. #1914 2009-01-19 11:49:43 -08:00
Eric Davis
7d32fc7088 Added a new helper to UsersHelper.
* project_options_for_select doesn't allow setting the selected project
  so it is replaced with project_options_for_select_with_selected in the views

  #1914
2009-01-19 11:47:02 -08:00
Eric Davis
627a03c5e6 Enabled the edit link on index. 2009-01-19 11:35:39 -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
b7a4850b06 Wrong name for the project select field. #1914 2009-01-19 11:20:00 -08:00
Eric Davis
2fe0bd3052 Refactored duplicate logic to a before_filter. #1914 2009-01-19 11:17:13 -08:00
Eric Davis
86c1990faa Require a user_id on the new action. #1914 2009-01-19 11:14:57 -08:00
Eric Davis
8fe67ef8ae Updated the form to use the form_for now that there is a Rate object. #1914 2009-01-19 11:14:39 -08:00
Eric Davis
83764cfe40 Use the same form for new as well as edit. #1916 2009-01-19 10:57:28 -08:00
Eric Davis
c178f616d5 Integrated views into the controller specs. #1916 2009-01-19 10:56:39 -08:00
Eric Davis
e6bb0de7e7 Updated url documentation 2009-01-19 10:46:51 -08:00
Eric Davis
ae0be85f76 Using form partial for the new rate. #1916 2009-01-19 10:45:53 -08:00
Eric Davis
c3250c882a Blocked all non-admins from using the RatesController. #1916 2009-01-19 10:40:42 -08:00
Eric Davis
6698ff8169 Moved the Rate History out of the users partial and into a partial for Rates
* This will allow the RatesController to use the same view

  #1916
2009-01-19 10:28:58 -08:00