rubycentral/cfp-app

View on GitHub
app/views/profiles/edit.html.haml

Summary

Maintainability
Test Coverage
.row
  .col-md-12
    .page-header
      %h1
        Edit Your Profile

= simple_form_for current_user, url: profile_path, html: {role: 'form'} do |f|
  .row
    %fieldset.col-md-6
      .widget
        .widget-header
          %i.fa.fa-user
          %h3 Your Profile
        .widget-content
          - unless current_user.complete?
            %p
              Please make sure your name and email address are present and correct.
          %p
            This information will be
            %strong hidden
            from the review committee during the review process.
          .form-group
            = f.label :name
            = f.text_field :name, class: 'form-control', placeholder: 'Your name', autofocus: true
          %p
            = f.label :bio
            = f.text_area :bio, class: 'form-control', placeholder: 'Enter your bio', rows: 7, maxlength: 500
            %p.help-block Bio is limited to 500 characters.

    %fieldset.col-md-6
      .widget
        .widget-header
          %i.fa.fa-lock
          - if current_user.provider.present?
            %i.fa{class: "fa-#{current_user.provider.downcase}"}
          %h3 Identity Services
        .widget-content
          %p
            Email is only used for notifications on proposal feedback and acceptance into the program.
          .form-group
            = f.label :email
            = f.email_field :email, class: 'form-control', placeholder: 'Your email address', value: current_user.unconfirmed_email.present? ? current_user.unconfirmed_email : current_user.email
            - if current_user.unconfirmed_email.present?
              %p.help-block.red-text This email has not been confirmed yet.
          .form-group
            = f.label :password
            = f.password_field :password, class: 'form-control', placeholder: 'Password'
          .form-group
            = f.label :password_confirmation
            = f.password_field :password_confirmation, class: 'form-control', placeholder: 'Confirm password'

    %fieldset.col-md-6
      .widget
        .widget-header
          %i.fa.fa-lock
          %h3 Profile Icon Image
        .widget-content
          %p
            Add or change your profile icon image by visiting
            = link_to('Gravatar', 'https://en.gravatar.com/connect/', target: "_blank")

          - if current_user.provider.present?
            .service
              %button.btn.btn-default.disabled{class: "btn-#{current_user.provider.downcase}-alt"}
                %i{class: "fa fa-#{current_user.provider.downcase}"}
                | Connected via
                = current_user.provider

      - if current_user.teammates.present?
        .widget
          .widget-header
            %i.fa.fa-envelope
            %h3
              Notifications
              = link_to "#", id: "notification-preferences-toggle",
                data: { container: 'body', toggle: 'popover', placement: "left",
                        content: notification_preferences_tooltip, html: true } do
                %i.fa.fa-question-circle
          .widget-content
            = f.simple_fields_for :teammates do |fields|
              - teammate = fields.object
              %b= teammate.event.name
              = fields.input :notification_preference,
                collection: Teammate::NOTIFICATION_PREFERENCES.invert,
                as: :radio_buttons, wrapper: 'horizontal_radio_and_checkboxes', label: false

  .row
    .col-md-12.form-submit
      %button.pull-right.btn.btn-success.btn-lg{type: "submit"} Save