From bc7bcca0c3f1096e7548b2f2248b5df0ba53c0f9 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Mon, 25 Sep 2023 15:49:35 -0500 Subject: [PATCH] Complete Lesson 14 --- app/views/layouts/_footer.html.erb | 6 ++++++ app/views/layouts/_header.html.erb | 6 ++++++ app/views/layouts/application.html.erb | 14 ++------------ app/views/movies/_form.html.erb | 18 ++++++++++++++++++ app/views/movies/edit.html.erb | 19 +------------------ app/views/movies/new.html.erb | 19 +------------------ 6 files changed, 34 insertions(+), 48 deletions(-) create mode 100644 app/views/layouts/_footer.html.erb create mode 100644 app/views/layouts/_header.html.erb create mode 100644 app/views/movies/_form.html.erb diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb new file mode 100644 index 0000000..202baef --- /dev/null +++ b/app/views/layouts/_footer.html.erb @@ -0,0 +1,6 @@ + diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb new file mode 100644 index 0000000..b67850f --- /dev/null +++ b/app/views/layouts/_header.html.erb @@ -0,0 +1,6 @@ +
+ +
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 76728ae..31a872a 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -12,20 +12,10 @@ -
- -
+ <%= render "layouts/header" %>
<%= yield %>
- + <%= render "layouts/footer" %> diff --git a/app/views/movies/_form.html.erb b/app/views/movies/_form.html.erb new file mode 100644 index 0000000..17cbca9 --- /dev/null +++ b/app/views/movies/_form.html.erb @@ -0,0 +1,18 @@ +<%= form_with(model: movie) do |f| %> + <%= f.label :title %> + <%= f.text_field :title, autofocus: true %> + + <%= f.label :description %> + <%= f.text_area :description, rows: 10 %> + + <%= f.label :rating %> + <%= f.text_field :rating %> + + <%= f.label :released_on %> + <%= f.date_field :released_on %> + + <%= f.label :total_gross %> + <%= f.number_field :total_gross %> + + <%= f.submit %> +<% end %> diff --git a/app/views/movies/edit.html.erb b/app/views/movies/edit.html.erb index 0d4325e..ba44d2c 100644 --- a/app/views/movies/edit.html.erb +++ b/app/views/movies/edit.html.erb @@ -1,20 +1,3 @@

Editing <%= @movie.title %>

-<%= form_with(model: @movie) do |f| %> - <%= f.label :title %> - <%= f.text_field :title %> - - <%= f.label :description %> - <%= f.text_area :description, rows: 7 %> - - <%= f.label :rating %> - <%= f.text_field :rating %> - - <%= f.label :released_on %> - <%= f.date_field :released_on %> - - <%= f.label :total_gross %> - <%= f.number_field :total_gross %> - - <%= f.submit %> -<% end %> +<%= render "form", movie: @movie %> diff --git a/app/views/movies/new.html.erb b/app/views/movies/new.html.erb index 56b8d51..da93d76 100644 --- a/app/views/movies/new.html.erb +++ b/app/views/movies/new.html.erb @@ -1,20 +1,3 @@

Creating a New Movie

-<%= form_with(model: @movie) do |f| %> - <%= f.label :title %> - <%= f.text_field :title %> - - <%= f.label :description %> - <%= f.text_area :description, rows: 7 %> - - <%= f.label :rating %> - <%= f.text_field :rating %> - - <%= f.label :released_on %> - <%= f.date_field :released_on %> - - <%= f.label :total_gross %> - <%= f.number_field :total_gross %> - - <%= f.submit %> -<% end %> +<%= render "form", movie: @movie %>