Commit d1f0ad45 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'tooltip-change' into 'master'

Update project star/unstar tooltip

## What does this MR do?
Fixes project toggle star button tooltip to show actual tooltip for its state.

## Are there points in the code the reviewer needs to double check?
No.

## Why was this MR needed?
- When you star a project tooltip wasn't changing.
- When you star a project and refresh the page, tooltip was still showing `Star Project`

## What are the relevant issue numbers?
Fixes #18143

## Screenshots (if relevant)

### Before 
![Screen_Shot_2016-06-15_at_15.31.57](/uploads/e005951c23eeed7c2761a0ec1911f3ce/Screen_Shot_2016-06-15_at_15.31.57.png)

### After
![tooltip-change](/uploads/4caec99eac6ffcc7331947fdfdb9e051/tooltip-change.gif)

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- [ ] Tests
  - [ ] Added for this feature/bug
  - [ ] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !4672
parents 8bfbafbb 138ff057
...@@ -93,6 +93,7 @@ v 8.9.0 (unreleased) ...@@ -93,6 +93,7 @@ v 8.9.0 (unreleased)
- New custom icons for navigation - New custom icons for navigation
- Horizontally scrolling navigation on project, group, and profile settings pages - Horizontally scrolling navigation on project, group, and profile settings pages
- Hide global side navigation by default - Hide global side navigation by default
- Fix project Star/Unstar project button tooltip
- Remove tanuki logo from side navigation; center on top nav - Remove tanuki logo from side navigation; center on top nav
- Include user relationships when retrieving award_emoji - Include user relationships when retrieving award_emoji
- Various associations are now eager loaded when parsing issue references to reduce the number of queries executed - Various associations are now eager loaded when parsing issue references to reduce the number of queries executed
......
((w) -> ((w) ->
window.gl or= {}
window.gl.utils or= {}
jQuery.timefor = (time, suffix, expiredLabel) -> jQuery.timefor = (time, suffix, expiredLabel) ->
return '' unless time return '' unless time
...@@ -21,4 +24,13 @@ ...@@ -21,4 +24,13 @@
return timefor return timefor
gl.utils.updateTooltipTitle = ($tooltipEl, newTitle) ->
$tooltipEl
.tooltip 'destroy'
.attr 'title', newTitle
.tooltip 'fixTitle'
) window ) window
...@@ -9,9 +9,11 @@ class @Star ...@@ -9,9 +9,11 @@ class @Star
$this.parent().find('.star-count').text data.star_count $this.parent().find('.star-count').text data.star_count
if isStarred if isStarred
$starSpan.removeClass('starred').text 'Star' $starSpan.removeClass('starred').text 'Star'
gl.utils.updateTooltipTitle $this, 'Star project'
$starIcon.removeClass('fa-star').addClass 'fa-star-o' $starIcon.removeClass('fa-star').addClass 'fa-star-o'
else else
$starSpan.addClass('starred').text 'Unstar' $starSpan.addClass('starred').text 'Unstar'
gl.utils.updateTooltipTitle $this, 'Unstar project'
$starIcon.removeClass('fa-star-o').addClass 'fa-star' $starIcon.removeClass('fa-star-o').addClass 'fa-star'
return return
......
- if current_user - if current_user
= link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn star-btn toggle-star has-tooltip', method: :post, remote: true, title: "Star project" do = link_to toggle_star_namespace_project_path(@project.namespace, @project), { class: 'btn star-btn toggle-star has-tooltip', method: :post, remote: true, title: current_user.starred?(@project) ? 'Unstar project' : 'Star project' } do
- if current_user.starred?(@project) - if current_user.starred?(@project)
= icon('star fw') = icon('star fw')
%span.starred Unstar %span.starred Unstar
......
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