BigW Consortium Gitlab

_star.html.haml 705 Bytes
Newer Older
1
- if current_user
2
  = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn star-btn toggle-star', method: :post, remote: true do
3
    = icon('star fw')
4 5
    %span.count
      = @project.star_count
6

7 8 9 10 11 12 13
  :javascript
    $('.project-home-panel .toggle-star').on('ajax:success', function (e, data, status, xhr) {
      $(this).replaceWith(data.html);
    })
    .on('ajax:error', function (e, xhr, status, error) {
      new Flash('Star toggle failed. Try again later.', 'alert');
    });
14

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