-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor views to use SectionComponent
Using the SectionComponent in each view rather implementing it in the application layout gives us a bit more flexibility. In particular we use the flexibility to lift the "An online music store. Owned by us." strapline on the homepage out of the white SectionComponent.
- Loading branch information
Showing
29 changed files
with
389 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 10 additions & 6 deletions
16
app/components/section_component/section_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/components/sidebar_section_component/sidebar_section_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
<%= render('shared/page_header', text: 'Albums') %> | ||
<%= render('shared/page_sub_header', text: 'Pending') %> | ||
|
||
<ul> | ||
<% Album.pending.each do |album| %> | ||
<li><%= text_link_to "#{album.title} by #{album.artist.name}", artist_album_path(album.artist, album) %></li> | ||
<% end %> | ||
</ul> | ||
<%= render(SectionComponent.new(title: 'Pending albums')) do %> | ||
<ul> | ||
<% Album.pending.each do |album| %> | ||
<li><%= text_link_to "#{album.title} by #{album.artist.name}", artist_album_path(album.artist, album) %></li> | ||
<% end %> | ||
</ul> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
<div class="flex flex-col gap-6"> | ||
<ol class="flex gap-2 text-sm"> | ||
<li><%= link_to 'Account', account_path, class: 'hover:underline' %></li> | ||
<li class='text-slate-400'>/</li> | ||
<li><%= link_to @album.artist.name, edit_artist_path(@album.artist), class: 'hover:underline' %></li> | ||
<li class='text-slate-400'>/</li> | ||
<li class='text-rose-400'><%= @album.title %></li> | ||
</ol> | ||
<%= render(SectionComponent.new(title: "Editing #{@album.title}")) do %> | ||
<div class="flex flex-col gap-6"> | ||
<ol class="flex gap-2 text-sm"> | ||
<li><%= link_to 'Account', account_path, class: 'hover:underline' %></li> | ||
<li class='text-slate-400'>/</li> | ||
<li><%= link_to @album.artist.name, edit_artist_path(@album.artist), class: 'hover:underline' %></li> | ||
<li class='text-slate-400'>/</li> | ||
<li class='text-rose-400'><%= @album.title %></li> | ||
</ol> | ||
|
||
<div class="border-b border-slate-300"> | ||
<h1 class="text-2xl font-bold mb-1">Editing <%= @album.title %></h1> | ||
<%= render "form", album: @album %> | ||
</div> | ||
|
||
<%= render "form", album: @album %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
<div class="flex flex-col gap-6"> | ||
<ol class="flex gap-2 text-sm"> | ||
<li><%= link_to 'Account', account_path, class: 'hover:underline' %></li> | ||
<li class='text-slate-400'>/</li> | ||
<li><%= link_to @album.artist.name, edit_artist_path(@album.artist), class: 'hover:underline' %></li> | ||
<li class='text-slate-400'>/</li> | ||
<li class='text-rose-400'>New album</li> | ||
</ol> | ||
<%= render(SectionComponent.new(title: 'New album')) do %> | ||
<div class="flex flex-col gap-3"> | ||
<ol class="flex gap-2 text-sm"> | ||
<li><%= link_to 'Account', account_path, class: 'hover:underline' %></li> | ||
<li class='text-slate-400'>/</li> | ||
<li><%= link_to @album.artist.name, edit_artist_path(@album.artist), class: 'hover:underline' %></li> | ||
<li class='text-slate-400'>/</li> | ||
<li class='text-rose-400'>New album</li> | ||
</ol> | ||
|
||
<div class="border-b border-slate-300"> | ||
<h1 class="text-2xl font-bold mb-1">New album</h1> | ||
<%= render "form", album: @album %> | ||
</div> | ||
|
||
<%= render "form", album: @album %> | ||
</div> | ||
<% end %> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
<div class="border-b border-slate-300 mb-6"> | ||
<h1 class="text-2xl font-bold mb-1">My account</h1> | ||
</div> | ||
<%= render(SectionComponent.new(title: 'My account')) do %> | ||
<%= render(AccountNavComponent.new(user: @artist.user)) %> | ||
|
||
<%= render(AccountNavComponent.new(user: @artist.user)) %> | ||
<%= render(SidebarSectionComponent.new(title: 'Artist details')) do %> | ||
<%= render "form", artist: @artist %> | ||
<% end %> | ||
|
||
<%= render(SidebarSectionComponent.new(title: 'Artist details')) do %> | ||
<%= render "form", artist: @artist %> | ||
<% end %> | ||
|
||
<%= render(SidebarSectionComponent.new(title: 'Albums')) do %> | ||
<div class="grid grid-cols-3 gap-4"> | ||
<% @artist.albums.in_release_order.each do |album| %> | ||
<%= link_to(edit_artist_album_path(album.artist, album)) do %> | ||
<%= render(CardComponent.new( | ||
title: album.title, | ||
subtitle: ( album.publication_status if !album.published? ), | ||
image: ( cdn_url(album.cover.representation(resize_to_limit: [1000, 1000])) if album.cover.representable? ) | ||
)) %> | ||
<%= render(SidebarSectionComponent.new(title: 'Albums')) do %> | ||
<div class="grid grid-cols-3 gap-4"> | ||
<% @artist.albums.in_release_order.each do |album| %> | ||
<%= link_to(edit_artist_album_path(album.artist, album)) do %> | ||
<%= render(CardComponent.new( | ||
title: album.title, | ||
subtitle: ( album.publication_status if !album.published? ), | ||
image: ( cdn_url(album.cover.representation(resize_to_limit: [1000, 1000])) if album.cover.representable? ) | ||
)) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= link_to(new_artist_album_path(@artist)) do %> | ||
<div class="border border-slate-500 border-dashed hover:border-solid aspect-w-1 aspect-h-1"> | ||
<div class="grid place-items-center"> | ||
<div class="flex gap-2 items-center text-amber-600"> | ||
<span> | ||
<svg class="fill-amber-600" width="14" height="14" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M14 8.5H8V14.5H6V8.5H0V6.5H6V0.5H8V6.5H14V8.5Z" /> | ||
</svg> | ||
</span> | ||
Add album | ||
<%= link_to(new_artist_album_path(@artist)) do %> | ||
<div class="border border-slate-500 border-dashed hover:border-solid aspect-w-1 aspect-h-1"> | ||
<div class="grid place-items-center"> | ||
<div class="flex gap-2 items-center text-amber-600"> | ||
<span> | ||
<svg class="fill-amber-600" width="14" height="14" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M14 8.5H8V14.5H6V8.5H0V6.5H6V0.5H8V6.5H14V8.5Z" /> | ||
</svg> | ||
</span> | ||
Add album | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
<div class="border-b border-slate-300 mb-6"> | ||
<h1 class="text-2xl font-bold mb-1">My account</h1> | ||
</div> | ||
<%= render(SectionComponent.new(title: 'My account')) do %> | ||
<%= render(AccountNavComponent.new(user: @user)) %> | ||
|
||
<%= render(AccountNavComponent.new(user: @user)) %> | ||
|
||
<%= render(SidebarSectionComponent.new(title: 'Artist details')) do %> | ||
<%= render "form", artist: @artist %> | ||
<%= render(SidebarSectionComponent.new(title: 'Artist details')) do %> | ||
<%= render "form", artist: @artist %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
<%= render('shared/page_header', text: 'My collection') %> | ||
<%= render(SectionComponent.new(title: 'My collection')) do %> | ||
|
||
<% if Current.user.collection.empty? %> | ||
<p class="class='text-sm text-slate-600">There's nothing in your collection at the moment.</p> | ||
<% end %> | ||
<% if Current.user.collection.empty? %> | ||
<p class="class='text-sm text-slate-600">There's nothing in your collection at the moment.</p> | ||
<% end %> | ||
|
||
<div class="pt-4 grid grid-cols-3 gap-4"> | ||
<% Current.user.collection.each do |purchase| %> | ||
<%= link_to(artist_album_path(purchase.album.artist, purchase.album)) do %> | ||
<%= render(CardComponent.new( | ||
<div class="pt-4 grid grid-cols-3 gap-4"> | ||
<% Current.user.collection.each do |purchase| %> | ||
<%= link_to(artist_album_path(purchase.album.artist, purchase.album)) do %> | ||
<%= render(CardComponent.new( | ||
title: purchase.album.title, | ||
subtitle: purchase.album.artist.name, | ||
image: ( cdn_url(purchase.album.cover.representation(resize_to_limit: [1000, 1000])) if purchase.album.cover.representable? ) | ||
)) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<%= render('shared/page_header', text: 'Reset your password') %> | ||
|
||
<%= form_with(url: identity_password_reset_path, method: :patch, builder: TailwindFormBuilder) do |form| %> | ||
<%= render ModelErrorComponent.new(model: @user) %> | ||
<%= form.hidden_field :sid, value: params[:sid] %> | ||
<%= form.password_field :password, label: { text: 'New password' }, required: true, autofocus: true, autocomplete: "new-password", class: 'w-full mb-3' %> | ||
<%= form.password_field :password_confirmation, label: { text: 'Confirm new password' }, required: true, autocomplete: "new-password", class: 'w-full mb-3' %> | ||
<%= form.submit "Save changes", class: 'w-full mt-3' %> | ||
<%= render(SectionComponent.new(title: 'Reset your password')) do %> | ||
<%= form_with(url: identity_password_reset_path, method: :patch, builder: TailwindFormBuilder) do |form| %> | ||
<%= render ModelErrorComponent.new(model: @user) %> | ||
<%= form.hidden_field :sid, value: params[:sid] %> | ||
<%= form.password_field :password, label: { text: 'New password' }, required: true, autofocus: true, autocomplete: "new-password", class: 'w-full mb-3' %> | ||
<%= form.password_field :password_confirmation, label: { text: 'Confirm new password' }, required: true, autocomplete: "new-password", class: 'w-full mb-3' %> | ||
<%= form.submit "Save changes", class: 'w-full mt-3' %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<%= render('shared/page_header', text: 'Forgot your password?') %> | ||
<%= render(SectionComponent.new(title: 'Forgot your password?')) do %> | ||
<%= form_with(url: identity_password_reset_path, builder: TailwindFormBuilder) do |form| %> | ||
<%= form.email_field :email, required: true, autofocus: true, class: 'w-full mb-3' %> | ||
|
||
<%= form_with(url: identity_password_reset_path, builder: TailwindFormBuilder) do |form| %> | ||
<%= form.email_field :email, required: true, autofocus: true, class: 'w-full mb-3' %> | ||
|
||
<div> | ||
<%= form.submit "Send password reset email", class: 'w-full' %> | ||
</div> | ||
<div> | ||
<%= form.submit "Send password reset email", class: 'w-full' %> | ||
</div> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<%= render 'shared/page_header', text: 'Thank you!' %> | ||
|
||
<p class="mb-3 leading-relaxed">Thank you for registering your interest. We'll be in touch with more news soon.</p> | ||
<%= render(SectionComponent.new(title: 'Thank you!')) do %> | ||
<p class="mb-3 leading-relaxed">Thank you for registering your interest. We'll be in touch with more news soon.</p> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<%= render 'shared/page_header', text: 'Thank you' %> | ||
|
||
<p class="mb-3 leading-relaxed">We've sent you an email. Please | ||
check your inbox and click the link to confirm your email | ||
address.</p> | ||
<%= render(SectionComponent.new(title: 'Thank you!')) do %> | ||
<p class="mb-3 leading-relaxed">We've sent you an email. Please | ||
check your inbox and click the link to confirm your email | ||
address.</p> | ||
<% end %> |
Oops, something went wrong.