diff options
Diffstat (limited to 'app/views/projects/buttons/_star.html.haml')
-rw-r--r-- | app/views/projects/buttons/_star.html.haml | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/views/projects/buttons/_star.html.haml b/app/views/projects/buttons/_star.html.haml new file mode 100644 index 00000000000..89e3f4ac738 --- /dev/null +++ b/app/views/projects/buttons/_star.html.haml @@ -0,0 +1,22 @@ +- if current_user + = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn toggle-star', method: :post, remote: true do + - if current_user.starred?(@project) + Unstar + - else + Star + %span.count + = @project.star_count +- else + = link_to new_user_session_path, class: 'btn has_tooltip', title: 'You must sign in to star a project' do + = icon('star') + 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') + + |