ministryofjustice/peoplefinder

View on GitHub
app/views/groups/_form.html.haml

Summary

Maintainability
Test Coverage
- @editing_mode = true
= form_for @group do |f|

  = f.text_field :name
  = f.text_field :acronym

  .grid-row
    .column-two-thirds
      = f.text_area :description, placeholder: t('.placeholder'), rows: 10, "data-limit": 2000

    .column-one-third
      .form-group.help-area
        %h3.heading-medium
          Formatting
        %p
          Click each heading below to find out how you can add formatting to your text.
        %details
          %summary
            %span.summary
              Bullet point list
          .panel
            Copy and paste the formatting below then replace each item with the text you want
            %br
            * bullet point copy here
            %br
            * bullet point copy here
            %br
              * sub bullet point copy here
            %br
              * sub bullet point copy here

        %details
          %summary
            %span.summary
              Numbered list
          .panel
            Copy and paste the formatting below then replace each item with the text you want
            %br
            1. point 1 copy here
            %br
            2. point 2 copy here
            %br
            3. point 3 copy here

        %details
          %summary
            %span.summary
              Line space
          .panel
            To add a line space press enter

  - if @group.editable_parent?
    .form-group.group-parent.editable-container
      - if params[:group_id]
        = f.hidden_field :parent_id
      - else
        %label.form-label-bold
          Team parent
        %p#error_group_base.form-hint
          Change where in the organisation this team is located.

        -unless @group.new_record?
          .editable-summary.parent-summary
            - if @group.parent
              .title
                = breadcrumbs(@group.parent.path, show_links: false)
            = link_to 'Change team parent', '#', class: 'show-editable-fields'

        .editable-fields{ style: ('display:none' unless @group.new_record?) }
          %p.form-hint
            = t('.team_selector_hint')
          - if @org_structure
            = render 'shared/org_browser', org_structure: @org_structure, form: f, field_name: :parent_id
            = link_to 'Done', '#', class: 'hide-editable-fields button-secondary'

  .form-group
    = f.submit class: 'button'

  .form-group
    .cancel
      - if @group.new_record?
        = link_to 'Cancel', :back
      - else
        = link_to 'Cancel', @group