From 43dfec7e0420d6bf607a8085ab0e3f64de35b5f8 Mon Sep 17 00:00:00 2001 From: Andrew Miner Date: Sat, 28 Feb 2015 18:52:34 -0800 Subject: [PATCH] Add initial version of the home page --- src/css/classes.scss | 59 +++++++- src/css/templates/home_page.scss | 56 ++++++++ src/css/templates/index.scss | 1 + src/css/templates/item_page.scss | 39 ++--- src/css/templates/mod_page.scss | 27 ---- src/pages/includes/_header.jade | 4 +- .../controllers/craft_page_controller.coffee | 6 +- .../controllers/home_page_controller.coffee | 22 +++ .../whats_new_page_controller.coffee | 16 --- src/scripts/crafting_guide_router.coffee | 8 +- src/scripts/models/craft_page.coffee | 2 +- src/templates/home_page.jade | 134 ++++++++++++++++++ src/templates/whats_new_page.jade | 8 -- 13 files changed, 284 insertions(+), 98 deletions(-) create mode 100644 src/css/templates/home_page.scss create mode 100644 src/scripts/controllers/home_page_controller.coffee delete mode 100644 src/scripts/controllers/whats_new_page_controller.coffee create mode 100644 src/templates/home_page.jade delete mode 100644 src/templates/whats_new_page.jade diff --git a/src/css/classes.scss b/src/css/classes.scss index afc0e7112..64c06cfa4 100644 --- a/src/css/classes.scss +++ b/src/css/classes.scss @@ -22,6 +22,48 @@ All rights reserved. .error-new { background: $color-error-new !important; } +.sidebar { + position: relative; width: 18.75%; + + display: inline-block; + padding: 1em; + vertical-align: top; + + .titleImage { + position: relative; height: 16em; width: 16em; + margin-bottom: 2em; + + a { + position: relative; width: 100%; + + img { + @include pixel-image; + } + } + } + + .externalLink { + position: relative; width: 80%; + margin: 0 10%; + display: none; + + p { + font-family: $font-family-normal; + font-size: $font-size-normal; + text-align: center; + } + } +} + +.mainBody { + position: relative; width: 81.25%; + + display: inline-block; + padding: 1em; + padding-top: 2em; + vertical-align: top; +} + .section { margin-top: 3em; @@ -31,14 +73,19 @@ All rights reserved. margin-bottom: 0.5em; } + h3 { + font-family: $font-family-header; + font-size: $font-size-normal; + margin: 2em 0 0 0.5em; + } + + .entry { + position: relative; width: 100%; + padding: 0 2em; + } + .panel { background: white; padding: 1em; - - & > div { - position: relative; width: 33%; - display: inline-block; - padding: 0.5em; - } } } \ No newline at end of file diff --git a/src/css/templates/home_page.scss b/src/css/templates/home_page.scss new file mode 100644 index 000000000..eeca3324c --- /dev/null +++ b/src/css/templates/home_page.scss @@ -0,0 +1,56 @@ +/* +Crafting Guide - home_page.scss + +Copyright (C) 2015 by Redwood Labs +All rights reserved. +*/ + +.view__home_page { + h2 { + font-size: $font-size-x-large; + } + + p { + font-family: $font-family-normal; + font-size: $font-size-normal; + line-height: 1.25em; + margin: 1em 0; + + &:first-child { + margin-top: 0; + } + + &:last-child { + margin-bottom: 0; + } + } + + li { + font-family: $font-family-normal; + font-size: $font-size-normal; + margin-bottom: 0.5em; + } + + ol { + list-style-type: decimal; + margin: 0.5em 4em 2em 4em; + } + + ul { + list-style: disc outside; + margin: 0.5em 4em 2em 4em; + } + + .intro { + font-size: $font-size-large; + } + + .section:first-child { + margin-top: 0; + } + + .section-link { + color: $color-active; + font-weight: bold; + } +} diff --git a/src/css/templates/index.scss b/src/css/templates/index.scss index dbdd29cb5..4fc65273c 100644 --- a/src/css/templates/index.scss +++ b/src/css/templates/index.scss @@ -10,6 +10,7 @@ All rights reserved. @import 'crafting_table'; @import 'feedback'; @import 'full_recipe'; +@import 'home_page'; @import 'inventory'; @import 'inventory_table'; @import 'item'; diff --git a/src/css/templates/item_page.scss b/src/css/templates/item_page.scss index 311f63044..c72bac015 100644 --- a/src/css/templates/item_page.scss +++ b/src/css/templates/item_page.scss @@ -13,38 +13,7 @@ All rights reserved. display: inline-block; } - .sidebar { - position: relative; width: 18.75%; - padding: 1em; - - .titleImage { - position: relative; height: 16em; width: 16em; - margin-bottom: 2em; - - img { - position: relative; width: 100%; - @include pixel-image; - } - } - - a { - position: relative; width: 80%; - margin: 0 10%; - display: none; - - p { - font-family: $font-family-normal; - font-size: $font-size-normal; - text-align: center; - } - } - } - .mainBody { - position: relative; width: 81.25%; - padding: 1em; - padding-top: 2em; - h1.name { font-family: $font-family-header; font-size: $font-size-x-large; @@ -92,4 +61,12 @@ All rights reserved. display: none; } } + + .panel { + & > div { + position: relative; width: 33%; + display: inline-block; + padding: 0.5em; + } + } } diff --git a/src/css/templates/mod_page.scss b/src/css/templates/mod_page.scss index ec86e85e8..c7e17e46e 100644 --- a/src/css/templates/mod_page.scss +++ b/src/css/templates/mod_page.scss @@ -14,42 +14,15 @@ All rights reserved. } .sidebar { - position: relative; width: 18.75%; - padding: 1em; - - .titleImage { - position: relative; height: 16em; width: 16em; - margin-bottom: 2em; - - img { - position: relative; width: 100%; - @include pixel-image; - } - } .version { position: relative; width: 80%; margin: 0 10%; margin-bottom: 1em; } - - a { - position: relative; width: 80%; - margin: 0 10%; - display: none; - - p { - font-family: $font-family-normal; - font-size: $font-size-normal; - text-align: center; - } - } } .mainBody { - position: relative; width: 81.25%; - padding: 1em; - padding-top: 2em; .name { font-family: $font-family-header; diff --git a/src/pages/includes/_header.jade b/src/pages/includes/_header.jade index 6ebfa0435..f59b0ce21 100644 --- a/src/pages/includes/_header.jade +++ b/src/pages/includes/_header.jade @@ -12,8 +12,8 @@ .divider.bottom .navBar - a(data-page="whats_new", href="/") - p What's New? + a(data-page="home", href="/") + p Home .dot a(data-page="configure", href="/configure") p Configure diff --git a/src/scripts/controllers/craft_page_controller.coffee b/src/scripts/controllers/craft_page_controller.coffee index 28e67cdf4..a06dd1a10 100644 --- a/src/scripts/controllers/craft_page_controller.coffee +++ b/src/scripts/controllers/craft_page_controller.coffee @@ -10,7 +10,7 @@ CraftingTableController = require './crafting_table_controller' {Event} = require '../constants' ImageLoader = require './image_loader' InventoryController = require './inventory_controller' -CraftingPage = require '../models/craft_page' +CraftPage = require '../models/craft_page' ModPackController = require './mod_pack_controller' NameFinder = require '../models/name_finder' Storage = require '../models/storage' @@ -19,13 +19,13 @@ Storage = require '../models/storage' ######################################################################################################################## -module.exports = class CraftingPageController extends BaseController +module.exports = class CraftPageController extends BaseController constructor: (options={})-> if not options.imageLoader? then throw new Error 'options.imageLoader is required' if not options.modPack? then throw new Error 'options.modPack is required' - options.model ?= new CraftingPage modPack:options.modPack + options.model ?= new CraftPage modPack:options.modPack options.storage ?= new Storage storage:window.localStorage options.templateName = 'craft_page' super options diff --git a/src/scripts/controllers/home_page_controller.coffee b/src/scripts/controllers/home_page_controller.coffee new file mode 100644 index 000000000..febf81a83 --- /dev/null +++ b/src/scripts/controllers/home_page_controller.coffee @@ -0,0 +1,22 @@ +### +Crafting Guide - home_page_controller.coffee + +Copyright (c) 2015 by Redwood Labs +All rights reserved. +### + +BaseController = require './base_controller' + +######################################################################################################################## + +module.exports = class HomeController extends BaseController + + constructor: (options={})-> + options.templateName = 'home_page' + super options + + # Backbone.View Overrides ###################################################################### + + events: -> + return _.extend super, + 'click .mainBody a': 'routeLinkClick' diff --git a/src/scripts/controllers/whats_new_page_controller.coffee b/src/scripts/controllers/whats_new_page_controller.coffee deleted file mode 100644 index 9adcea159..000000000 --- a/src/scripts/controllers/whats_new_page_controller.coffee +++ /dev/null @@ -1,16 +0,0 @@ -### -Crafting Guide - whats_new_page_controller.coffee - -Copyright (c) 2015 by Redwood Labs -All rights reserved. -### - -BaseController = require './base_controller' - -######################################################################################################################## - -module.exports = class WhatsNewController extends BaseController - - constructor: (options={})-> - options.templateName = 'whats_new_page' - super options diff --git a/src/scripts/crafting_guide_router.coffee b/src/scripts/crafting_guide_router.coffee index b2fc38573..d33a982f3 100644 --- a/src/scripts/crafting_guide_router.coffee +++ b/src/scripts/crafting_guide_router.coffee @@ -23,7 +23,7 @@ ModPageController = require './controllers/mod_page_controller' Storage = require './models/storage' {Url} = require './constants' UrlParams = require './url_params' -WhatsNewPageController = require './controllers/whats_new_page_controller' +HomePageController = require './controllers/home_page_controller' ######################################################################################################################## @@ -64,7 +64,7 @@ module.exports = class CraftingGuideRouter extends Backbone.Router @_recordPageView() routes: - '': 'route__whats_new' + '': 'route__home' 'browse': 'route__browse' 'browse/:modSlug': 'route__browseMod' 'browse/:modSlug/:itemSlug': 'route__browseModItem' @@ -78,13 +78,13 @@ module.exports = class CraftingGuideRouter extends Backbone.Router # Route Methods ################################################################################ - route__whats_new: -> + route__home: -> params = new UrlParams recipeName:{type:'string'}, count:{type:'integer'} if params.recipeName? @deprecated__v1_root params return - @_setPage 'whats_new', new WhatsNewPageController _.extend {}, @_defaultOptions + @_setPage 'home', new HomePageController _.extend {}, @_defaultOptions route__browse: -> @_setPage 'browse', new BrowsePageController _.extend {}, @_defaultOptions diff --git a/src/scripts/models/craft_page.coffee b/src/scripts/models/craft_page.coffee index 2fd8687e8..2fafb162d 100644 --- a/src/scripts/models/craft_page.coffee +++ b/src/scripts/models/craft_page.coffee @@ -14,7 +14,7 @@ ModPack = require './mod_pack' ######################################################################################################################## -module.exports = class CraftingPage extends BaseModel +module.exports = class CraftPage extends BaseModel constructor: (attributes={}, options={})-> attributes.modPack ?= new ModPack diff --git a/src/templates/home_page.jade b/src/templates/home_page.jade new file mode 100644 index 000000000..f46995f48 --- /dev/null +++ b/src/templates/home_page.jade @@ -0,0 +1,134 @@ +//- +//- Crafting Guide - home_page.jade +//- +//- Copyright (c) 2015 by Redwood Labs +//- All rights reserved. +//- + +.view__home_page + .sidebar + .titleImage + .titleImage: img(src='/data/buildcraft/logo.png') + .titleImage: img(src='/data/industrial_craft_2/logo.png') + .titleImage: img(src='/data/applied_energistics_2/logo.png') + .titleImage: img(src='/data/thermal_expansion/logo.png') + .titleImage: img(src='/data/enderio/logo.png') + .titleImage: img(src='/data/railcraft/logo.png') + + .mainBody + .section + h2 Welcome! + .panel + .entry + p.intro. + Crafting Guide is the ultimate resource for Minecraft. Whether you're punching trees or building + reactors, you'll find everything you need right here. + ul + li.intro Can't remember the recipe for a BuildCraft Quarry? + li.intro Curious to see all the blocks added by Railcraft? + li.intro Want step-by-step directions for making a full IC2 QuantumSuit? + p.intro No problem. Crafting Guide can do it all. + p. + Configure which mods you're using, and the entire + site will update itself to your mod pack. + p. + Browse through your own customized item catalog to + see full recipe lists, related items, recipes added by each tool, and even which items can be + made from the item you're looking at. + p. + Craft any number of items from your mod pack to see a + full list of raw ingredients, and recipe-by-recipe instructions on how to make everything on + your list. No item is too complex, and no build is too big. + + .section + h2 What's new? + .panel + h3 2015-02-28 + .entry + p. + This release delivers the second major expansion of Crafting Guide! Here's the list of what's + new: + ul + li New home page! + li Moved the crafting planner (the old home page) to its own Craft page + li Moved mod pack management to the new Configure page + li Added a Browse page where you can peruse the list of supported mods + + h3 2015-02-26 + .entry + p. + This release adds a new section to the item pages called "Used as Tool to Make". The new section + shows all the other items which can be made by that tool. For example, the IC2 Macerator shows + a bunch of things like Iron Dust, Gold Dust, etc. + + h3 2015-02-24 + .entry + p. + This release changes the crafting page to let you modify the quantity of items in the "Items You + Want" and "Items You Have" section. Let's say you want to make 64 Potions of Healing. You add "Potion of Healing" just + as as you always did, but now you can click on the quantity to change it to whatever you want. + p. + At the same time, I've changed the quantity field to allow up to 9999 of any item. Have fun with + those huge builds! + + h3 2015-02-22 + .entry + p. + Woo hoo! Or, should I say: Choo choo! I just added support for RailCraft! I also pushed up lots + of performance improvements (55% faster at computing crafting plans)! Hopefully, you won't + really notice anything except that entering new items and computing really complicated crafting + plans don't take so long. + + h3 2015-02-19 + .entry + p. + I just made some major updates to the crafting algorithm. Without getting into details, I'll say + that there are a few things you should notice: + ol + li it will favor recipes which produce more of an item versus those which produce fewer (e.g., + | IC2 plates get made with the Block Cutter instead of the Forge Hammer) + li metal ingots will frequently (but not always) get crafted using 2x recipes instead of + | smelting ore directly in a furnace + li recipes for vanilla items added by mods are now available (e.g., smelting Iron Dust into Iron + | ingots) + + h3 2015-02-10 + .entry + p. + I just pushed up some fixes to avoid confusing various items of the same name from different + mods. The best example of this are the two Wrenches from Buildcraft and IC2, but there are a + bunch of others. + + h3 2015-02-09 + .entry + p. + This release fixes a number of small issues and improves performance in a number of places. Most + especially, all links within the site have been changed to update the page in place without the + need to re-download anything. This should make browsing between item pages much faster. + + h3 2015-02-08 + .entry + p. + This is the singlest largest expansion of the website yet! Each item from each mod now has its + own page! This will expand in the future, but for now this shows all the recipes for the item as + well as all the closely related items and the others items that can be made using the item. + p. + This also changes things so that links to Crafting Guide from other sites will first go to the + item's page (instead of to the crafting plan). Not to worry though... there's still a direct + link from each item to the full crafting plan for that item. + + h3 2015-02-02 + .entry + p. + Crafting Guide now has support for EnderIO! I tend to add new mods in order of those with the + most votes, so remember to suggest your favorites! + + h3 2015-01-30 + .entry + p. + I've just updated the mod pages to allow the items to be grouped into logical sections. This + makes it a lot easier to get a feel for what kinds of things a mod adds and it makes it a lot + easier to find things. diff --git a/src/templates/whats_new_page.jade b/src/templates/whats_new_page.jade deleted file mode 100644 index bfd9df8b6..000000000 --- a/src/templates/whats_new_page.jade +++ /dev/null @@ -1,8 +0,0 @@ -//- -//- Crafting Guide - whats_new_page.jade -//- -//- Copyright (c) 2015 by Redwood Labs -//- All rights reserved. -//- - -h1 What's new?