From 137b57956b7a2a24d2a00041e55c809e468e6c07 Mon Sep 17 00:00:00 2001 From: syedbarimanjan Date: Wed, 1 May 2024 01:27:25 +0500 Subject: [PATCH 1/7] initial commit --- app/views/articles/index.html.erb | 136 +++++++++++++++++++++++++++++- 1 file changed, 135 insertions(+), 1 deletion(-) diff --git a/app/views/articles/index.html.erb b/app/views/articles/index.html.erb index 60b63457..40780952 100644 --- a/app/views/articles/index.html.erb +++ b/app/views/articles/index.html.erb @@ -1,4 +1,4 @@ -
+

Maybe Articles

@@ -6,4 +6,138 @@

Thoughts and insights around personal finance.

+
+ + + + + + +
+
+
+ Join the Maybe <%= image_tag("icon-maybe-color.svg", alt: "Maybe Logo", class: "inline") %> waitlist +
+
+

Join the waitlist to get notified when a hosted version of the app is available.

+ <%= render_signup_form %> +
+
+
+ <%= image_tag "screenshot.png", alt: "Maybe Screenshot", class: "w-full border border-black/1 rounded-2xl shadow-[0_7.36px_7.36px_-3.68px_rgba(11,11,11,0.03)] shadow-[0_18.39px_22.07px_-3.68px_rgba(11,11,11,0.08)]" %> +
From 90ed54bbb085739e06bccc46e58f0bd542b5bbf3 Mon Sep 17 00:00:00 2001 From: syedbarimanjan Date: Wed, 1 May 2024 03:08:14 +0500 Subject: [PATCH 2/7] show view --- app/assets/images/joshpigford.png | Bin 0 -> 3489 bytes app/views/articles/index.html.erb | 2 +- app/views/articles/show.html.erb | 134 +++++++++++++++++++++++++++++- 3 files changed, 132 insertions(+), 4 deletions(-) create mode 100644 app/assets/images/joshpigford.png diff --git a/app/assets/images/joshpigford.png b/app/assets/images/joshpigford.png new file mode 100644 index 0000000000000000000000000000000000000000..0b8a4696be47aef55b1861ed8f3106df6b7921fd GIT binary patch literal 3489 zcmV;S4PNqzP)XcR%<*s&Q%u_%iom*Sn=`+aBUlJCsyQcFpRWglXAX3xx=^Ue4B zewQ;6zGgc-JY0}v`2vqi{CUCiyrd*aNpX$m6`tpLns;6IH$0ZI+3XU&Mw7nE&Fkyy zNwzBlu*jbR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2fQ4=rA}}N=;aM1vt4eZd>h}-@N=ZbAu-1 z541CvUR>;sx<9rejeMoPhX*YOpLCMgOP#{~%`&zQ8}v{X2i*>{h{ta+bPhVnxG8bJ zVqzx30BtpJ&ag4t-a)Rti8;FnJ)g%zN3Gn^^mqQ~@~ew~2!o0*X|KNh-COr=-(J!b z>srd)_~9l4b*gzD$)ZzXC<7XW}zdEX?HpXgOa=?rz?U!@BY2jdv<|&i0i64!58E$G
- Rounded avatar + <%= image_tag("joshpigford.png", class: "w-10 h-10 rounded-full") %>

Josh Pigford

diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index 0ea2f73f..c1598f07 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -1,4 +1,132 @@ -
-

Articles#show

-

Find me in app/views/articles/show.html.erb

+
+ +
+
+
+
+
+ +

+

1 min read

+
+

How to make equity investing part of your investment strategy

+
+
+ <%= image_tag("joshpigford.png", class: "w-10 h-10 rounded-full") %> +

Author

+

Josh Pigford

+
+

+ Lorem ipsum dolor sit amet consectetur. Ultricies odio maecenas pretium aliquam. Mi ut semper nisi lacus sodales quisque id nibh ullamcorper. Donec eros at id id. Pretium ac amet et habitant nascetur. Ipsum dignissim pulvinar in fermentum adipiscing. Nec sit volutpat porttitor quam faucibus sed facilisis feugiat ultrices. Pharetra euismod velit urna nec quis. Sollicitudin egestas hendrerit ac convallis. Sit dui amet fermentum ipsum leo ultrices. Parturient venenatis pharetra nibh venenatis commodo. Orci amet luctus tristique enim mus at. Nulla sapien sapien cursus lectus egestas id purus. Feugiat eu vel suspendisse placerat convallis. Porta turpis lectus quis morbi. + Interdum orci ornare phasellus viverra diam tristique. Donec massa amet non morbi donec. Enim amet pellentesque tristique lorem tincidunt. Integer consequat tempor donec aenean velit fringilla. Tellus ac pellentesque commodo penatibus suspendisse sed. Sed tincidunt vitae eget commodo ultrices imperdiet enim. Eu in venenatis sapien ornare enim neque ac facilisi. Enim erat vitae ultrices pulvinar quis. Porttitor semper erat at cursus purus sapien orci eros. Lacus quis rhoncus libero cras volutpat ultrices ultrices. Amet fusce adipiscing dui fringilla mauris ac ullamcorper faucibus. At neque elit justo sagittis ut libero commodo ut. + Phasellus amet porta quis mi. Erat eu non condimentum leo velit. Nec vel pretium commodo commodo dolor rhoncus. Morbi semper vel pellentesque tincidunt donec dignissim nulla. Sed nisl faucibus est eget est et facilisis. + Duis ultrices tempus potenti consequat metus fringilla. Sed ipsum sed libero enim turpis dolor. Elementum lectus vitae eget risus mauris cras at. Consectetur eget erat tristique auctor. Rhoncus lectus placerat phasellus id pellentesque quam. + In egestas quisque donec facilisis in in. Natoque lorem egestas feugiat consequat nulla volutpat pellentesque justo sagittis. Nulla sit diam quis aliquam dignissim. Nullam senectus interdum amet tincidunt congue et nunc et felis. Mauris cum at natoque consectetur. Arcu nibh ac sed tellus nisi. Id habitant leo aliquam sagittis arcu sagittis tellus duis lacus. Ut leo id eu tellus amet nam lectus. +

+
+
+

SHARE

+
+ + + +
+
+
+
+ + + +
+
+
+ Join the Maybe <%= image_tag("icon-maybe-color.svg", alt: "Maybe Logo", class: "inline") %> waitlist +
+
+

Join the waitlist to get notified when a hosted version of the app is available.

+ <%= render_signup_form %> +
+
+
+ <%= image_tag "screenshot.png", alt: "Maybe Screenshot", class: "w-full border border-black/1 rounded-2xl shadow-[0_7.36px_7.36px_-3.68px_rgba(11,11,11,0.03)] shadow-[0_18.39px_22.07px_-3.68px_rgba(11,11,11,0.08)]" %> +
From e4fbea49e1265d4ad3f1c55edd991d39f955896b Mon Sep 17 00:00:00 2001 From: syedbarimanjan Date: Wed, 1 May 2024 03:14:31 +0500 Subject: [PATCH 3/7] changes --- app/views/articles/show.html.erb | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index c1598f07..c51b1d7e 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -28,37 +28,30 @@ In egestas quisque donec facilisis in in. Natoque lorem egestas feugiat consequat nulla volutpat pellentesque justo sagittis. Nulla sit diam quis aliquam dignissim. Nullam senectus interdum amet tincidunt congue et nunc et felis. Mauris cum at natoque consectetur. Arcu nibh ac sed tellus nisi. Id habitant leo aliquam sagittis arcu sagittis tellus duis lacus. Ut leo id eu tellus amet nam lectus.

-
-

SHARE

+
+

SHARE

- - -
-
From 3f0d9dbdc8c7751a5cdaf5161ce7f6c3d057075f Mon Sep 17 00:00:00 2001 From: syedbarimanjan Date: Wed, 1 May 2024 13:09:11 +0500 Subject: [PATCH 4/7] refactor --- app/assets/images/defaultavatar.jpg | Bin 0 -> 1590 bytes app/controllers/articles_controller.rb | 6 ++ app/helpers/articles_helper.rb | 29 +++++ app/views/articles/_article_card.html.erb | 26 +++++ app/views/articles/index.html.erb | 123 +--------------------- app/views/articles/show.html.erb | 42 ++++---- 6 files changed, 84 insertions(+), 142 deletions(-) create mode 100644 app/assets/images/defaultavatar.jpg create mode 100644 app/views/articles/_article_card.html.erb diff --git a/app/assets/images/defaultavatar.jpg b/app/assets/images/defaultavatar.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8cecc3021324a8c5674d897e8d3cd18326e3a8f2 GIT binary patch literal 1590 zcmb7Edo;0bR`ObO2=R5Bs8WBwbJj9v=-vz+I@Wt-HUg*KNl(bC| z5E}@z11QKYQ#^pf;Bc{RXfY&WlYvY@h!Mn*Kt<090FNz!U#<^qMg*j0R9 z+kt6(Ch%mYRgC}5a%pmDMxkHBIecfxeAoT!aPwJH^1Fn9;tIV<*4Z!2i@PQEu4ZBIg zuz{9t_Lt^NMF;NoE$z#5dFvUmPY_r_ZyvIIF;c%gjN7+{+Pc1$1mm$dwQhC~u0lw?xcK4hTFB>IWZR0INy4ZV*Dp6qRY=V*;n|`} z&T_o*${ADcZ{jldSf$u>*5p(7&*Q>hbsn-bc00s++Fd_49HGC#xn$7b%Im1E$_v;C zci9~;8x1l|@p0h8?_Py&$6bx?fniaTzipfQi$1STb zw?t#x3kTBftHC_9kk@iUAB^nf!^#H_I_cXnGAP`L{_g2z{39KcJ_el;MQyGtB2@Z3 z3h{K#X{n7xIWq-;?~Qp$Gk3iG8D+QU_tp#JLx}6=*bB=u^h$pN3-mAANT*@CReEQr|qqY4^>h$R~ZSOnF za#pU6hJoBa6C-|%OCI^5Zd3XG+b0xY9sTD(#?zOlxTigUg_S&0>0T1C + \ No newline at end of file diff --git a/app/views/articles/index.html.erb b/app/views/articles/index.html.erb index 95bde29e..eaec497b 100644 --- a/app/views/articles/index.html.erb +++ b/app/views/articles/index.html.erb @@ -7,126 +7,9 @@

Thoughts and insights around personal finance.

- - - - - - + <% @articles.each do |article| %> + <%= render partial: "articles/article_card", locals: { article: article } %> + <% end %>
diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index c51b1d7e..01aecebb 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -1,32 +1,30 @@
- + <% end %>
-
+
- +

-

1 min read

+

<%= calculate_read_time(@article.content) %>

-

How to make equity investing part of your investment strategy

+

<%= @article.title %>

- <%= image_tag("joshpigford.png", class: "w-10 h-10 rounded-full") %> + <% if @article.author_name.present? %> + <%= image_tag("joshpigford.png", class: "w-10 h-10 rounded-full") %> + <% else %> + <%= image_tag("defaultavatar.jpg", class: "w-10 h-10 rounded-full") %> + <% end %>

Author

-

Josh Pigford

+

<%= @article.author_name %>

-

- Lorem ipsum dolor sit amet consectetur. Ultricies odio maecenas pretium aliquam. Mi ut semper nisi lacus sodales quisque id nibh ullamcorper. Donec eros at id id. Pretium ac amet et habitant nascetur. Ipsum dignissim pulvinar in fermentum adipiscing. Nec sit volutpat porttitor quam faucibus sed facilisis feugiat ultrices. Pharetra euismod velit urna nec quis. Sollicitudin egestas hendrerit ac convallis. Sit dui amet fermentum ipsum leo ultrices. Parturient venenatis pharetra nibh venenatis commodo. Orci amet luctus tristique enim mus at. Nulla sapien sapien cursus lectus egestas id purus. Feugiat eu vel suspendisse placerat convallis. Porta turpis lectus quis morbi. - Interdum orci ornare phasellus viverra diam tristique. Donec massa amet non morbi donec. Enim amet pellentesque tristique lorem tincidunt. Integer consequat tempor donec aenean velit fringilla. Tellus ac pellentesque commodo penatibus suspendisse sed. Sed tincidunt vitae eget commodo ultrices imperdiet enim. Eu in venenatis sapien ornare enim neque ac facilisi. Enim erat vitae ultrices pulvinar quis. Porttitor semper erat at cursus purus sapien orci eros. Lacus quis rhoncus libero cras volutpat ultrices ultrices. Amet fusce adipiscing dui fringilla mauris ac ullamcorper faucibus. At neque elit justo sagittis ut libero commodo ut. - Phasellus amet porta quis mi. Erat eu non condimentum leo velit. Nec vel pretium commodo commodo dolor rhoncus. Morbi semper vel pellentesque tincidunt donec dignissim nulla. Sed nisl faucibus est eget est et facilisis. - Duis ultrices tempus potenti consequat metus fringilla. Sed ipsum sed libero enim turpis dolor. Elementum lectus vitae eget risus mauris cras at. Consectetur eget erat tristique auctor. Rhoncus lectus placerat phasellus id pellentesque quam. - In egestas quisque donec facilisis in in. Natoque lorem egestas feugiat consequat nulla volutpat pellentesque justo sagittis. Nulla sit diam quis aliquam dignissim. Nullam senectus interdum amet tincidunt congue et nunc et felis. Mauris cum at natoque consectetur. Arcu nibh ac sed tellus nisi. Id habitant leo aliquam sagittis arcu sagittis tellus duis lacus. Ut leo id eu tellus amet nam lectus. -

+

<%= @article.content %>

SHARE

@@ -50,7 +48,7 @@
-
+
@@ -68,8 +66,8 @@

Josh Pigford

-
-
+
+
@@ -88,8 +86,8 @@

Josh Pigford

-
-
+
+
@@ -108,7 +106,7 @@

Josh Pigford

- +
From c6ea2172dcccc1277f994ea5328224e79670ebb8 Mon Sep 17 00:00:00 2001 From: syedbarimanjan Date: Wed, 1 May 2024 18:27:37 +0500 Subject: [PATCH 5/7] refactor --- Gemfile | 1 + Gemfile.lock | 8 + .../{joshpigford.png => josh_pigford.png} | Bin app/controllers/articles_controller.rb | 1 + app/helpers/articles_helper.rb | 40 ++--- app/views/articles/_article_card.html.erb | 20 +-- app/views/articles/_author_avatar.html.erb | 6 + .../articles/_waitlist_cta_form.html.erb | 12 ++ app/views/articles/show.html.erb | 141 ++++-------------- 9 files changed, 87 insertions(+), 142 deletions(-) rename app/assets/images/{joshpigford.png => josh_pigford.png} (100%) create mode 100644 app/views/articles/_author_avatar.html.erb create mode 100644 app/views/articles/_waitlist_cta_form.html.erb diff --git a/Gemfile b/Gemfile index 49bad87e..63b363dd 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,7 @@ gem "bootsnap", require: false gem "importmap-rails" gem "propshaft" gem "tailwindcss-rails" +gem "lucide-rails", github: "maybe-finance/lucide-rails" # Hotwire gem "stimulus-rails" diff --git a/Gemfile.lock b/Gemfile.lock index bb74467c..6bb771f0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,6 +6,13 @@ GIT pagy (>= 3.5) rails (>= 6.0.3) +GIT + remote: https://github.com/maybe-finance/lucide-rails.git + revision: 6170b3a0eceb43a8af6552638e9526673c356d0d + specs: + lucide-rails (0.2.0) + railties (>= 4.1.0) + GIT remote: https://github.com/rails/rails.git revision: cc7f0b0d4cabc4807a271a6dfa22150943c80412 @@ -370,6 +377,7 @@ DEPENDENCIES hotwire-livereload importmap-rails jbuilder + lucide-rails! madmin! pg (~> 1.5) propshaft diff --git a/app/assets/images/joshpigford.png b/app/assets/images/josh_pigford.png similarity index 100% rename from app/assets/images/joshpigford.png rename to app/assets/images/josh_pigford.png diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index 5a191eff..c4ce7a84 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -5,6 +5,7 @@ def index def show @article = Article.where(slug: params[:id]).first + @next_articles = Article.where("id > ?", @article.id).limit(3) if @article.nil? redirect_to '/404' diff --git a/app/helpers/articles_helper.rb b/app/helpers/articles_helper.rb index 24b04982..9494133a 100644 --- a/app/helpers/articles_helper.rb +++ b/app/helpers/articles_helper.rb @@ -7,25 +7,25 @@ def calculate_read_time(content) "#{read_time_minutes}Min Read" end - def random_tailwind_gradient_class - tailwind_gradient_classes = [ - "from-pink-500 via-purple-500 to-indigo-500", - "from-yellow-400 via-red-500 to-pink-500", - "from-green-400 via-teal-500 to-blue-500", - "from-indigo-400 via-blue-500 to-cyan-500", - "from-red-400 via-pink-500 to-purple-500", - "from-purple-400 via-indigo-500 to-blue-500", - "from-green-400 via-lime-500 to-yellow-500", - "from-yellow-400 via-orange-500 to-red-500", - "from-blue-400 via-cyan-500 to-teal-500", - "from-orange-400 via-red-500 to-pink-500", - "from-teal-400 via-green-500 to-lime-500", - "from-fuchsia-400 via-purple-500 to-indigo-500", - "from-rose-400 via-red-500 to-yellow-500", - "from-cyan-400 via-teal-500 to-green-500", - "from-lime-400 via-yellow-500 to-orange-500" - ] - "bg-gradient-to-t #{tailwind_gradient_classes.sample} rounded-xl" - end + ARTICLE_GRADIENTS = [ + "from-rose-400 to-pink-500", + "from-pink-400 to-rose-500", + "from-fuchsia-400 to-pink-500", + "from-pink-400 to-fuchsia-500", + "from-purple-400 to-pink-500", + "from-pink-400 to-purple-500", + "from-violet-400 to-pink-500", + "from-pink-400 to-violet-500", + "from-indigo-400 to-pink-500", + "from-pink-400 to-indigo-500", + "from-blue-400 to-pink-500", + "from-pink-400 to-blue-500", + "from-sky-400 to-pink-500", + "from-pink-400 to-sky-500", + "from-cyan-400 to-pink-500", + ] + def article_random_gradient(article) + ARTICLE_GRADIENTS[article.slug.hash % ARTICLE_GRADIENTS.size] + end end diff --git a/app/views/articles/_article_card.html.erb b/app/views/articles/_article_card.html.erb index 63733a3d..931f5213 100644 --- a/app/views/articles/_article_card.html.erb +++ b/app/views/articles/_article_card.html.erb @@ -1,26 +1,20 @@ <%# locals: (article:) -%>
-
+
\ No newline at end of file diff --git a/app/views/articles/_author_avatar.html.erb b/app/views/articles/_author_avatar.html.erb new file mode 100644 index 00000000..cec45ca3 --- /dev/null +++ b/app/views/articles/_author_avatar.html.erb @@ -0,0 +1,6 @@ +<%# locals: (author:) -%> +<% if author.present? %> + <%= image_tag("#{author.downcase.gsub(' ', '_')}.png", class: "w-10 h-10 rounded-full") %> +<% else %> + <%= image_tag("defaultavatar.jpg", class: "w-10 h-10 rounded-full") %> +<% end %> \ No newline at end of file diff --git a/app/views/articles/_waitlist_cta_form.html.erb b/app/views/articles/_waitlist_cta_form.html.erb new file mode 100644 index 00000000..bafc9f29 --- /dev/null +++ b/app/views/articles/_waitlist_cta_form.html.erb @@ -0,0 +1,12 @@ +
+
+ Join the Maybe <%= image_tag("icon-maybe-color.svg", alt: "Maybe Logo", class: "inline") %> waitlist +
+
+

Join the waitlist to get notified when a hosted version of the app is available.

+ <%= render_signup_form %> +
+
+
+ <%= image_tag "screenshot.png", alt: "Maybe Screenshot", class: "w-full border border-black/1 rounded-2xl shadow-[0_7.36px_7.36px_-3.68px_rgba(11,11,11,0.03)] shadow-[0_18.39px_22.07px_-3.68px_rgba(11,11,11,0.08)]" %> +
\ No newline at end of file diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index 01aecebb..9d6bb525 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -5,119 +5,42 @@ <% end %>
-
-
-
-
- -

-

<%= calculate_read_time(@article.content) %>

-
-

<%= @article.title %>

-
-
- <% if @article.author_name.present? %> - <%= image_tag("joshpigford.png", class: "w-10 h-10 rounded-full") %> - <% else %> - <%= image_tag("defaultavatar.jpg", class: "w-10 h-10 rounded-full") %> - <% end %> -

Author

-

<%= @article.author_name %>

-
-

<%= @article.content %>

-
-
-

SHARE

- +
+
+
+
+ +

+

<%= calculate_read_time(@article.content) %>

+
+

<%= @article.title %>

-
-
-
-
-
- -
- <%= image_tag("joshpigford.png", class: "w-10 h-10 rounded-full") %> -

Josh Pigford

-
-
-
-
-
- -
- -
- Rounded avatar -

Josh Pigford

-
+
+ <%= render partial: "articles/author_avatar", locals: { author: @article.author_name } %> +

Author

+

<%= @article.author_name %>

+

<%= @article.content %>

-
-
- -
- -
- Rounded avatar -

Josh Pigford

-
+
+

SHARE

+
+ <%= link_to "#", class: "border border-gray-300 focus:ring-4 focus:outline-none focus:ring-gray-300 font-medium rounded-full text-sm p-2.5 text-center inline-flex items-center" do %> + <%= lucide_icon("link-2", class: "h-5 w-5 text-gray-700") %> + <% end %> + <%= link_to "#", class: "border border-gray-300 focus:ring-4 focus:outline-none focus:ring-gray-300 font-medium rounded-full text-sm p-2.5 text-center inline-flex items-center" do %> + <%= lucide_icon("twitter", class: "h-5 w-5 text-gray-700") %> + <% end %> + <%= link_to "#", class: "border border-gray-300 focus:ring-4 focus:outline-none focus:ring-gray-300 font-medium rounded-full text-sm p-2.5 text-center inline-flex items-center" do %> + <%= lucide_icon("linkedin", class: "h-5 w-5 text-gray-700") %> + <% end %>
+ +
+ <% @next_articles.each do |next_article| %> + <%= render "articles/article_card", article: next_article %> + <% end %>
-
-
- Join the Maybe <%= image_tag("icon-maybe-color.svg", alt: "Maybe Logo", class: "inline") %> waitlist -
-
-

Join the waitlist to get notified when a hosted version of the app is available.

- <%= render_signup_form %> -
-
-
- <%= image_tag "screenshot.png", alt: "Maybe Screenshot", class: "w-full border border-black/1 rounded-2xl shadow-[0_7.36px_7.36px_-3.68px_rgba(11,11,11,0.03)] shadow-[0_18.39px_22.07px_-3.68px_rgba(11,11,11,0.08)]" %> -
+ <%= render partial: "articles/waitlist_cta_form" %>
From 2ab79939ed6fcdf4ec3b145e8874a6f267df4f8b Mon Sep 17 00:00:00 2001 From: syedbarimanjan Date: Wed, 1 May 2024 19:08:22 +0500 Subject: [PATCH 6/7] refactor --- app/controllers/articles_controller.rb | 2 +- app/views/articles/_article_card.html.erb | 6 ++---- app/views/articles/index.html.erb | 6 +++--- app/views/articles/show.html.erb | 2 +- app/views/layouts/application.html.erb | 4 ++-- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index c4ce7a84..4dc9b2aa 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -5,7 +5,7 @@ def index def show @article = Article.where(slug: params[:id]).first - @next_articles = Article.where("id > ?", @article.id).limit(3) + @next_articles = Article.where.not(slug: @article.slug).limit(3) if @article.nil? redirect_to '/404' diff --git a/app/views/articles/_article_card.html.erb b/app/views/articles/_article_card.html.erb index 931f5213..2f3dab73 100644 --- a/app/views/articles/_article_card.html.erb +++ b/app/views/articles/_article_card.html.erb @@ -1,6 +1,5 @@ <%# locals: (article:) -%> - \ No newline at end of file +<% end %> \ No newline at end of file diff --git a/app/views/articles/index.html.erb b/app/views/articles/index.html.erb index eaec497b..85016eca 100644 --- a/app/views/articles/index.html.erb +++ b/app/views/articles/index.html.erb @@ -1,12 +1,12 @@
-

Maybe Articles

- <%= image_tag("icon-articles.svg", alt: "Articles", class: "inline") %> +

Maybe Blog

+ <%= image_tag("icon-articles.svg", alt: "Blog", class: "inline") %>

Thoughts and insights around personal finance.

-
+
<% @articles.each do |article| %> <%= render partial: "articles/article_card", locals: { article: article } %> <% end %> diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index 9d6bb525..c01750c6 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -37,7 +37,7 @@
-
+
<% @next_articles.each do |next_article| %> <%= render "articles/article_card", article: next_article %> <% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a54f53f5..12af5bbd 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -27,7 +27,7 @@ Early Access
@@ -53,7 +53,7 @@

General

  • - <%= link_to "Articles", articles_path %> + <%= link_to "Blog", articles_path %>
  • <%= link_to "Glossary", "#" %> From 1c3729c446eb5c7bd323031dad6a7400203fc441 Mon Sep 17 00:00:00 2001 From: syedbarimanjan Date: Wed, 1 May 2024 20:07:10 +0500 Subject: [PATCH 7/7] use lucide --- app/views/articles/_article_card.html.erb | 2 +- app/views/articles/show.html.erb | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/articles/_article_card.html.erb b/app/views/articles/_article_card.html.erb index 2f3dab73..9d505a17 100644 --- a/app/views/articles/_article_card.html.erb +++ b/app/views/articles/_article_card.html.erb @@ -1,6 +1,6 @@ <%# locals: (article:) -%> <%= link_to article_url(article.slug), class: "overflow-hidden rounded-xl shadow transition hover:shadow-lg p-1 bg-white border flex flex-col justify-between h-full gap-5" do %> -
    +
    diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index c01750c6..d4949773 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -1,8 +1,6 @@
    <%= link_to articles_path, class: "border border-gray-300 focus:ring-4 focus:outline-none focus:ring-gray-300 font-medium rounded-full text-sm p-2.5 text-center inline-flex items-center" do %> - - - + <%= lucide_icon("arrow-left", class: "h-5 w-5") %> <% end %>