Skip to content

Commit

Permalink
Changed model names in model listings to reflect current ones. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsielicki committed Oct 7, 2015
1 parent 1dc2653 commit 0b81add
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/slycat/web/server/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def js_bundle():
"js/slycat-parser-controls.js",
"js/slycat-model-results.js",
"js/slycat-changes-feed.js",
"js/slycat-model-names.js",
"js/slycat-navbar.js",
"js/slycat-local-browser.js",
"js/slycat-remote-browser.js",
Expand Down
21 changes: 21 additions & 0 deletions web-server/js/slycat-model-names.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright 2013, Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain
rights in this software.
*/

define('slycat-model-names', [], function()
{
var module = {};

module.translate_model_type = function(model_type)
{
var model_names = {
'parameter-image' : 'parameter space',
'parameter-image-plus' : 'parameter image'
};
return model_names[model_type] ? model_names[model_type] : model_type;
}

return module;
});
3 changes: 2 additions & 1 deletion web-server/js/slycat-navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain
rights in this software.
*/

define("slycat-navbar", ["slycat-server-root", "slycat-web-client", "slycat-changes-feed", "slycat-dialog", "knockout", "knockout-mapping"], function(server_root, client, changes_feed, dialog, ko, mapping)
define("slycat-navbar", ["slycat-server-root", "slycat-web-client", "slycat-changes-feed", "slycat-dialog", "slycat-model-names", "knockout", "knockout-mapping"], function(server_root, client, changes_feed, dialog, model_names, ko, mapping)
{
ko.components.register("slycat-navbar",
{
viewModel: function(params)
{
var component = this;
component.server_root = server_root;
component.model_names = model_names;

// Keep track of the current project, if any.
component.project_id = ko.observable(params.project_id);
Expand Down
5 changes: 4 additions & 1 deletion web-server/js/slycat-project-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain
rights in this software.
*/

define("slycat-project-main", ["slycat-server-root", "slycat-web-client", "slycat-markings", "slycat-changes-feed", "slycat-dialog", "knockout", "knockout-mapping", "URI"], function(server_root, client, markings, changes_feed, dialog, ko, mapping, URI)
define("slycat-project-main", ["slycat-server-root", "slycat-web-client", "slycat-markings", "slycat-changes-feed", "slycat-dialog", "slycat-model-names", "knockout", "knockout-mapping", "URI"], function(server_root, client, markings, changes_feed, dialog, model_names, ko, mapping, URI)
{
var module = {}
module.start = function()
Expand Down Expand Up @@ -50,6 +50,9 @@ define("slycat-project-main", ["slycat-server-root", "slycat-web-client", "slyca
model_type: reference["model-type"] ? reference["model-type"]() : "",
};
});

page.model_names = model_names;

page.edit_template = function(reference)
{
}
Expand Down
2 changes: 1 addition & 1 deletion web-server/templates/slycat-navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<span class="fa fa-trash-o"></span>
</button>
</span>
<span class="label label-default" data-bind="visible: model_type, text:model_type + ' model'"></span>
<span class="label label-default" data-bind="visible: model_type, text:$parent.model_names.translate_model_type(model_type) + ' model'"></span>
<strong>
<span>
<span data-bind="text:model_name"></span>
Expand Down
4 changes: 2 additions & 2 deletions web-server/templates/slycat-project.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h3>Models</h3>
<div class="panel panel-default">
<div class="list-group" data-bind="foreach: models">
<a class="list-group-item" data-bind="attr: {href:$parent.server_root + 'models/' + $data._id()}">
<span class="label label-default" data-bind="text:$data['model-type']() + ' model'"></span>
<span class="label label-default" data-bind="text: $root.model_names.translate_model_type($data['model-type']()) + ' model'"></span>
<strong data-bind="text:name"></strong>
<div class="pull-right" style="display: inline-block" data-bind="html:$parent.badge($data.marking())"></div>
<span class="label label-danger" data-bind="visible:$data.result && $data.result() == 'failed',popover:{placement:'right', trigger:'hover', content:message}">Failed</span>
Expand All @@ -47,7 +47,7 @@ <h3>Templates</h3>
<div class="panel panel-default">
<div class="list-group" data-bind="foreach: templates">
<div class="list-group-item">
<span class="label label-default" data-bind="visible:model_type, text:model_type + ' model'"></span>
<span class="label label-default" data-bind="visible:model_type, text: $root.model_names.translate_model_type(model_type) + ' model'"></span>
<strong data-bind="text:name"></strong>
<small>
<em>
Expand Down

0 comments on commit 0b81add

Please sign in to comment.