Skip to content

Commit

Permalink
Rubocop slim
Browse files Browse the repository at this point in the history
Mainly for the double-quoting.
  • Loading branch information
thibaudgg committed Dec 15, 2024
1 parent f81613f commit b68aede
Show file tree
Hide file tree
Showing 53 changed files with 446 additions and 431 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ Style/StringLiterals:

Style/FrozenStringLiteralComment:
Enabled: true

require:
- rubocop-slim
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ group :development do
gem "ruby-lsp-rspec", require: false

gem "rubocop-rails-omakase", require: false
gem "rubocop-slim", require: false

gem "cloudflare"
gem "resolv"
Expand Down
11 changes: 11 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,11 @@ GEM
rubocop-minitest
rubocop-performance
rubocop-rails
rubocop-rspec (3.3.0)
rubocop (~> 1.61)
rubocop-slim (0.2.8)
rubocop (~> 1.45)
slimi (~> 0.7)
ruby-lsp (0.22.1)
language_server-protocol (~> 3.17.0)
prism (>= 1.2, < 2.0)
Expand All @@ -585,6 +590,10 @@ GEM
slim (5.2.1)
temple (~> 0.10.0)
tilt (>= 2.1.0)
slimi (0.7.5)
temple
thor
tilt
solid_queue (1.1.0)
activejob (>= 7.1)
activerecord (>= 7.1)
Expand Down Expand Up @@ -716,6 +725,8 @@ DEPENDENCIES
rqrcode
rspec-rails
rubocop-rails-omakase
rubocop-rspec
rubocop-slim
ruby-lsp-rails
ruby-lsp-rspec
rubyXL
Expand Down
6 changes: 3 additions & 3 deletions app/views/active_admin/_site_footer.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ footer class="pt-40"
ul class="flex justify-center" role="group"
li = link_to updates_path, class: "inline-flex items-center px-2 py-1 no-underline text-sm font-medium text-gray-400 dark:text-gray-600 bg-white border border-gray-200 rounded-s-lg hover:bg-gray-100 hover:text-green-600 focus:z-10 focus:ring-2 focus:ring-green-700 focus:text-green-700 dark:bg-transparent dark:border-gray-800 dark:hover:text-green-500 dark:hover:bg-gray-700 dark:focus:ring-green-500 dark:focus:text-white" do
= icon "gift", class: "w-5 h-5 me-2"
= t('.updates')
= t(".updates")

li = link_to handbook_path, class: "inline-flex items-center px-2 py-1 no-underline text-sm font-medium text-gray-400 dark:text-gray-600 bg-white border border-l-0 border-gray-200 rounded-e-lg hover:bg-gray-100 hover:text-green-600 focus:z-10 focus:ring-2 focus:ring-green-700 focus:text-green-700 dark:bg-transparent dark:border-gray-800 dark:hover:text-green-500 dark:hover:bg-gray-700 dark:focus:ring-green-500 dark:focus:text-white" do
= icon "book-open", class: "w-5 h-5 me-2"
= t('.handbook')
= t(".handbook")

div class="flex justify-center py-8 mt-4"
= link_to csa_admin_website_url, class: "inline-flex items-center text-sm py-1 px-2 text-gray-300 dark:text-gray-700 hover:text-green-600 hover:text-green-600 dark:hover:text-green-500 hover:bg-gray-100 dark:hover:bg-gray-700 font-medium focus:outline-none rounded-md no-underline" do
= icon "logo", class: "w-4 h-4 me-2 fill-current", library: "own"
= 'CSA Admin'
= "CSA Admin"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
- deliveries = BasketContent.filled_deliveries
= form_with url: duplicate_all_basket_contents_path, method: :post, class: 'sidebar_form' do |f|
= form_with url: duplicate_all_basket_contents_path, method: :post, class: "sidebar_form" do |f|
= f.hidden_field :to_delivery_id, value: to_delivery.id
p = t('.text')
p = t(".text")
div class="mt-3"
= f.select :from_delivery_id, deliveries.map { |d| [I18n.l(d.date, format: :medium), d.id] }, {}, { class: "h-7 text-sm py-0 px-2" }
= f.select :from_delivery_id, deliveries.map { |d| [ I18n.l(d.date, format: :medium), d.id ] }, {}, { class: "h-7 text-sm py-0 px-2" }
div class="flex justify-end mt-2"
= f.submit t('.button'), class: "action-item-button secondary small"
= f.submit t(".button"), class: "action-item-button secondary small"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
- deliveries = BasketContent.coming_unfilled_deliveries(after_date: from_delivery.date)
= form_with url: duplicate_all_basket_contents_path, method: :post, class: 'sidebar_form' do |f|
= form_with url: duplicate_all_basket_contents_path, method: :post, class: "sidebar_form" do |f|
= f.hidden_field :from_delivery_id, value: from_delivery.id
p = t('.text', from: I18n.l(from_delivery.date, format: :long))
p = t(".text", from: I18n.l(from_delivery.date, format: :long))
div class="mt-3"
= f.select :to_delivery_id, deliveries.map { |d| [I18n.l(d.date, format: :medium), d.id] }, {}, { class: "h-7 text-sm py-0 px-2" }
= f.select :to_delivery_id, deliveries.map { |d| [ I18n.l(d.date, format: :medium), d.id ] }, {}, { class: "h-7 text-sm py-0 px-2" }
div class="flex justify-end mt-2"
= f.submit t('.button'), class: "action-item-button secondary small"
= f.submit t(".button"), class: "action-item-button secondary small"
14 changes: 7 additions & 7 deletions app/views/active_admin/payments/_import.html.slim
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
= form_tag import_payments_path, multipart: true, class: 'sidebar_form' do
= form_tag import_payments_path, multipart: true, class: "sidebar_form" do
- case Current.org.country_code
- when 'DE'
= label_tag :file, t('.file_label_de')
= file_field_tag :file, accept: 'text/xml, .mta', required: true, class: "mt-1"
- when "DE"
= label_tag :file, t(".file_label_de")
= file_field_tag :file, accept: "text/xml, .mta", required: true, class: "mt-1"
- else
= label_tag :file, t('.file_label')
= file_field_tag :file, accept: 'text/xml', required: true, class: "mt-1"
= label_tag :file, t(".file_label")
= file_field_tag :file, accept: "text/xml", required: true, class: "mt-1"
div class="flex justify-end mt-1 py-1"
= submit_tag t('.submit'), class: 'action-item-button secondary small'
= submit_tag t(".submit"), class: "action-item-button secondary small"
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
- if destroy_action_authorized?(resource) && !resource.class.in?([ Member, Membership ])
= link_to resource_path(resource), method: :delete, data: { confirm: delete_confirmation_text }, title: delete_label do
= icon 'trash', class: 'w-5 h-5'
= icon "trash", class: "w-5 h-5"

- if edit_action_authorized?(resource)
= link_to edit_resource_path(resource), title: edit_label do
= icon 'pencil-square', class: 'w-5 h-5'
= icon "pencil-square", class: "w-5 h-5"

- if show_action_authorized?(resource)
= link_to resource_path(resource), title: view_label do
= icon 'eye', class: 'w-5 h-5'
= icon "eye", class: "w-5 h-5"
6 changes: 3 additions & 3 deletions app/views/layouts/active_admin_logged_out.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ html lang=I18n.locale
body class="h-screen flex flex-col dark:bg-black text-gray-950 dark:text-gray-100 antialiased"
div class="flex-grow flex flex-col items-center align-middle justify-center md:w-2/5 mx-auto px-2"
div class="mt-12 md:mt-24 mb-12 w-auto"
= image_tag(org_logo_url, size: '500', alt: "#{Current.org.name} Logo", class: "logo h-40 w-40 md:h-52 md:w-52")
= image_tag(org_logo_url, size: "500", alt: "#{Current.org.name} Logo", class: "logo h-40 w-40 md:h-52 md:w-52")
= render "active_admin/flash_messages"
div class="w-full px-2 md:px-5"
= yield
Expand All @@ -18,9 +18,9 @@ html lang=I18n.locale
ul class="flex flex-row w-full items-center justify-center"
- Current.org.languages.each do |locale|
li class="[&:not(:first-child)]:before:content-['/'] uppercase text-gray-300 dark:text-gray-700"
= link_to locale, url_for(locale: locale), title: t("languages.#{locale}"), onclick: 'Turbolinks.clearCache()', class: 'px-2 text-gray-400 dark:text-gray-600'
= link_to locale, url_for(locale: locale), title: t("languages.#{locale}"), onclick: "Turbolinks.clearCache()", class: "px-2 text-gray-400 dark:text-gray-600"

div class="pt-8 flex justify-center gap-2"
= link_to csa_admin_website_url, class: "inline-flex items-center text-sm py-1 px-2 text-gray-300 dark:text-gray-700 hover:text-green-600 hover:text-green-600 dark:hover:text-green-500 hover:bg-gray-100 dark:hover:bg-gray-700 font-medium focus:outline-none rounded-md no-underline" do
= icon "logo", class: "w-4 h-4 me-2 fill-current", library: "own"
= 'CSA Admin'
= "CSA Admin"
20 changes: 10 additions & 10 deletions app/views/layouts/members.html.slim
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
doctype html
html lang=I18n.locale
head
title = [Current.org.name, t('.title')].join('')
title = [ Current.org.name, t(".title") ].join("")
script async=true src="https://ga.jspm.io/npm:[email protected]/dist/es-module-shims.js" data-turbo-track="reload"
= javascript_importmap_tags 'members'
= stylesheet_link_tag 'https://npmcdn.com/flatpickr/dist/themes/confetti.css'
= stylesheet_link_tag "tailwind", "inter-font", data: { turbo_track: 'reload' }
= javascript_importmap_tags "members"
= stylesheet_link_tag "https://npmcdn.com/flatpickr/dist/themes/confetti.css"
= stylesheet_link_tag "tailwind", "inter-font", data: { turbo_track: "reload" }
= csrf_meta_tags
meta charset="UTF-8"
meta name="viewport" content="width=device-width, initial-scale=1.0"
Expand All @@ -16,13 +16,13 @@ html lang=I18n.locale
div class="flex flex-col md:flex-row md:mx-auto md:max-w-4xl"
div class="flex flex-col md:w-80"
div
= render 'layouts/members/header'
= render "layouts/members/header"
div class="md:mx-8 hidden md:block flex" data-menu-target='menu'
= render 'layouts/members/footer'
= render "layouts/members/footer"
main class="mt-4 md:mt-48 mb-24 mx-auto px-4 md:pl-0 w-full md:max-w-xl" data-menu-target='body'
section class="relative w-full"
div class='md:absolute md:-mt-24 w-full md:pr-4'
= render 'layouts/members/flashes'
= render "layouts/members/flashes"
div class=''
= yield

Expand All @@ -33,10 +33,10 @@ html lang=I18n.locale
header class='flex'
div class='mx-auto my-8 md:my-16 print:!my-6'
= link_to Current.org.url do
= image_tag(org_logo_url, alt: "#{Current.org.name} Logo", class: 'h-32 w-32 md:h-60 md:w-60 print:!h-16 print:!w-16')
= image_tag(org_logo_url, alt: "#{Current.org.name} Logo", class: "h-32 w-32 md:h-60 md:w-60 print:!h-16 print:!w-16")
main class="w-full" data-menu-target='body'
section class="w-full"
= render 'layouts/members/flashes'
= render "layouts/members/flashes"
= yield
div class='mt-48 flex-none flex print:hidden'
= render 'layouts/members/footer'
= render "layouts/members/footer"
8 changes: 4 additions & 4 deletions app/views/layouts/members/_flashes.html.slim
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
- flash.each do |type, msg|
- case type
- when 'alert'
- when "alert"
div class="flash mb-8 bg-red-100 dark:bg-red-900 border border-red-400 dark:border-red-600 text-red-700 dark:text-red-300 p-2 rounded flex items-center"
= icon "exclamation-triangle", class: 'w-5 h-5'
= icon "exclamation-triangle", class: "w-5 h-5"
span class='ml-2'
= msg
- when 'notice'
- when "notice"
div class="flash mb-8 bg-green-100 dark:bg-green-900 border border-green-400 dark:border-green-600 text-green-700 dark:text-green-300 p-2 rounded flex items-center"
= icon "information-circle", class: 'w-5 h-5'
= icon "information-circle", class: "w-5 h-5"
span class='ml-2'
= msg
36 changes: 18 additions & 18 deletions app/views/layouts/members/_footer.html.slim
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
footer class="w-full flex flex-col text-base text-gray-400 mt-16 dark:text-gray-600"
div class="mx-auto #{'md:mx-0' if current_member}"
ul class="flex flex-row flex-wrap #{'flex-col' if current_member} "
div class="mx-auto #{"md:mx-0" if current_member}"
ul class="flex flex-row flex-wrap #{"flex-col" if current_member} "
- if current_member && Current.org.member_information_text?
li class="mx-auto px-4 md:mx-0 md:px-0"
= link_to members_info_path, class: 'flex items-center hover:text-green-500 py-1 px-4 md:px-0' do
= icon 'newspaper', class: 'h-6 w-6'
= link_to members_info_path, class: "flex items-center hover:text-green-500 py-1 px-4 md:px-0" do
= icon "newspaper", class: "h-6 w-6"
span class='ml-2' = member_information_title
- if current_member
li class="mx-auto px-4 md:mx-0 md:px-0 mb-4"
= link_to calendar_webcal_url, class: 'flex items-center hover:text-green-500 py-1 px-4 md:px-0', title: t(".calendar_feed") do
= icon 'calendar-days', class: 'h-6 w-6'
span class='ml-2' = t('.calendar')
= link_to calendar_webcal_url, class: "flex items-center hover:text-green-500 py-1 px-4 md:px-0", title: t(".calendar_feed") do
= icon "calendar-days", class: "h-6 w-6"
span class='ml-2' = t(".calendar")
- if Current.org.phone?
li class="mx-auto px-4 #{'md:mx-0 md:px-0' if current_member}"
= link_to "tel:#{Current.org.phone.phony_formatted(spaces: '', format: :international)}", class: 'flex items-center hover:text-green-500 py-1 px-4 md:px-0' do
= icon 'phone', class: 'h-6 w-6'
li class="mx-auto px-4 #{"md:mx-0 md:px-0" if current_member}"
= link_to "tel:#{Current.org.phone.phony_formatted(spaces: '', format: :international)}", class: "flex items-center hover:text-green-500 py-1 px-4 md:px-0" do
= icon "phone", class: "h-6 w-6"
span class='ml-2'
= Current.org.phone
li class="mx-auto px-4 #{'md:mx-0 md:px-0' if current_member}"
= mail_to Current.org.email, class: 'flex items-center hover:text-green-500 py-1 px-4 md:px-0' do
= icon 'envelope', class: 'h-6 w-6'
li class="mx-auto px-4 #{"md:mx-0 md:px-0" if current_member}"
= mail_to Current.org.email, class: "flex items-center hover:text-green-500 py-1 px-4 md:px-0" do
= icon "envelope", class: "h-6 w-6"
span class='ml-2'
= t('.contact')
= t(".contact")
- if Current.org.languages.many? && !current_member
div class="mx-auto p-4 "
ul class="divide-x divide-gray-200 dark:divide-gray-800 border border-gray-200 dark:border-gray-800 rounded text-center flex flex-row"
- Current.org.languages.each do |locale|
li class='hover:bg-gray-100 dark:hover:bg-gray-900'
= link_to locale, url_for(locale: locale), title: t("languages.#{locale}"), data: { turbolinks: false }, class: 'block w-12 leading-8 hover:text-green-500 uppercase'
div class="mx-auto #{'md:mx-0.5' if current_member} mb-4 mt-12 text-gray-300 dark:text-gray-700"
= link_to csa_admin_website_url, class: 'flex items-center hover:text-green-500' do
= link_to locale, url_for(locale: locale), title: t("languages.#{locale}"), data: { turbolinks: false }, class: "block w-12 leading-8 hover:text-green-500 uppercase"
div class="mx-auto #{"md:mx-0.5" if current_member} mb-4 mt-12 text-gray-300 dark:text-gray-700"
= link_to csa_admin_website_url, class: "flex items-center hover:text-green-500" do
= icon "logo", class: "w-5 h-5 me-2 md:me-2.5 fill-current", library: "own"
= 'CSA Admin'
= "CSA Admin"
Loading

0 comments on commit b68aede

Please sign in to comment.