Skip to content

Commit

Permalink
Minor markup tweaks and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
crxssed7 committed Dec 31, 2024
1 parent d52f990 commit b108dd6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 28 deletions.
24 changes: 12 additions & 12 deletions app/views/issues/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@
<%= render Actions::ActionsComponent.new(resource: @issue, user: current_user) %>
</div>

<%= render SectionComponent.new do %>
<p class="font-bold">Other issues:</p>
<div class="flex gap-4 max-w-full overflow-auto my-4 pb-2">
<% @comic.ordered_issues.each do |issue| %>
<% classes = (@issue == issue) ? "font-bold" : "font-light" %>
<a href="<%= comic_issue_path(issue, comic_id: @comic.id) %>" class="<%= classes %>">
#<%= issue.formatted_issue_number %>
</a>
<% end %>
</div>
<% end %>

<%= render SectionComponent.new do %>
<%= render BorderComponent.new do %>
<% if @issue.deck.present? %>
Expand All @@ -55,15 +67,3 @@
</div>
<% end %>
<% end %>

<%= render SectionComponent.new do %>
<p class="font-bold">Other issues:</p>
<div class="flex gap-4 max-w-full overflow-auto my-4 pb-2">
<% @comic.ordered_issues.each do |issue| %>
<% classes = (@issue == issue) ? "font-bold" : "font-light" %>
<a href="<%= comic_issue_path(issue, comic_id: @comic.id) %>" class="<%= classes %>">
#<%= issue.formatted_issue_number %>
</a>
<% end %>
</div>
<% end %>
4 changes: 2 additions & 2 deletions app/views/statistics/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<% if @year != Statistics::BaseCount::ALLTIME %>
<%= render SectionComponent.new do %>
<div class="flex justify-between">
<%= render LinkComponent.new(text: "< #{@year.to_i - 1}", href: user_statistic_path(@year.to_i - 1, user_id: @user)) %>
<%= render LinkComponent.new(text: "#{@year.to_i + 1} >", href: user_statistic_path(@year.to_i + 1, user_id: @user)) %>
<%= render LinkComponent.new(text: "« #{@year.to_i - 1}", href: user_statistic_path(@year.to_i - 1, user_id: @user)) %>
<%= render LinkComponent.new(text: "#{@year.to_i + 1} »", href: user_statistic_path(@year.to_i + 1, user_id: @user)) %>
</div>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

# Log to STDOUT with the current request id as a default log tag.
config.log_tags = [:request_id]
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
config.logger = ActiveSupport::TaggedLogging.logger($stdout)

# Change to "debug" to log everything (including potentially personally-identifiable information!)
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def up
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string

if configured_service = ActiveStorage::Blob.service.name
if (configured_service = ActiveStorage::Blob.service.name)
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ def change
t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type
t.string :variation_digest, null: false

t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.index %i[blob_id variation_digest], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end

private
def primary_key_type
config = Rails.configuration.generators
config.options[config.orm][:primary_key_type] || :primary_key
end

def blobs_primary_key_type
pkey_name = connection.primary_key(:active_storage_blobs)
pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
pkey_column.bigint? ? :bigint : pkey_column.type
end
def primary_key_type
config = Rails.configuration.generators
config.options[config.orm][:primary_key_type] || :primary_key
end

def blobs_primary_key_type
pkey_name = connection.primary_key(:active_storage_blobs)
pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
pkey_column.bigint? ? :bigint : pkey_column.type
end
end
4 changes: 2 additions & 2 deletions spec/requests/statistics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@

it "renders links to the next and previous year" do
get path
assert_select "a.cursor-pointer", text: "< 2022"
assert_select "a.cursor-pointer", text: "2024 >"
assert_select "a.cursor-pointer", text: "« 2022"
assert_select "a.cursor-pointer", text: "2024 »"
end

it_behaves_like "a statistics page"
Expand Down

0 comments on commit b108dd6

Please sign in to comment.