diff --git a/app/assets/images/projects/magenta/1.jpg b/app/assets/images/projects/magenta/1.jpg new file mode 100644 index 0000000..30f6ca5 Binary files /dev/null and b/app/assets/images/projects/magenta/1.jpg differ diff --git a/app/assets/images/projects/magenta/10.jpg b/app/assets/images/projects/magenta/10.jpg new file mode 100644 index 0000000..1ed6d84 Binary files /dev/null and b/app/assets/images/projects/magenta/10.jpg differ diff --git a/app/assets/images/projects/magenta/11.jpg b/app/assets/images/projects/magenta/11.jpg new file mode 100644 index 0000000..ee1e5bf Binary files /dev/null and b/app/assets/images/projects/magenta/11.jpg differ diff --git a/app/assets/images/projects/magenta/13.jpg b/app/assets/images/projects/magenta/13.jpg new file mode 100644 index 0000000..24ee58f Binary files /dev/null and b/app/assets/images/projects/magenta/13.jpg differ diff --git a/app/assets/images/projects/magenta/2.jpg b/app/assets/images/projects/magenta/2.jpg new file mode 100644 index 0000000..78c44a8 Binary files /dev/null and b/app/assets/images/projects/magenta/2.jpg differ diff --git a/app/assets/images/projects/magenta/3.jpg b/app/assets/images/projects/magenta/3.jpg new file mode 100644 index 0000000..4e5b88c Binary files /dev/null and b/app/assets/images/projects/magenta/3.jpg differ diff --git a/app/assets/images/projects/magenta/4.jpg b/app/assets/images/projects/magenta/4.jpg new file mode 100644 index 0000000..67029e3 Binary files /dev/null and b/app/assets/images/projects/magenta/4.jpg differ diff --git a/app/assets/images/projects/magenta/5.jpg b/app/assets/images/projects/magenta/5.jpg new file mode 100644 index 0000000..77ba13e Binary files /dev/null and b/app/assets/images/projects/magenta/5.jpg differ diff --git a/app/assets/images/projects/magenta/7.jpg b/app/assets/images/projects/magenta/7.jpg new file mode 100644 index 0000000..5de55f5 Binary files /dev/null and b/app/assets/images/projects/magenta/7.jpg differ diff --git a/app/assets/images/projects/magenta/8.jpg b/app/assets/images/projects/magenta/8.jpg new file mode 100644 index 0000000..b827cfc Binary files /dev/null and b/app/assets/images/projects/magenta/8.jpg differ diff --git a/app/assets/images/projects/magenta/9.jpg b/app/assets/images/projects/magenta/9.jpg new file mode 100644 index 0000000..2f0f2b9 Binary files /dev/null and b/app/assets/images/projects/magenta/9.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/1.jpg b/app/assets/images/projects/the-philadelphia-experiment/1.jpg new file mode 100644 index 0000000..00380fe Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/1.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/10.jpg b/app/assets/images/projects/the-philadelphia-experiment/10.jpg new file mode 100644 index 0000000..a1d19b5 Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/10.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/12.jpg b/app/assets/images/projects/the-philadelphia-experiment/12.jpg new file mode 100644 index 0000000..11a088f Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/12.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/2.jpg b/app/assets/images/projects/the-philadelphia-experiment/2.jpg new file mode 100644 index 0000000..e46d53a Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/2.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/3.jpg b/app/assets/images/projects/the-philadelphia-experiment/3.jpg new file mode 100644 index 0000000..e07fc0f Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/3.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/4.jpg b/app/assets/images/projects/the-philadelphia-experiment/4.jpg new file mode 100644 index 0000000..fedb9e0 Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/4.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/5.jpg b/app/assets/images/projects/the-philadelphia-experiment/5.jpg new file mode 100644 index 0000000..da9dc1d Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/5.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/6.jpg b/app/assets/images/projects/the-philadelphia-experiment/6.jpg new file mode 100644 index 0000000..3abcfea Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/6.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/7.jpg b/app/assets/images/projects/the-philadelphia-experiment/7.jpg new file mode 100644 index 0000000..7e3fc94 Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/7.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/8.jpg b/app/assets/images/projects/the-philadelphia-experiment/8.jpg new file mode 100644 index 0000000..04c1c56 Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/8.jpg differ diff --git a/app/assets/images/projects/the-philadelphia-experiment/9.jpg b/app/assets/images/projects/the-philadelphia-experiment/9.jpg new file mode 100644 index 0000000..d632cb5 Binary files /dev/null and b/app/assets/images/projects/the-philadelphia-experiment/9.jpg differ diff --git a/app/assets/images/projects/zachary-armstrong/1.jpg b/app/assets/images/projects/zachary-armstrong/1.jpg new file mode 100644 index 0000000..77438ff Binary files /dev/null and b/app/assets/images/projects/zachary-armstrong/1.jpg differ diff --git a/app/assets/images/projects/zachary-armstrong/11.jpg b/app/assets/images/projects/zachary-armstrong/11.jpg new file mode 100644 index 0000000..e232419 Binary files /dev/null and b/app/assets/images/projects/zachary-armstrong/11.jpg differ diff --git a/app/assets/images/projects/zachary-armstrong/2.jpg b/app/assets/images/projects/zachary-armstrong/2.jpg new file mode 100644 index 0000000..4c2aac6 Binary files /dev/null and b/app/assets/images/projects/zachary-armstrong/2.jpg differ diff --git a/app/assets/images/projects/zachary-armstrong/3.jpg b/app/assets/images/projects/zachary-armstrong/3.jpg new file mode 100644 index 0000000..8f4485d Binary files /dev/null and b/app/assets/images/projects/zachary-armstrong/3.jpg differ diff --git a/app/assets/images/projects/zachary-armstrong/4.jpg b/app/assets/images/projects/zachary-armstrong/4.jpg new file mode 100644 index 0000000..15b01a0 Binary files /dev/null and b/app/assets/images/projects/zachary-armstrong/4.jpg differ diff --git a/app/assets/images/projects/zachary-armstrong/5.jpg b/app/assets/images/projects/zachary-armstrong/5.jpg new file mode 100644 index 0000000..5a62901 Binary files /dev/null and b/app/assets/images/projects/zachary-armstrong/5.jpg differ diff --git a/app/assets/images/projects/zachary-armstrong/6.jpg b/app/assets/images/projects/zachary-armstrong/6.jpg new file mode 100644 index 0000000..c09bcde Binary files /dev/null and b/app/assets/images/projects/zachary-armstrong/6.jpg differ diff --git a/app/assets/images/projects/zachary-armstrong/7.jpg b/app/assets/images/projects/zachary-armstrong/7.jpg new file mode 100644 index 0000000..a6be3c7 Binary files /dev/null and b/app/assets/images/projects/zachary-armstrong/7.jpg differ diff --git a/app/assets/images/projects/zachary-armstrong/8.jpg b/app/assets/images/projects/zachary-armstrong/8.jpg new file mode 100644 index 0000000..beb1584 Binary files /dev/null and b/app/assets/images/projects/zachary-armstrong/8.jpg differ diff --git a/app/assets/images/projects/zachary-armstrong/9.jpg b/app/assets/images/projects/zachary-armstrong/9.jpg new file mode 100644 index 0000000..ee90e24 Binary files /dev/null and b/app/assets/images/projects/zachary-armstrong/9.jpg differ diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2ebbc96..c4e65e1 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,7 +1,78 @@ class ProjectsController < InheritedResources::Base def index - @projects = Project.all + @projects = find_projects - render json: @projects, serializer: CachedCollectionSerializer + render json: { projects: @projects } + end + + private + + def find_projects + [{ + id: 1, + name: "The Philadelphia Experiment", + numeral: "I", + slug: "the-philadelphia-experiment", + pages: [ + { url: image_url("the-philadelphia-experiment/1.jpg") }, + { url: image_url("the-philadelphia-experiment/2.jpg") }, + { url: image_url("the-philadelphia-experiment/3.jpg") }, + { url: image_url("the-philadelphia-experiment/4.jpg") }, + { url: image_url("the-philadelphia-experiment/5.jpg") }, + { url: image_url("the-philadelphia-experiment/6.jpg") }, + { url: image_url("the-philadelphia-experiment/7.jpg") }, + { url: image_url("the-philadelphia-experiment/8.jpg") }, + { url: image_url("the-philadelphia-experiment/9.jpg") }, + { url: image_url("the-philadelphia-experiment/10.jpg") }, + { url: vimeo_url(61014435), is_video: true }, + { url: image_url("the-philadelphia-experiment/12.jpg") }, + ] + }, { + id: 2, + name: "Zachary Armstrong", + numeral: "II", + slug: "zachary-armstrong", + pages: [ + { url: image_url("zachary-armstrong/1.jpg") }, + { url: image_url("zachary-armstrong/2.jpg") }, + { url: image_url("zachary-armstrong/3.jpg") }, + { url: image_url("zachary-armstrong/4.jpg") }, + { url: image_url("zachary-armstrong/5.jpg") }, + { url: image_url("zachary-armstrong/6.jpg") }, + { url: image_url("zachary-armstrong/7.jpg") }, + { url: image_url("zachary-armstrong/8.jpg") }, + { url: image_url("zachary-armstrong/9.jpg") }, + { url: vimeo_url(86785302), is_video: true }, + { url: image_url("zachary-armstrong/11.jpg") }, + ] + }, { + id: 3, + name: "Magenta", + numeral: "III", + slug: "magenta", + pages: [ + { url: image_url("magenta/1.jpg") }, + { url: image_url("magenta/2.jpg") }, + { url: image_url("magenta/3.jpg") }, + { url: image_url("magenta/4.jpg") }, + { url: image_url("magenta/5.jpg") }, + { url: vimeo_url(90116548), is_video: true }, + { url: image_url("magenta/7.jpg") }, + { url: image_url("magenta/8.jpg") }, + { url: image_url("magenta/9.jpg") }, + { url: image_url("magenta/10.jpg") }, + { url: image_url("magenta/11.jpg") }, + { url: vimeo_url(93339618), is_video: true }, + { url: image_url("magenta/13.jpg") }, + ] + }] + end + + def image_url(name) + self.class.helpers.image_url("projects/#{name}") + end + + def vimeo_url(id) + "http://player.vimeo.com/video/#{id}?title=0&byline=0&portrait=0&color=cfcfcf%22%20width=%22888" end end diff --git a/spec/requests/lookbooks_spec.rb b/spec/requests/lookbooks_spec.rb index 77d9340..7cf3a76 100644 --- a/spec/requests/lookbooks_spec.rb +++ b/spec/requests/lookbooks_spec.rb @@ -1,6 +1,6 @@ describe "GET /api/lookbooks", type: :request do it "returns all lookbooks" do - get lookbooks_path, format: :json + get "/api/lookbooks", json_header expect(response.status).to eq 200 expect(response).to match_response_schema("lookbooks") diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb index f2cf782..d0f7cd9 100644 --- a/spec/requests/projects_spec.rb +++ b/spec/requests/projects_spec.rb @@ -1,8 +1,5 @@ describe "GET /api/projects" do it "includes all published projects" do - project = create(:project, :published, photos: [create(:photo)], ) - create(:banner, resource: project) - get "/api/projects", {}, json_header expect(response.status).to eq 200 diff --git a/spec/support/api/schemas/projects.json b/spec/support/api/schemas/projects.json index 85181dc..6e725e4 100644 --- a/spec/support/api/schemas/projects.json +++ b/spec/support/api/schemas/projects.json @@ -1,6 +1,6 @@ { "type": "object", - "required": ["projects", "photos"], + "required": ["projects"], "properties": { "projects": { "type": "array", @@ -8,38 +8,22 @@ "required": [ "id", "name", - "video_url", - "published_at", - "photo_ids" + "pages", + "slug" ], "properties" : { "id": { "type": "integer" }, "name": { "type": "string" }, - "video_url": { "type": "string" }, - "published_at": { "type": "string", "format": "date-time" }, - "photo_ids": { "type": "array" }, - "banner": { "type": "string" }, - "banner_hover": { "type": "string" } - } - } - }, - "photos": { - "type": "array", - "items": { - "required": [ - "id", - "url", - "caption", - "thumbnail" - ], - "properties" : { - "id": { "type": "integer" }, - "url": { "type": "string" }, - "caption": { "type": "string" }, - "thumbnail": { "type": "string" } + "slug": { "type": "string" }, + "pages": { + "type": "array", + "items": { + "url": { "type": "string" }, + "is_video": { "type": "boolean" } + } + } } } } } } -