diff --git a/app/assets/images/calendar-add.svg b/app/assets/images/calendar-add.svg new file mode 100644 index 000000000..faceba80b --- /dev/null +++ b/app/assets/images/calendar-add.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/stylesheets/bubbles.css b/app/assets/stylesheets/bubbles.css index 6d934c604..89f2abfd5 100644 --- a/app/assets/stylesheets/bubbles.css +++ b/app/assets/stylesheets/bubbles.css @@ -136,6 +136,23 @@ &.bubble__date { aspect-ratio: 1; inset: 2cqi 2cqi auto auto; + + label { + display: grid; + place-items: center; + + > * { + grid-area: 1/1; + } + } + } + + &.bubble__date--new { + padding: 0.7em; + + .windshield & { + display: none; + } } &:where(.bubble__meta) { @@ -157,7 +174,7 @@ white-space: nowrap; z-index: 1; - &:has(.input:not([type="file"])) { + &:has(.input:not([type="file"], [type="date"])) { border-radius: 2em; padding: 0.2em 0.5em; diff --git a/app/assets/stylesheets/inputs.css b/app/assets/stylesheets/inputs.css index b6a2116b3..967811c2e 100644 --- a/app/assets/stylesheets/inputs.css +++ b/app/assets/stylesheets/inputs.css @@ -179,3 +179,10 @@ -webkit-box-shadow: 0 0 0px 1000px var(--color-selected) inset; } } + +.input--hidden { + block-size: 0; + inline-size: 0; + opacity: 0; + padding: 0; +} diff --git a/app/controllers/bubbles_controller.rb b/app/controllers/bubbles_controller.rb index 9ea672312..c89f697ca 100644 --- a/app/controllers/bubbles_controller.rb +++ b/app/controllers/bubbles_controller.rb @@ -41,7 +41,7 @@ class BubblesController < ApplicationController end def bubble_params - params.require(:bubble).permit(:title, :body, :color, :image, :remove_image, tag_ids: []) + params.require(:bubble).permit(:title, :body, :color, :due_on, :image, :remove_image, tag_ids: []) end def remove_image diff --git a/app/javascript/controllers/form_controller.js b/app/javascript/controllers/form_controller.js index 80b2727ab..4288143a4 100644 --- a/app/javascript/controllers/form_controller.js +++ b/app/javascript/controllers/form_controller.js @@ -14,4 +14,10 @@ export default class extends Controller { preventAttachment(event) { event.preventDefault() } + + showPicker(event) { + if ("showPicker" in HTMLInputElement.prototype) { + event.target.showPicker() + } + } } diff --git a/app/views/bubbles/_bubble.html.erb b/app/views/bubbles/_bubble.html.erb index f40b4767a..3ce7d5d05 100644 --- a/app/views/bubbles/_bubble.html.erb +++ b/app/views/bubbles/_bubble.html.erb @@ -35,9 +35,25 @@ <% end %> - + <% if bubble.due_on.present? %> + <%= form_with model: bubble, data: { controller: "form" } do | form | %> + + <% end %> + <% else %> +
+ <% end %> <% bubble.tags.each do |tag| %> <%= link_to "##{tag.title}", bubbles_path(tag_id: tag), class: "bubble__bubble bubble__meta bubble__tag" %> diff --git a/db/migrate/20240913172737_add_due_date_to_bubbles.rb b/db/migrate/20240913172737_add_due_date_to_bubbles.rb new file mode 100644 index 000000000..bac2015ec --- /dev/null +++ b/db/migrate/20240913172737_add_due_date_to_bubbles.rb @@ -0,0 +1,5 @@ +class AddDueDateToBubbles < ActiveRecord::Migration[8.0] + def change + add_column :bubbles, :due_on, :date + end +end diff --git a/db/schema.rb b/db/schema.rb index fc9215339..8cdd61d63 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_09_05_191233) do +ActiveRecord::Schema[8.0].define(version: 2024_09_13_172737) do create_table "accounts", force: :cascade do |t| t.string "name", null: false t.datetime "created_at", null: false @@ -62,6 +62,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_09_05_191233) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "creator_id", null: false + t.date "due_on" end create_table "comments", force: :cascade do |t|