Skip to content

Commit

Permalink
Merge branch 'main' into fix-host-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bodhish committed Oct 16, 2024
2 parents 78e5c91 + 181dc36 commit a5f78a2
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 22 deletions.
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ gem "administrate", "1.0.0.beta1"
# Open AI ruby
gem "ruby-openai", "~> 6.2.0"
# Pagy for pagination
gem "pagy", "~> 9.0.9"
gem "pagy", "~> 6.0"
# Pundit for authorization
gem "pundit", "~> 2.4"
# AWS S3 for file storage
Expand All @@ -36,6 +36,8 @@ gem "aws-sdk-s3", require: false
gem "devise", "~> 4.9"
# Tailwind CSS
gem "tailwindcss-rails", "~> 2.7"
# CORS for API
gem 'rack-cors', "~> 2.0.1"

Check failure on line 40 in Gemfile

View workflow job for this annotation

GitHub Actions / lint

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.



Expand Down Expand Up @@ -76,6 +78,7 @@ end
group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
gem "pry"
end

group :test do
Expand Down
13 changes: 11 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
coderay (1.1.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
crass (1.0.6)
Expand Down Expand Up @@ -240,6 +241,7 @@ GEM
net-smtp
marcel (1.0.4)
matrix (0.4.2)
method_source (1.1.0)
mini_mime (1.1.5)
minitest (5.25.1)
msgpack (1.7.2)
Expand Down Expand Up @@ -275,7 +277,7 @@ GEM
racc (~> 1.4)
orm_adapter (0.5.0)
ostruct (0.6.0)
pagy (9.0.9)
pagy (6.5.0)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
Expand All @@ -286,6 +288,9 @@ GEM
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
psych (5.1.2)
stringio
public_suffix (6.0.1)
Expand All @@ -296,6 +301,8 @@ GEM
raabro (1.4.0)
racc (1.8.1)
rack (3.1.7)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
Expand Down Expand Up @@ -452,11 +459,13 @@ DEPENDENCIES
inline_svg (~> 1.10.0)
jbuilder
kamal (>= 2.0.0.rc2)
pagy (~> 9.0.9)
pagy (~> 6.0)
pg (~> 1.1)
propshaft
pry
puma (>= 5.0)
pundit (~> 2.4)
rack-cors (~> 2.0.1)
rails!
rubocop-rails-omakase
ruby-openai (~> 6.2.0)
Expand Down
2 changes: 1 addition & 1 deletion app/views/form_fields/_index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="<%= dom_id(form_field, :index) %>" class="bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-md shadow p-6">
<div id="<%= dom_id(form_field, :index) %>" class="bg-white rounded-md shadow p-6">
<%= turbo_stream_from form_field %>
<%= render form_field %>
<%= link_to "View", form_field, class: "btn btn-white" %>
Expand Down
8 changes: 4 additions & 4 deletions app/views/form_fields/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<div>
<h1 class="h3">Form Fields</h1>
<div class="text-sm font-medium">
<span class="text-gray-500 dark:text-gray-300/75">Sort by:</span>
<%= sortable @form_fields, :title, "Title", class: "text-gray-700 dark:text-gray-300 mr-1" %>
<%= sortable @form_fields, :description, "Description", class: "text-gray-700 dark:text-gray-300 mr-1" %>
<%= sortable @form_fields, :page_id, "Page", class: "text-gray-700 dark:text-gray-300 mr-1" %>
<span class="text-gray-500">Sort by:</span>
<%= sortable @form_fields, :title, "Title", class: "text-gray-700 mr-1" %>
<%= sortable @form_fields, :description, "Description", class: "text-gray-700 mr-1" %>
<%= sortable @form_fields, :page_id, "Page", class: "text-gray-700 mr-1" %>
</div>
</div>
<%= link_to t("shared.scaffold.new.title", model: "Form Field"), new_page_form_field_path(@page), class: "btn btn-white" %>
Expand Down
6 changes: 3 additions & 3 deletions app/views/form_fields/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<div class="container px-4 mx-auto my-8">
<div class="flex items-center justify-between mb-4">
<h1 class="h3">
<%= link_to @form_field.page.template.name, template_path(@form_field.page.template), class: "text-black dark:text-white" %>
<%= link_to @form_field.page.template.name, template_path(@form_field.page.template), class: "text-black" %>
<span class="text-gray-400 font-light mx-2">\</span>
<%= link_to @form_field.page.name, page_path(@form_field.page), class: "text-black dark:text-white" %>
<%= link_to @form_field.page.name, page_path(@form_field.page), class: "text-black" %>
<span class="text-gray-400 font-light mx-2">\</span>
Form Field #<%= @form_field.id %>
</h1>
<%= link_to t("edit"), edit_form_field_path(@form_field), class: "btn btn-white" %>
</div>
<div class="p-8 bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded shadow">
<div class="p-8 bg-white rounded shadow">
<%= render @form_field %>
</div>
</div>
5 changes: 5 additions & 0 deletions app/views/pages/_index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div id="<%= dom_id(page, :index) %>" class="bg-white rounded-md shadow p-4">
<%= turbo_stream_from page %>
<%= render page %>
<%= link_to "View", page, class: "btn btn-white" %>
</div>
8 changes: 8 additions & 0 deletions app/views/pages/_page.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div id="<%= dom_id page %>">
<h3 >
<%= page.name %>
</h3>
<div class="mb-4">
<p class="text-sm font-medium text-gray-500 mb-2">Supports Auto Fill for <%= page.form_fields.count%> fields</p>
</div>
</div>
5 changes: 5 additions & 0 deletions app/views/pages/_page.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
json.extract! page, :id, :template_id, :name, :created_at, :updated_at
json.url page_url(page, format: :json)
json.form_fields page.form_fields do |form_field|
json.partial! "form_fields/form_field", form_field: form_field
end
29 changes: 29 additions & 0 deletions app/views/pages/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<%= content_for :title, "Pages" %>
<%= turbo_stream_from :pages %>
<div class="container px-4 mx-auto my-8">
<div class="flex items-center justify-between mb-4">
<div>
<h1 class="h3">
<%= link_to @template.name, template_path(@template), class: "text-black" %>
<span class="text-gray-400 font-light mx-2">\</span>
Pages
</h1>
<div class="text-sm font-medium">
<span class="text-gray-500">Sort by:</span>
<%= sortable @pages, :template_id, "Template", class: "text-gray-700" %>
<%= sortable @pages, :name, "Name", class: "text-gray-700" %>
</div>
</div>
</div>
<%= tag.div id: ("pages" if first_page?), class: "space-y-4" do %>
<%= render partial: "pages/index", collection: @pages, as: :page, cached: true %>
<div class="hidden only:flex flex-col items-center justify-between lg:flex-row">
<%= image_tag "empty.svg", class: "mb-4 lg:w-1/2" %>
</div>
<% end %>
<% if @pagy.pages > 1 %>
<div class="my-6 text-center">
<%== pagy_nav(@pagy) %>
</div>
<% end %>
</div>
1 change: 1 addition & 0 deletions app/views/pages/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json.array! @pages, partial: "pages/page", as: :page
36 changes: 36 additions & 0 deletions app/views/pages/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<script src="https://medispeak-app.pages.dev/assets/index.html.js" crossorigin="" type="module"></script>
<link rel="modulepreload" crossorigin="" href="https://medispeak-app.pages.dev/assets/App.js">
<link rel="stylesheet" href="https://medispeak-app.pages.dev/assets/App.css">
<%= content_for :title, "Pages ##{@page.id}" %>
<%= turbo_stream_from @page %>
<div class="container px-4 mx-auto my-8">
<div class="flex items-center justify-between mb-4">
<h1 class="h3">
<%= link_to @page.template.name, template_path(@page.template), class: "text-black" %>
<span class="text-gray-400 font-light mx-2">\</span>
<%= @page.name %>
</h1>
</div>
<div class="p-8 bg-white rounded shadow">
<%= render @page %>
</div>
<div class="mt-4 max-w-xl p-8 space-y-4 bg-white rounded shadow">
<% @page.form_fields.each do |form_filed| %>
<div>
<label for="<%=form_filed.title%>" class="block text-sm font-medium leading-6 text-gray-900"><%=form_filed.title%></label>
<div class="mt-1">
<input type="text" name="<%=form_filed.title%>" id="<%=form_filed.title%>" class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" placeholder="<%=form_filed.description%>" aria-describedby="email-description">
</div>
<p class="mt-1 text-sm text-gray-500" id="email-description"><%=form_filed.description%></p>
</div>
<% end%>
<% if @page.form_fields.empty? %>
<div class="flex items-center justify-between mb-4">
<div class="text-sm font-semibold">
Please contact our support team to add form fields to this page.
</div>
</div>
<% end %>
</div>
<div id="medispeak_root"></div>
</div>
1 change: 1 addition & 0 deletions app/views/pages/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json.partial! "pages/page", page: @page
2 changes: 1 addition & 1 deletion app/views/templates/_index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="<%= dom_id(template, :index) %>" class="bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-md shadow p-6">
<div id="<%= dom_id(template, :index) %>" class="bg-white rounded-md shadow p-6">
<%= turbo_stream_from template %>
<%= render template %>
<%= link_to "View", template, class: "btn btn-white" %>
Expand Down
8 changes: 4 additions & 4 deletions app/views/templates/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<div>
<h1 class="h3">Templates</h1>
<div class="text-sm font-medium">
<span class="text-gray-500 dark:text-gray-300/75">Sort by:</span>
<%= sortable @templates, :title, "Title", class: "text-gray-700 dark:text-gray-300 mr-1" %>
<%= sortable @templates, :fqdn, "Fqdn", class: "text-gray-700 dark:text-gray-300 mr-1" %>
<%= sortable @templates, :autofill, "Autofill", class: "text-gray-700 dark:text-gray-300 mr-1" %>
<span class="text-gray-500">Sort by:</span>
<%= sortable @templates, :title, "Title", class: "text-gray-700 mr-1" %>
<%= sortable @templates, :fqdn, "Fqdn", class: "text-gray-700 mr-1" %>
<%= sortable @templates, :autofill, "Autofill", class: "text-gray-700 mr-1" %>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/templates/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= content_for :title, "Template ##{@template.id}" %>
<%= turbo_stream_from @template %>
<div class="container px-4 mx-auto my-8">
<div class="p-8 bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded shadow">
<div class="p-8 bg-white rounded shadow">
<%= render @template %>
</div>
<%= tag.div id: "pages", class: "space-y-4 mt-4" do %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/transcriptions/_transcription.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</dt>
<dd class="text-sm leading-6 text-gray-500">Transcriptions from recording</dd>
</div>
<div class="mt-1 prose prose-sm text-gray-500 dark:text-gray-300">
<div class="mt-1 prose prose-sm text-gray-500">
<p>
<% if transcription.transcription_text == nil %>
No transcription generated.
Expand All @@ -36,7 +36,7 @@
</dt>
<dd class="text-sm leading-6 text-gray-500">AI Filled Form Fields</dd>
</div>
<div class="mt-1 prose prose-sm text-gray-500 dark:text-gray-300">
<div class="mt-1 prose prose-sm text-gray-500">
<p>
<% if transcription.ai_response == {} %>
No response generated with AI.
Expand Down
4 changes: 2 additions & 2 deletions app/views/transcriptions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<div>
<h1 class="h3">Transcriptions</h1>
<div class="text-sm font-medium">
<span class="text-gray-500 dark:text-gray-300/75">Sort by:</span>
<%= sortable @transcriptions, :created_at, "Created", class: "text-gray-700 dark:text-gray-300 mr-1" %>
<span class="text-gray-500">Sort by:</span>
<%= sortable @transcriptions, :created_at, "Created", class: "text-gray-700 mr-1" %>
</div>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions config/initializers/cors.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'

Check failure on line 3 in config/initializers/cors.rb

View workflow job for this annotation

GitHub Actions / lint

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
resource '*', headers: :any, methods: [:get, :post, :patch, :put]

Check failure on line 4 in config/initializers/cors.rb

View workflow job for this annotation

GitHub Actions / lint

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Check failure on line 4 in config/initializers/cors.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideArrayLiteralBrackets: Use space inside array brackets.

Check failure on line 4 in config/initializers/cors.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideArrayLiteralBrackets: Use space inside array brackets.
end
end
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
description: 'Medispeak demo EMR'
)

demo_app_domains = [ "localhost:3000", "www.medispeak.in" ]
demo_app_domains = [ "localhost:5173", "www.medispeak.in" ]

demo_app_domains.each do |fqdn|
Domain.create!(
Expand Down

0 comments on commit a5f78a2

Please sign in to comment.