Last active
April 25, 2018 15:26
-
-
Save theredpea/906b0afec319bf4941d906dd9771adc4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//applyBookmark( item, $event ) | |
//ng-click="applyBookmark( item, $event )" | |
//<div tid="bmSectionRepeat" class="bm-action ng-scope" ng-repeat="item in section.list | orderBy:sortFn track by item.qInfo.qId" ng-if="isItemVisible( item )" qva-context-menu="onContextMenu( $event, item )" ng-click="applyBookmark( item, $event )" role="button" tabindex="0"> | |
// client.utils/routing | |
define("client.utils/routing", ["general.controllers/route-controller", "util"], function(a, b) { | |
"use strict"; | |
... | |
goToSheet: function(b, d) { | |
a.setUrl(c.getUrlForSheet(b, d, !1)) | |
}, | |
//note | |
// - d.States | |
// - d.States.analysis | |
require('client.utils/state').States | |
{analysis: 0, edit: 1, play: 2, editstory: 3} | |
//bookmark-service | |
//================== | |
define("client.services/bookmark-service", ["qvangular", "client.models/bookmark", "client.models/sheet", "client.utils/state", "client.utils/routing", "client.services/grid-service", "jquery", "general.services/delayed-modal/delayed-modal"], function(a, b, c, d, e, f, g) { | |
"use strict"; | |
function h() { | |
j("Bookmarks.BookmarkMissingDialogTitle", "Bookmarks.BookmarkMissingDialogText1", "Bookmarks.BookmarkMissingDialogText2") | |
} | |
function i(a) { | |
var b, c; | |
"bookmark" === a ? (b = "Bookmarks.SheetMissingDialogText1", | |
c = "Bookmarks.SheetMissingDialogText2") : (b = "Snapshot.SheetMissingDialogText1", | |
c = "Snapshot.SheetMissingDialogText2"), | |
j("Bookmarks.SheetMissingDialogTitle", b, c) | |
} | |
function j(b, c, d) { | |
var e = a.getService("$delayedModal") | |
, f = g.extend(!0, {}, {}, { | |
title: b, | |
html: '<p q-translation="' + c + '"></p><p class="dm-p" q-translation="' + d + '"></p>' | |
}); | |
e.open(f) | |
} | |
function k(a, c) { | |
return b.apply(a).then(function() { | |
if (c) | |
return b.get(a).then(function(a) { | |
return n(a) | |
}, function() { | |
return h(), | |
!1 | |
}) | |
}) | |
} | |
function l(a, c) { | |
return b.apply(a).then(function() { | |
return n(c) | |
}) | |
} | |
function m(a) { | |
return a.apply().then(function() { | |
return n(a) | |
}) | |
} | |
function n(a) { | |
return a.getLayout().then(function(a) { | |
if (a.sheetId) | |
return c.get(a.sheetId).then(function() { | |
return e.goToSheet(a.sheetId, Object.keys(d.States)[d.States.analysis]), | |
f.zoomOut(), | |
!0 | |
}, function() { | |
return i(a.qInfo.qType), | |
!1 | |
}) | |
}) | |
} | |
return { | |
applyBookmark: k, | |
applySnapshot: l, | |
applyEmbeddedSnapshot: m | |
} | |
//bookmarks-service | |
//================== | |
define("client.views/bookmarks/bookmarks-service", ["qvangular", "jquery", "general.utils/dom-util", "client.services/bookmark-service", "client.models/sheet", "translator", "core.utils/deferred", "client.models/bookmark", "client.models/current-selections", "client.utils/state", "client.views/app-overview/smalldevice/small-device-menu-service", "general.utils/string-normalization"], function(a, b, c, d, e, f, g, h, i, j, k, l) { | |
"use strict"; | |
a.service("qvBookmarkService", function() { | |
var p, q, r, s = {}, t = !1, u = ""; | |
return r = { | |
id: 0, | |
edit: !1, | |
search: !1, | |
searchString: "", | |
hasSearchMatch: !0, | |
name: "" | |
}, | |
q = { | |
approved: { | |
name: "approved", | |
list: [], | |
show: !1, | |
divider: !1, | |
isVisible: !0, | |
translation: "Bookmarks.ApprovedBookmarks" | |
}, | |
private: { | |
name: "private", | |
list: [], | |
show: !1, | |
divider: !1, | |
isVisible: !0, | |
translation: "Bookmarks.MyBookmarks" | |
} | |
}, | |
//this is the service | |
p = { | |
... | |
applyBookmark: function(b, c, e) { | |
return !a(c) && (d.applyBookmark(b.qInfo.qId, e), | |
p.close(), | |
!0) | |
}, | |
//Apply Selection in the UI Context Menu (i.e. without navigating to sheet) | |
//================== | |
define("client.views/bookmarks/section", ["qvangular", "text!client.views/bookmarks/section.ng.html", "jquery", "client.views/bookmarks/contextmenu", "translator"], function(a, b, c, d, e) { | |
"use strict"; | |
a.directive("qvBookmarksSection", ["qvBookmarkService", "$delayedModal", "$timeout", function(a, f, g) { | |
return { | |
... | |
b.onContextMenu = function(e, f) { | |
j = c(".qv-popover-container").showComponent(d, { | |
event: e, | |
clickedItem: f, | |
remove: function() { | |
b.removeBookmark(f) | |
}, | |
applySelections: function() { | |
//Notice it uses the next one, below. | |
a.applyBookmark(f, e) && b.$emit("closeNavigator") | |
}, | |
} | |
inEdit: function() { | |
return b.inEdit(f) | |
} | |
}) | |
} | |
, | |
b.applyBookmark = function(d, e) { | |
var f = c(e.target).closest("button, input, textarea, .icon-info").length; | |
b.inEdit(d) || f || a.applyBookmark(d, e, !0) && b.$emit("closeNavigator") | |
} | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment