<% project = local_assigns[:project] || @project %>
<% if project && User.current.logged? && project.visible?(User.current) %>
  <% favorite = UxToolkitFavoriteProject.exists?(user_id: User.current.id, project_id: project.id) %>
  <div class="box ux-toolkit-favorite-project">
    <h3 class="icon <%= favorite ? 'icon-fav' : 'icon-bookmark' %>">
      <%= ux_toolkit_sprite_icon(favorite ? 'fav' : 'bookmark-add', l(:label_ux_toolkit_favorite_project)) %>
    </h3>
    <% if favorite %>
      <%= button_to l(:label_ux_toolkit_remove_project_from_favorites),
                    remove_ux_toolkit_favorite_project_path(project),
                    method: :delete,
                    class: 'button-small' %>
    <% else %>
      <%= button_to l(:label_ux_toolkit_add_project_to_favorites),
                    ux_toolkit_favorite_project_path(project),
                    method: :post,
                    class: 'button-small' %>
    <% end %>
  </div>
<% end %>
