From 4434f93aa984aabbb5bc35225f0ffe92c0b6f05d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 11 Jan 2014 12:36:10 +0200 Subject: [PATCH] Select2 dropdown autoWidth --- app/assets/javascripts/main.js.coffee | 2 +- app/assets/stylesheets/generic/selects.scss | 17 ++++++++++++++++- app/assets/stylesheets/sections/projects.scss | 35 +---------------------------------- 3 files changed, 18 insertions(+), 36 deletions(-) diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee index 64fe7bd..9cf4dba 100644 --- a/app/assets/javascripts/main.js.coffee +++ b/app/assets/javascripts/main.js.coffee @@ -68,7 +68,7 @@ $ -> e.preventDefault() # Initialize select2 selects - $('select.select2').select2(width: 'resolve') + $('select.select2').select2(width: 'resolve', dropdownAutoWidth: true) # Initialize tooltips $('.has_tooltip').tooltip() diff --git a/app/assets/stylesheets/generic/selects.scss b/app/assets/stylesheets/generic/selects.scss index bd9fc21..fa10e85 100644 --- a/app/assets/stylesheets/generic/selects.scss +++ b/app/assets/stylesheets/generic/selects.scss @@ -2,11 +2,20 @@ .select2-container { .select2-choice { - background: #EEE; + background: #FFF; border-color: #BBB; + + .select2-arrow { + background: #FFF; + } } } +.select2-drop-active { + border: 1px solid #BBB; + margin-top: 4px; +} + select { &.select2 { width: 100px; @@ -51,3 +60,9 @@ select { } } } + + +/** Branch/tag selector **/ +.project-refs-form .select2-container { + margin-right: 10px; +} diff --git a/app/assets/stylesheets/sections/projects.scss b/app/assets/stylesheets/sections/projects.scss index 8749c74..1783648 100644 --- a/app/assets/stylesheets/sections/projects.scss +++ b/app/assets/stylesheets/sections/projects.scss @@ -75,7 +75,7 @@ .project-home-dropdown + & { margin-right: 45px; } - + .btn, .form-control { border: 1px solid #E1E1E1; @@ -234,39 +234,6 @@ ul.nav.nav-projects-tabs { min-width: 200px; } -/** Branch/tag selector **/ -.project-refs-form { - margin: 0; - span { - background:none !important; - position:static !important; - width:auto !important; - height:auto !important; - } -} - -.project-refs-form .select2-container { - position: relative; - top: 0; - left: 0; - margin-right: 10px; - - .select2-single span { - font-weight: bold; - color: #555; - } - - &.select2-container-active { - .select2-drop { - min-width: 400px; - } - - .select2-results { - max-height: 400px; - } - } -} - .deploy-project-label { margin: 1px; } -- libgit2 0.21.2