app/views/stickies/_select_project.html.haml
- favorite_end = false
- all_projects = current_user.all_non_archived_projects
- all_projects = all_projects.has_template if @group
.modal-header
%button.close{ type: 'button', data: { dismiss: 'modal' }, aria: { hidden: 'true' } } ×
%h4.modal-title
Select Project or
= link_to 'Create New Project', new_project_path(due_date: params[:due_date], object: 'sticky'), method: :get, remote: true
.modal-body
.row
-# TODO: Remove awkward use of </div> to split favorite and other projects.
- all_projects.by_favorite(current_user.id).order("(favorite IS NULL or favorite = 'f') ASC, name").each_with_index do |project, index|
- if favorite_end == false && !project.favorited_by?(current_user) && index != 0
</div>
%h4.modal-title{ style: 'border-bottom:1px solid #e5e5e5;margin-bottom:10px' } Other Projects
- favorite_end = true
<div class="row">
.col-xs-6.col-sm-4.col-md-3.col-lg-2{ style: 'margin-bottom:10px;' }
.nowrap{ style: 'overflow:hidden;' }
- if @group
= link_to project.name, new_group_path(project_id: project, group: { initial_due_date: params[:due_date] }), remote: true, class: 'btn btn-default btn-block btn-fade-effect', style: "background-color:#{project.color(current_user)};color:#{project.text_color(current_user)}"
- else
= link_to project.name, new_sticky_path(project_id: project, sticky: { due_date: params[:due_date] }), remote: true, class: 'btn btn-default btn-block btn-fade-effect', style: "background-color:#{project.color(current_user)};color:#{project.text_color(current_user)}"
.modal-footer
= link_to 'Close', '#', class: 'btn btn-default', data: { dismiss: 'modal' }