Skip to content

Commit

Permalink
working commit for some bits related to #67
Browse files Browse the repository at this point in the history
  • Loading branch information
kltm committed Jan 15, 2015
1 parent c1ea049 commit 2fbcef2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
9 changes: 9 additions & 0 deletions js/NoctuaEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ var MMEnvInit = function(in_model, in_relations, in_token){
var zret_btn_elt = '#' + zret_btn_id;
var zout_btn_id = 'zoomout';
var zout_btn_elt = '#' + zout_btn_id;
//
var undo_btn_id = 'action_undo';
var undo_btn_elt = '#' + undo_btn_id;
var redo_btn_id = 'action_redo';
var redo_btn_elt = '#' + redo_btn_id;
//
var refresh_btn_id = 'action_refresh';
var refresh_btn_elt = '#' + refresh_btn_id;
var reset_btn_id = 'action_reset';
Expand Down Expand Up @@ -1866,6 +1872,9 @@ var MMEnvInit = function(in_model, in_relations, in_token){
}
});

// // TODO: As a test, see what the undo/redo listing looks like.
// manager.get_model_undo_redo(ecore.get_id());

// As a use case, we want to have the title available to people in
// their browsers.
var mtitle = 'Untitled';
Expand Down
2 changes: 1 addition & 1 deletion static/bbop.js
Original file line number Diff line number Diff line change
Expand Up @@ -1886,7 +1886,7 @@ bbop.version.revision = "2.2.3";
*
* Partial version for this library: release (date-like) information.
*/
bbop.version.release = "20141009";
bbop.version.release = "20141015";
/*
* Package: logger.js
*
Expand Down
29 changes: 29 additions & 0 deletions static/bbopx.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,16 @@ bbopx.minerva.manager = function(barista_location, namespace, user_token){
}
_set_url_from_token(user_token);

// Helper function to add get_undo_redo when the user token
// (hopefully good) is defined.
function _add_undo_redo_req(req_set, model_id){
if( anchor._user_token ){
var req = new bbopx.minerva.request('model', 'get-undo-redo');
req.model_id(model_id);
req_set.add(req);
}
}

// An internal manager for handling the unhappiness of AJAX callbacks.
//var jqm = new bbop.rest.manager.jquery(bbop.rest.response.mmm);
var jqm = new bbop.rest.manager.jquery(bbopx.barista.response);
Expand Down Expand Up @@ -995,6 +1005,25 @@ bbopx.minerva.manager = function(barista_location, namespace, user_token){
anchor.apply_callbacks('prerun', [anchor]);
jqm.action(anchor._url, args, 'GET');
};

// This will make the request whether or not the user has an okay
// token defined (as opposed to the helper function
// _add_undo_redo()).
//
// Intent: "query".
// Expect: "success" and "meta".
anchor.get_model_undo_redo = function(model_id){

//
var reqs = new bbopx.minerva.request_set(anchor.user_token(), 'query');
var req = new bbopx.minerva.request('model', 'get-undo-redo');
req.model_id(model_id);
reqs.add(req);

var args = reqs.callable();
anchor.apply_callbacks('prerun', [anchor]);
jqm.action(anchor._url, args, 'GET');
};

// Intent: "action".
// Expect: "success" and "merge".
Expand Down
7 changes: 7 additions & 0 deletions templates/noctua_editor.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
<li><a id="menu-model-annotations"
href="#">Edit annotations</a></li>
<li class="divider"></li>
<li role="presentation" class="disabled">
<a id="action_undo" href="#">Undo last </a>
</li>
<li role="presentation" class="disabled">
<a id="action_redo" href="#">Redo last</a>
</li>
<li class="divider"></li>
<li><a id="action_refresh"
href="#">Soft refresh</a></li>
<li><a id="action_reset"
Expand Down

0 comments on commit 2fbcef2

Please sign in to comment.