#1632 Simplify code on settings page
Merged by pingou. Opened by lsedlar.
lsedlar/pagure settings-refactor  into  master

Download 1632.patch

There is a lot of duplication in the settings page template. Let's make it simpler.

The first two commits are slightly unrelated: one fixes incorrect button label in Notifications section, the second correctly selects option based on custom field type (the attribute seems to be field_type, not type_).

The following commits perform these changes:

  1. Make sure that there always is at least one row in each extensible form (priorities, milestones, close statuses, custom fields, quick replies). This is only use visible change.
  2. Remove HTML from JS snippets. Instead we can clone last from respective form (since we are sure there is at least one), reset value in all input fields and append it to the form. Setting default priorities can be simplified by cloning rows as well.
  3. All the snippets now only differ in identifier of the form. Moving this information to a data- attribute on the button we can use a single snippet for all the forms.

I'll need to test it a little locally, but looking at the code, this looks quite cool, thanks! :)

Working good, thanks for the clean up!

Pull-Request has been merged by pingou

Metadata