dobtco / dvl-core

Base styles for the DOBT View Layer.
https://design.dobt.co/
1 stars 1 forks source link

No disabled state for rich text dropdowns #293

Closed vlymar closed 7 years ago

vlymar commented 8 years ago

I tried passing disabled: true to the input field, and it gets added as an attribute and class to the html, but the actual element does not go into disabled state.

      simple_form_for(
        @project,
        url: organization_project_admin_collaborators_path,
        method: :post,
        remote: true,
        html: {
          'data-autosubmitter' => true
        }
      ) do |f|
        div(class: 'org_permissions_wrap') {
          f.input_field :organization_permission_level,
                        as: :dropdown_select,
                        collection: enum_to_dropdown_select_collection(
                          PermissionLevel.assignable.except(:custom),
                          'simple_form.options.defaults.permission_level'
                        ),
                        include_blank: t('org_permissions_blank'),
                        'data-no-blank-class' => true,
                        'data-as-wrapper' => '.org_permissions_wrap',
                        disabled: true

        }
      end
<input 
  disabled="disabled" 
  class="dropdown_select optional disabled" 
  include_blank="Can't see this project"
  data-no-blank-class="true" 
  data-as-wrapper=".org_permissions_wrap"
  type="hidden" value="3"
  name="project[organization_permission_level]" 
  id="project_organization_permission_level"
>

Manually adding .disabled to the styled_select_wrapper doesn't do it either

This will be necessary for https://github.com/dobtco/screendoor-v2/pull/4311

ajb commented 7 years ago

I just implemented this and was writing up a PR, but you know, there's actually an easier solution:

Since a disabled dropdown is never going to be expanded, and because rich-text dropdowns and regular <select>s look identical when collapsed, we could just use a regular disabled <select>.

@vlymar, how does that sound?

vlymar commented 7 years ago

genius

vlymar commented 7 years ago

only issue is the dropdown border is quite faint against the grey background, assuming thats an unrelated non-issue though

screen shot 2016-11-14 at 4 16 30 pm

vlymar commented 7 years ago

im happy to close this issue if you agree

ajb commented 7 years ago

Yeah, that's unrelated and can be dealt with in Screendoor. :+1: