Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !399

Refactor form styles

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge tg-forms into tg-css-refactor Jan 10, 2016
  • Overview 4
  • Commits 8
  • Pipelines 0
  • Changes 18

Created by: tysongach

This PR refactors the styling of forms. It introduces a new reusable pattern for marking up and styling form elements. That pattern is a field-unit class, which was loosely called a form-field previously.

A form-unit is simply a grouping of elements that create a whole “field” in a form, the most common being a simple label/input pair (classed as field-unit__label and field-unit__field now). But a form-unit can have many children beyond field-unit__label and field-unit__field, for example, if we have a hint for the input, we could add a field-unit__field-hint. It offers a lot of flexibility moving forward and, overall, DRYs up a lot of the styles around forms:

  • We used to have to set margins on every type of input a form had (which is a bit of a moving target), e.g. input, select, .selectize, etc. This gets out of hand quickly and results in duplicated margin values all over our CSS. Now that we have a consistent field-unit element which should wrap each whole “field” in a form, we can define the margin here, and only do it once.
  • The old components/_form.scss partial, is gone and means we don’t have lots of base element styles outside of the base/ stylesheet directory
  • This consistent structure will allow us to more easily make these form fields responsive
  • Helps to eliminate specificity issues, some of which were brought up in https://github.com/thoughtbot/administrate/pull/273 and a very similar solution was discussed there.

Some look and feel has been changed in this PR (screenshots below). It wouldn’t be much effort to hit a near exact match to how it looks now, but I’m more concerned with establishing a great base for styling.

Before

screen shot 2016-01-10 at 13 27 29

After

screen shot 2016-01-10 at 13 27 34

  • Note: This PR depends on #379 getting merged.
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: tg-forms