Commit d88aafcb authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'select2' of /home/git/repositories/gitlab/gitlabhq

parents 12dbd0a4 04ad19dc
...@@ -144,7 +144,6 @@ gem "therubyracer" ...@@ -144,7 +144,6 @@ gem "therubyracer"
gem 'turbolinks' gem 'turbolinks'
gem 'jquery-turbolinks' gem 'jquery-turbolinks'
gem 'chosen-rails', "1.0.1"
gem 'select2-rails' gem 'select2-rails'
gem 'jquery-atwho-rails', "~> 0.3.3" gem 'jquery-atwho-rails', "~> 0.3.3"
gem "jquery-rails", "2.1.3" gem "jquery-rails", "2.1.3"
......
...@@ -71,12 +71,6 @@ GEM ...@@ -71,12 +71,6 @@ GEM
celluloid (0.15.2) celluloid (0.15.2)
timers (~> 1.1.0) timers (~> 1.1.0)
charlock_holmes (0.6.9.4) charlock_holmes (0.6.9.4)
chosen-rails (1.0.1)
coffee-rails (>= 3.2)
compass-rails (>= 1.0)
railties (>= 3.0)
sass-rails (>= 3.2)
chunky_png (1.2.9)
cliver (0.2.2) cliver (0.2.2)
code_analyzer (0.4.3) code_analyzer (0.4.3)
sexp_processor sexp_processor
...@@ -92,12 +86,6 @@ GEM ...@@ -92,12 +86,6 @@ GEM
coffee-script-source (1.6.3) coffee-script-source (1.6.3)
colored (1.2) colored (1.2)
colorize (0.5.8) colorize (0.5.8)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
compass-rails (1.1.1)
compass (>= 0.12.2)
connection_pool (1.2.0) connection_pool (1.2.0)
coveralls (0.7.0) coveralls (0.7.0)
multi_json (~> 1.3) multi_json (~> 1.3)
...@@ -161,7 +149,6 @@ GEM ...@@ -161,7 +149,6 @@ GEM
dotenv (>= 0.7) dotenv (>= 0.7)
thor (>= 0.13.6) thor (>= 0.13.6)
formatador (0.2.4) formatador (0.2.4)
fssm (0.2.10)
gemoji (1.3.1) gemoji (1.3.1)
gherkin-ruby (0.3.1) gherkin-ruby (0.3.1)
racc racc
...@@ -572,7 +559,6 @@ DEPENDENCIES ...@@ -572,7 +559,6 @@ DEPENDENCIES
bootstrap-sass (~> 3.0) bootstrap-sass (~> 3.0)
capybara capybara
carrierwave carrierwave
chosen-rails (= 1.0.1)
coffee-rails coffee-rails
colored colored
coveralls coveralls
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
//= require jquery.turbolinks //= require jquery.turbolinks
//= require bootstrap //= require bootstrap
//= require modernizr //= require modernizr
//= require chosen-jquery
//= require select2 //= require select2
//= require raphael //= require raphael
//= require g.raphael-min //= require g.raphael-min
......
...@@ -29,12 +29,10 @@ ...@@ -29,12 +29,10 @@
$('#filter_issue_search').val($('#issue_search').val()) $('#filter_issue_search').val($('#issue_search').val())
initSelects: -> initSelects: ->
$("#update_status").chosen() $("select#update_status").select2()
$("#update_assignee_id").chosen() $("select#update_assignee_id").select2()
$("#update_milestone_id").chosen() $("select#update_milestone_id").select2()
$("#label_name").chosen() $("select#label_name").select2()
$("#assignee_id").chosen()
$("#milestone_id").chosen()
$("#milestone_id, #assignee_id, #label_name").on "change", -> $("#milestone_id, #assignee_id, #label_name").on "change", ->
$(this).closest("form").submit() $(this).closest("form").submit()
......
...@@ -67,8 +67,8 @@ $ -> ...@@ -67,8 +67,8 @@ $ ->
$('.appear-data').fadeIn() $('.appear-data').fadeIn()
e.preventDefault() e.preventDefault()
# Initialize chosen selects # Initialize select2 selects
$('select.chosen').chosen() $('select.select2').select2(width: 'resolve', dropdownAutoWidth: true)
# Initialize tooltips # Initialize tooltips
$('.has_tooltip').tooltip() $('.has_tooltip').tooltip()
...@@ -126,12 +126,6 @@ $ -> ...@@ -126,12 +126,6 @@ $ ->
$(@).remove() $(@).remove()
(($) -> (($) ->
_chosen = $.fn.chosen
$.fn.extend chosen: (options) ->
default_options = search_contains: "true"
$.extend default_options, options
_chosen.apply @, [default_options]
# Disable an element and add the 'disabled' Bootstrap class # Disable an element and add the 'disabled' Bootstrap class
$.fn.extend disable: -> $.fn.extend disable: ->
$(@).attr('disabled', 'disabled').addClass('disabled') $(@).attr('disabled', 'disabled').addClass('disabled')
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# * Filter merge requests # * Filter merge requests
# #
@merge_requestsPage = -> @merge_requestsPage = ->
$('#assignee_id').chosen() $('#assignee_id').select2()
$('#milestone_id').chosen() $('#milestone_id').select2()
$('#milestone_id, #assignee_id').on 'change', -> $('#milestone_id, #assignee_id').on 'change', ->
$(this).closest('form').submit() $(this).closest('form').submit()
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
* the top of the compiled file, but it's generally better to create a new file per style scope. * the top of the compiled file, but it's generally better to create a new file per style scope.
*= require jquery.ui.gitlab *= require jquery.ui.gitlab
*= require jquery.atwho *= require jquery.atwho
*= require chosen
*= require select2 *= require select2
*= require_self *= require_self
*/ */
......
/** Chosen.js selectbox style override **/ /** Select2 selectbox style override **/
.chosen-container {
min-width: 100px;
.chosen-single { .select2-container {
height: 26px; .select2-choice {
background: #EEE !important; background: #FFF;
border: 1px solid #DDD !important; border-color: #BBB;
@include box-shadow(none !important);
@include border-radius(4px !important);
}
.chosen-results li.highlighted {
background: #29b;
}
.chosen-drop { .select2-arrow {
margin-top: 10px; background: #FFF;
border: 1px solid #DDD !important; }
@include border-radius(4px !important);
}
.chosen-search input {
border: 1px solid #CCC !important;
@include box-shadow(none !important);
} }
} }
/** Select2 styling **/ .select2-drop-active {
.select2-container .select2-choice { border: 1px solid #BBB;
@include bg-light-gray-gradient; margin-top: 4px;
}
.select2-container .select2-choice div {
border: none;
background: none;
}
.select2-drop {
padding-top: 8px;
}
.select2-no-results, .select2-searching {
padding: 7px;
color: #666;
}
.chosen-container .chosen-single div b {
background-position-y: 0px !important;
}
.chosen-container .chosen-drop .chosen-search input {
background-position-y: -24px !important;
}
.chosen-compact {
max-width: 170px !important;
} }
select { select {
&.chosen { &.select2 {
width: 100px; width: 100px;
} }
&.chosen-sm { &.select2-sm {
width: 100px; width: 100px;
} }
} }
@media (min-width: $screen-sm-min) { @media (min-width: $screen-sm-min) {
select { select {
&.chosen { &.select2 {
width: 150px; width: 150px;
} }
&.chosen-sm { &.select2-sm {
width: 120px; width: 120px;
} }
} }
...@@ -81,10 +40,10 @@ select { ...@@ -81,10 +40,10 @@ select {
/* Medium devices (desktops, 992px and up) */ /* Medium devices (desktops, 992px and up) */
@media (min-width: $screen-md-min) { @media (min-width: $screen-md-min) {
select { select {
&.chosen { &.select2 {
width: 170px; width: 170px;
} }
&.chosen-sm { &.select2-sm {
width: 140px; width: 140px;
} }
} }
...@@ -93,11 +52,17 @@ select { ...@@ -93,11 +52,17 @@ select {
/* Large devices (large desktops, 1200px and up) */ /* Large devices (large desktops, 1200px and up) */
@media (min-width: $screen-lg-min) { @media (min-width: $screen-lg-min) {
select { select {
&.chosen { &.select2 {
width: 200px; width: 200px;
} }
&.chosen-sm { &.select2-sm {
width: 150px; width: 150px;
} }
} }
} }
/** Branch/tag selector **/
.project-refs-form .select2-container {
margin-right: 10px;
}
...@@ -77,8 +77,8 @@ input.check_all_issues { ...@@ -77,8 +77,8 @@ input.check_all_issues {
@media (min-width: 800px) { .issues_filters select { width: 160px; } } @media (min-width: 800px) { .issues_filters select { width: 160px; } }
@media (min-width: 1200px) { .issues_filters select { width: 220px; } } @media (min-width: 1200px) { .issues_filters select { width: 220px; } }
@media (min-width: 800px) { .issues_bulk_update .chosen-container { min-width: 120px; } } @media (min-width: 800px) { .issues_bulk_update .select2-container { min-width: 120px; } }
@media (min-width: 1200px) { .issues_bulk_update .chosen-container { min-width: 160px; } } @media (min-width: 1200px) { .issues_bulk_update .select2-container { min-width: 160px; } }
.issues-holder { .issues-holder {
.issues_filters { .issues_filters {
...@@ -105,7 +105,7 @@ input.check_all_issues { ...@@ -105,7 +105,7 @@ input.check_all_issues {
} }
.issues_bulk_update { .issues_bulk_update {
.chosen-container { .select2-container {
text-shadow: none; text-shadow: none;
} }
} }
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
font-weight: normal !important; font-weight: normal !important;
} }
.chosen-container .chosen-single { .select2-container .select2-single {
span { span {
font-weight: bold; font-weight: bold;
color: #555; color: #555;
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
.project-home-dropdown + & { .project-home-dropdown + & {
margin-right: 45px; margin-right: 45px;
} }
.btn, .btn,
.form-control { .form-control {
border: 1px solid #E1E1E1; border: 1px solid #E1E1E1;
...@@ -230,43 +230,10 @@ ul.nav.nav-projects-tabs { ...@@ -230,43 +230,10 @@ ul.nav.nav-projects-tabs {
} }
} }
.transfer-project .chosen-container { .transfer-project .select2-container {
min-width: 200px; 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 .chosen-container {
position: relative;
top: 0;
left: 0;
margin-right: 10px;
.chosen-single span {
font-weight: bold;
color: #555;
}
&.chosen-container-active {
.chosen-drop {
min-width: 400px;
}
.chosen-results {
max-height: 400px;
}
}
}
.deploy-project-label { .deploy-project-label {
margin: 1px; margin: 1px;
} }
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
%div %div
= users_select_tag(:user_ids, multiple: true) = users_select_tag(:user_ids, multiple: true)
%div.prepend-top-10 %div.prepend-top-10
= select_tag :group_access, options_for_select(UsersGroup.group_access_roles), class: "project-access-select chosen" = select_tag :group_access, options_for_select(UsersGroup.group_access_roles), class: "project-access-select select2"
%hr %hr
= submit_tag 'Add users into group', class: "btn btn-create" = submit_tag 'Add users into group', class: "btn btn-create"
.ui-box .ui-box
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
%p 2. Set access level for them %p 2. Set access level for them
.form-group .form-group
= f.label :group_access, "Group Access", class: 'control-label' = f.label :group_access, "Group Access", class: 'control-label'
.col-sm-10= select_tag :group_access, options_for_select(UsersGroup.group_access_roles, @users_group.group_access), class: "project-access-select chosen" .col-sm-10= select_tag :group_access, options_for_select(UsersGroup.group_access_roles, @users_group.group_access), class: "project-access-select select2"
.form-actions .form-actions
= f.submit 'Add users into group', class: "btn btn-create" = f.submit 'Add users into group', class: "btn btn-create"
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
- if @project.repository.exists? && @project.repository.branch_names.any? - if @project.repository.exists? && @project.repository.branch_names.any?
.form-group .form-group
= f.label :default_branch, "Default Branch", class: 'control-label' = f.label :default_branch, "Default Branch", class: 'control-label'
.col-sm-10= f.select(:default_branch, @repository.branch_names, {}, {class: 'chosen select-wide'}) .col-sm-10= f.select(:default_branch, @repository.branch_names, {}, {class: 'select2 select-wide'})
= render "visibility_level", f: f, visibility_level: @project.visibility_level, can_change_visibility_level: can?(current_user, :change_visibility_level, @project) = 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,7 +145,7 @@
%span Namespace %span Namespace
.col-sm-10 .col-sm-10
.form-group .form-group
= f.select :namespace_id, namespaces_options(@project.namespace_id), { prompt: 'Choose a project namespace' }, { class: 'chosen' } = f.select :namespace_id, namespaces_options(@project.namespace_id), { prompt: 'Choose a project namespace' }, { class: 'select2' }
%ul %ul
%li Be careful. Changing the project's namespace can have unintended side effects. %li Be careful. Changing the project's namespace can have unintended side effects.
%li You can only transfer the project to namespaces you manage. %li You can only transfer the project to namespaces you manage.
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
%i.icon-user %i.icon-user
Assign to Assign to
.col-sm-10 .col-sm-10
= f.select(:assignee_id, assignee_options(@issue), { include_blank: "Select a user" }, {class: 'chosen'}) = f.select(:assignee_id, assignee_options(@issue), { include_blank: "Select a user" }, {class: 'select2'})
   
= link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link'
.form-group .form-group
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
= f.label :milestone_id, class: 'control-label' do = f.label :milestone_id, class: 'control-label' do
%i.icon-time %i.icon-time
Milestone Milestone
.col-sm-10= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'chosen'}) .col-sm-10= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2'})
.form-group .form-group
= f.label :label_list, class: 'control-label' do = f.label :label_list, class: 'control-label' do
...@@ -87,6 +87,6 @@ ...@@ -87,6 +87,6 @@
}); });
$('.assign-to-me-link').on('click', function(e){ $('.assign-to-me-link').on('click', function(e){
$('#issue_assignee_id').val("#{current_user.id}").trigger("chosen:updated"); $('#issue_assignee_id').val("#{current_user.id}").trigger("change");
e.preventDefault(); e.preventDefault();
}); });
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
- if can?(current_user, :modify_issue, @issue) - if can?(current_user, :modify_issue, @issue)
= link_to profile_path(issue.assignee) do = link_to profile_path(issue.assignee) do
= image_tag(avatar_icon(issue.assignee.email), class: 'avatar avatar-inline s16 assignee') if issue.assignee = image_tag(avatar_icon(issue.assignee.email), class: 'avatar avatar-inline s16 assignee') if issue.assignee
= f.select(:assignee_id, assignee_options(@issue), { include_blank: "Assign to user (none):" }, {class: 'chosen'}) = f.select(:assignee_id, assignee_options(@issue), { include_blank: "Assign to user (none):" }, {class: 'select2'})
- elsif issue.assignee - elsif issue.assignee
= link_to_member(@project, @issue.assignee) = link_to_member(@project, @issue.assignee)
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
%cite.cgray Attached to milestone %cite.cgray Attached to milestone
- if can?(current_user, :modify_issue, @issue) - if can?(current_user, :modify_issue, @issue)
= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone (none):" }, {class: 'chosen chosen-compact'}) = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone (none):" }, {class: 'select2 select2-compact'})
= hidden_field_tag :issue_context = hidden_field_tag :issue_context
= f.submit class: 'btn' = f.submit class: 'btn'
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
- elsif params[:issue_context] - elsif params[:issue_context]
$('.issue-box .context').html("#{escape_javascript(render partial: 'issue_context', locals: { issue: @issue })}"); $('.issue-box .context').html("#{escape_javascript(render partial: 'issue_context', locals: { issue: @issue })}");
$('.issue-box .context').effect('highlight'); $('.issue-box .context').effect('highlight');
$('.chosen').chosen(); $('.select2').select2();
$('.edit-issue.inline-update input[type="submit"]').hide(); $('.edit-issue.inline-update input[type="submit"]').hide();
- if @issue.milestone - if @issue.milestone
$('.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>") $('.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>")
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
.col-md-5 .col-md-5
.clearfix .clearfix
.pull-left .pull-left
= f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project chosen span3', disabled: @merge_request.persisted? }) = f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project select2 span3', disabled: @merge_request.persisted? })
.pull-left .pull-left
&nbsp; &nbsp;
= f.select(:source_branch, @merge_request.source_project.repository.branch_names, { include_blank: "Select branch" }, {class: 'source_branch chosen span2'}) = f.select(:source_branch, @merge_request.source_project.repository.branch_names, { include_blank: "Select branch" }, {class: 'source_branch select2 span2'})
.mr_source_commit.prepend-top-10 .mr_source_commit.prepend-top-10
.col-md-2 .col-md-2
.merge-request-angle .merge-request-angle
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
.clearfix .clearfix
.pull-left .pull-left
- projects = @project.forked_from_project.nil? ? [@project] : [ @project,@project.forked_from_project] - projects = @project.forked_from_project.nil? ? [@project] : [ @project,@project.forked_from_project]
= f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace'), {}, { class: 'target_project chosen span3', disabled: @merge_request.persisted? }) = f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace'), {}, { class: 'target_project select2 span3', disabled: @merge_request.persisted? })
.pull-left .pull-left
&nbsp; &nbsp;
= f.select(:target_branch, @target_branches, { include_blank: "Select branch" }, {class: 'target_branch chosen span2'}) = f.select(:target_branch, @target_branches, { include_blank: "Select branch" }, {class: 'target_branch select2 span2'})
.mr_target_commit.prepend-top-10 .mr_target_commit.prepend-top-10
%hr %hr
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
%i.icon-user %i.icon-user
Assign to Assign to
.col-sm-10 .col-sm-10
= f.select(:assignee_id, assignee_options(@merge_request), { include_blank: "Select a user" }, {class: 'chosen'}) = f.select(:assignee_id, assignee_options(@merge_request), { include_blank: "Select a user" }, {class: 'select2'})
&nbsp; &nbsp;
= link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link'
.form-group .form-group
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
= f.label :milestone_id, class: 'control-label' do = f.label :milestone_id, class: 'control-label' do
%i.icon-time %i.icon-time
Milestone Milestone
.col-sm-10= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'chosen'}) .col-sm-10= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'})
.form-actions .form-actions
...@@ -90,6 +90,6 @@ ...@@ -90,6 +90,6 @@
$.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() }); $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() });
}); });
$('.assign-to-me-link').on('click', function(e){ $('.assign-to-me-link').on('click', function(e){
$('#merge_request_assignee_id').val("#{current_user.id}").trigger("chosen:updated"); $('#merge_request_assignee_id').val("#{current_user.id}").trigger("select2:updated");
e.preventDefault(); e.preventDefault();
}); });
:plain :plain
$(".target_branch").html("#{escape_javascript(options_for_select(@target_branches))}"); $(".target_branch").html("#{escape_javascript(options_for_select(@target_branches))}");
$(".target_branch").trigger("chosen:updated"); $(".target_branch").trigger("select2:updated");
$(".mr_target_commit").html(""); $(".mr_target_commit").html("");
$(".target_branch").trigger("change"); $(".target_branch").trigger("change");
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
= f.label :namespace_id, class: 'control-label' do = f.label :namespace_id, class: 'control-label' do
%span Namespace %span Namespace
.col-sm-10 .col-sm-10
= f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user), {}, {class: 'chosen', tabindex: 2} = f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user), {}, {class: 'select2', tabindex: 2}
.form-group .form-group
.col-sm-2 .col-sm-2
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
.entry.clearfix .entry.clearfix
= f.label :name, "Branch" = f.label :name, "Branch"
.col-md-3 .col-md-3
= f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "chosen span3"}) = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "select2 span3"})
&nbsp; &nbsp;
= f.submit 'Protect', class: "btn-create btn" = f.submit 'Protect', class: "btn-create btn"
- unless @branches.empty? - unless @branches.empty?
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
.col-sm-10= f.text_field :title, placeholder: "Example Snippet", class: 'form-control', required: true .col-sm-10= f.text_field :title, placeholder: "Example Snippet", class: 'form-control', required: true
.form-group .form-group
= f.label "Lifetime" = f.label "Lifetime"
.col-sm-10= f.select :expires_at, lifetime_select_options, {}, {class: 'chosen span2'} .col-sm-10= f.select :expires_at, lifetime_select_options, {}, {class: 'select2 span2'}
.form-group .form-group
.file-editor .file-editor
= f.label :file_name, "File" = f.label :file_name, "File"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
%p 2. Set access level for them %p 2. Set access level for them
.form-group .form-group
= f.label :project_access, "Project Access", class: 'control-label' = f.label :project_access, "Project Access", class: 'control-label'
.col-sm-10= select_tag :project_access, options_for_select(Gitlab::Access.options, @user_project_relation.project_access), class: "project-access-select chosen" .col-sm-10= select_tag :project_access, options_for_select(Gitlab::Access.options, @user_project_relation.project_access), class: "project-access-select select2"
.form-actions .form-actions
= f.submit 'Add users', class: "btn btn-create" = f.submit 'Add users', class: "btn btn-create"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
= form_tag apply_import_project_team_members_path(@project), method: 'post', class: 'form-horizontal' do = form_tag apply_import_project_team_members_path(@project), method: 'post', class: 'form-horizontal' do
.form-group .form-group
= label_tag :source_project_id, "Project", class: 'control-label' = label_tag :source_project_id, "Project", class: 'control-label'
.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) .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)
.form-actions .form-actions
= submit_tag 'Import project members', class: "btn btn-create" = submit_tag 'Import project members', class: "btn btn-create"
......
= form_tag switch_project_refs_path(@project), method: :get, class: "project-refs-form" do = form_tag switch_project_refs_path(@project), method: :get, class: "project-refs-form" do
= select_tag "ref", grouped_options_refs, class: "project-refs-select chosen chosen-sm" = select_tag "ref", grouped_options_refs, class: "project-refs-select select2 select2-sm"
= hidden_field_tag :destination, destination = hidden_field_tag :destination, destination
- if defined?(path) - if defined?(path)
= hidden_field_tag :path, path = hidden_field_tag :path, path
......
...@@ -3,7 +3,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -3,7 +3,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
include SharedProject include SharedProject
include SharedNote include SharedNote
include SharedPaths include SharedPaths
include ChosenHelper include Select2Helper
step 'I am a member of project "Shop"' do step 'I am a member of project "Shop"' do
@project = Project.find_by_name "Shop" @project = Project.find_by_name "Shop"
...@@ -42,14 +42,14 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -42,14 +42,14 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
end end
step 'I fill out a "Merge Request On Forked Project" merge request' do step 'I fill out a "Merge Request On Forked Project" merge request' do
chosen @forked_project.id, from: "#merge_request_source_project_id" select2 @forked_project.id, from: "#merge_request_source_project_id"
chosen @project.id, from: "#merge_request_target_project_id" select2 @project.id, from: "#merge_request_target_project_id"
find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s
find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s
chosen "master", from: "#merge_request_source_branch" select2 "master", from: "#merge_request_source_branch"
chosen "stable", from: "#merge_request_target_branch" select2 "stable", from: "#merge_request_target_branch"
find(:select, "merge_request_source_branch", {}).value.should == 'master' find(:select, "merge_request_source_branch", {}).value.should == 'master'
find(:select, "merge_request_target_branch", {}).value.should == 'stable' find(:select, "merge_request_target_branch", {}).value.should == 'stable'
......
...@@ -15,11 +15,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -15,11 +15,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
end end
And 'page should select "master" in select box' do And 'page should select "master" in select box' do
page.should have_selector '.chosen-single span', text: "master" page.should have_selector '.select2-chosen', text: "master"
end end
And 'page should select "v2.1.0" in select box' do And 'page should select "v2.1.0" in select box' do
page.should have_selector '.chosen-single span', text: "v2.1.0" page.should have_selector '.select2-chosen', text: "v2.1.0"
end end
And 'page should have "master" on graph' do And 'page should have "master" on graph' do
...@@ -56,11 +56,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -56,11 +56,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
end end
And 'page should select "stable" in select box' do And 'page should select "stable" in select box' do
page.should have_selector '.chosen-single span', text: "stable" page.should have_selector '.select2-chosen', text: "stable"
end end
And 'page should select "v2.1.0" in select box' do And 'page should select "v2.1.0" in select box' do
page.should have_selector '.chosen-single span', text: "v2.1.0" page.should have_selector '.select2-chosen', text: "v2.1.0"
end end
And 'page should have "stable" on graph' do And 'page should have "stable" on graph' do
......
...@@ -15,7 +15,7 @@ require 'spinach/capybara' ...@@ -15,7 +15,7 @@ require 'spinach/capybara'
require 'sidekiq/testing/inline' require 'sidekiq/testing/inline'
%w(valid_commit big_commits select2_helper chosen_helper test_env).each do |f| %w(valid_commit big_commits select2_helper test_env).each do |f|
require Rails.root.join('spec', 'support', f) require Rails.root.join('spec', 'support', f)
end end
......
# Chosen programmatic helper
# It allows you to select value from chosen select
#
# Params
# value - real value of selected item
# opts - options containing css selector
#
# Usage:
#
# chosen(2, from: '#user_ids')
#
module ChosenHelper
def chosen(value, options={})
raise "Must pass a hash containing 'from'" if not options.is_a?(Hash) or not options.has_key?(:from)
selector = options[:from]
page.execute_script("$('#{selector}').val('#{value}').trigger('chosen:updated');")
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment