From a365217890d716479b2bc4c29ef075500952b564 Mon Sep 17 00:00:00 2001 From: Andrew Miner Date: Fri, 30 Jan 2015 10:19:41 -0800 Subject: [PATCH] Add documentation & download links to mod page --- src/css/templates/mod_page.scss | 3 +- src/data/applied_energistics_2/mod.cg | 10 +++--- src/data/buildcraft/mod.cg | 10 +++--- src/data/industrial_craft_2/mod.cg | 10 +++--- src/data/minecraft/mod.cg | 10 +++--- src/data/thermal_expansion/mod.cg | 10 +++--- .../controllers/mod_page_controller.coffee | 32 +++++++++++-------- src/scripts/models/mod.coffee | 10 +++--- .../parser_versions/mod_parser_v1.coffee | 20 +++++++++--- src/templates/mod_page.jade | 2 ++ 10 files changed, 74 insertions(+), 43 deletions(-) diff --git a/src/css/templates/mod_page.scss b/src/css/templates/mod_page.scss index 22281719c..e910fdd9b 100644 --- a/src/css/templates/mod_page.scss +++ b/src/css/templates/mod_page.scss @@ -30,9 +30,10 @@ All rights reserved. margin-bottom: 1em; } - .homePage { + a { position: relative; width: 80%; margin: 0 10%; + display: none; p { font-family: $font-family-normal; diff --git a/src/data/applied_energistics_2/mod.cg b/src/data/applied_energistics_2/mod.cg index 78c3d3bd4..41c2cc6bd 100644 --- a/src/data/applied_energistics_2/mod.cg +++ b/src/data/applied_energistics_2/mod.cg @@ -1,8 +1,10 @@ schema: 1 -name: Applied Energistics 2 -author: AlgorithmX2 -description: A technical mod which adds an advanced, computer-based storage system -homePageUrl: http://ae-mod.info/ +name: Applied Energistics 2 +author: AlgorithmX2 +description: A technical mod which adds an advanced, computer-based storage system +homePageUrl: http://ae-mod.info/ +documentationUrl: http://ae-mod.info/ +downloadUrl: http://ae-mod.info/Downloads/ version: rv1-stable-1 diff --git a/src/data/buildcraft/mod.cg b/src/data/buildcraft/mod.cg index e5b1b1967..078e9ef32 100644 --- a/src/data/buildcraft/mod.cg +++ b/src/data/buildcraft/mod.cg @@ -1,8 +1,10 @@ schema: 1 -name: Buildcraft -author: SpaceToad -description: A technical mod which adds power generation, mining, and building systems -homePageUrl: http://www.mod-buildcraft.com +name: Buildcraft +author: SpaceToad +description: A technical mod which adds power generation, mining, and building systems +homePageUrl: http://www.mod-buildcraft.com +documentationUrl: http://www.mod-buildcraft.com/wiki/doku.php +downloadUrl: http://www.mod-buildcraft.com/download/ version: 6.2.6 diff --git a/src/data/industrial_craft_2/mod.cg b/src/data/industrial_craft_2/mod.cg index b33c47305..4c80f0153 100644 --- a/src/data/industrial_craft_2/mod.cg +++ b/src/data/industrial_craft_2/mod.cg @@ -1,9 +1,11 @@ schema: 1 -name: Industrial Craft 2 -author: Alblaka -description: A technical mod adding multi-tiered power systems, mining and ore processing, and powered armor -homePageUrl: http://wiki.industrial-craft.net/ +name: Industrial Craft 2 +author: Alblaka +description: A technical mod adding multi-tiered power systems, mining and ore processing, and powered armor +homePageUrl: http://wiki.industrial-craft.net/ +documentationUrl: http://wiki.industrial-craft.net/ +downloadUrl: http://jenkins.ic2.player.to/job/IC2_experimental/ version: experimental-2.2.663 version: classic-1.7.10-6 diff --git a/src/data/minecraft/mod.cg b/src/data/minecraft/mod.cg index b821f31ed..542099d00 100644 --- a/src/data/minecraft/mod.cg +++ b/src/data/minecraft/mod.cg @@ -1,8 +1,10 @@ schema: 1 -name: Minecraft -author: Mojang -description: The basic game by itself -homePageUrl: http://www.minecraft.net +name: Minecraft +author: Mojang +description: The basic game by itself +homePageUrl: http://www.minecraft.net +documentationUrl: http://minecraft.gamepedia.com/Minecraft_Wiki +downloadUrl: https://minecraft.net/store/minecraft version: 1.7.10 diff --git a/src/data/thermal_expansion/mod.cg b/src/data/thermal_expansion/mod.cg index 3bd83d648..6d0a0a762 100644 --- a/src/data/thermal_expansion/mod.cg +++ b/src/data/thermal_expansion/mod.cg @@ -1,8 +1,10 @@ schema: 1 -name: Thermal Expansion -author: Team CoFH -description: A technical mod which adds ore processing, item transportion, fluid handling, and many new ores. -homePageUrl: http://teamcofh.com/thermal-expansion/ +name: Thermal Expansion +author: Team CoFH +description: A technical mod which adds ore processing, item transportion, fluid handling, and many new ores. +homePageUrl: http://teamcofh.com/thermal-expansion/ +documentationUrl: http://teamcofh.com/thermal-expansion/ +downloadUrl: http://teamcofh.com/thermal-expansion/ version: 4.0.0B8-23 diff --git a/src/scripts/controllers/mod_page_controller.coffee b/src/scripts/controllers/mod_page_controller.coffee index d02835c0d..78069fda7 100644 --- a/src/scripts/controllers/mod_page_controller.coffee +++ b/src/scripts/controllers/mod_page_controller.coffee @@ -42,14 +42,15 @@ module.exports = class ModPageController extends BaseController # BaseController Overrides ##################################################################### onDidRender: -> - @$name = @$('.name') - @$byline = @$('.byline p') - @$description = @$('.description p') - @$homePageLink = @$('.homePage') - @$items = @$('.items .panel') - @$titleImage = @$('.titleImage img') - @$versionSelector = @$('select.version') - @$wikiLink = @$('.wiki') + @$name = @$('.name') + @$byline = @$('.byline p') + @$description = @$('.description p') + @$documentationLink = @$('.documentation') + @$downloadLink = @$('.download') + @$homePageLink = @$('.homePage') + @$items = @$('.items .panel') + @$titleImage = @$('.titleImage img') + @$versionSelector = @$('select.version') super @@ -59,7 +60,10 @@ module.exports = class ModPageController extends BaseController @$titleImage.attr 'src', (if @model? then Url.modLogoImage(modSlug:@model.slug) else '') @$description.html if @model? then @model.description else '' - @_refreshHomePageLink() + @_refreshLink @$homePageLink, @model.homePageUrl + @_refreshLink @$documentationLink, @model.documentationUrl + @_refreshLink @$downloadLink, @model.downloadUrl + @_refreshItems() @_refreshVersions() super @@ -90,12 +94,12 @@ module.exports = class ModPageController extends BaseController return modVersion - _refreshHomePageLink: -> - if @model.homePageUrl? - @$homePageLink.fadeIn duration:Duration.fast - @$homePageLink.attr 'href', @model.homePageUrl + _refreshLink: ($link, url)-> + if url? + $link.fadeIn duration:Duration.fast + $link.attr 'href', url else - @$homePageLink.fadeOut duration:Duration.fast + $link.fadeOut duration:Duration.fast _refreshItems: -> controllerIndex = 0 diff --git a/src/scripts/models/mod.coffee b/src/scripts/models/mod.coffee index 0cdd47978..6b7a2c1bd 100644 --- a/src/scripts/models/mod.coffee +++ b/src/scripts/models/mod.coffee @@ -16,10 +16,12 @@ module.exports = class Mod extends BaseModel constructor: (attributes={}, options={})-> if not attributes.slug? then throw new Error 'attributes.slug is required' - attributes.author ?= '' - attributes.description ?= '' - attributes.name ?= '' - attributes.homePageUrl ?= null + attributes.author ?= '' + attributes.description ?= '' + attributes.documentationUrl ?= null + attributes.downloadUrl ?= null + attributes.homePageUrl ?= null + attributes.name ?= '' super attributes, options @_activeModVersion = null diff --git a/src/scripts/models/parser_versions/mod_parser_v1.coffee b/src/scripts/models/parser_versions/mod_parser_v1.coffee index 90e7716ed..d987e0a69 100644 --- a/src/scripts/models/parser_versions/mod_parser_v1.coffee +++ b/src/scripts/models/parser_versions/mod_parser_v1.coffee @@ -37,6 +37,16 @@ module.exports = class ModParserV2 extends CommandParserVersionBase @_rawData.description = description + _command_documentationUrl: (documentationUrl)-> + if @_rawData.documentationUrl? then throw new Error 'duplicate declaration of "documentationUrl"' + if documentationUrl.length is 0 then throw new Error 'documentationUrl cannot be empty (omit it instead)' + @_rawData.documentationUrl = documentationUrl + + _command_downloadUrl: (downloadUrl)-> + if @_rawData.downloadUrl? then throw new Error 'duplicate declaration of "downloadUrl"' + if downloadUrl.length is 0 then throw new Error 'downloadUrl cannot be empty (omit it instead)' + @_rawData.downloadUrl = downloadUrl + _command_name: (name)-> if @_rawData.name? then throw new Error 'duplicate declaration of "name"' if name.length is 0 then throw new Error '"name" cannot be empty' @@ -61,10 +71,12 @@ module.exports = class ModParserV2 extends CommandParserVersionBase if not rawData.homePageUrl? then throw new Error 'the "homePageUrl" declaration is required' if not rawData.versions? then throw new Error 'at least one "version" declaration is required' - model.author = rawData.author if rawData.author? - model.description = rawData.description if rawData.description? - model.name = rawData.name - model.homePageUrl = rawData.homePageUrl + model.author = rawData.author if rawData.author? + model.description = rawData.description if rawData.description? + model.documentationUrl = rawData.documentationUrl if rawData.documentationUrl? + model.downloadUrl = rawData.downloadUrl if rawData.downloadUrl? + model.name = rawData.name + model.homePageUrl = rawData.homePageUrl for version in rawData.versions model.addModVersion new ModVersion modSlug:model.slug, version:version diff --git a/src/templates/mod_page.jade b/src/templates/mod_page.jade index 0aa63906f..0ea465e33 100644 --- a/src/templates/mod_page.jade +++ b/src/templates/mod_page.jade @@ -10,6 +10,8 @@ .titleImage: img select.version a.homePage(target="new"): p Offical Home Page + a.documentation(target="new"): p Documentation + a.download(target="new"): p Download .mainBody h1.name