Add a "report a problem" link in crafting plan
This commit is contained in:
@@ -14,19 +14,6 @@ All rights reserved.
|
|||||||
position: absolute; top: 5em; right: 2em; bottom: 0; left: 2em;
|
position: absolute; top: 5em; right: 2em; bottom: 0; left: 2em;
|
||||||
background: $color-background-panel;
|
background: $color-background-panel;
|
||||||
|
|
||||||
.prev {
|
|
||||||
background: url('/images/arrow-left-disabled.png');
|
|
||||||
position: absolute; top: 50%; left: 1em; height: 8em; width: 4em;
|
|
||||||
@include transform(translateY(-50%));
|
|
||||||
|
|
||||||
&.enabled {
|
|
||||||
background: url('/images/arrow-left.png');
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover { background: url('/images/arrow-left-hover.png'); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
position: absolute; top: 50%; left: 33%;
|
position: absolute; top: 50%; left: 33%;
|
||||||
@include transform(translate(-50%, -50%));
|
@include transform(translate(-50%, -50%));
|
||||||
@@ -85,5 +72,33 @@ All rights reserved.
|
|||||||
&:hover { background: url('/images/arrow-right-hover.png'); }
|
&:hover { background: url('/images/arrow-right-hover.png'); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.prev {
|
||||||
|
background: url('/images/arrow-left-disabled.png');
|
||||||
|
position: absolute; top: 50%; left: 1em; height: 8em; width: 4em;
|
||||||
|
@include transform(translateY(-50%));
|
||||||
|
|
||||||
|
&.enabled {
|
||||||
|
background: url('/images/arrow-left.png');
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover { background: url('/images/arrow-left-hover.png'); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.problem {
|
||||||
|
position: absolute; bottom: 1em; right: 1em;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: $color-gray-light;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: $font-size-normal;
|
||||||
|
text-decoration: underline;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: $color-gray-medium;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ BaseController = require './base_controller'
|
|||||||
CraftingGridController = require './crafting_grid_controller'
|
CraftingGridController = require './crafting_grid_controller'
|
||||||
{Duration} = require '../constants'
|
{Duration} = require '../constants'
|
||||||
ImageLoader = require './image_loader'
|
ImageLoader = require './image_loader'
|
||||||
|
InventoryParser = require '../models/inventory_parser'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
@@ -32,6 +33,12 @@ module.exports = class CraftingTableController extends BaseController
|
|||||||
onPrevClicked: ->
|
onPrevClicked: ->
|
||||||
@model.step -= 1
|
@model.step -= 1
|
||||||
|
|
||||||
|
onReportProblem: ->
|
||||||
|
parser = new InventoryParser @modPack
|
||||||
|
itemList = parser.unparse @model.plan.want
|
||||||
|
message = "When I was on step #{@model.step + 1} of making:\n\n#{itemList}\nI noticed that...\n"
|
||||||
|
global.feedbackController.enterFeedback message
|
||||||
|
|
||||||
# BaseController Overrides #####################################################################
|
# BaseController Overrides #####################################################################
|
||||||
|
|
||||||
onDidRender: ->
|
onDidRender: ->
|
||||||
@@ -45,6 +52,7 @@ module.exports = class CraftingTableController extends BaseController
|
|||||||
@$outputLink = @$('.output a')
|
@$outputLink = @$('.output a')
|
||||||
@$outputQuantity = @$('.quantity')
|
@$outputQuantity = @$('.quantity')
|
||||||
@$prev = @$('.prev')
|
@$prev = @$('.prev')
|
||||||
|
@$problemControl = @$('.problem')
|
||||||
@$title = @$('h2 p')
|
@$title = @$('h2 p')
|
||||||
@$tool = @$('.tool p')
|
@$tool = @$('.tool p')
|
||||||
|
|
||||||
@@ -85,6 +93,12 @@ module.exports = class CraftingTableController extends BaseController
|
|||||||
@$multiplier.html ''
|
@$multiplier.html ''
|
||||||
|
|
||||||
@$el.tooltip show:{delay:Duration.slow, duration:Duration.fast}
|
@$el.tooltip show:{delay:Duration.slow, duration:Duration.fast}
|
||||||
|
|
||||||
|
if not (@model.hasSteps and global.feedbackController?)
|
||||||
|
@$problemControl.hide duration:Duration.fast
|
||||||
|
else
|
||||||
|
@$problemControl.show duration:Duration.normal
|
||||||
|
|
||||||
super
|
super
|
||||||
|
|
||||||
# Backbone.View Overrides ######################################################################
|
# Backbone.View Overrides ######################################################################
|
||||||
@@ -92,3 +106,4 @@ module.exports = class CraftingTableController extends BaseController
|
|||||||
events:
|
events:
|
||||||
'click .next': 'onNextClicked'
|
'click .next': 'onNextClicked'
|
||||||
'click .prev': 'onPrevClicked'
|
'click .prev': 'onPrevClicked'
|
||||||
|
'click .problem a': 'onReportProblem'
|
||||||
|
|||||||
@@ -7,13 +7,21 @@ All rights reserved.
|
|||||||
|
|
||||||
Inventory = require './inventory'
|
Inventory = require './inventory'
|
||||||
Item = require './item'
|
Item = require './item'
|
||||||
|
StringBuilder = require './string_builder'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
module.exports = class InventoryParser
|
module.exports = class InventoryParser
|
||||||
|
|
||||||
|
constructor: (modPack=null)->
|
||||||
|
@modPack = modPack
|
||||||
|
|
||||||
|
# Class Methods ################################################################################
|
||||||
|
|
||||||
@ITEM_REGEX = /^([0-9]+)(.*)$/
|
@ITEM_REGEX = /^([0-9]+)(.*)$/
|
||||||
|
|
||||||
|
# Public Methods ###############################################################################
|
||||||
|
|
||||||
parse: (data, inventory=null)->
|
parse: (data, inventory=null)->
|
||||||
inventory ?= new Inventory
|
inventory ?= new Inventory
|
||||||
return inventory if not data? or data.length is 0
|
return inventory if not data? or data.length is 0
|
||||||
@@ -28,3 +36,15 @@ module.exports = class InventoryParser
|
|||||||
inventory.add _.slugify(name), quantity
|
inventory.add _.slugify(name), quantity
|
||||||
|
|
||||||
return inventory
|
return inventory
|
||||||
|
|
||||||
|
unparse: (inventory)->
|
||||||
|
if not @modPack? then throw new Error 'this.modPack is needed to unparse'
|
||||||
|
|
||||||
|
builder = new StringBuilder
|
||||||
|
for item in inventory.toList()
|
||||||
|
if _.isString item
|
||||||
|
builder.line @modPack.findName item
|
||||||
|
else
|
||||||
|
builder.line item[0], ' ', @modPack.findName item[1]
|
||||||
|
|
||||||
|
return builder.toString()
|
||||||
@@ -21,3 +21,5 @@
|
|||||||
p.quantity
|
p.quantity
|
||||||
p.multiplier
|
p.multiplier
|
||||||
.next
|
.next
|
||||||
|
.problem
|
||||||
|
a report a problem
|
||||||
|
|||||||
Reference in New Issue
Block a user