Skip to content

Commit 57fddf4

Browse files
committed
add cloudinary in storage.yml
1 parent 39dc859 commit 57fddf4

File tree

6 files changed

+26
-37
lines changed

6 files changed

+26
-37
lines changed

app/controllers/lists_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def create
2929
authorize @list
3030

3131
if @list.save
32+
puts @list.photo.attached?
3233
redirect_to list_path(@list)
3334
else
3435
render :new

app/views/lists/index.html.erb

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,48 @@
11
<div class="bannerimage d-flex justify-content-center align-items-center">
2-
<h2> Save your watchlists easily</h2>
2+
<h2>Save your watchlists easily</h2>
33
</div>
4-
54
<!-- All users watchlists -->
65
<div class="container">
76
<div class="watchlist-title mt-2">
87
<h3>All watchlists</h3>
98
</div>
10-
119
<div class="movie-grid-index">
1210
<% @lists.each do |list| %>
13-
<div class=""><%= link_to list_path(list) do %>
14-
<div class="card bg-dark text-white cardhover greyfilter">
15-
<img class="card-img" src="<%= cl_image_path list.photo.key, height: 150, width: 300, crop: :fill %>" alt="Card image">
16-
<div class="d-flex card-img-overlay justify-content-center align-items-center">
17-
<h5 class="title"><%= list.name %></h5>
11+
<div class=""><%= link_to list_path(list) do %>
12+
<div class="card bg-dark text-white cardhover greyfilter">
13+
<img class="card-img" src="<%= cl_image_path list.photo.key, height: 150, width: 300, crop: :fill %>" alt="Card image">
14+
<p><%= cl_image_path list.photo.key %></p>
15+
<div class="d-flex card-img-overlay justify-content-center align-items-center">
16+
<h5 class="title"><%= list.name %></h5>
17+
</div>
1818
</div>
19-
</div>
20-
<% end %>
19+
<% end %>
2120
</div>
2221
<% end %>
2322
</div>
2423
</div>
25-
2624
<!-- Own watchlists -->
2725
<div class="container">
2826
<div class="watchlist-title mt-2">
2927
<h3>Your watchlists</h3>
30-
3128
<% if user_signed_in? && policy(List).create? %>
3229
<%= link_to new_list_path, class: "btn btn-primary" do %>
3330
<i class="fas fa-plus"></i> New watchlist
3431
<% end %>
3532
<% end %>
3633
</div>
37-
3834
<% if user_signed_in? %>
3935
<% if @self_lists.length > 0 %>
4036
<div class="movie-grid-index">
4137
<% @self_lists.each do |list| %>
42-
<div class=""><%= link_to list_path(list) do %>
43-
<div class="card bg-dark text-white cardhover greyfilter">
44-
<img class="card-img" src="<%= cl_image_path list.photo.key, height: 150, width: 300, crop: :fill %>" alt="Card image">
45-
<div class="d-flex card-img-overlay justify-content-center align-items-center">
46-
<h5 class="title"><%= list.name %></h5>
38+
<div class=""><%= link_to list_path(list) do %>
39+
<div class="card bg-dark text-white cardhover greyfilter">
40+
<img class="card-img" src="<%= cl_image_path list.photo.key, height: 150, width: 300, crop: :fill %>" alt="Card image">
41+
<div class="d-flex card-img-overlay justify-content-center align-items-center">
42+
<h5 class="title"><%= list.name %></h5>
43+
</div>
4744
</div>
48-
</div>
49-
<% end %>
45+
<% end %>
5046
</div>
5147
<% end %>
5248
</div>

app/views/lists/new.html.erb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
<div class="container newList">
22
<h1>Create a new movie list</h1>
3-
4-
<%= simple_form_for(@list) do |f| %>
3+
<%= simple_form_for(@list, html: { multipart: true }) do |f| %>
54
<%= f.input :name %>
65
<br>
76
<%= f.input :photo, as: :file %>
87
<br>
9-
10-
<div>
8+
<div>
119
<%= f.button :submit, "Create a new movie list", class: "btn btn-primary mt-2" %>
1210
<% end %>
13-
1411
<%= link_to root_path, class: "btn btn-light mt-2" do %>
1512
<i class="fas fa-undo-alt"> Back to list</i>
1613
<% end %>

app/views/lists/show.html.erb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@
99
method: :delete,
1010
data: { confirm: "Are you sure you want to delete this list ?" },
1111
class: "" do %>
12-
<button class="btn btn-danger button-marginright"><i class="far fa-trash-alt"> Delete</i></button>
12+
<button class="btn btn-danger button-marginright"><i class="far fa-trash-alt"> Delete</i></button>
1313
<% end %>
1414
</span>
1515
<% end %>
1616
</div>
1717
</div>
18-
18+
<p><%= @list.photo.key %></p>
1919
<div class="container">
2020
<div class="mb-3 back-button w-100">
2121
<% if user_signed_in? && policy(@list).edit? %>
2222
<%= link_to new_list_bookmark_path(@list.id), class: "btn btn-primary button-marginright" do %>
2323
<i class="fas fa-plus"> Add a movie</i>
2424
<% end %>
25-
2625
<%= link_to edit_list_path(@list), class: "btn btn-light button-marginright" do %>
2726
<i class="fas fa-edit"> Edit</i>
2827
<% end %>
@@ -31,7 +30,6 @@
3130
<i class="fas fa-undo-alt"> Back to list</i>
3231
<% end %>
3332
</div>
34-
3533
<ul class="p-0 movie-grid">
3634
<% @list.movies.each do |movie| %>
3735
<li class="movie-card" data-aos="fade-down" data-aos-easing="ease-in-sine">
@@ -46,12 +44,12 @@
4644
<div class="movie-footer">
4745
<p><i class="fas fa-quote-left"></i> <%= bookmark.comment %></p>
4846
<% if user_signed_in? && (@list.user == current_user) %>
49-
<%= link_to list_bookmark_path(@list, bookmark),
47+
<%= link_to list_bookmark_path(@list, bookmark),
5048
method: :delete,
5149
data: { confirm: "Are you sure you want to delete this bookmark ?" },
5250
class: "" do %>
53-
<i class="far fa-trash-alt"> Delete</i>
54-
<% end %>
51+
<i class="far fa-trash-alt"> Delete</i>
52+
<% end %>
5553
<% end %>
5654
</div>
5755
</li>
@@ -63,7 +61,6 @@
6361
-->
6462
</ul>
6563
</div>
66-
6764
<script>
6865
AOS.init();
6966
</script>

config/environments/development.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
config.cache_store = :memory_store
3030

3131
# Store uploaded files on the local file system (see config/storage.yml for options).
32-
config.active_storage.service = :local
32+
config.active_storage.service = :cloudinary
3333

3434
# Don't care if the mailer can't send.
3535
config.action_mailer.raise_delivery_errors = false

config/storage.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ local:
88

99
cloudinary:
1010
service: Cloudinary
11-
folder: <%= Rails.env %>
12-
11+
folder: <%= Rails.env %>/watchlist
1312
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
1413
# amazon:
1514
# service: S3
@@ -25,7 +24,6 @@ cloudinary:
2524
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
2625
# bucket: your_own_bucket
2726

28-
2927
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
3028
# microsoft:
3129
# service: AzureStorage

0 commit comments

Comments
 (0)