Skip to content

Commit 8b6f204

Browse files
committed
start adding jam page & functionality
1 parent ca12c8b commit 8b6f204

File tree

6 files changed

+422
-4
lines changed

6 files changed

+422
-4
lines changed
98.2 KB
Loading

app/assets/stylesheets/basil.scss

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1-
// Place all the styles related to the Basil controller here.
2-
// They will automatically be included in application.css.
3-
// You can use Sass (SCSS) here: https://sass-lang.com/
1+
$small-screen-up: 601px !default;
2+
$medium-screen-up: 993px !default;
3+
$large-screen-up: 1201px !default;
4+
$small-screen: 600px !default;
5+
$medium-screen: 992px !default;
6+
$large-screen: 1200px !default;
7+
8+
$medium-and-up: "only screen and (min-width : #{$small-screen-up})" !default;
9+
$large-and-up: "only screen and (min-width : #{$medium-screen-up})" !default;
10+
$small-and-down: "only screen and (max-width : #{$small-screen})" !default;
11+
$medium-and-down: "only screen and (max-width : #{$medium-screen})" !default;
12+
$medium-only: "only screen and (min-width : #{$small-screen-up}) and (max-width : #{$medium-screen})" !default;
13+
14+
@mixin column-count($ct) {
15+
-webkit-column-count: $ct;
16+
-moz-column-count: $ct;
17+
column-count: $ct;
18+
}
19+
20+
.cards-container {
21+
column-break-inside: avoid;
22+
.card {
23+
display: inline-block;
24+
overflow: visible;
25+
}
26+
}
27+
28+
@media #{$small-and-down} {
29+
.cards-container {
30+
@include column-count(1);
31+
}
32+
}
33+
@media #{$medium-and-up} {
34+
.cards-container {
35+
@include column-count(2);
36+
}
37+
}
38+
@media #{$large-and-up} {
39+
.cards-container {
40+
@include column-count(3);
41+
}
42+
}
43+
44+
.text-center {
45+
text-align: center;
46+
}
47+

app/controllers/basil_controller.rb

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class BasilController < ApplicationController
2-
before_action :authenticate_user!, except: [:complete_commission, :about, :stats]
2+
before_action :authenticate_user!, except: [:complete_commission, :about, :stats, :jam, :queue_jam_job, :commission_info]
33

44
before_action :require_admin_access, only: [:review], unless: -> { Rails.env.development? }
55

@@ -210,6 +210,32 @@ def content
210210
def about
211211
end
212212

213+
def jam
214+
@recent_commissions = BasilCommission.order('id DESC').limit(16)
215+
end
216+
217+
def queue_jam_job
218+
raise params.inspect
219+
end
220+
221+
def commission_info
222+
@commission = BasilCommission.find_by(job_id: params[:jobid])
223+
raise "No BasilCommission with ID #{params[:jobid]}" if @commission.nil?
224+
225+
render json: {
226+
image_url: @commission.image.url,
227+
user_id: @commission.user_id,
228+
prompt: @commission.prompt,
229+
job_id: @commission.job_id,
230+
created_at: @commission.created_at,
231+
updated_at: @commission.updated_at,
232+
completed_at: @commission.completed_at,
233+
style: @commission.style,
234+
final_settings: @commission.final_settings,
235+
cached_seconds_taken: @commission.cached_seconds_taken,
236+
}
237+
end
238+
213239
def stats
214240
@commissions = BasilCommission.all.with_deleted
215241

0 commit comments

Comments
 (0)