From 07c5d0fa2a5eed85320b3b8eeca128833c4c3296 Mon Sep 17 00:00:00 2001 From: ming Date: Mon, 28 Apr 2025 12:02:08 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=A4=EC=BC=80=EC=A4=84=EB=9F=AC=20edit=20?= =?UTF-8?q?=EC=8A=A4=ED=83=80=EC=9D=BC=20=EB=A6=AC=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=ED=86=A0=EA=B8=80?= =?UTF-8?q?=20=EB=B2=84=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stylesheets/application.tailwind.css | 13 +++- app/views/schedules/schedule_edit.html.erb | 75 ++++++++++++------- app/views/schedules/view.html.erb | 64 ++++++++-------- 3 files changed, 89 insertions(+), 63 deletions(-) diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css index 613572e..69d2670 100644 --- a/app/assets/stylesheets/application.tailwind.css +++ b/app/assets/stylesheets/application.tailwind.css @@ -78,7 +78,7 @@ } .select-style { - @apply block w-full h-8 px-3 py-1.5 border border-default-slate/50 rounded-xs text-base-background + @apply block w-full px-3 py-1.5 border border-default-slate/50 rounded-xs text-base-background } .select-style option { @@ -86,12 +86,21 @@ } .input-style { - @apply block w-full h-8 px-3 py-1.5 border border-default-slate/50 rounded-xs + @apply block w-full px-3 py-1.5 border border-default-slate/50 rounded-xs } .textarea-style { @apply block w-full pl-4 flex-1 py-1.5 ring-1 ring-inset ring-default-slate/50 rounded-xs } + + /*Toggle Button*/ + .toggle_style { + @apply w-14 h-8 bg-danger rounded-full peer-checked:bg-notice transition-all duration-300 + } + + .toggle_btn { + @apply absolute left-1 top-1 w-6 h-6 bg-white rounded-full transition-all duration-300 peer-checked:translate-x-full shadow-sm + } } @layer utilities { diff --git a/app/views/schedules/schedule_edit.html.erb b/app/views/schedules/schedule_edit.html.erb index 2f4088c..9e39391 100644 --- a/app/views/schedules/schedule_edit.html.erb +++ b/app/views/schedules/schedule_edit.html.erb @@ -1,45 +1,62 @@ -
+
- <%= form_with url: schedule_edit_update_schedules_path, method: :post, class: 'flex flex-col h-full divide-y divide-border-base-border p-4' do %> + <%= form_with url: schedule_edit_update_schedules_path, method: :post, class: 'flex flex-col h-full' do %> <%= hidden_field_tag :controller_id, params[:id] %> -
-
+
+
<%= @controller.name %> 컨트롤러
<%= submit_tag "업데이트", class: "btn bg-primary" %>
- - - - - - - - - - - +
    <% @schedule.each do |s| %> -
- - - - - - + + <% end %> - -
시간사용여부온도삭제
- <%= select_tag "schedule[#{s.id}][hour]", - options_for_select((0..23).map { |h| [h.to_s.rjust(2, '0'), h] }, s.hour), - class: "select-style text-white" %> - <%= number_field_tag "schedule[#{s.id}][minute]", s.minute, min: 0, max: 59, step: 1, inputmode: "decimal", class: "input-style" %><%= check_box_tag "schedule[#{s.id}][is_active]", "1", s.is_active == true || s.is_active == 1 %><%= number_field_tag "schedule[#{s.id}][temperature]", s.temperature, step: "0.1", inputmode: "decimal", class: "input-style" %> +
  • +
    + +
    +
    시간
    +
    + <%= select_tag "schedule[#{s.id}][hour]", + options_for_select((0..23).map { |h| [h.to_s.rjust(2, '0'), h] }, s.hour), + class: "select-style text-white" %> +
    :
    + <%= number_field_tag "schedule[#{s.id}][minute]", s.minute, min: 0, max: 59, step: 1, inputmode: "decimal", class: "input-style" %> +
    +
    + + +
    +
    온도
    +
    +
    + <%= number_field_tag "schedule[#{s.id}][temperature]", s.temperature, step: "0.1", inputmode: "decimal", class: "input-style" %> +
    +
    °C
    +
    +
    +
    + + +
    +
    사용여부
    + +
    + + +
    <%= link_to "삭제", schedule_path(s), data: { turbo_method: :delete, turbo_confirm: "정말 삭제하시겠습니까?" }, class: "btn bg-danger text-sm" %> -
  • +
    <% end %>
    diff --git a/app/views/schedules/view.html.erb b/app/views/schedules/view.html.erb index 19cc4aa..ab7db0e 100644 --- a/app/views/schedules/view.html.erb +++ b/app/views/schedules/view.html.erb @@ -6,44 +6,44 @@ <%= link_to "수정", schedule_edit_schedule_path(@controller.id), class: "btn bg-default-slate" %>
      - <% @schedule.each do |s| %> -
    • -
      - -
      -
      시간
      -
      -
      <%= s.hour.to_s.rjust(2, '0') %>
      -
      :
      -
      <%= s.minute.to_s.rjust(2, '0') %>
      -
      -
      - - -
      -
      온도
      -
      -
      <%= s.temperature %>
      -
      °C
      -
      + <% @schedule.each do |s| %> +
    • +
      + +
      +
      시간
      +
      +
      <%= s.hour.to_s.rjust(2, '0') %>
      +
      :
      +
      <%= s.minute.to_s.rjust(2, '0') %>
      - +
      -
      사용여부
      -
      - <%#= s.is_active %> - <% if s.is_active %> - - <% else %> - - <% end %> +
      온도
      +
      +
      <%= s.temperature %>
      +
      °C
      -
    • - <% end %> -
    +
    + + +
    +
    사용여부
    +
    + <%#= s.is_active %> + <% if s.is_active %> + + <% else %> + + <% end %> +
    +
    + + <% end %> +