Skip to content

Commit

Permalink
start adding turbo for sources
Browse files Browse the repository at this point in the history
  • Loading branch information
pessi-v committed Jul 2, 2024
1 parent 822416f commit 7943a05
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ gem 'ogpr'
# It is flexible, offers heuristic parsing, and additionally provides extensive support for IRIs and URI templates.
gem 'addressable'

# gem "ruby-readability"
gem "ruby-readability", :require => 'readability'

# gem 'nokogiri'

Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ GEM
google-protobuf (4.27.0-x86_64-linux)
bigdecimal
rake (>= 13)
guess_html_encoding (0.0.11)
http-accept (1.7.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
Expand Down Expand Up @@ -281,6 +282,9 @@ GEM
netrc (~> 0.8)
rexml (3.2.8)
strscan (>= 3.0.9)
ruby-readability (0.7.1)
guess_html_encoding (>= 0.0.4)
nokogiri (>= 1.6.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
rufus-scheduler (3.9.1)
Expand Down Expand Up @@ -397,6 +401,7 @@ DEPENDENCIES
puma (>= 5.0)
rails (~> 7.1.3, >= 7.1.3.3)
redis (>= 4.0.1)
ruby-readability
rufus-scheduler
selenium-webdriver
slim-rails
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@import "components/item-c";
@import "components/item-d";
@import "components/item-e";
@import "components/source";

// Layouts
@import "layouts/container";
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/components/_source.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.source_info {
border-top: var(--border);
border-bottom: var(--border);
}
3 changes: 2 additions & 1 deletion app/assets/stylesheets/config/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
--border-radius: 0.375rem;

// Border
--border: solid 2px var(--color-light);
// --border: solid 2px var(--color-light);
--border: 1px dashed var(--color-glint);

// Shadows
--shadow-large: 2px 4px 10px hsl(0 0% 0% / 0.1);
Expand Down
5 changes: 0 additions & 5 deletions app/assets/stylesheets/layouts/_page_grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
grid-row-end: 4;
}

.source_info {
grid-column: span 2;
grid-row: span 2;
}

.item-b {
// in it's own file
}
Expand Down
2 changes: 1 addition & 1 deletion app/views/sources/_source.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ css:
}


div id=dom_id(source)
.source_info id=dom_id(source)
p
strong
'Name:
Expand Down
15 changes: 8 additions & 7 deletions app/views/sources/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

= button_to('Reload all feeds', fetch_feeds_path)


= link_to "New source", new_source_path
= turbo_frame_tag 'first_turbo_frame' do # 1) this will intercept the link clicks
= link_to "New source", new_source_path, data: { turbo_frame: 'new_source' }

div id="article_counts"
table
Expand All @@ -22,9 +22,10 @@
p
= @article_counts_by_day[index]

div id="sources"
.list_view_desktop
- @sources.each do |source|
= link_to(source, class: 'source_info') do
= render source

.list_view_desktop
= turbo_frame_tag 'new_source'
- @sources.each do |source|
= link_to(source) do
= render source

3 changes: 2 additions & 1 deletion app/views/sources/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ h1

br

= render "form", source: @source
= turbo_frame_tag 'new_source'
= render "form", source: @source


4 changes: 0 additions & 4 deletions config/initializers/scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@
s.every '30m' do
Sources::FeedFetcher.new.consume_all
end

s.every '1m' do
puts 'keep alive'
end

0 comments on commit 7943a05

Please sign in to comment.