Allow user to select actual version of a mod
This commit is contained in:
@@ -10,6 +10,7 @@ All rights reserved.
|
||||
@import 'feedback';
|
||||
@import 'inventory';
|
||||
@import 'item_page';
|
||||
@import 'mod';
|
||||
@import 'mod_pack';
|
||||
@import 'recipe';
|
||||
@import 'stack';
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Crafting Table - mod.scss
|
||||
|
||||
Copyright (c) 2014-2015 by Redwood Labs
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
.view__mod {
|
||||
position: relative; width: 100%;
|
||||
padding: 1em;
|
||||
|
||||
div, p {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.version {
|
||||
position: relative; width: 10em;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.name {
|
||||
position: relative; width: 15em;
|
||||
margin-right: 1em;
|
||||
|
||||
p {
|
||||
font-family: $font-family-normal;
|
||||
font-size: $font-size-normal;
|
||||
// text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
p { color: $color-gray-light; }
|
||||
}
|
||||
}
|
||||
@@ -7,21 +7,12 @@ All rights reserved.
|
||||
|
||||
.view__mod_pack {
|
||||
|
||||
input { border: 0; font-size: 1.5em; width: 90%; }
|
||||
input {
|
||||
border: 0; font-size: 1.5em; width: 90%;
|
||||
}
|
||||
|
||||
table {
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
|
||||
td {
|
||||
position: relative; height: 2 * $font-size-normal;
|
||||
padding: 0 1em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
td:nth-child(1) { width: 5%; }
|
||||
td:nth-child(2) { width: 30%; }
|
||||
td:nth-child(3) { width: 65%; border-left: 0.1em solid $color-brick-light; }
|
||||
.mods {
|
||||
position: relative; width: 100%;
|
||||
}
|
||||
|
||||
.panel {
|
||||
@@ -29,13 +20,13 @@ All rights reserved.
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
position: relative; width: 35%;
|
||||
position: relative; width: 100%;
|
||||
margin-top: 1em;
|
||||
padding: 1em 1em;
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
|
||||
button {
|
||||
position: relative; width: 66%;
|
||||
position: relative; width: 20em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,3 +28,10 @@ If you've seen it before, go look again. There's a whole new site now, which sup
|
||||
* You can now make many different items at once (e.g., a whole NanoSuit)
|
||||
|
||||
[crafting-guide.com](http://crafting-guide.com)
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
A few more updates to report! First, now your preferences for which mods are active and whether tools are included
|
||||
will be remembered between visits. Second, I've finished adding support for Thermal Expansion 4. The crafting algorithm
|
||||
doesn't yet taken into account the ore-doubling/tripling machinery, but all the recipes for the entire mod are present
|
||||
and functional. I'll work on using the machines in a future update. Next up: IC2 Experimental!
|
||||
@@ -52,7 +52,8 @@ ModelState.failed = 'failed'
|
||||
exports.Url = Url = {}
|
||||
Url.itemIcon = _.template "/data/<%= modSlug %>/<%= modVersion %>/images/<%= slug %>.png"
|
||||
Url.item = _.template "/item/<%= slug %>"
|
||||
Url.mod = _.template "/data/<%= modSlug %>/mod.cg"
|
||||
Url.mod = _.template "/mod/<%= modSlug %>"
|
||||
Url.modData = _.template "/data/<%= modSlug %>/mod.cg"
|
||||
Url.modVersion = _.template "/data/<%= modSlug %>/<%= modVersion %>/mod-version.cg"
|
||||
|
||||
exports.UrlParam = UrlParam = {}
|
||||
|
||||
@@ -9,6 +9,7 @@ BaseController = require './base_controller'
|
||||
{Event} = require '../constants'
|
||||
Mod = require '../models/mod'
|
||||
{RequiredMods} = require '../constants'
|
||||
{Url} = require '../constants'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
@@ -25,38 +26,44 @@ module.exports = class ModController extends BaseController
|
||||
|
||||
# Event Methods ################################################################################
|
||||
|
||||
onEnabledChanged: ->
|
||||
return unless @rendered
|
||||
enabled = @$(':checked').length > 0
|
||||
if enabled
|
||||
@model.activeVersion = Mod.Version.Latest
|
||||
else
|
||||
@model.activeVersion = Mod.Version.None
|
||||
@_plan.removeUncraftableItems()
|
||||
onVersionChanged: ->
|
||||
@model.activeVersion = @$version.val()
|
||||
|
||||
# BaseController Overrides #####################################################################
|
||||
|
||||
onDidRender: ->
|
||||
@$enabled = @$('td:nth-child(1) input')
|
||||
@$name = @$('td:nth-child(2) p')
|
||||
@$description = @$('td:nth-child(3) p')
|
||||
@$version = @$('.version')
|
||||
@$nameLink = @$('.name a')
|
||||
@$nameText = @$('.name p')
|
||||
@$description = @$('.description p')
|
||||
super
|
||||
|
||||
refresh: ->
|
||||
if @model.slug in RequiredMods
|
||||
@$enabled.attr 'checked', 'checked'
|
||||
@$enabled.attr 'disabled', 'disabled'
|
||||
if @model.activeVersion is Mod.Version.None
|
||||
@$el.addClass 'disabled'
|
||||
else
|
||||
@$enabled.removeAttr 'disabled'
|
||||
if @model.activeVersion is Mod.Version.None
|
||||
@$enabled.removeAttr 'checked'
|
||||
else
|
||||
@$enabled.attr 'checked', 'checked'
|
||||
@$el.removeClass 'disabled'
|
||||
|
||||
@$name.html "#{@model.name}"
|
||||
@$description.html "#{@model.description}"
|
||||
@$version.empty()
|
||||
|
||||
if not (@model.slug in RequiredMods)
|
||||
option = $("<option value=\"none\">Disabled</option>")
|
||||
if @model.activeVersion is Mod.Version.None
|
||||
option.attr 'selected', 'selected'
|
||||
@$version.append option
|
||||
|
||||
@model.eachModVersion (modVersion)=>
|
||||
option = $("<option value=\"#{modVersion.version}\">#{modVersion.version}</option>")
|
||||
if modVersion is @model.activeModVersion
|
||||
option.attr 'selected', 'selected'
|
||||
@$version.append option
|
||||
|
||||
# @$nameLink.attr 'href', Url.mod modSlug:@model.slug
|
||||
@$nameText.html @model.name
|
||||
|
||||
@$description.html @model.description
|
||||
|
||||
# Backbone.View Overrides ######################################################################
|
||||
|
||||
events:
|
||||
'change input[type="checkbox"]': 'onEnabledChanged'
|
||||
'change .version': 'onVersionChanged'
|
||||
|
||||
@@ -34,7 +34,7 @@ module.exports = class ModPackController extends BaseController
|
||||
# BaseController Overrides #####################################################################
|
||||
|
||||
onDidRender: ->
|
||||
@$table = @$('table')
|
||||
@$mods = @$('.mods')
|
||||
@$toolbar = @$('.toolbar')
|
||||
super
|
||||
|
||||
@@ -56,7 +56,8 @@ module.exports = class ModPackController extends BaseController
|
||||
controller.render()
|
||||
@_controllers.push controller
|
||||
controller.$el.hide duration:0
|
||||
@$table.append controller.$el
|
||||
|
||||
@$mods.append controller.$el
|
||||
controller.$el.slideDown duration:Duration.normal
|
||||
index++
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ module.exports = class Mod extends BaseModel
|
||||
return null # prevent calling `set`
|
||||
|
||||
url: ->
|
||||
return Url.mod modSlug:@slug
|
||||
return Url.modData modSlug:@slug
|
||||
|
||||
# Private Methods ##############################################################################
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
//- All rights reserved.
|
||||
//-
|
||||
|
||||
tr
|
||||
td: input(type="checkbox")
|
||||
td: p
|
||||
td: p
|
||||
.view__mod
|
||||
select.version
|
||||
option(value="none") None
|
||||
.name
|
||||
a: p
|
||||
.description: p
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
p Mod Pack
|
||||
|
||||
.panel
|
||||
table
|
||||
tr
|
||||
td
|
||||
td
|
||||
|
||||
.mods
|
||||
.toolbar
|
||||
button(name="suggestMod") suggest a mod
|
||||
Reference in New Issue
Block a user