Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions oerpub/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@
extra/draganddropfiles,
common/image,
oer/figure,
oer/definition,
oer/assorted,
oer/title,
common/undo,
oer/undobutton,
oer/genericbutton,
oer/semanticblock,
oer/footnote,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the footnote/definition plugin (and CSS) to build/aloha/build-profile-with-oer.js ?

You should then be able to build a single aloha.js file that contains all the plugins.

The easiest way to run it and test is to do:

# Install the `r.js` script that builds a single file 
npm install requirejs

# Build the single aloha.js and aloha.css
./node-modules/.bin/r.js -o build/aloha/build-profile-with-oer.js

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the following error:

Tracing dependencies for: aloha
Error: ENOENT, no such file or directory '/home/ewald/programming/editor-sprint-june-2014/aloha-editor/target/build-profile-with-oer/rjs-output/lib/figure/figure-plugin.js'
In module tree:
    assorted/assorted-plugin
      assorted/image

Error: Error: ENOENT, no such file or directory '/home/ewald/programming/editor-sprint-june-2014/aloha-editor/target/build-profile-with-oer/rjs-output/lib/figure/figure-plugin.js'
In module tree:
    assorted/assorted-plugin
      assorted/image

    at Object.fs.openSync (fs.js:427:18)

oer/exercise,
oer/quotation,
oer/equation,
Expand Down Expand Up @@ -303,6 +305,8 @@
<li><a href="#" class="action insertExercise">Exercise</a></li>
<li><a href="#" class="action insertQuotation">Quotation</a></li>
<li><a href="#" class="action insertEquation">Equation</a></li>
<li><a href="#" class="action insertDefinition">Definition</a></li>
<li><a href="#" class="action insertFootnote">Footnote</a></li>
</ul>
</div>
<div class="btn-group">
Expand Down
30 changes: 30 additions & 0 deletions src/plugins/oer/footnote/css/footnote.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
body
{
counter-reset:footnote;
}

span.footnote-data {
display:none;
}

span.footnote-marker:hover > span.footnote-data {
position: absolute;
background: white;
display:inline;
padding: 0.5em;
border: 2px solid #A4C0CC;
border-radius: 10px;
}

span.footnote-marker {
counter-increment: footnote;
}

span.footnote-marker::before {
content: " "counter(footnote)" " ;
border-radius: 50%;
padding: 0.25em;
margin: 0.5em;
top: -1em;
background: #A4C0CC;
}
48 changes: 48 additions & 0 deletions src/plugins/oer/footnote/lib/footnote-plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
define([
'aloha',
'jquery',
'aloha/plugin',
'ui/ui',
'ui/toggleButton',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be commented out (to match below)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably.

'ui/button',
'css!footnote/css/footnote.css'
// 'ui/scopes',
// 'ui/port-helper-attribute-field',
// 'i18n!abbr/nls/i18n',
// 'i18n!aloha/nls/i18n'
], function (
Aloha,
jQuery,
Plugin,
Ui,
// ToggleButton,
Button
// Scopes,
// AttributeField,
// i18n,
// i18nCore
){
'use strict';
var GENTICS = window.GENTICS;
return Plugin.create('footnote', {
init: function () {
// Executed on plugin initialization
Ui.adopt("insertFootnote", Button, {
click: function() {
//
// All the footnote insertion code here.
//
var range = Aloha.Selection.getRangeObject();
var footnotedata = prompt("Enter your footnote");
var element = $(" <span class='footnote-marker'><span class='footnote-data'>" + footnotedata + " </span></span> ");
console.log(element);
GENTICS.Utils.Dom.insertIntoDOM(element , range, Aloha.activeEditable.obj)
}
});


},

});

});