Initial version of mod detail pages

This commit is contained in:
Andrew Miner
2015-01-29 10:04:11 -08:00
parent 71b25a8a16
commit 332f64abea
22 changed files with 392 additions and 111 deletions
+3 -1
View File
@@ -57,10 +57,12 @@ $color-background: #AAC9FF;
$color-background-panel: #FFFFFF;
$color-background-toolbar: rgba(255, 255, 255, 0.75);
$color-content: rgba(230, 230, 230, 0.90);
$color-error-new: #CD0000;
$color-error: #F3C2C2;
$color-error-new: #CD0000;
$color-footer: #3D1D09;
$color-footer-text: #FFFFFF;
$color-link: #0000FF;
$color-text: #000000;
// Z-Index Layers //////////////////////////////////////////////////////////////////////////////////
+2
View File
@@ -9,8 +9,10 @@ All rights reserved.
@import 'crafting_table';
@import 'feedback';
@import 'inventory';
@import 'item';
@import 'item_page';
@import 'mod';
@import 'mod_pack';
@import 'mod_page';
@import 'recipe';
@import 'stack';
+46
View File
@@ -0,0 +1,46 @@
/*
Crafting Guide - item.scss
Copyright (c) 2015 by Redwood Labs
All rights reserved.
*/
.view__item {
a {
text-decoration: none;
width: 100%;
&:hover {
.itemName {
color: $color-link;
text-decoration: underline;
}
table {
background: $color-gray-faint;
}
}
}
table {
width: 100%;
}
td.itemName {
color: $color-text;
font-family: $font-family-normal;
font-size: $font-size-normal;
font-weight: bold;
padding-left: 1em;
text-align: left;
vertical-align: middle;
}
td.itemIcon {
width: 3.6em;
img {
height: 3.6em; width: 3.6em;
}
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ All rights reserved.
p {
font-family: $font-family-normal;
font-size: $font-size-normal;
// text-decoration: underline;
text-decoration: underline;
}
}
+93
View File
@@ -0,0 +1,93 @@
/*
Crafting Guide - mod_page.scss
Copyright (c) 2014 by Redwood Labs
All rights reserved.
*/
.view__mod_page {
& > div {
vertical-align: top;
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%;
}
}
.version {
position: relative; width: 80%;
margin: 0 10%;
margin-bottom: 1em;
}
.homePage {
position: relative; width: 80%;
margin: 0 10%;
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;
font-size: $font-size-x-large;
margin: 0;
}
.byline {
margin: 0.25em 0 2em 0;
p {
font-family: $font-family-normal;
font-size: $font-size-small;
font-style: italic;
}
}
.description {
margin-bottom: 4em;
p {
font-family: $font-family-normal;
font-size: $font-size-large;
}
}
.section {
h2 {
font-family: $font-family-header;
font-size: $font-size-large;
}
.panel {
background: white;
padding: 1em;
& > div {
position: relative; width: 33%;
display: inline-block;
padding: 0.5em;
}
}
}
}
}
+1 -1
View File
@@ -3,6 +3,6 @@ schema: 1
name: Applied Energistics 2
author: AlgorithmX2
description: A technical mod which adds an advanced, computer-based storage system
url: http://www.mod-buildcraft.com
homePageUrl: http://www.mod-buildcraft.com
version: rv1-stable-1
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

+1 -1
View File
@@ -3,6 +3,6 @@ schema: 1
name: Buildcraft
author: SpaceToad
description: A technical mod which adds power generation, mining, and building systems
url: http://www.mod-buildcraft.com
homePageUrl: http://www.mod-buildcraft.com
version: 6.2.6
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+1 -1
View File
@@ -3,7 +3,7 @@ schema: 1
name: Industrial Craft 2
author: Alblaka
description: A technical mod adding multi-tiered power systems, mining and ore processing, and powered armor
url: http://wiki.industrial-craft.net/
homePageUrl: http://wiki.industrial-craft.net/
version: experimental-2.2.663
version: classic-1.7.10-6
+1 -1
View File
@@ -3,6 +3,6 @@ schema: 1
name: Minecraft
author: Mojang
description: The basic game by itself
url: http://www.minecraft.net
homePageUrl: http://www.minecraft.net
version: 1.7.10
+1 -1
View File
@@ -3,6 +3,6 @@ schema: 1
name: Thermal Expansion
author: Team CoFH
description: A technical mod which adds ore processing, item transportion, fluid handling, and many new ores.
url: http://teamcofh.com/thermal-expansion/
homePageUrl: http://teamcofh.com/thermal-expansion/
version: 4.0.0B8-23
+35 -43
View File
@@ -514,10 +514,10 @@
<key>Text</key>
<string>{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue255;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
\f0\b\fs36 \cf2 Quarry}</string>
\f0\b\fs36 \cf0 Quarry}</string>
<key>VerticalPad</key>
<integer>0</integer>
</dict>
@@ -950,7 +950,7 @@ by SpaceToad}</string>
<integer>0</integer>
<key>Text</key>
<string>{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
\cocoascreenfonts1{\fonttbl\f0\fnil\fcharset0 PressStart2P-Regular;}
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
@@ -1082,15 +1082,14 @@ by SpaceToad}</string>
dWx0cmljZXMgcG9zdWVyZSBjdWJpbGlhIEN1cmFlOyBW
ZXN0aWJ1bHVtIGVmZmljaXR1ciB1bHRyaWNlcyBjb21t
b2RvhoQCaUkBgaYBkoSEhAxOU0RpY3Rpb25hcnkAlIQB
aQWShJaWBk5TRm9udIaShISEBk5TRm9udB6UmRyEBVsy
OGNdBgAAABQAAAD//kgAZQBsAHYAZQB0AGkAYwBhAIQB
Zg6EAWMAnQGdAJ0AhpKElpYGTlNLZXJuhpKEhIQITlNO
dW1iZXIAhIQHTlNWYWx1ZQCUhAEqhIQBZKEAhpKElpYH
TlNDb2xvcoaShISEB05TQ29sb3IAlJ0ChARmZmZmAAAA
AYaShJaWEE5TUGFyYWdyYXBoU3R5bGWGkoSEhBBOU1Bh
aQSShJaWEE5TUGFyYWdyYXBoU3R5bGWGkoSEhBBOU1Bh
cmFncmFwaFN0eWxlAJSEBENDQFMAAISEhAdOU0FycmF5
AJSZAIaBIAqEBFszZl0OJIPNzEw9hpKElpYNTlNTdHJv
a2VDb2xvcoaShKOdA4QCZmYAAYaGhg==
AJSZAIaBIAqEBFszZl0OJIPNzEw9hpKElpYHTlNDb2xv
coaShISEB05TQ29sb3IAlIQBYwKEBGZmZmYAAAABhpKE
lpYGTlNGb250hpKEhIQGTlNGb250HpSZHIQFWzI4Y10G
AAAAFAAAAP/+SABlAGwAdgBlAHQAaQBjAGEAhAFmDp8A
nwGfAJ8AhpKElpYGTlNLZXJuhpKEhIQITlNOdW1iZXIA
hIQHTlNWYWx1ZQCUhAEqhIQBZKcAhoaG
</data>
<key>Text</key>
<string>{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
@@ -1192,7 +1191,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ac efficitur tort
<integer>0</integer>
<key>Text</key>
<string>{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
\cocoascreenfonts1{\fonttbl\f0\fnil\fcharset0 PressStart2P-Regular;}
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
@@ -1215,7 +1214,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ac efficitur tort
<key>ManualSizeImage</key>
<string>YES</string>
<key>Offset</key>
<string>{0.01932367192046051, -0}</string>
<string>{0.019323671920460469, -0}</string>
<key>Shape</key>
<string>Rectangle</string>
<key>Style</key>
@@ -1230,7 +1229,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ac efficitur tort
<key>ImageSizing</key>
<integer>0</integer>
<key>Offset</key>
<string>{0.01932367192046051, -0}</string>
<string>{0.019323671920460469, -0}</string>
</dict>
<key>shadow</key>
<dict>
@@ -1634,16 +1633,15 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ac efficitur tort
BAtzdHJlYW10eXBlZIHoA4QBQISEhBJOU0F0dHJpYnV0
ZWRTdHJpbmcAhIQITlNPYmplY3QAhZKEhIQITlNTdHJp
bmcBlIQBKwxieSBTcGFjZVRvYWSGhAJpSQEMkoSEhAxO
U0RpY3Rpb25hcnkAlIQBaQWShJaWBk5TS2VyboaShISE
CE5TTnVtYmVyAISEB05TVmFsdWUAlIQBKoSEAWSdAIaS
hJaWBk5TRm9udIaShISEBk5TRm9udB6UmSyEBVs0NGNd
BgAAACQAAAD//kgAZQBsAHYAZQB0AGkAYwBhAC0ATwBi
AGwAaQBxAHUAZQCEAWYMhAFjAKEBoQChAIaShJaWDU5T
U3Ryb2tlQ29sb3KGkoSEhAdOU0NvbG9yAJShA4QCZmYA
AYaShJaWEE5TUGFyYWdyYXBoU3R5bGWGkoSEhBBOU1Bh
cmFncmFwaFN0eWxlAJSEBENDQFMAAISEhAdOU0FycmF5
AJSZAIaBIAqEBFszZl0OJIPNzEw9hpKElpYHTlNDb2xv
coaShKOhAoQEZmZmZgAAAAGGhoY=
U0RpY3Rpb25hcnkAlIQBaQSShJaWEE5TUGFyYWdyYXBo
U3R5bGWGkoSEhBBOU1BhcmFncmFwaFN0eWxlAJSEBEND
QFMAAISEhAdOU0FycmF5AJSZAIaBIAqEBFszZl0OJIPN
zEw9hpKElpYHTlNDb2xvcoaShISEB05TQ29sb3IAlIQB
YwKEBGZmZmYAAAABhpKElpYGTlNGb250hpKEhIQGTlNG
b250HpSZLIQFWzQ0Y10GAAAAJAAAAP/+SABlAGwAdgBl
AHQAaQBjAGEALQBPAGIAbABpAHEAdQBlAIQBZgyfAJ8B
nwCfAIaShJaWBk5TS2VyboaShISECE5TTnVtYmVyAISE
B05TVmFsdWUAlIQBKoSEAWSnAIaGhg==
</data>
<key>Text</key>
<string>{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
@@ -2024,7 +2022,7 @@ BuildCraft 6.1 Preview: More Robots!}</string>
<integer>0</integer>
<key>Text</key>
<string>{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
\cocoascreenfonts1{\fonttbl\f0\fnil\fcharset0 PressStart2P-Regular;}
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
@@ -2156,17 +2154,15 @@ BuildCraft 6.1 Preview: More Robots!}</string>
dWx0cmljZXMgcG9zdWVyZSBjdWJpbGlhIEN1cmFlOyBW
ZXN0aWJ1bHVtIGVmZmljaXR1ciB1bHRyaWNlcyBjb21t
b2RvhoQCaUkBgaYBkoSEhAxOU0RpY3Rpb25hcnkAlIQB
aQaShJaWBk5TS2VyboaShISECE5TTnVtYmVyAISEB05T
VmFsdWUAlIQBKoSEAWSdAIaShJaWDU5TU3Ryb2tlQ29s
b3KGkoSEhAdOU0NvbG9yAJSEAWMChARmZmZmAAAAAYaS
hJaWBk5TRm9udIaShISEBk5TRm9udB6UmRyEBVsyOGNd
BgAAABQAAAD//kgAZQBsAHYAZQB0AGkAYwBhAIQBZg6f
AJ8BnwCfAIaShJaWB05TQ29sb3KGkp+ShJaWEE5TUGFy
YWdyYXBoU3R5bGWGkoSEhBdOU011dGFibGVQYXJhZ3Jh
cGhTdHlsZQCEhBBOU1BhcmFncmFwaFN0eWxlAJSEBEND
QFMAAISEhA5OU011dGFibGVBcnJheQCEhAdOU0FycmF5
aQWShJaWBk5TRm9udIaShISEBk5TRm9udB6UmRyEBVsy
OGNdBgAAABQAAAD//kgAZQBsAHYAZQB0AGkAYwBhAIQB
Zg6EAWMAnQGdAJ0AhpKElpYGTlNLZXJuhpKEhIQITlNO
dW1iZXIAhIQHTlNWYWx1ZQCUhAEqhIQBZKEAhpKElpYH
TlNDb2xvcoaShISEB05TQ29sb3IAlJ0ChARmZmZmAAAA
AYaShJaWEE5TUGFyYWdyYXBoU3R5bGWGkoSEhBBOU1Bh
cmFncmFwaFN0eWxlAJSEBENDQFMAAISEhAdOU0FycmF5
AJSZAIaBIAqEBFszZl0OJIPNzEw9hpKElpYNTlNTdHJv
a2VXaWR0aIaShJucnZ0AhoaG
a2VDb2xvcoaShKOdA4QCZmYAAYaGhg==
</data>
<key>Text</key>
<string>{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
@@ -2176,7 +2172,7 @@ BuildCraft 6.1 Preview: More Robots!}</string>
\pard\pardeftab720\sl280
\f0\fs28 \cf2 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \strokec2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ac efficitur tortor. Nulla eget molestie metus. Cras vulputate felis ut lectus iaculis, nec iaculis dui auctor. Sed nisl nisl, feugiat mollis elit vel, gravida euismod est. Vivamus porttitor tempus euismod. Proin at condimentum nibh. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum efficitur ultrices commodo}</string>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ac efficitur tortor. Nulla eget molestie metus. Cras vulputate felis ut lectus iaculis, nec iaculis dui auctor. Sed nisl nisl, feugiat mollis elit vel, gravida euismod est. Vivamus porttitor tempus euismod. Proin at condimentum nibh. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum efficitur ultrices commodo}</string>
<key>VerticalPad</key>
<integer>0</integer>
</dict>
@@ -2263,7 +2259,7 @@ BuildCraft 6.1 Preview: More Robots!}</string>
<integer>0</integer>
<key>Text</key>
<string>{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
\cocoascreenfonts1{\fonttbl\f0\fnil\fcharset0 PressStart2P-Regular;}
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
@@ -2478,7 +2474,7 @@ BuildCraft 6.1 Preview: More Robots!}</string>
<integer>10</integer>
<key>Text</key>
<string>{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
\cocoascreenfonts1{\fonttbl\f0\fnil\fcharset0 PressStart2P-Regular;}
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
@@ -2811,7 +2807,7 @@ BuildCraft 6.1 Preview: More Robots!}</string>
<key>MasterSheets</key>
<array/>
<key>ModificationDate</key>
<string>2015-01-19 19:14:03 +0000</string>
<string>2015-01-28 21:33:51 +0000</string>
<key>Modifier</key>
<string>Andrew Miner</string>
<key>NotesVisible</key>
@@ -2891,8 +2887,6 @@ BuildCraft 6.1 Preview: More Robots!}</string>
<string>Canvas 1</string>
</dict>
</array>
<key>Frame</key>
<string>{{558, -0}, {1998, 1417}}</string>
<key>ListView</key>
<true/>
<key>OutlineWidth</key>
@@ -2905,8 +2899,6 @@ BuildCraft 6.1 Preview: More Robots!}</string>
<true/>
<key>SidebarWidth</key>
<integer>168</integer>
<key>VisibleRegion</key>
<string>{{-320, 0}, {1801, 1275}}</string>
<key>Zoom</key>
<real>1</real>
<key>ZoomValues</key>
+7 -6
View File
@@ -49,12 +49,13 @@ ModelState.loading = 'loading'
ModelState.loaded = 'loaded'
ModelState.failed = 'failed'
exports.Url = Url = {}
Url.itemIcon = _.template "/data/<%= modSlug %>/<%= modVersion %>/images/<%= slug %>.png"
Url.item = _.template "/item/<%= slug %>"
Url.mod = _.template "/mod/<%= modSlug %>"
Url.modData = _.template "/data/<%= modSlug %>/mod.cg"
Url.modVersion = _.template "/data/<%= modSlug %>/<%= modVersion %>/mod-version.cg"
exports.Url = Url = {}
Url.itemIcon = _.template "/data/<%= modSlug %>/<%= modVersion %>/images/<%= slug %>.png"
Url.item = _.template "/item/<%= slug %>"
Url.mod = _.template "/mod/<%= modSlug %>"
Url.modData = _.template "/data/<%= modSlug %>/mod.cg"
Url.modVersion = _.template "/data/<%= modSlug %>/<%= modVersion %>/mod-version.cg"
Url.modLogoImage = _.template "/data/<%= modSlug %>/logo.png"
exports.UrlParam = UrlParam = {}
UrlParam.quantity = 'count'
@@ -0,0 +1,36 @@
###
Crafting Guide - item_controller.coffee
Copyright (c) 2015 by Redwood Labs
All rights reserved.
###
BaseController = require './base_controller'
{Url} = require '../constants'
########################################################################################################################
module.exports = class ItemController extends BaseController
constructor: (options={})->
if not options.model? then throw new Error 'options.model is required'
if not options.modPack? then throw new Error 'options.modPack is required'
options.templateName = 'item'
super options
@_modPack = options.modPack
# BaseController Overrides #####################################################################
onDidRender: ->
@$icon = @$('img')
@$name = @$('.itemName')
@$nameLink = @$('a')
super
refresh: ->
display = @_modPack.findItemDisplay @model.slug
@$icon.attr 'src', Url.itemIcon display
@$name.html display.itemName
@$nameLink.attr 'href', Url.item display
@@ -37,6 +37,7 @@ module.exports = class ModController extends BaseController
@$nameLink = @$('.name a')
@$nameText = @$('.name p')
@$description = @$('.description p')
super
refresh: ->
@@ -59,7 +60,7 @@ module.exports = class ModController extends BaseController
option.attr 'selected', 'selected'
@$version.append option
# @$nameLink.attr 'href', Url.mod modSlug:@model.slug
@$nameLink.attr 'href', Url.mod modSlug:@model.slug
@$nameText.html @model.name
@$description.html @model.description
@@ -5,10 +5,12 @@ Copyright (c) 2015 by Redwood Labs
All rights reserved.
###
BaseController = require './base_controller'
{Duration} = require '../constants'
ModPack = require '../models/mod_pack'
RecipeController = require './recipe_controller'
BaseController = require './base_controller'
{Duration} = require '../constants'
Mod = require '../models/mod'
ModPack = require '../models/mod_pack'
ItemController = require './item_controller'
{Url} = require '../constants'
########################################################################################################################
@@ -20,52 +22,117 @@ module.exports = class ModPageController extends BaseController
options.templateName = 'mod_page'
super options
@_modPack = options.modPack
@_recipeControllers = []
@_delayStep = options.delayStep
@_delayStep = options.delayStep
@_effectiveModVersion = null
@_itemControllers = []
@_modPack = options.modPack
Object.defineProperties this,
effectiveModVersion: {get:@_getEffectiveModVersion}
# Event Methods ################################################################################
onVersionChanged: ->
version = @$versionSelector.val()
logger.debug "new version: #{version}"
modVersion = @model.getModVersion version
logger.debug "new mod version: #{modVersion}"
@_effectiveModVersion = modVersion
if modVersion? then modVersion.fetch()
@refresh()
# BaseController Overrides #####################################################################
onDidRender: ->
@$title = @$('h1')
@$recipes = @$('.recipes')
@$name = @$('.name')
@$byline = @$('.byline p')
@$description = @$('.description p')
@$homePageLink = @$('.homePage')
@$items = @$('.items .panel')
@$titleImage = @$('.titleImage img')
@$versionSelector = @$('select.version')
@$wikiLink = @$('.wiki')
super
refresh: ->
@$title.html if @model? then @model.name else ''
controllerIndex = 0
delay = 0
if @model?.activeModVersion?.isLoaded
@$recipes.show duration:Duration.fast
@model.eachItem (item)=>
recipe = item.getPrimaryRecipe()
return if not recipe
item.eachRecipe (recipe)=>
controller = @_recipeControllers[controllerIndex]
if not controller?
_.delay (=> @_createRecipeController recipe), delay
delay += @_delayStep
else
controller.model = recipe
controllerIndex += 1
else
@$recipes.hide duration:Duration.fast
while @_recipeControllers.length > controllerIndex
controller = @_recipeControllers.pop()
controller.$el.slideUp duration:Duration.fast, complete:-> @remove()
@$name.html if @model? then @model.name else ''
@$byline.html if @model? then "by #{@model.author}" else ''
@$titleImage.attr 'src', (if @model? then Url.modLogoImage(modSlug:@model.slug) else '')
@$description.html if @model? then @model.description else ''
@_refreshHomePageLink()
@_refreshItems()
@_refreshVersions()
super
# Backbone.View Methods ########################################################################
events:
'change select.version': 'onVersionChanged'
# Private Methods ##############################################################################
_createRecipeController: (recipe)->
controller = new RecipeController model:recipe, modPack:@_modPack
_createItemController: (item)->
controller = new ItemController model:item, modPack:@_modPack
controller.$el.hide()
controller.render()
@_recipeControllers.push controller
@$recipes.append controller.$el
@_itemControllers.push controller
@$items.append controller.$el
controller.$el.slideDown duration:Duration.fast
_getEffectiveModVersion: ->
return @_effectiveModVersion if @_effectiveModVersion?
return null unless @model?
modVersion = @model.activeModVersion
modVersion ?= @model.getModVersion Mod.Version.Latest
return modVersion
_refreshHomePageLink: ->
if @model.homePageUrl?
@$homePageLink.fadeIn duration:Duration.fast
@$homePageLink.attr 'href', @model.homePageUrl
else
@$homePageLink.fadeOut duration:Duration.fast
_refreshItems: ->
controllerIndex = 0
delay = 0
effectiveModVersion = @effectiveModVersion
if effectiveModVersion?
@$items.show duration:Duration.fast
effectiveModVersion.eachItem (item)=>
controller = @_itemControllers[controllerIndex]
if not controller?
_.delay (=> @_createItemController item), delay
delay += @_delayStop
else
controller.model = item
controllerIndex += 1
else
@$items.hide duration:Duration.fast
while @_itemControllers.length > controllerIndex
controller = @_itemControllers.pop()
controller.$el.slideUp duration:Duration.fast, complete:-> @remove()
_refreshVersions: ->
@$versionSelector.empty()
return unless @model?
effectiveModVersion = @effectiveModVersion
versionCount = 0
@model.eachModVersion (modVersion)=>
option = $("<option value=\"#{modVersion.version}\">#{modVersion.version}</option>")
if modVersion is effectiveModVersion
option.attr 'selected', 'selected'
@$versionSelector.append option
versionCount++
if versionCount <= 1
@$versionSelector.attr 'disabled', 'disabled'
else
@$versionSelector.removeAttr 'disabled'
+21 -4
View File
@@ -19,7 +19,7 @@ module.exports = class Mod extends BaseModel
attributes.author ?= ''
attributes.description ?= ''
attributes.name ?= ''
attributes.primaryUrl ?= null
attributes.homePageUrl ?= null
super attributes, options
@_activeModVersion = null
@@ -62,9 +62,18 @@ module.exports = class Mod extends BaseModel
return unless @_activeModVersion?
@_activeModVersion.eachName callback
findItem: (slug)->
return unless @_activeModVersion?
@_activeModVersion.findItem slug
findItem: (slug, options={})->
options.includeDisabled ?= false
if not options.includeDisabled
return unless @_activeModVersion?
return @_activeModVersion.findItem slug
else
for modVersion in @_modVersions
item = modVersion.findItem slug
return item if item?
return null
findItemByName: (name)->
return unless @_activeModVersion?
@@ -100,6 +109,14 @@ module.exports = class Mod extends BaseModel
for modVersion in @_modVersions
callback modVersion
getModVersion: (version)->
return null if version is Mod.Version.None
return @_modVersions[@_modVersions.length-1] if version is Mod.Version.Latest
for modVersion in @_modVersions
return modVersion if modVersion.version is version
return null
getActiveVersion: ->
return @_activeVersion
+6 -4
View File
@@ -22,10 +22,12 @@ module.exports = class ModPack extends BaseModel
# Public Methods ###############################################################################
findItem: (slug)->
findItem: (slug, options={})->
options.includeDisabled ?= false
for mod in @_mods
continue unless mod.enabled
item = mod.findItem slug
continue unless mod.enabled or options.includeDisabled
item = mod.findItem slug, options
return item if item?
return null
@@ -42,7 +44,7 @@ module.exports = class ModPack extends BaseModel
findItemDisplay: (slug)->
result = {}
item = @findItem slug
item = @findItem slug, includeDisabled:true
if item?
result.modSlug = item.modVersion.modSlug
result.modVersion = item.modVersion.version
@@ -42,11 +42,11 @@ module.exports = class ModParserV2 extends CommandParserVersionBase
if name.length is 0 then throw new Error '"name" cannot be empty'
@_rawData.name = name
_command_url: (url='')->
if @_rawData.url? then throw new Error 'duplicate declaration of "url"'
if url.length is 0 then throw new Error 'url cannot be empty'
_command_homePageUrl: (homePageUrl='')->
if @_rawData.homePageUrl? then throw new Error 'duplicate declaration of "homePageUrl"'
if homePageUrl.length is 0 then throw new Error 'homePageUrl cannot be empty'
@_rawData.url = url
@_rawData.homePageUrl = homePageUrl
_command_version: (version='')->
if version.length is 0 then throw new Error 'version cannot be empty'
@@ -58,13 +58,13 @@ module.exports = class ModParserV2 extends CommandParserVersionBase
_buildMod: (rawData, model)->
if not rawData.name? then throw new Error 'the "name" declaration is required'
if not rawData.url? then throw new Error 'the "url" declaration is required'
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.primaryUrl = rawData.url
model.homePageUrl = rawData.homePageUrl
for version in rawData.versions
model.addModVersion new ModVersion modSlug:model.slug, version:version
+13
View File
@@ -0,0 +1,13 @@
//-
//- Crafting Guide - item.jade
//-
//- Copyright (c) 2015 by Redwood Labs
//- All rights reserved.
//-
.view__item
a
table
tr
td.itemIcon: img
td.itemName(width="*")
+12 -3
View File
@@ -6,7 +6,16 @@
//-
.view__mod_page
h1
.sidebar
.titleImage: img
select.version
a.homePage: p Offical Home Page
.recipes
h2 Recipes
.mainBody
h1.name
.byline: p
.description: p
.section.items
h2 Items
.panel