Skip to content

Commit

Permalink
move opening times markup into a partial
Browse files Browse the repository at this point in the history
  • Loading branch information
aaaaargZombies committed Aug 31, 2022
1 parent 4998b67 commit 27c0650
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
31 changes: 1 addition & 30 deletions app/views/admin/partners/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -111,36 +111,7 @@
<div class="row">
<div class="col-lg-8 col-md-12">
<h2>Opening times</h2>
<div data-controller="opening-times" data-opening-times-data-value='<%= @partner.opening_times %>'>
<ul class="list-group" data-opening-times-target="list">
</ul>

<div class="mt-3 input-group flex-row align-items-center justify-content-sm-between flex-wrap">
<label class="m-0" for="day">Day
<select class="ml-1" id="day" data-opening-times-target="day">
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
</select>
</label>
<label class="m-0" for="open">Opening Time
<input class="ml-1" id="open" type="time" name="" value="00:00" data-opening-times-target="open">
</label>
<label class="m-0" for="close">Closing Time
<input class="ml-1" id="close" type="time" name="" value="00:00" data-opening-times-target="close">
</label>
<label class="m-0" for="allDay">All Day
<input class="ml-1" id="allDay" type="checkbox" name="" value="" data-opening-times-target="allDay" data-action="change->opening-times#allDay" >
</label>
<button data-action="click->opening-times#addOpeningTime" type="" class="btn btn-primary">Add</button>
</div>

<%= f.text_area :opening_times, data: { opening_times_target: "textarea" }, hidden: true %>
</div>
<%= render 'opening_times', f %>
</div>
<div class="col-lg-4 col-md-12 tags">
<h2>Tags</h2>
Expand Down
30 changes: 30 additions & 0 deletions app/views/admin/partners/_opening_times.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<div data-controller="opening-times" data-opening-times-data-value='<%= @partner.opening_times %>'>
<ul class="list-group" data-opening-times-target="list">
</ul>

<div class="mt-3 input-group flex-row align-items-center justify-content-sm-between flex-wrap">
<label class="m-0" for="day">Day
<select class="ml-1" id="day" data-opening-times-target="day">
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
</select>
</label>
<label class="m-0" for="open">Opening Time
<input class="ml-1" id="open" type="time" name="" value="00:00" data-opening-times-target="open">
</label>
<label class="m-0" for="close">Closing Time
<input class="ml-1" id="close" type="time" name="" value="00:00" data-opening-times-target="close">
</label>
<label class="m-0" for="allDay">All Day
<input class="ml-1" id="allDay" type="checkbox" name="" value="" data-opening-times-target="allDay" data-action="change->opening-times#allDay" >
</label>
<button data-action="click->opening-times#addOpeningTime" type="" class="btn btn-primary">Add</button>
</div>

<%= f.text_area :opening_times, data: { opening_times_target: "textarea" }, hidden: true %>
</div>

0 comments on commit 27c0650

Please sign in to comment.