Skip to content

Instantly share code, notes, and snippets.

@Heavyblade
Created July 4, 2013 21:31
Show Gist options
  • Select an option

  • Save Heavyblade/5930341 to your computer and use it in GitHub Desktop.

Select an option

Save Heavyblade/5930341 to your computer and use it in GitHub Desktop.
#task-subtask{:style => ((task.sub_tasks.count > 0 || params[:edit] == "true") ? "display:block" : "display: none"), :class => (params[:edit] == "true" ? "edit" : "normal") }
- if task.creator.id == current_user.id
.actions
%a.delete_subtask{:href => "#"}
%a.edit_subtask{:href => "#"}
%ol
- if params[:edit] == "true"
- task.sub_tasks.each do |x|
%li{:id => x.id.to_s}
.drag
.check_box
%input.check.checkbox{:type => "checkbox", :value => x.title, :id => x.id.to_s, :checked => x.checked }
.edit-box
%input{:type => "text", :style => "", :value => x.title}
.delete_x
%a.delete{:href => "#"}x
%li.add_box
.check_box
.edit-box
%input.fields#add_check{:type => "text", :name => "task-description"}
.delete_x
- else
- task.sub_tasks.each do |x|
%li{:id => x.id.to_s, :class => x.idx}
.check_box
%input.check{:type => "checkbox", :value => x.title, :id => x.id.to_s, :checked => x.checked }
.title
= x.title
- if params[:edit] == "true"
.buttons
%input.save{:type => "submit", :value => "Save"}
%a.cancel-edit.secondary cancel
:javascript
$("#task-subtask ol").sortable({placeholder: "placeholder","forcePlaceholderSize": true, stop: function(event, ui) {$(".add_box").show()}, start: function(event, ui) {$(".add_box").hide()} })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment