diff options
author | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-03-25 08:00:16 -0400 |
---|---|---|
committer | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-03-25 09:54:05 -0400 |
commit | 1cc6d786e4bfd22b5c94dae516ef04c0f32cb379 (patch) | |
tree | 8b3d8d2c4896d37965e81c0834f1c1493678a161 | |
parent | 53a831124e4e704cc494511ed4d04969a223db4e (diff) | |
download | gitlab-ce-1cc6d786e4bfd22b5c94dae516ef04c0f32cb379.tar.gz |
Fix minor code style issues
Fix underscore template error.
Fix `=` spacing
-rw-r--r-- | app/assets/javascripts/labels_select.js.coffee | 7 | ||||
-rw-r--r-- | app/helpers/issuables_helper.rb | 10 | ||||
-rw-r--r-- | app/views/shared/issuable/_sidebar.html.haml | 18 | ||||
-rw-r--r-- | config/environments/development.rb | 2 | ||||
-rw-r--r-- | spec/features/issues_spec.rb | 13 |
5 files changed, 21 insertions, 29 deletions
diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee index d77490cae4e..16cbffa6818 100644 --- a/app/assets/javascripts/labels_select.js.coffee +++ b/app/assets/javascripts/labels_select.js.coffee @@ -32,10 +32,8 @@ class @LabelsSelect if issueUpdateURL labelHTMLTemplate = _.template( '<% _.each(labels, function(label){ %> - <a href=" - #{["",issueURLSplit[1], issueURLSplit[2],""].join("/")} - issues?label_name=<%= label.title %>"> - <span class="label color-label" style="background-color: <%= label.color %>; color: #FFFFFF"> + <a href="<%= ["",issueURLSplit[1], issueURLSplit[2],""].join("/") %>issues?label_name=<%= label.title %>"> + <span class="label color-label" style="background-color: <%= label.color %>;"> <%= label.title %> </span> </a> @@ -152,6 +150,7 @@ class @LabelsSelect ).done (data) -> $loading.fadeOut() $selectbox.hide() + data.issueURLSplit = issueURLSplit if not data.labels.length template = labelNoneHTMLTemplate() else diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 81df2094392..62050691a39 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -16,6 +16,16 @@ module IssuablesHelper base_issuable_scope(issuable).where('iid > ?', issuable.iid).last end + def issuable_json_path(issuable) + project = issuable.project + + if issuable.kind_of?(MergeRequest) + namespace_project_merge_request_path(project.namespace, project, issuable.iid, :json) + else + namespace_project_issue_path(project.namespace, project, issuable.iid, :json) + end + end + def prev_issuable_for(issuable) base_issuable_scope(issuable).where('iid < ?', issuable.iid).first end diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index c6e6aacbb5c..b606f454eeb 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -1,10 +1,6 @@ %aside.right-sidebar{ class: sidebar_gutter_collapsed_class } .issuable-sidebar .block.issuable-sidebar-header - - if issuable.to_ability_name == 'merge_request' - - issuable_url = namespace_project_merge_request_path(@project.namespace, @project, issuable.iid, :json) - - else - - issuable_url = namespace_project_issue_path(@project.namespace, @project, issuable.iid, :json) %span.issuable-count.hide-collapsed.pull-left = issuable.iid of @@ -32,7 +28,7 @@ = icon('user') .title.hide-collapsed Assignee - =icon('spinner spin', class: 'block-loading') + = icon('spinner spin', class: 'block-loading') - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project) = link_to 'Edit', '#', class: 'edit-link pull-right' .value.bold.hide-collapsed @@ -46,12 +42,12 @@ - else %span.assign-yourself No assignee - - %a.js-assign-yourself{href:'#'} + %a.js-assign-yourself{ href: '#' } assign yourself .selectbox.hide-collapsed = f.hidden_field 'assignee_id', value: issuable.assignee_id, id: 'issue_assignee_id' - = dropdown_tag('Select assignee', options: { toggle_class: 'js-user-search js-author-search', title: 'Assign user', filter: true, dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author', placeholder: 'Search users', data: { first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), field_name: "#{issuable.to_ability_name}[assignee_id]", issue_update: issuable_url, ability_name: issuable.to_ability_name, null_user: true } }) + = dropdown_tag('Select assignee', options: { toggle_class: 'js-user-search js-author-search', title: 'Assign user', filter: true, dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author', placeholder: 'Search users', data: { first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), field_name: "#{issuable.to_ability_name}[assignee_id]", issue_update: issuable_json_path(issuable), ability_name: issuable.to_ability_name, null_user: true } }) .block.milestone .sidebar-collapsed-icon @@ -63,7 +59,7 @@ No .title.hide-collapsed Milestone - =icon('spinner spin', class: 'block-loading') + = icon('spinner spin', class: 'block-loading') - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project) = link_to 'Edit', '#', class: 'edit-link pull-right' .value.bold.hide-collapsed @@ -75,7 +71,7 @@ .selectbox.hide-collapsed = f.hidden_field 'milestone_id', value: issuable.milestone_id, id: nil - = dropdown_tag('Milestone', options: { title: 'Assign milestone', toggle_class: 'js-milestone-select js-extra-options', filter: true, dropdown_class: 'dropdown-menu-selectable', placeholder: 'Search milestones', data: { show_no: true, field_name: "#{issuable.to_ability_name}[milestone_id]", project_id: @project.id, issuable_id: issuable.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :json), ability_name: issuable.to_ability_name, issue_update: issuable_url, use_id: true }}) + = dropdown_tag('Milestone', options: { title: 'Assign milestone', toggle_class: 'js-milestone-select js-extra-options', filter: true, dropdown_class: 'dropdown-menu-selectable', placeholder: 'Search milestones', data: { show_no: true, field_name: "#{issuable.to_ability_name}[milestone_id]", project_id: @project.id, issuable_id: issuable.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :json), ability_name: issuable.to_ability_name, issue_update: issuable_json_path(issuable), use_id: true }}) - if issuable.project.labels.any? .block.labels @@ -85,7 +81,7 @@ = issuable.labels.count .title.hide-collapsed Labels - =icon('spinner spin', class: 'block-loading') + = icon('spinner spin', class: 'block-loading') - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project) = link_to 'Edit', '#', class: 'edit-link pull-right' .value.bold.issuable-show-labels.hide-collapsed{ class: ("has-labels" if issuable.labels.any?) } @@ -98,7 +94,7 @@ - issuable.labels.each do |label| = hidden_field_tag "#{issuable.to_ability_name}[label_names][]", label.id, id: nil .dropdown - %button.dropdown-menu-toggle.js-label-select.js-multiselect{type: "button", data: {toggle: "dropdown", field_name: "#{issuable.to_ability_name}[label_names][]", ability_name: issuable.to_ability_name, show_no: "true", show_any: "true", selected: issuable.label_names.join(","), project_id: (@project.id if @project), issue_update: issuable_url, labels: (namespace_project_labels_path(@project.namespace, @project, :json) if @project)}} + %button.dropdown-menu-toggle.js-label-select.js-multiselect{type: "button", data: {toggle: "dropdown", field_name: "#{issuable.to_ability_name}[label_names][]", ability_name: issuable.to_ability_name, show_no: "true", show_any: "true", selected: issuable.label_names.join(","), project_id: (@project.id if @project), issue_update: issuable_json_path(issuable), labels: (namespace_project_labels_path(@project.namespace, @project, :json) if @project)}} %span.dropdown-toggle-text Label = icon('chevron-down') diff --git a/config/environments/development.rb b/config/environments/development.rb index 78fc91bc3cc..689694a3480 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -36,7 +36,7 @@ Rails.application.configure do # For having correct urls in mails config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } # Open sent mails in browser - config.action_mailer.delivery_method = :test + config.action_mailer.delivery_method = :letter_opener # Don't make a mess when bootstrapping a development environment config.action_mailer.perform_deliveries = (ENV['BOOTSTRAP'] != '1') diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index d4939584ab6..db46657c36a 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -34,20 +34,7 @@ describe 'Issues', feature: true do fill_in 'issue_title', with: 'bug 345' fill_in 'issue_description', with: 'bug description' end - - # it 'does not change issue count' do - # expect { click_button 'Save changes' }.to_not change { Issue.count } - # end - - # it 'should update issue fields' do - # click_button 'Save changes' - - # expect(page).to have_content @user.name - # expect(page).to have_content 'bug 345' - # expect(page).to have_content project.name - # end end - end describe 'Editing issue assignee' do |