Growstuff/growstuff

View on GitHub
app/views/shared/editable/_date.html.haml

Summary

Maintainability
Test Coverage
- if can? :edit, model
  %small.edit-link
    %a.editable-date#description{"data-field" => "#date--#{model.id}-#{field.to_s}",
      "data-display": display_field, href: "#"}
      = edit_icon
  .hide{id: "date--#{model.id}-#{field.to_s}"}
    = bootstrap_form_for(model) do |f|
      = f.date_field field,
               value: model.send(field) ? model.send(field).to_fs(:ymd) : '', label: 'When?'
      = f.submit :save