summaryrefslogtreecommitdiff
path: root/app/views/projects/buttons/_star.html.haml
blob: 5d7df5ae09993f0877d54b431ea093882c350eb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
- if current_user
  = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn star-btn toggle-star', method: :post, remote: true do
    = icon('star fw')
    - if current_user.starred?(@project)
      Unstar
    - else
      Star
    %span.count
      = @project.star_count

  :coffeescript
    $('.project-home-panel .toggle-star').on 'ajax:success', (e, data, status, xhr) ->
      $(@).replaceWith(data.html)
    .on 'ajax:error', (e, xhr, status, error) ->
      new Flash('Star toggle failed. Try again later.', 'alert')

- else
  = link_to new_user_session_path, class: 'btn has_tooltip star-btn', title: 'You must sign in to star a project' do
    = icon('star fw')
    Star
    %span.count
      = @project.star_count