Skip to content
Draft
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
7 changes: 5 additions & 2 deletions app/controllers/api/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
module Api
class ProjectsController < ApiController
before_action :authorize_user, only: %i[create update index destroy]
before_action :load_project, only: %i[show update destroy show_context]
before_action :load_project, only: %i[show update destroy show_context], unless: -> { params[:id] == "blank-scratch-starter" }
before_action :load_projects, only: %i[index]
load_and_authorize_resource
load_and_authorize_resource unless: -> { params[:id] == "blank-scratch-starter" }
before_action :verify_lesson_belongs_to_school, only: :create
after_action :pagination_link_header, only: %i[index]

Expand All @@ -17,6 +17,9 @@ def index
end

def show
if params[:id] == "blank-scratch-starter"
render :scratch_starter, formats: [:json] and return
end
if [email protected]_id.nil? && @project.lesson_id.nil?
project_with_user = @project.with_user(current_user)
@user = project_with_user[1]
Expand Down
42 changes: 42 additions & 0 deletions app/views/api/projects/scratch_starter.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
json.meta do
json.vm "11.5.0"
json.agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
json.semver "3.0.0"
end

json.targets do
json.array! [
{
name: "Stage",
lists: {},
tempo: 60,
blocks: {},
sounds: [],
volume: 100,
isStage: true,
comments: {},
costumes: [
{
name: "backdrop1",
md5ext: "cd21514d0531fdffb22204e0ec5ed84a.svg",
assetId: "cd21514d0531fdffb22204e0ec5ed84a",
dataFormat: "svg",
rotationCenterX: 240,
rotationCenterY: 180
}
],
variables: {
"`jEk@4|i[#Fk?(8x)AV.-my variable": ["my variable", 0]
},
broadcasts: {},
layerOrder: 0,
videoState: "on",
currentCostume: 0,
videoTransparency: 50,
textToSpeechLanguage: nil
}
]
end

json.monitors []
json.extensions []