diff --git a/README.md b/README.md
index 4166a73..a87ca5c 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,7 @@
+# nindika is shutting down on 15/01/2023
+Thanks for all support. If you need help with nindika code, getting in touch in discussions.
+
+
# nindika
[![Releases](https://img.shields.io/github/v/release/stephannv/nindika)](https://github.com/stephannv/nindika/releases)
[![CI](https://github.com/stephannv/nindika/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/stephannv/nindika/actions/workflows/ci.yml?query=branch%3Amain++)
diff --git a/app/components/layout/user_menu_component.html.erb b/app/components/layout/user_menu_component.html.erb
index 5f11ffd..2332597 100644
--- a/app/components/layout/user_menu_component.html.erb
+++ b/app/components/layout/user_menu_component.html.erb
@@ -7,7 +7,7 @@
%>
-
+ <%= link_to wishlist_path(format: :csv) do %>
+
+ Exportar lista de desejo
+ <% end %>
+
<%= button_to destroy_user_session_path, class: "btn btn-block mt-2 gap-3", method: :delete, data: { turbo: false } do %>
<%= t(".logout") %>
diff --git a/app/controllers/wishlists_controller.rb b/app/controllers/wishlists_controller.rb
index 8f5180a..f0475e0 100644
--- a/app/controllers/wishlists_controller.rb
+++ b/app/controllers/wishlists_controller.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+require "csv"
class WishlistsController < ApplicationController
include HasGamesListPage
@@ -6,6 +7,16 @@ class WishlistsController < ApplicationController
before_action :authenticate_user!
def show
- render_games_list_page(title: t(".title"), filter_overrides: { wishlisted: true })
+ respond_to do |format|
+ format.html do
+ render_games_list_page(title: t(".title"), filter_overrides: { wishlisted: true })
+ end
+
+ format.csv do
+ @games = current_user.wishlist.order(:title)
+ response.headers["Content-Type"] = "text/csv"
+ response.headers["Content-Disposition"] = "attachment;filename=lista-desejo-nindika.csv"
+ end
+ end
end
end
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index a7e8fe6..b1fadf9 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -24,6 +24,12 @@
+
+ O nindika.com sairĂ¡ do ar em 15/01/2022. Obrigado pelo apoio!
+ <% if current_user.present? %>
+ Exporte sua lista de desejos <%= link_to "aqui", wishlist_path(format: :csv), class: "link", data: { turbo: false } %>.
+ <% end %>
+
<%= render Layout::FrameComponent.new(title: yield(:page_title)) do %>
<%= yield %>
<% end %>
diff --git a/app/views/wishlists/show.csv.erb b/app/views/wishlists/show.csv.erb
new file mode 100644
index 0000000..b015532
--- /dev/null
+++ b/app/views/wishlists/show.csv.erb
@@ -0,0 +1,4 @@
+<%= CSV.generate_line(["Jogo", "Site", "Data de lançamento"]).strip %>
+<% @games.each do |game| %>
+<%= CSV.generate_line([game.title.gsub(/[^0-9A-Za-z ]/, ' ').strip, game.website_url, game.release_date_display]).strip %>
+<% end %>