YaleSTC / shifts

Application to easily track shifts, reports, and payforms for employees.
MIT License
23 stars 18 forks source link

Cannot create new Data Types #269

Closed njlxyaoxinwei closed 10 years ago

njlxyaoxinwei commented 10 years ago

The new and edit pages for data_types are broken due to deprecation, so is the edit page of data_field

njlxyaoxinwei commented 10 years ago

The dataType select should automatically trigger a change in the description. This feature is not even working properly in the rails2 DEMO site.

njlxyaoxinwei commented 10 years ago

For the edit page of a data_field, the observe_field method is deprecated

njlxyaoxinwei commented 10 years ago

I fixed all the deprecated methods, rewrote data_types/data_field partial, data_types_form.js and data_field_input.js to handle the different help texts and input fields for different data_field types. I also added the upper and lower bound attributes on text_field types and exact_alert attribute on all but the text_area types. (as the old rails2 version tried to do but had not yet made it working)

Then I refactored out the form for data_field, named the partial data_fields/description, so that data_types/data_field partial shares the same code with the data_fields/form partial. The functionality of the deprecated observe_field is now realized by the markup in description partial and two CoffeeScripts data_types_form.js.coffee and data_field_input.js.coffee. I also fixed minor details about correctly displaying default types and their corresponding help texts and input fields etc.

There is now no need for the entire data_field_types directory in views. Besides, alert_bounds, alert_exact, value_field partial in data_fields view are no longer needed either. Neither is the update_form action on the data_fields_controller and update_form.js.rjs. The deprecated add_data_field_link method in data_types_helper is no longer used either. All these are now realized by the HTML markup for all descriptions in my description partial and the code to pick one in my two CoffeeScript files. Therefore I have removed the said files/code.

njlxyaoxinwei commented 10 years ago

The views for user_profile_fields were really similar to those of data_fields, so we should be able to do something similar to make it work.