Created
May 3, 2013 10:19
-
-
Save robertknight/5508364 to your computer and use it in GitHub Desktop.
Table actions menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/webContent/notes/summary.html b/src/webContent/notes/summary.html | |
index 63a23cb..a519377 100644 | |
--- a/src/webContent/notes/summary.html | |
+++ b/src/webContent/notes/summary.html | |
@@ -30,7 +30,7 @@ | |
<div class="table-data" id="{{elementId}}-table-data">{{{table}}}</div> | |
<div class="table-actions"> | |
<a class="table-copy-link" id="{{elementId}}-copy-link" href="#copy-table" | |
- title="Copy table data">Copy</a> | |
+ title="Copy table data">Options</a> | |
</div> | |
<div> </div> | |
</div> | |
diff --git a/src/webContent/notes/summary.js b/src/webContent/notes/summary.js | |
index 311fa4d..c5a8de5 100644 | |
--- a/src/webContent/notes/summary.js | |
+++ b/src/webContent/notes/summary.js | |
@@ -36,9 +36,22 @@ function addOutlineEntry(entry, index) { | |
} else if (entry.type == CODEServices.OutlineEntry.TABLE_ENTRY) { | |
var tableTemplate = ich.table_template(entry, {}); | |
$('#section-tables-and-figures').append(tableTemplate); | |
- $('#' + entry.elementId + '-copy-link').click(function() { | |
- var tableData = $('#' + entry.elementId + '-table-data'); | |
- MendeleyDesktop.module('ui').copyToClipboard(tableData.html()); | |
+ var link = $('#' + entry.elementId + '-copy-link'); | |
+ link.click(function() { | |
+ var offset = UiUtils.dropDownMenuOffset(link); | |
+ var menuItem = MendeleyDesktop.module('ui').showMenu( | |
+ offset.left, | |
+ offset.top, | |
+ ['Copy', 'Share', 'Tweet'] | |
+ ); | |
+ if (menuItem == 0) { | |
+ var tableData = $('#' + entry.elementId + '-table-data'); | |
+ MendeleyDesktop.module('ui').copyToClipboard(tableData.html()); | |
+ } else if (menuItem == 1) { | |
+ // share content | |
+ } else if (menuItem == 2) { | |
+ // Tweet content | |
+ } | |
}); | |
} else if (entry.type == CODEServices.OutlineEntry.FIGURE_ENTRY) { | |
var figureTemplate = ich.figure_template(entry, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment