Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert erb2hamlit #4

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@ group :test do
gem 'rspec-rails', '~> 6.0.2'
gem 'shoulda-matchers', '~> 5.3.0'
end

gem "hamlit", "~> 3.0"
gem "hamlit-rails", "~> 0.2.3"

gem "html2haml", "~> 2.3"
27 changes: 27 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ GEM
dry-schema (>= 1.12, < 2)
zeitwerk (~> 2.6)
erubi (1.12.0)
erubis (2.7.0)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
Expand All @@ -142,6 +143,24 @@ GEM
ffaker (2.21.0)
globalid (1.1.0)
activesupport (>= 5.0)
haml (6.1.2)
temple (>= 0.8.2)
thor
tilt
hamlit (3.0.3)
temple (>= 0.8.2)
thor
tilt
hamlit-rails (0.2.3)
actionpack (>= 4.0.1)
activesupport (>= 4.0.1)
hamlit (>= 1.2.0)
railties (>= 4.0.1)
html2haml (2.3.0)
erubis (~> 2.7.0)
haml (>= 4.0)
nokogiri (>= 1.6.0)
ruby_parser (~> 3.5)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
interactor (3.1.2)
Expand Down Expand Up @@ -296,6 +315,9 @@ GEM
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
ruby_parser (3.20.3)
sexp_processor (~> 4.16)
sexp_processor (4.17.0)
shoulda-matchers (5.3.0)
activesupport (>= 5.2.0)
sprockets (4.2.0)
Expand All @@ -308,7 +330,9 @@ GEM
stringio (3.0.8)
strong_migrations (1.6.1)
activerecord (>= 5.2)
temple (0.10.2)
thor (1.2.2)
tilt (2.2.0)
timeout (0.4.0)
traceroute (0.8.1)
rails (>= 3.0.0)
Expand Down Expand Up @@ -343,6 +367,9 @@ DEPENDENCIES
factory_bot_rails (~> 6.2.0)
faraday (~> 2.7.10)
ffaker (~> 2.21.0)
hamlit (~> 3.0)
hamlit-rails (~> 0.2.3)
html2haml (~> 2.3)
interactor-rails (~> 2.2.1)
jbuilder (~> 2.11.5)
jsbundling-rails (~> 1.1.2)
Expand Down
66 changes: 0 additions & 66 deletions app/views/api_wrapper/index.html.erb

This file was deleted.

42 changes: 42 additions & 0 deletions app/views/api_wrapper/index.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.container
%h1 Find Your Activity for Today
%div
= form_with url: "/api_wrapper", method: :get, class: 'form-inline' do |form|
.form-group.mt-2.mb-2
= form.label :type, "Activity type:", class: 'mr-2'
= form.select :type, %w[education recreational social diy charity cooking relaxation music busywork], { :include_blank => true }, { class: "form-control mr-2" }
.form-group.mt-2.mb-2
= form.label :participants, "Number of participants:", class: 'mr-2'
= form.number_field :participants, placeholder: "1-8", step: 1, class: "form-control mr-2"
.form-group.mt-2.mb-2
= form.label :minprice, "Minimum price:", class: 'mr-2'
= form.number_field :minprice, placeholder: "0-0.8", step: 0.1, class: "form-control mr-2"
.form-group.mt-2.mb-2
= form.label :maxprice, "Maximum price:", class: 'mr-2'
= form.number_field :maxprice, placeholder: "0-0.9", step: 0.1, class: "form-control mr-2"
.form-group.mt-2.mb-2
= form.label :minaccessibility, "Minimum accessibility:", class: 'mr-2'
= form.number_field :minaccessibility, placeholder: "0-0.9", step: 0.1, class: "form-control mr-2"
.form-group.mt-2.mb-2
= form.label :maxaccessibility, "Maximum accessibility:", class: 'mr-2'
= form.number_field :maxaccessibility, placeholder: "0-0.9", step: 0.1, class: "form-control mr-2"
= form.submit "Search", class: "btn btn-primary mt-2 mb-2"
- if @activity.present?
%div
%h2 Activity details:
%table.table.table-striped
%thead
%tr
%th Activity
%th Type
%th Participants
%th Price
%th Link
%tbody
%tr
%td= @activity["activity"]
%td= @activity["type"]
%td= @activity["participants"]
%td= @activity["price"]
%td= link_to @activity["link"], @activity["link"], target: "_blank"
= link_to 'View Activity History', latest_activities_path, class: 'btn btn-primary mt-2 mb-2'
45 changes: 0 additions & 45 deletions app/views/api_wrapper/latest_activities.html.erb

This file was deleted.

29 changes: 29 additions & 0 deletions app/views/api_wrapper/latest_activities.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.container
%h1 Activities search history
= form_with url: latest_activities_path, method: :get, class: 'form-inline mb-3' do |form|
.form-group.mt-2.mb-2
= form.label :sort, "Sort By:", class: 'mr-2'
= form.select :sort, %w[activity_type participants price created_at accessibility], {selected: params[:sort]}, { class: "form-control mr-2" }
.form-group.mt-2.mb-2
= form.label :order, "Order:", class: 'mr-2'
= form.select :order, %w[asc desc], {selected: params[:order]}, { class: "form-control mr-2" }
= form.submit "Apply", class: "btn btn-primary mt-2 mb-2"
- if @activities.present?
%table.table.table-striped
%thead
%tr
%th Type
%th Participants
%th Price
%th Date
%tbody
- @activities.each do |activity|
%tr
%td= activity.activity_type
%td= activity.participants
%td= activity.price
%td= activity.created_at.strftime('%Y-%m-%d %H:%M:%S')
!= pagy_bootstrap_nav @pagy if @pagy && @pagy.pages > 1
- else
%p No activities found.
= link_to 'Back and find your activity', api_wrapper_path, class: 'btn btn-primary mt-2 mb-2'
17 changes: 0 additions & 17 deletions app/views/layouts/application.html.erb

This file was deleted.

13 changes: 13 additions & 0 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
!!!
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title Simple api wrapper
%meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
= csrf_meta_tags
= csp_meta_tag
= stylesheet_link_tag "application"
= javascript_include_tag "application", "data-turbo-track": "reload", defer: true
%body
= render partial: 'shared/flash_message'
= yield
13 changes: 0 additions & 13 deletions app/views/layouts/mailer.html.erb

This file was deleted.

8 changes: 8 additions & 0 deletions app/views/layouts/mailer.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
!!!
%html
%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/
:css
/* Email styles need to be inline */
%body
= yield
1 change: 0 additions & 1 deletion app/views/layouts/mailer.text.erb

This file was deleted.

1 change: 1 addition & 0 deletions app/views/layouts/mailer.text.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= yield
19 changes: 0 additions & 19 deletions app/views/shared/_flash_message.html.erb

This file was deleted.

11 changes: 11 additions & 0 deletions app/views/shared/_flash_message.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- if notice.present?
.alert.alert-success{:role => "alert"}
= notice
- if alert.present?
.alert.alert-danger{:role => "alert"}
- if alert.is_a?(Dry::Validation::MessageSet)
%ul
- alert.each do |error|
%li= "#{error.path.join(' ') } #{error.text}"
- else
= alert
Loading