Skip to content

Commit d599065

Browse files
committed
basic tailwind styling
1 parent aec29cf commit d599065

File tree

8 files changed

+75
-23
lines changed

8 files changed

+75
-23
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@
77
/test/dummy/db/*.sqlite3-*
88
/test/dummy/log/*.log
99
/test/dummy/storage/
10-
/test/dummy/tmp/
10+
/test/dummy/tmp/
11+
12+
# Custom to this project
13+
todo.md

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"editor.semanticHighlighting.enabled": true,
1111
"editor.formatOnType": true,
1212
"editor.wordSeparators": "`~@#$%^&*()-=+[{]}\\|;:'\",.<>/"
13-
}
13+
},
1414
}

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ gem "rubocop-rails-omakase", require: false
1414

1515
# Start debugger with binding.b [https://github.com/ruby/debug]
1616
gem "debug"
17+
gem "erb_lint"

Gemfile.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ GEM
7979
tzinfo (~> 2.0, >= 2.0.5)
8080
ast (2.4.2)
8181
base64 (0.2.0)
82+
better_html (2.1.1)
83+
actionview (>= 6.0)
84+
activesupport (>= 6.0)
85+
ast (~> 2.0)
86+
erubi (~> 1.4)
87+
parser (>= 2.4)
88+
smart_properties
8289
bigdecimal (3.1.8)
8390
builder (3.3.0)
8491
concurrent-ruby (1.3.4)
@@ -89,6 +96,13 @@ GEM
8996
irb (~> 1.10)
9097
reline (>= 0.3.8)
9198
drb (2.2.1)
99+
erb_lint (0.6.0)
100+
activesupport
101+
better_html (>= 2.0.1)
102+
parser (>= 2.7.1.4)
103+
rainbow
104+
rubocop (>= 1)
105+
smart_properties
92106
erubi (1.13.0)
93107
globalid (1.2.1)
94108
activesupport (>= 6.1)
@@ -220,6 +234,7 @@ GEM
220234
rubocop-rails
221235
ruby-progressbar (1.13.0)
222236
securerandom (0.3.1)
237+
smart_properties (1.17.0)
223238
sprockets (4.2.1)
224239
concurrent-ruby (~> 1.0)
225240
rack (>= 2.2.4, < 4)
@@ -270,6 +285,7 @@ PLATFORMS
270285
DEPENDENCIES
271286
action_prompt!
272287
debug
288+
erb_lint
273289
puma
274290
rubocop-rails-omakase
275291
sprockets-rails

app/controllers/action_prompt/previews_controller.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
class ActionPrompt::PreviewsController < Rails::ApplicationController
1+
class ActionPrompt::PreviewsController < ActionController::Base
22
prepend_view_path ActionPrompt::Engine.root.join("app", "views")
3-
before_action :require_local!
3+
layout "application"
4+
# Ideally, we'd like to inhert from Rails::ApplicationController, but that
5+
# would prevent us from using a Tailwind CDN. So instead, we're using ActionController::Base.
6+
#
7+
# If we are able to use Rails::ApplicationController, then re-enable this line
8+
# before_action :require_local!
49

510
def index
611
@page_title = "Action Prompt Previews"
Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
<h1>Action Prompt Previews</h1>
2-
3-
<% if @previews.any? %>
4-
<% @previews.each do |preview| %>
5-
<h3><%= preview.preview_name.titleize %></h3>
6-
<% preview.prompts.each do |prompt| %>
7-
<p><%= link_to prompt.name, "/action_prompt/previews/#{prompt.slug}" %></p>
8-
<% end %>
1+
<h1 class="text-xl font-semibold">Action Prompt Previews</h1>
2+
<div class="py-4">
3+
<% if @previews.blank? %>
4+
<p>You have not defined any Action Prompt Previews.</p>
5+
<!-- TODO: Add a link to the Action Prompt documentation here -->
6+
<% else %>
7+
<div class="space-y-4">
8+
<% @previews.each do |preview| %>
9+
<div>
10+
<h2 class="text-lg font-semibold"><%= preview.preview_name.titleize %></h2>
11+
<ul>
12+
<% preview.prompts.each do |prompt| %>
13+
<li><%= link_to prompt.name, "/action_prompt/previews/#{prompt.slug}", class: "cursor-pointer text-blue-500 underline hover:text-blue-600" %></li>
14+
<% end %>
15+
</ul>
16+
</div>
17+
<% end %>
18+
</div>
919
<% end %>
10-
<% else %>
11-
<p>You have not defined any Action Prompt Previews.</p>
12-
<!-- TODO: Add a link to the Action Prompt documentation here -->
13-
<% end %>
20+
</div>
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
<h1>Action Prompt Preview</h1>
2-
<div>
3-
<%= @preview_class.name %>
4-
</div>
5-
<div>
1+
<div>Prompt</div>
2+
<h1 class="text-xl font-semibold">
3+
<%= @preview_class.name %>: <%= params[:prompt_name] %>
4+
</h1>
5+
<div class="py-4">
6+
<div>
7+
Output
8+
</div>
9+
<div class="bg-gray-100 p-2 rounded-md border shadow-sm">
610
<%= @prompt_output %>
7-
</div>
8-
11+
</div>
12+
</div>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title><%= @page_title %></title>
7+
<script src="https://cdn.tailwindcss.com"></script>
8+
</head>
9+
<body class="min-h-screen bg-yellow-100 pt-2">
10+
11+
<div class="mx-auto w-2/3 bg-white rounded-lg p-8 shadow-lg">
12+
<%= yield %>
13+
</div>
14+
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)