Skip to content

Commit

Permalink
lint: enable HardCodedString for views
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellberg committed Mar 29, 2024
1 parent f0b41e3 commit 90f2b3b
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 19 deletions.
11 changes: 7 additions & 4 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ linters:
enabled: true
PartialInstanceVariable:
enabled: true
# DeprecatedClasses:
# enabled: true
# HardCodedString:
# enabled: true
DeprecatedClasses:
enabled: true
HardCodedString:
enabled: true
exclude:
- "app/views/dashboard/show.html.erb"
- "app/views/public/landing_page.html.erb"
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
inherit_gem:
standard: config/base.yml
AllCops:
SuggestExtensions: false
17 changes: 13 additions & 4 deletions app/components/navbar/account_selector/component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@
<span class="flex flex-col text-left line-height gap-y-0.5 mr-2">
<strong class="font-bold text-primary"><%= Current.account.name %></strong>
<% if Current.account.personal? %>
<span class="text-xs flex items-center"><i class="fa fa-user text-light mr-1 w-3 h-3"></i> Personal account</span>
<span class="text-xs flex items-center">
<i class="fa fa-user text-light mr-1 w-3 h-3"></i>
<%= t('.personal_account') %>
</span>
<% else %>
<span class="text-xs flex items-center"><i class="fa fa-users text-light mr-1 w-4 h-4"></i> Team account</span>
<span class="text-xs flex items-center">
<i class="fa fa-users text-light mr-1 w-4 h-4"></i>
<%= t('.team_account') %>
</span>
<% end %>
</span>
<i class="fa ml-auto fa-caret-down"></i>
<%= render(Navbar::Separator::Component.new) %>
</span>
<% end %>

<span class="py-2 px-4 font-bold">Switch account <i class="fa w-3 h-3 fa-arrow-turn-down"></i></span>
<span class="py-2 px-4 font-bold">
<%= t('.switch_button') %>
<i class="fa w-3 h-3 fa-arrow-turn-down"></i>
</span>

<%= link_to dashboard_path(account_id: nil), class: "flex items-center justify-between px-4 py-2.5 hover:bg-background" do %>
<span><%= Current.user.personal_account.name %></span>
Expand All @@ -30,5 +39,5 @@
<% end %>
<% end %>

<%= link_to "Create a new team", "#", class: "block px-4 py-2.5 hover:bg-background" %>
<%= link_to t('.new_account_button'), "#", class: "block px-4 py-2.5 hover:bg-background" %>
<% end %>
5 changes: 5 additions & 0 deletions app/components/navbar/account_selector/component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
en:
personal_account: Personal account
team_account: Team account
switch_button: Switch account
new_account_button: Create a new team
2 changes: 1 addition & 1 deletion app/views/accounts/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% title "Edit your account profile" %>
<%= render(PageLayouts::Settings::Component.new) do %>
<%= render "form", account: %>
<%= render "form", account: @account %>
<% end %>
12 changes: 6 additions & 6 deletions app/views/partials/navigations/_settings.html.erb
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<div class="flex items-center justify-between bg-surface-hover py-3 px-4 text-sm font-bold border-y">
Account settings
<%= t(".account_settings") %>
<i class="fa fa-arrow-turn-down w-3 h-3"></i>
</div>

<%= render(PageLayouts::Settings::NavigationItem::Component.new(
label: "Profile settings",
description: "Edit your account profile.",
label: t('.items.account.label'),
description: t('.items.account.description'),
icon: "fa fa-user",
path: edit_account_path
)) %>

<div class="flex items-center justify-between bg-surface-hover py-3 px-4 text-sm font-bold border-y">
User settings
<%= t(".user_settings") %>
<i class="fa fa-arrow-turn-down w-3 h-3"></i>
</div>

<%= render(PageLayouts::Settings::NavigationItem::Component.new(
label: "Login credentials",
description: "Change user email or password.",
label: t('.items.user.label'),
description: t('.items.user.description'),
icon: "fa fa-lock",
path: edit_user_registration_path
)) %>
13 changes: 13 additions & 0 deletions config/locales/kiqr.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
en:
partials:
navigations:
settings:
account_settings: "Account settings"
user_settings: "Login & security"
items:
account:
label: "Profile settings"
description: "Edit your account profile"
user:
label: "Login credentials"
description: "Change user email or password."
4 changes: 0 additions & 4 deletions lib/generators/view_component/templates/component.rb.tt
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# frozen_string_literal: true

class <%= class_name %>::Component < <%= parent_class %>
# with_collection_parameter :<%= singular_name %>
<%- if initialize_signature -%>
<%= initialize_signature %>
<%- end -%>
end

0 comments on commit 90f2b3b

Please sign in to comment.