diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css index 83e263f..1b3277a 100644 --- a/app/assets/stylesheets/application.tailwind.css +++ b/app/assets/stylesheets/application.tailwind.css @@ -132,7 +132,7 @@ } .content { - @apply lg:rounded-lg bg-base-content p-0 lg:p-4 + @apply lg:rounded-lg bg-base-background } .page-title { @@ -190,7 +190,7 @@ /*Dashboard*/ .dashboard-group { - @apply rounded-md bg-base-background min-h-32 p-4 flex flex-col justify-between cursor-pointer + @apply rounded-md bg-base-content min-h-32 p-4 flex flex-col justify-between cursor-pointer shadow-xs } /*Pagy*/ diff --git a/app/views/environment/edit_co2.html.erb b/app/views/environment/edit_co2.html.erb new file mode 100644 index 0000000..30bbabe --- /dev/null +++ b/app/views/environment/edit_co2.html.erb @@ -0,0 +1,86 @@ +
+
+ <%= link_to environment_index_path(id: params[:id]), class: "flex items-center" do %> + + <% end %> +
<%= @controller.id %>동 온도 스케줄러
+
+
+ <%= form_with url: edit_temp_environment_path, method: :post, class: 'flex flex-col h-full' do %> + <%= hidden_field_tag :controller_id, params[:id] %> +
+ <%= submit_tag "업데이트", class: "btn bg-primary w-fit" %> +
+
    + <% if @schedule.present? %> + <% @schedule.each do |s| %> +
  • +
    + +
    +
    시간
    +
    + <%= 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 min-w-[60px]" %> +
    :
    + <%= number_field_tag "schedule[#{s.id}][minute]", + s.minute, min: 0, max: 59, step: 1, inputmode: "decimal", + class: "input-style min-w-[60px]" %> +
    +
    + + +
    +
    온도 (°C)
    +
    + <%= number_field_tag "schedule[#{s.id}][temperature]", s.temperature, min: -99, max: 99, step: "0.1", inputmode: "decimal", class: "input-style min-w-[68px]" %> +
    +
    +
    + +
    + +
    +
    ON/OFF
    + +
    + + +
    +
     
    + <%= link_to schedule_path(s), + data: { turbo_method: :delete, turbo_confirm: "정말 삭제하시겠습니까?" }, + class: "btn bg-danger text-sm flex items-center px-2 py-0 my-1.5 lg:px-4 lg:py-1.5 lg:my-0" do %> + +
    + <% end %> +
    +
    +
  • + <% end %> + <% else %> +
  • 저장된 스케줄이 없습니다.
  • + <% end %> +
+
+
+ <%= button_to "초기화", reset_schedule_path(params[:id]), + method: :post, + data: { turbo_confirm: "정말 초기화하시겠습니까? 모든 스케줄 데이터가 삭제됩니다." }, + class: "btn bg-danger" %> + <%= button_to "추가하기", open_modals_path(type: "add_schedule", id: params[:id]), + class: "btn bg-default-slate", + data: { + turbo_method: :post, + turbo_frame: "modals" + } %> +
+
+ <% end %> +
+
diff --git a/app/views/environment/edit_humidity.html.erb b/app/views/environment/edit_humidity.html.erb new file mode 100644 index 0000000..30bbabe --- /dev/null +++ b/app/views/environment/edit_humidity.html.erb @@ -0,0 +1,86 @@ +
+
+ <%= link_to environment_index_path(id: params[:id]), class: "flex items-center" do %> + + <% end %> +
<%= @controller.id %>동 온도 스케줄러
+
+
+ <%= form_with url: edit_temp_environment_path, method: :post, class: 'flex flex-col h-full' do %> + <%= hidden_field_tag :controller_id, params[:id] %> +
+ <%= submit_tag "업데이트", class: "btn bg-primary w-fit" %> +
+
    + <% if @schedule.present? %> + <% @schedule.each do |s| %> +
  • +
    + +
    +
    시간
    +
    + <%= 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 min-w-[60px]" %> +
    :
    + <%= number_field_tag "schedule[#{s.id}][minute]", + s.minute, min: 0, max: 59, step: 1, inputmode: "decimal", + class: "input-style min-w-[60px]" %> +
    +
    + + +
    +
    온도 (°C)
    +
    + <%= number_field_tag "schedule[#{s.id}][temperature]", s.temperature, min: -99, max: 99, step: "0.1", inputmode: "decimal", class: "input-style min-w-[68px]" %> +
    +
    +
    + +
    + +
    +
    ON/OFF
    + +
    + + +
    +
     
    + <%= link_to schedule_path(s), + data: { turbo_method: :delete, turbo_confirm: "정말 삭제하시겠습니까?" }, + class: "btn bg-danger text-sm flex items-center px-2 py-0 my-1.5 lg:px-4 lg:py-1.5 lg:my-0" do %> + +
    + <% end %> +
    +
    +
  • + <% end %> + <% else %> +
  • 저장된 스케줄이 없습니다.
  • + <% end %> +
+
+
+ <%= button_to "초기화", reset_schedule_path(params[:id]), + method: :post, + data: { turbo_confirm: "정말 초기화하시겠습니까? 모든 스케줄 데이터가 삭제됩니다." }, + class: "btn bg-danger" %> + <%= button_to "추가하기", open_modals_path(type: "add_schedule", id: params[:id]), + class: "btn bg-default-slate", + data: { + turbo_method: :post, + turbo_frame: "modals" + } %> +
+
+ <% end %> +
+
diff --git a/app/views/environment/edit_temp.html.erb b/app/views/environment/edit_temp.html.erb index 4ba3b47..30bbabe 100644 --- a/app/views/environment/edit_temp.html.erb +++ b/app/views/environment/edit_temp.html.erb @@ -5,8 +5,8 @@ <% end %>
<%= @controller.id %>동 온도 스케줄러
-
- <%= form_with url: schedule_edit_update_schedules_path, method: :post, class: 'flex flex-col h-full' do %> +
+ <%= form_with url: edit_temp_environment_path, method: :post, class: 'flex flex-col h-full' do %> <%= hidden_field_tag :controller_id, params[:id] %>
<%= submit_tag "업데이트", class: "btn bg-primary w-fit" %> diff --git a/app/views/environment/index.html.erb b/app/views/environment/index.html.erb index 8ba1d9f..f87562d 100644 --- a/app/views/environment/index.html.erb +++ b/app/views/environment/index.html.erb @@ -1,7 +1,7 @@
- <%= link_to view_temp_environment_path(id: params[:id]), class: "dashboard-group" do %> + <%= link_to edit_temp_environment_path(id: params[:id]), class: "dashboard-group" do %>
@@ -33,7 +33,7 @@ <% end %> - <%= link_to view_humidity_environment_path(id: params[:id]), class: "dashboard-group" do %> + <%= link_to edit_humidity_environment_path(id: params[:id]), class: "dashboard-group" do %>
@@ -65,7 +65,7 @@ <% end %> - <%= link_to view_co2_environment_path(id: params[:id]), class: "dashboard-group" do %> + <%= link_to edit_co2_environment_path(id: params[:id]), class: "dashboard-group" do %>
@@ -133,7 +133,7 @@ <% end %> - <%= link_to view_area_environment_path(id: params[:id]), class: "dashboard-group" do %> + <%= link_to edit_area_environment_path(id: params[:id]), class: "dashboard-group" do %>
diff --git a/app/views/environment/view_temp.html.erb b/app/views/environment/view_temp.html.erb index 0ab5427..bec811d 100644 --- a/app/views/environment/view_temp.html.erb +++ b/app/views/environment/view_temp.html.erb @@ -5,7 +5,7 @@ <% end %>
<%= @controller.id %>동 온도 스케줄러
-
+
<%= link_to "수정", edit_temp_environment_path(@controller.id), class: "btn bg-default-slate" %>
diff --git a/app/views/nutrient/index.html.erb b/app/views/nutrient/index.html.erb index 8fa38f0..b3917e7 100644 --- a/app/views/nutrient/index.html.erb +++ b/app/views/nutrient/index.html.erb @@ -1,7 +1,7 @@
- <%= link_to view_temp_environment_path(id: params[:id]), class: "dashboard-group" do %> + <%= link_to edit_temp_environment_path(id: params[:id]), class: "dashboard-group" do %>
@@ -34,7 +34,7 @@ <% end %> - <%= link_to view_temp_environment_path(id: params[:id]), class: "dashboard-group" do %> + <%= link_to edit_temp_environment_path(id: params[:id]), class: "dashboard-group" do %>
diff --git a/app/views/schedules/schedule_edit.html.erb b/app/views/schedules/schedule_edit.html.erb index 191d494..30bbabe 100644 --- a/app/views/schedules/schedule_edit.html.erb +++ b/app/views/schedules/schedule_edit.html.erb @@ -1,14 +1,17 @@ -
-
-
- <%= form_with url: schedule_edit_update_schedules_path, method: :post, class: 'flex flex-col' do %> - <%= hidden_field_tag :controller_id, params[:id] %> -
-
-
<%= @controller.name %> 컨트롤러
- <%= submit_tag "업데이트", class: "btn bg-primary" %> -
-
    +
    +
    + <%= link_to environment_index_path(id: params[:id]), class: "flex items-center" do %> + + <% end %> +
    <%= @controller.id %>동 온도 스케줄러
    +
    +
    + <%= form_with url: edit_temp_environment_path, method: :post, class: 'flex flex-col h-full' do %> + <%= hidden_field_tag :controller_id, params[:id] %> +
    + <%= submit_tag "업데이트", class: "btn bg-primary w-fit" %> +
    +
      <% if @schedule.present? %> <% @schedule.each do |s| %>
    • @@ -65,19 +68,19 @@ <% end %>
    - <% end %> -
    - <%= button_to "초기화", reset_schedule_path(params[:id]), - method: :post, - data: { turbo_confirm: "정말 초기화하시겠습니까? 모든 스케줄 데이터가 삭제됩니다." }, - class: "btn bg-danger" %> - <%= button_to "추가하기", open_modals_path(type: "add_schedule", id: params[:id]), - class: "btn bg-default-slate", - data: { - turbo_method: :post, - turbo_frame: "modals" - } %> +
    + <%= button_to "초기화", reset_schedule_path(params[:id]), + method: :post, + data: { turbo_confirm: "정말 초기화하시겠습니까? 모든 스케줄 데이터가 삭제됩니다." }, + class: "btn bg-danger" %> + <%= button_to "추가하기", open_modals_path(type: "add_schedule", id: params[:id]), + class: "btn bg-default-slate", + data: { + turbo_method: :post, + turbo_frame: "modals" + } %> +
    -
    + <% end %>
    diff --git a/config/routes.rb b/config/routes.rb index 4e59fb1..045884c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,11 +32,13 @@ Rails.application.routes.draw do resources :environment do member do - get "view_temp" - get "view_humidity" - get "view_co2" - get "view_area" get "edit_temp" + get "edit_humidity" + get "edit_co2" + get "edit_area" + end + collection do + post "edit_temp_update" end end resources :nutrient