Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ gem "turbo-rails"
gem "stimulus-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
gem "slim-rails"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should add this gem -- It adds additional complexity for new people/designers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gem does not disable using erb for us

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know but having slim in the app makes it harder for newbies to contribute since they may not be familiar with slim/haml syntax.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could add some words into Readme saying that people can use what they best contribute with?

Copy link
Collaborator

@hernanvicente hernanvicente Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with not adding more complexity. We should keep just one template DSL or format; it will avoid confusion or divergent styles for later markup implementations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea was that there is no complexity in CRUD application markup which Skillrx really is.
At the same time Erb template can be twice bigger and that makes things a bit slow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanmarcia @hernanvicente I've removed slim


# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
gem "bcrypt", "~> 3.1.7"
Expand Down Expand Up @@ -52,6 +53,7 @@ group :development, :test do

gem "rspec-rails"
gem "factory_bot_rails"
gem "faker"
end

group :development do
Expand All @@ -65,6 +67,7 @@ end
group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "rails-controller-testing"
gem "selenium-webdriver"
gem "shoulda-matchers"
end
18 changes: 18 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ GEM
factory_bot_rails (6.4.4)
factory_bot (~> 6.5)
railties (>= 5.0.0)
faker (3.5.1)
i18n (>= 1.8.11, < 2)
ffi (1.17.1-aarch64-linux-gnu)
ffi (1.17.1-aarch64-linux-musl)
ffi (1.17.1-arm-linux-gnu)
Expand Down Expand Up @@ -262,6 +264,10 @@ GEM
activesupport (= 8.0.1)
bundler (>= 1.15.0)
railties (= 8.0.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
Expand Down Expand Up @@ -344,6 +350,13 @@ GEM
websocket (~> 1.0)
shoulda-matchers (6.4.0)
activesupport (>= 5.2.0)
slim (5.2.1)
temple (~> 0.10.0)
tilt (>= 2.1.0)
slim-rails (3.7.0)
actionpack (>= 3.1)
railties (>= 3.1)
slim (>= 3.0, < 6.0, != 5.0.0)
solid_cable (3.0.7)
actioncable (>= 7.2)
activejob (>= 7.2)
Expand All @@ -369,12 +382,14 @@ GEM
stimulus-rails (1.3.4)
railties (>= 6.0.0)
stringio (3.1.2)
temple (0.10.3)
thor (1.3.2)
thruster (0.1.10)
thruster (0.1.10-aarch64-linux)
thruster (0.1.10-arm64-darwin)
thruster (0.1.10-x86_64-darwin)
thruster (0.1.10-x86_64-linux)
tilt (2.6.0)
timeout (0.4.3)
turbo-rails (2.0.11)
actionpack (>= 6.0.0)
Expand Down Expand Up @@ -422,6 +437,7 @@ DEPENDENCIES
capybara
debug
factory_bot_rails
faker
hotwire-spark
importmap-rails
jbuilder
Expand All @@ -431,10 +447,12 @@ DEPENDENCIES
propshaft
puma (>= 5.0)
rails (~> 8.0.1)
rails-controller-testing
rspec-rails
rubocop-rails-omakase
selenium-webdriver
shoulda-matchers
slim-rails
solid_cable
solid_cache
solid_queue
Expand Down
39 changes: 39 additions & 0 deletions app/controllers/languages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
class LanguagesController < ApplicationController
before_action :set_language, only: [ :edit, :update ]

def index
@languages = Language.all
end

def new
@language = Language.new
end

def create
@language = Language.new(language_params)

if @language.save
redirect_to languages_path
else
render :new
end
end

def edit
end

def update
@language.update(language_params)
redirect_to languages_path
end

private

def language_params
params.require(:language).permit(:name, :file_share_folder)
end

def set_language
@language = Language.find(params[:id])
end
end
3 changes: 3 additions & 0 deletions app/models/language.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Language < ApplicationRecord
validates :name, :file_share_folder, presence: true, uniqueness: true
end
15 changes: 15 additions & 0 deletions app/views/languages/_form.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

= form_for language do |f|
.form-body
.row
= render "shared/errors", resource: language
.col-12
.form-group
= f.label :name
= f.text_field :name, class: "form-control", placeholder: "Name"
.form-group
= f.label :file_share_folder
= f.text_field :file_share_folder, class: "form-control", placeholder: "Folder"
.col-12.d-flex.justify-content-end
= f.submit "Save", class: "btn btn-primary me-1 mb-1"
= link_to "Cancel", languages_path, class: "btn btn-light-secondary me-1 mb-1"
11 changes: 11 additions & 0 deletions app/views/languages/edit.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
content_for :title, "Editing language"

section#basic-vertical-layouts
.row.match-height
.col-md-6.col-12
.card
.card-header
h2.card-title Edit language
.card-content
.card-body
= render "form", language: @language
30 changes: 30 additions & 0 deletions app/views/languages/index.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
content_for :title, "Languages"

section.section
.row#table-striped
.col-12.cold-md-12
.card
.card-header.d-flex.justify-content-between.align-items-center
h2.card-title Languages
= link_to new_language_path, class: "btn btn-primary" do
i.bi.bi-plus
| Add New Language
.card-content
.card-body
p.card-text Some important information or instruction can be placed here.
.table-responsive
table.table.table-lg.table-striped.mb-0
thead
tr
th Name
th File share folder
th.text-end Actions
tbody
- @languages.each do |language|
tr
td.text-bold-500 = language.name
td.text-bold-500 = language.file_share_folder
td.text-end
= link_to edit_language_path(language), class: "btn btn-secondary btn-sm" do
i.bi.bi-pencil
| Edit
11 changes: 11 additions & 0 deletions app/views/languages/new.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
content_for :title, "New language"

section#basic-vertical-layouts
.row.match-height
.col-md-6.col-12
.card
.card-header
h2.card-title New language
.card-content
.card-body
= render "form", language: @language
94 changes: 0 additions & 94 deletions app/views/layouts/_sidebar.html.erb

This file was deleted.

53 changes: 53 additions & 0 deletions app/views/layouts/_sidebar.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#sidebar
.sidebar-wrapper.active
.sidebar-header.position-relative
.d-flex.justify-content-between.align-items-center
.logo
a href="index.html"
| Logo
.theme-toggle.d-flex.gap-2.align-items-center.mt-2
svg.iconify.iconify--system-uicons[xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="20" height="20" preserveaspectratio="xMidYMid meet" viewbox="0 0 21 21"]
g fill="none" fill-rule="evenodd" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
path d="M10.5 14.5c2.219 0 4-1.763 4-3.982a4.003 4.003 0 0 0-4-4.018c-2.219 0-4 1.781-4 4c0 2.219 1.781 4 4 4zM4.136 4.136L5.55 5.55m9.9 9.9l1.414 1.414M1.5 10.5h2m14 0h2M4.135 16.863L5.55 15.45m9.899-9.9l1.414-1.415M10.5 19.5v-2m0-14v-2" opacity=".3"
g transform="translate(-210 -1)"
path d="M220.5 2.5v2m6.5.5l-1.5 1.5"
circle cx="220.5" cy="11.5" r="4"
path d="m214 5l1.5 1.5m5 14v-2m6.5-.5l-1.5-1.5M214 18l1.5-1.5m-4-5h2m14 0h2"
.form-check.form-switch.fs-6
input#toggle-dark.form-check-input.me-0[type="checkbox" style="cursor: pointer"]
label.form-check-label
svg.iconify.iconify--mdi[xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="20" height="20" preserveaspectratio="xMidYMid meet" viewbox="0 0 24 24"]
path fill="currentColor" d="m17.75 4.09l-2.53 1.94l.91 3.06l-2.63-1.81l-2.63 1.81l.91-3.06l-2.53-1.94L12.44 4l1.06-3l1.06 3l3.19.09m3.5 6.91l-1.64 1.25l.59 1.98l-1.7-1.17l-1.7 1.17l.59-1.98L15.75 11l2.06-.05L18.5 9l.69 1.95l2.06.05m-2.28 4.95c.83-.08 1.72 1.1 1.19 1.85c-.32.45-.66.87-1.08 1.27C15.17 23 8.84 23 4.94 19.07c-3.91-3.9-3.91-10.24 0-14.14c.4-.4.82-.76 1.27-1.08c.75-.53 1.93.36 1.85 1.19c-.27 2.86.69 5.83 2.89 8.02a9.96 9.96 0 0 0 8.02 2.89m-1.64 2.02a12.08 12.08 0 0 1-7.8-3.47c-2.17-2.19-3.33-5-3.49-7.82c-2.81 3.14-2.7 7.96.31 10.98c3.02 3.01 7.84 3.12 10.98.31Z"

.sidebar-toggler.x
a.sidebar-hide.d-xl-none.d-block[href="#"]
i.bi.bi-x.bi-middle
.sidebar-menu
ul.menu
li.sidebar-title
| Administration
li.sidebar-item
a.sidebar-link[href="#{regions_path}"]
i.bi.bi-globe
span
| Regions
li.sidebar-item
a.sidebar-link[href="table.html"]
i.bi.bi-hospital-fill
span
| Providers
li.sidebar-item
a.sidebar-link[href="ui-file-uploader.html"]
i.bi.bi-tags-fill
span
| Topics
li.sidebar-item
a.sidebar-link[href="#{languages_path}"]
i.bi.bi-translate
span
| Languages
li.sidebar-item
a.sidebar-link[href="application-chat.html"]
i.bi.bi-people
span
| Users
Loading