Commit d88aafcb5d15827029a8f42e1a88ac313b1d218e
Exists in
spb-stable
and in
3 other branches
Merge branch 'select2' of /home/git/repositories/gitlab/gitlabhq
Showing
29 changed files
with
73 additions
and
187 deletions
Show diff stats
Gemfile
Gemfile.lock
| ... | ... | @@ -71,12 +71,6 @@ GEM |
| 71 | 71 | celluloid (0.15.2) |
| 72 | 72 | timers (~> 1.1.0) |
| 73 | 73 | charlock_holmes (0.6.9.4) |
| 74 | - chosen-rails (1.0.1) | |
| 75 | - coffee-rails (>= 3.2) | |
| 76 | - compass-rails (>= 1.0) | |
| 77 | - railties (>= 3.0) | |
| 78 | - sass-rails (>= 3.2) | |
| 79 | - chunky_png (1.2.9) | |
| 80 | 74 | cliver (0.2.2) |
| 81 | 75 | code_analyzer (0.4.3) |
| 82 | 76 | sexp_processor |
| ... | ... | @@ -92,12 +86,6 @@ GEM |
| 92 | 86 | coffee-script-source (1.6.3) |
| 93 | 87 | colored (1.2) |
| 94 | 88 | colorize (0.5.8) |
| 95 | - compass (0.12.2) | |
| 96 | - chunky_png (~> 1.2) | |
| 97 | - fssm (>= 0.2.7) | |
| 98 | - sass (~> 3.1) | |
| 99 | - compass-rails (1.1.1) | |
| 100 | - compass (>= 0.12.2) | |
| 101 | 89 | connection_pool (1.2.0) |
| 102 | 90 | coveralls (0.7.0) |
| 103 | 91 | multi_json (~> 1.3) |
| ... | ... | @@ -161,7 +149,6 @@ GEM |
| 161 | 149 | dotenv (>= 0.7) |
| 162 | 150 | thor (>= 0.13.6) |
| 163 | 151 | formatador (0.2.4) |
| 164 | - fssm (0.2.10) | |
| 165 | 152 | gemoji (1.3.1) |
| 166 | 153 | gherkin-ruby (0.3.1) |
| 167 | 154 | racc |
| ... | ... | @@ -572,7 +559,6 @@ DEPENDENCIES |
| 572 | 559 | bootstrap-sass (~> 3.0) |
| 573 | 560 | capybara |
| 574 | 561 | carrierwave |
| 575 | - chosen-rails (= 1.0.1) | |
| 576 | 562 | coffee-rails |
| 577 | 563 | colored |
| 578 | 564 | coveralls | ... | ... |
app/assets/javascripts/application.js
app/assets/javascripts/issues.js.coffee
| ... | ... | @@ -29,12 +29,10 @@ |
| 29 | 29 | $('#filter_issue_search').val($('#issue_search').val()) |
| 30 | 30 | |
| 31 | 31 | initSelects: -> |
| 32 | - $("#update_status").chosen() | |
| 33 | - $("#update_assignee_id").chosen() | |
| 34 | - $("#update_milestone_id").chosen() | |
| 35 | - $("#label_name").chosen() | |
| 36 | - $("#assignee_id").chosen() | |
| 37 | - $("#milestone_id").chosen() | |
| 32 | + $("select#update_status").select2() | |
| 33 | + $("select#update_assignee_id").select2() | |
| 34 | + $("select#update_milestone_id").select2() | |
| 35 | + $("select#label_name").select2() | |
| 38 | 36 | $("#milestone_id, #assignee_id, #label_name").on "change", -> |
| 39 | 37 | $(this).closest("form").submit() |
| 40 | 38 | ... | ... |
app/assets/javascripts/main.js.coffee
| ... | ... | @@ -67,8 +67,8 @@ $ -> |
| 67 | 67 | $('.appear-data').fadeIn() |
| 68 | 68 | e.preventDefault() |
| 69 | 69 | |
| 70 | - # Initialize chosen selects | |
| 71 | - $('select.chosen').chosen() | |
| 70 | + # Initialize select2 selects | |
| 71 | + $('select.select2').select2(width: 'resolve', dropdownAutoWidth: true) | |
| 72 | 72 | |
| 73 | 73 | # Initialize tooltips |
| 74 | 74 | $('.has_tooltip').tooltip() |
| ... | ... | @@ -126,12 +126,6 @@ $ -> |
| 126 | 126 | $(@).remove() |
| 127 | 127 | |
| 128 | 128 | (($) -> |
| 129 | - _chosen = $.fn.chosen | |
| 130 | - $.fn.extend chosen: (options) -> | |
| 131 | - default_options = search_contains: "true" | |
| 132 | - $.extend default_options, options | |
| 133 | - _chosen.apply @, [default_options] | |
| 134 | - | |
| 135 | 129 | # Disable an element and add the 'disabled' Bootstrap class |
| 136 | 130 | $.fn.extend disable: -> |
| 137 | 131 | $(@).attr('disabled', 'disabled').addClass('disabled') | ... | ... |
app/assets/javascripts/merge_requests.js.coffee
| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | # * Filter merge requests |
| 3 | 3 | # |
| 4 | 4 | @merge_requestsPage = -> |
| 5 | - $('#assignee_id').chosen() | |
| 6 | - $('#milestone_id').chosen() | |
| 5 | + $('#assignee_id').select2() | |
| 6 | + $('#milestone_id').select2() | |
| 7 | 7 | $('#milestone_id, #assignee_id').on 'change', -> |
| 8 | 8 | $(this).closest('form').submit() |
| 9 | 9 | ... | ... |
app/assets/stylesheets/application.scss
app/assets/stylesheets/generic/selects.scss
| 1 | -/** Chosen.js selectbox style override **/ | |
| 2 | -.chosen-container { | |
| 3 | - min-width: 100px; | |
| 1 | +/** Select2 selectbox style override **/ | |
| 4 | 2 | |
| 5 | - .chosen-single { | |
| 6 | - height: 26px; | |
| 7 | - background: #EEE !important; | |
| 8 | - border: 1px solid #DDD !important; | |
| 9 | - @include box-shadow(none !important); | |
| 10 | - @include border-radius(4px !important); | |
| 11 | - } | |
| 12 | - | |
| 13 | - .chosen-results li.highlighted { | |
| 14 | - background: #29b; | |
| 15 | - } | |
| 3 | +.select2-container { | |
| 4 | + .select2-choice { | |
| 5 | + background: #FFF; | |
| 6 | + border-color: #BBB; | |
| 16 | 7 | |
| 17 | - .chosen-drop { | |
| 18 | - margin-top: 10px; | |
| 19 | - border: 1px solid #DDD !important; | |
| 20 | - @include border-radius(4px !important); | |
| 21 | - } | |
| 22 | - | |
| 23 | - .chosen-search input { | |
| 24 | - border: 1px solid #CCC !important; | |
| 25 | - @include box-shadow(none !important); | |
| 8 | + .select2-arrow { | |
| 9 | + background: #FFF; | |
| 10 | + } | |
| 26 | 11 | } |
| 27 | 12 | } |
| 28 | 13 | |
| 29 | -/** Select2 styling **/ | |
| 30 | -.select2-container .select2-choice { | |
| 31 | - @include bg-light-gray-gradient; | |
| 32 | -} | |
| 33 | - | |
| 34 | -.select2-container .select2-choice div { | |
| 35 | - border: none; | |
| 36 | - background: none; | |
| 37 | -} | |
| 38 | - | |
| 39 | -.select2-drop { | |
| 40 | - padding-top: 8px; | |
| 41 | -} | |
| 42 | - | |
| 43 | -.select2-no-results, .select2-searching { | |
| 44 | - padding: 7px; | |
| 45 | - color: #666; | |
| 46 | -} | |
| 47 | - | |
| 48 | -.chosen-container .chosen-single div b { | |
| 49 | - background-position-y: 0px !important; | |
| 50 | -} | |
| 51 | - | |
| 52 | -.chosen-container .chosen-drop .chosen-search input { | |
| 53 | - background-position-y: -24px !important; | |
| 54 | -} | |
| 55 | - | |
| 56 | -.chosen-compact { | |
| 57 | - max-width: 170px !important; | |
| 14 | +.select2-drop-active { | |
| 15 | + border: 1px solid #BBB; | |
| 16 | + margin-top: 4px; | |
| 58 | 17 | } |
| 59 | 18 | |
| 60 | 19 | select { |
| 61 | - &.chosen { | |
| 20 | + &.select2 { | |
| 62 | 21 | width: 100px; |
| 63 | 22 | } |
| 64 | 23 | |
| 65 | - &.chosen-sm { | |
| 24 | + &.select2-sm { | |
| 66 | 25 | width: 100px; |
| 67 | 26 | } |
| 68 | 27 | } |
| 69 | 28 | |
| 70 | 29 | @media (min-width: $screen-sm-min) { |
| 71 | 30 | select { |
| 72 | - &.chosen { | |
| 31 | + &.select2 { | |
| 73 | 32 | width: 150px; |
| 74 | 33 | } |
| 75 | - &.chosen-sm { | |
| 34 | + &.select2-sm { | |
| 76 | 35 | width: 120px; |
| 77 | 36 | } |
| 78 | 37 | } |
| ... | ... | @@ -81,10 +40,10 @@ select { |
| 81 | 40 | /* Medium devices (desktops, 992px and up) */ |
| 82 | 41 | @media (min-width: $screen-md-min) { |
| 83 | 42 | select { |
| 84 | - &.chosen { | |
| 43 | + &.select2 { | |
| 85 | 44 | width: 170px; |
| 86 | 45 | } |
| 87 | - &.chosen-sm { | |
| 46 | + &.select2-sm { | |
| 88 | 47 | width: 140px; |
| 89 | 48 | } |
| 90 | 49 | } |
| ... | ... | @@ -93,11 +52,17 @@ select { |
| 93 | 52 | /* Large devices (large desktops, 1200px and up) */ |
| 94 | 53 | @media (min-width: $screen-lg-min) { |
| 95 | 54 | select { |
| 96 | - &.chosen { | |
| 55 | + &.select2 { | |
| 97 | 56 | width: 200px; |
| 98 | 57 | } |
| 99 | - &.chosen-sm { | |
| 58 | + &.select2-sm { | |
| 100 | 59 | width: 150px; |
| 101 | 60 | } |
| 102 | 61 | } |
| 103 | 62 | } |
| 63 | + | |
| 64 | + | |
| 65 | +/** Branch/tag selector **/ | |
| 66 | +.project-refs-form .select2-container { | |
| 67 | + margin-right: 10px; | |
| 68 | +} | ... | ... |
app/assets/stylesheets/sections/issues.scss
| ... | ... | @@ -77,8 +77,8 @@ input.check_all_issues { |
| 77 | 77 | @media (min-width: 800px) { .issues_filters select { width: 160px; } } |
| 78 | 78 | @media (min-width: 1200px) { .issues_filters select { width: 220px; } } |
| 79 | 79 | |
| 80 | -@media (min-width: 800px) { .issues_bulk_update .chosen-container { min-width: 120px; } } | |
| 81 | -@media (min-width: 1200px) { .issues_bulk_update .chosen-container { min-width: 160px; } } | |
| 80 | +@media (min-width: 800px) { .issues_bulk_update .select2-container { min-width: 120px; } } | |
| 81 | +@media (min-width: 1200px) { .issues_bulk_update .select2-container { min-width: 160px; } } | |
| 82 | 82 | |
| 83 | 83 | .issues-holder { |
| 84 | 84 | .issues_filters { |
| ... | ... | @@ -105,7 +105,7 @@ input.check_all_issues { |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | .issues_bulk_update { |
| 108 | - .chosen-container { | |
| 108 | + .select2-container { | |
| 109 | 109 | text-shadow: none; |
| 110 | 110 | } |
| 111 | 111 | } | ... | ... |
app/assets/stylesheets/sections/merge_requests.scss
app/assets/stylesheets/sections/projects.scss
| ... | ... | @@ -75,7 +75,7 @@ |
| 75 | 75 | .project-home-dropdown + & { |
| 76 | 76 | margin-right: 45px; |
| 77 | 77 | } |
| 78 | - | |
| 78 | + | |
| 79 | 79 | .btn, |
| 80 | 80 | .form-control { |
| 81 | 81 | border: 1px solid #E1E1E1; |
| ... | ... | @@ -230,43 +230,10 @@ ul.nav.nav-projects-tabs { |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | -.transfer-project .chosen-container { | |
| 233 | +.transfer-project .select2-container { | |
| 234 | 234 | min-width: 200px; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | -/** Branch/tag selector **/ | |
| 238 | -.project-refs-form { | |
| 239 | - margin: 0; | |
| 240 | - span { | |
| 241 | - background:none !important; | |
| 242 | - position:static !important; | |
| 243 | - width:auto !important; | |
| 244 | - height:auto !important; | |
| 245 | - } | |
| 246 | -} | |
| 247 | - | |
| 248 | -.project-refs-form .chosen-container { | |
| 249 | - position: relative; | |
| 250 | - top: 0; | |
| 251 | - left: 0; | |
| 252 | - margin-right: 10px; | |
| 253 | - | |
| 254 | - .chosen-single span { | |
| 255 | - font-weight: bold; | |
| 256 | - color: #555; | |
| 257 | - } | |
| 258 | - | |
| 259 | - &.chosen-container-active { | |
| 260 | - .chosen-drop { | |
| 261 | - min-width: 400px; | |
| 262 | - } | |
| 263 | - | |
| 264 | - .chosen-results { | |
| 265 | - max-height: 400px; | |
| 266 | - } | |
| 267 | - } | |
| 268 | -} | |
| 269 | - | |
| 270 | 237 | .deploy-project-label { |
| 271 | 238 | margin: 1px; |
| 272 | 239 | } | ... | ... |
app/views/admin/groups/show.html.haml
| ... | ... | @@ -57,7 +57,7 @@ |
| 57 | 57 | %div |
| 58 | 58 | = users_select_tag(:user_ids, multiple: true) |
| 59 | 59 | %div.prepend-top-10 |
| 60 | - = select_tag :group_access, options_for_select(UsersGroup.group_access_roles), class: "project-access-select chosen" | |
| 60 | + = select_tag :group_access, options_for_select(UsersGroup.group_access_roles), class: "project-access-select select2" | |
| 61 | 61 | %hr |
| 62 | 62 | = submit_tag 'Add users into group', class: "btn btn-create" |
| 63 | 63 | .ui-box | ... | ... |
app/views/groups/_new_group_member.html.haml
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | %p 2. Set access level for them |
| 13 | 13 | .form-group |
| 14 | 14 | = f.label :group_access, "Group Access", class: 'control-label' |
| 15 | - .col-sm-10= select_tag :group_access, options_for_select(UsersGroup.group_access_roles, @users_group.group_access), class: "project-access-select chosen" | |
| 15 | + .col-sm-10= select_tag :group_access, options_for_select(UsersGroup.group_access_roles, @users_group.group_access), class: "project-access-select select2" | |
| 16 | 16 | |
| 17 | 17 | .form-actions |
| 18 | 18 | = f.submit 'Add users into group', class: "btn btn-create" | ... | ... |
app/views/projects/edit.html.haml
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | - if @project.repository.exists? && @project.repository.branch_names.any? |
| 27 | 27 | .form-group |
| 28 | 28 | = f.label :default_branch, "Default Branch", class: 'control-label' |
| 29 | - .col-sm-10= f.select(:default_branch, @repository.branch_names, {}, {class: 'chosen select-wide'}) | |
| 29 | + .col-sm-10= f.select(:default_branch, @repository.branch_names, {}, {class: 'select2 select-wide'}) | |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | = render "visibility_level", f: f, visibility_level: @project.visibility_level, can_change_visibility_level: can?(current_user, :change_visibility_level, @project) |
| ... | ... | @@ -145,7 +145,7 @@ |
| 145 | 145 | %span Namespace |
| 146 | 146 | .col-sm-10 |
| 147 | 147 | .form-group |
| 148 | - = f.select :namespace_id, namespaces_options(@project.namespace_id), { prompt: 'Choose a project namespace' }, { class: 'chosen' } | |
| 148 | + = f.select :namespace_id, namespaces_options(@project.namespace_id), { prompt: 'Choose a project namespace' }, { class: 'select2' } | |
| 149 | 149 | %ul |
| 150 | 150 | %li Be careful. Changing the project's namespace can have unintended side effects. |
| 151 | 151 | %li You can only transfer the project to namespaces you manage. | ... | ... |
app/views/projects/issues/_form.html.haml
| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | %i.icon-user |
| 25 | 25 | Assign to |
| 26 | 26 | .col-sm-10 |
| 27 | - = f.select(:assignee_id, assignee_options(@issue), { include_blank: "Select a user" }, {class: 'chosen'}) | |
| 27 | + = f.select(:assignee_id, assignee_options(@issue), { include_blank: "Select a user" }, {class: 'select2'}) | |
| 28 | 28 | |
| 29 | 29 | = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' |
| 30 | 30 | .form-group |
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | = f.label :milestone_id, class: 'control-label' do |
| 33 | 33 | %i.icon-time |
| 34 | 34 | Milestone |
| 35 | - .col-sm-10= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'chosen'}) | |
| 35 | + .col-sm-10= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2'}) | |
| 36 | 36 | |
| 37 | 37 | .form-group |
| 38 | 38 | = f.label :label_list, class: 'control-label' do |
| ... | ... | @@ -87,6 +87,6 @@ |
| 87 | 87 | }); |
| 88 | 88 | |
| 89 | 89 | $('.assign-to-me-link').on('click', function(e){ |
| 90 | - $('#issue_assignee_id').val("#{current_user.id}").trigger("chosen:updated"); | |
| 90 | + $('#issue_assignee_id').val("#{current_user.id}").trigger("change"); | |
| 91 | 91 | e.preventDefault(); |
| 92 | 92 | }); | ... | ... |
app/views/projects/issues/_issue_context.html.haml
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | - if can?(current_user, :modify_issue, @issue) |
| 7 | 7 | = link_to profile_path(issue.assignee) do |
| 8 | 8 | = image_tag(avatar_icon(issue.assignee.email), class: 'avatar avatar-inline s16 assignee') if issue.assignee |
| 9 | - = f.select(:assignee_id, assignee_options(@issue), { include_blank: "Assign to user (none):" }, {class: 'chosen'}) | |
| 9 | + = f.select(:assignee_id, assignee_options(@issue), { include_blank: "Assign to user (none):" }, {class: 'select2'}) | |
| 10 | 10 | - elsif issue.assignee |
| 11 | 11 | = link_to_member(@project, @issue.assignee) |
| 12 | 12 | |
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | %cite.cgray Attached to milestone |
| 18 | 18 | |
| 19 | 19 | - if can?(current_user, :modify_issue, @issue) |
| 20 | - = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone (none):" }, {class: 'chosen chosen-compact'}) | |
| 20 | + = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone (none):" }, {class: 'select2 select2-compact'}) | |
| 21 | 21 | |
| 22 | 22 | = hidden_field_tag :issue_context |
| 23 | 23 | = f.submit class: 'btn' | ... | ... |
app/views/projects/issues/update.js.haml
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | - elsif params[:issue_context] |
| 6 | 6 | $('.issue-box .context').html("#{escape_javascript(render partial: 'issue_context', locals: { issue: @issue })}"); |
| 7 | 7 | $('.issue-box .context').effect('highlight'); |
| 8 | - $('.chosen').chosen(); | |
| 8 | + $('.select2').select2(); | |
| 9 | 9 | $('.edit-issue.inline-update input[type="submit"]').hide(); |
| 10 | 10 | - if @issue.milestone |
| 11 | 11 | $('.milestone-nav-link').replaceWith("<span class='milestone-nav-link'>| <span class='light'>Milestone</span> #{escape_javascript(link_to @issue.milestone.title, project_milestone_path(@issue.project, @issue.milestone))}</span>") | ... | ... |
app/views/projects/merge_requests/_form.html.haml
| ... | ... | @@ -10,10 +10,10 @@ |
| 10 | 10 | .col-md-5 |
| 11 | 11 | .clearfix |
| 12 | 12 | .pull-left |
| 13 | - = f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project chosen span3', disabled: @merge_request.persisted? }) | |
| 13 | + = f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project select2 span3', disabled: @merge_request.persisted? }) | |
| 14 | 14 | .pull-left |
| 15 | 15 | |
| 16 | - = f.select(:source_branch, @merge_request.source_project.repository.branch_names, { include_blank: "Select branch" }, {class: 'source_branch chosen span2'}) | |
| 16 | + = f.select(:source_branch, @merge_request.source_project.repository.branch_names, { include_blank: "Select branch" }, {class: 'source_branch select2 span2'}) | |
| 17 | 17 | .mr_source_commit.prepend-top-10 |
| 18 | 18 | .col-md-2 |
| 19 | 19 | .merge-request-angle |
| ... | ... | @@ -22,10 +22,10 @@ |
| 22 | 22 | .clearfix |
| 23 | 23 | .pull-left |
| 24 | 24 | - projects = @project.forked_from_project.nil? ? [@project] : [ @project,@project.forked_from_project] |
| 25 | - = f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace'), {}, { class: 'target_project chosen span3', disabled: @merge_request.persisted? }) | |
| 25 | + = f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace'), {}, { class: 'target_project select2 span3', disabled: @merge_request.persisted? }) | |
| 26 | 26 | .pull-left |
| 27 | 27 | |
| 28 | - = f.select(:target_branch, @target_branches, { include_blank: "Select branch" }, {class: 'target_branch chosen span2'}) | |
| 28 | + = f.select(:target_branch, @target_branches, { include_blank: "Select branch" }, {class: 'target_branch select2 span2'}) | |
| 29 | 29 | .mr_target_commit.prepend-top-10 |
| 30 | 30 | |
| 31 | 31 | %hr |
| ... | ... | @@ -47,7 +47,7 @@ |
| 47 | 47 | %i.icon-user |
| 48 | 48 | Assign to |
| 49 | 49 | .col-sm-10 |
| 50 | - = f.select(:assignee_id, assignee_options(@merge_request), { include_blank: "Select a user" }, {class: 'chosen'}) | |
| 50 | + = f.select(:assignee_id, assignee_options(@merge_request), { include_blank: "Select a user" }, {class: 'select2'}) | |
| 51 | 51 | |
| 52 | 52 | = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' |
| 53 | 53 | .form-group |
| ... | ... | @@ -55,7 +55,7 @@ |
| 55 | 55 | = f.label :milestone_id, class: 'control-label' do |
| 56 | 56 | %i.icon-time |
| 57 | 57 | Milestone |
| 58 | - .col-sm-10= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'chosen'}) | |
| 58 | + .col-sm-10= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'}) | |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | .form-actions |
| ... | ... | @@ -90,6 +90,6 @@ |
| 90 | 90 | $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() }); |
| 91 | 91 | }); |
| 92 | 92 | $('.assign-to-me-link').on('click', function(e){ |
| 93 | - $('#merge_request_assignee_id').val("#{current_user.id}").trigger("chosen:updated"); | |
| 93 | + $('#merge_request_assignee_id').val("#{current_user.id}").trigger("select2:updated"); | |
| 94 | 94 | e.preventDefault(); |
| 95 | 95 | }); | ... | ... |
app/views/projects/merge_requests/update_branches.js.haml
app/views/projects/new.html.haml
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | = f.label :namespace_id, class: 'control-label' do |
| 28 | 28 | %span Namespace |
| 29 | 29 | .col-sm-10 |
| 30 | - = f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user), {}, {class: 'chosen', tabindex: 2} | |
| 30 | + = f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user), {}, {class: 'select2', tabindex: 2} | |
| 31 | 31 | |
| 32 | 32 | .form-group |
| 33 | 33 | .col-sm-2 | ... | ... |
app/views/projects/protected_branches/index.html.haml
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | .entry.clearfix |
| 23 | 23 | = f.label :name, "Branch" |
| 24 | 24 | .col-md-3 |
| 25 | - = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "chosen span3"}) | |
| 25 | + = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "select2 span3"}) | |
| 26 | 26 | |
| 27 | 27 | = f.submit 'Protect', class: "btn-create btn" |
| 28 | 28 | - unless @branches.empty? | ... | ... |
app/views/projects/snippets/_form.html.haml
| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | .col-sm-10= f.text_field :title, placeholder: "Example Snippet", class: 'form-control', required: true |
| 15 | 15 | .form-group |
| 16 | 16 | = f.label "Lifetime" |
| 17 | - .col-sm-10= f.select :expires_at, lifetime_select_options, {}, {class: 'chosen span2'} | |
| 17 | + .col-sm-10= f.select :expires_at, lifetime_select_options, {}, {class: 'select2 span2'} | |
| 18 | 18 | .form-group |
| 19 | 19 | .file-editor |
| 20 | 20 | = f.label :file_name, "File" | ... | ... |
app/views/projects/team_members/_form.html.haml
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | %p 2. Set access level for them |
| 18 | 18 | .form-group |
| 19 | 19 | = f.label :project_access, "Project Access", class: 'control-label' |
| 20 | - .col-sm-10= select_tag :project_access, options_for_select(Gitlab::Access.options, @user_project_relation.project_access), class: "project-access-select chosen" | |
| 20 | + .col-sm-10= select_tag :project_access, options_for_select(Gitlab::Access.options, @user_project_relation.project_access), class: "project-access-select select2" | |
| 21 | 21 | |
| 22 | 22 | .form-actions |
| 23 | 23 | = f.submit 'Add users', class: "btn btn-create" | ... | ... |
app/views/projects/team_members/import.html.haml
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | = form_tag apply_import_project_team_members_path(@project), method: 'post', class: 'form-horizontal' do |
| 7 | 7 | .form-group |
| 8 | 8 | = label_tag :source_project_id, "Project", class: 'control-label' |
| 9 | - .col-sm-10= select_tag(:source_project_id, options_from_collection_for_select(current_user.authorized_projects, :id, :name_with_namespace), prompt: "Select project", class: "chosen lg", required: true) | |
| 9 | + .col-sm-10= select_tag(:source_project_id, options_from_collection_for_select(current_user.authorized_projects, :id, :name_with_namespace), prompt: "Select project", class: "select2 lg", required: true) | |
| 10 | 10 | |
| 11 | 11 | .form-actions |
| 12 | 12 | = submit_tag 'Import project members', class: "btn btn-create" | ... | ... |
app/views/shared/_ref_switcher.html.haml
| 1 | 1 | = form_tag switch_project_refs_path(@project), method: :get, class: "project-refs-form" do |
| 2 | - = select_tag "ref", grouped_options_refs, class: "project-refs-select chosen chosen-sm" | |
| 2 | + = select_tag "ref", grouped_options_refs, class: "project-refs-select select2 select2-sm" | |
| 3 | 3 | = hidden_field_tag :destination, destination |
| 4 | 4 | - if defined?(path) |
| 5 | 5 | = hidden_field_tag :path, path | ... | ... |
features/steps/project/project_forked_merge_requests.rb
| ... | ... | @@ -3,7 +3,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps |
| 3 | 3 | include SharedProject |
| 4 | 4 | include SharedNote |
| 5 | 5 | include SharedPaths |
| 6 | - include ChosenHelper | |
| 6 | + include Select2Helper | |
| 7 | 7 | |
| 8 | 8 | step 'I am a member of project "Shop"' do |
| 9 | 9 | @project = Project.find_by_name "Shop" |
| ... | ... | @@ -42,14 +42,14 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps |
| 42 | 42 | end |
| 43 | 43 | |
| 44 | 44 | step 'I fill out a "Merge Request On Forked Project" merge request' do |
| 45 | - chosen @forked_project.id, from: "#merge_request_source_project_id" | |
| 46 | - chosen @project.id, from: "#merge_request_target_project_id" | |
| 45 | + select2 @forked_project.id, from: "#merge_request_source_project_id" | |
| 46 | + select2 @project.id, from: "#merge_request_target_project_id" | |
| 47 | 47 | |
| 48 | 48 | find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s |
| 49 | 49 | find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s |
| 50 | 50 | |
| 51 | - chosen "master", from: "#merge_request_source_branch" | |
| 52 | - chosen "stable", from: "#merge_request_target_branch" | |
| 51 | + select2 "master", from: "#merge_request_source_branch" | |
| 52 | + select2 "stable", from: "#merge_request_target_branch" | |
| 53 | 53 | |
| 54 | 54 | find(:select, "merge_request_source_branch", {}).value.should == 'master' |
| 55 | 55 | find(:select, "merge_request_target_branch", {}).value.should == 'stable' | ... | ... |
features/steps/project/project_network_graph.rb
| ... | ... | @@ -15,11 +15,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps |
| 15 | 15 | end |
| 16 | 16 | |
| 17 | 17 | And 'page should select "master" in select box' do |
| 18 | - page.should have_selector '.chosen-single span', text: "master" | |
| 18 | + page.should have_selector '.select2-chosen', text: "master" | |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | 21 | And 'page should select "v2.1.0" in select box' do |
| 22 | - page.should have_selector '.chosen-single span', text: "v2.1.0" | |
| 22 | + page.should have_selector '.select2-chosen', text: "v2.1.0" | |
| 23 | 23 | end |
| 24 | 24 | |
| 25 | 25 | And 'page should have "master" on graph' do |
| ... | ... | @@ -56,11 +56,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps |
| 56 | 56 | end |
| 57 | 57 | |
| 58 | 58 | And 'page should select "stable" in select box' do |
| 59 | - page.should have_selector '.chosen-single span', text: "stable" | |
| 59 | + page.should have_selector '.select2-chosen', text: "stable" | |
| 60 | 60 | end |
| 61 | 61 | |
| 62 | 62 | And 'page should select "v2.1.0" in select box' do |
| 63 | - page.should have_selector '.chosen-single span', text: "v2.1.0" | |
| 63 | + page.should have_selector '.select2-chosen', text: "v2.1.0" | |
| 64 | 64 | end |
| 65 | 65 | |
| 66 | 66 | And 'page should have "stable" on graph' do | ... | ... |
features/support/env.rb
| ... | ... | @@ -15,7 +15,7 @@ require 'spinach/capybara' |
| 15 | 15 | require 'sidekiq/testing/inline' |
| 16 | 16 | |
| 17 | 17 | |
| 18 | -%w(valid_commit big_commits select2_helper chosen_helper test_env).each do |f| | |
| 18 | +%w(valid_commit big_commits select2_helper test_env).each do |f| | |
| 19 | 19 | require Rails.root.join('spec', 'support', f) |
| 20 | 20 | end |
| 21 | 21 | ... | ... |
spec/support/chosen_helper.rb
| ... | ... | @@ -1,21 +0,0 @@ |
| 1 | -# Chosen programmatic helper | |
| 2 | -# It allows you to select value from chosen select | |
| 3 | -# | |
| 4 | -# Params | |
| 5 | -# value - real value of selected item | |
| 6 | -# opts - options containing css selector | |
| 7 | -# | |
| 8 | -# Usage: | |
| 9 | -# | |
| 10 | -# chosen(2, from: '#user_ids') | |
| 11 | -# | |
| 12 | - | |
| 13 | -module ChosenHelper | |
| 14 | - def chosen(value, options={}) | |
| 15 | - raise "Must pass a hash containing 'from'" if not options.is_a?(Hash) or not options.has_key?(:from) | |
| 16 | - | |
| 17 | - selector = options[:from] | |
| 18 | - | |
| 19 | - page.execute_script("$('#{selector}').val('#{value}').trigger('chosen:updated');") | |
| 20 | - end | |
| 21 | -end |