Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help angular module #2024

Merged
merged 26 commits into from
Dec 5, 2020
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aa68aeb
Created view-annotation.md [ci skip]
rastogi-bhavya Oct 16, 2020
08da81c
Adding screenshots for annotation documentation [ci skip]
rastogi-bhavya Oct 16, 2020
b2f5d89
Adding login Image
rastogi-bhavya Oct 19, 2020
b7a58f1
Update view-annotation.md
rastogi-bhavya Oct 19, 2020
766866e
Images Update
rastogi-bhavya Oct 19, 2020
d440865
Adding images to view-annotation.md [ci skip]
rastogi-bhavya Oct 19, 2020
952981f
Inline image test [ci skip]
rastogi-bhavya Oct 23, 2020
53a74dc
Add all the images inline [ci skip]
rastogi-bhavya Oct 23, 2020
1157554
introduce wiki app
RFSH Oct 28, 2020
2d53157
Fixed how images were added to the document [ci skip]
rastogi-bhavya Oct 29, 2020
28f8e52
Removing comments about line & polygon [ci skip]
rastogi-bhavya Oct 29, 2020
cf8a853
copyediting
crisaless Oct 31, 2020
88e1b9d
fixing anchor link
crisaless Oct 31, 2020
cb4a67f
fixing another anchor
crisaless Oct 31, 2020
3e794f8
rename wiki app to help app + add toc to help pages
RFSH Dec 3, 2020
8157e72
Merge branch 'master' of github.com:informatics-isi-edu/chaise into a…
RFSH Dec 3, 2020
5e387a5
fix toc scroll
RFSH Dec 3, 2020
650d871
remove toc
RFSH Dec 3, 2020
b050f00
Screenshot image update [ci skip]
rastogi-bhavya Dec 4, 2020
7a7bde2
Adding EditButton icon [ci skip]
rastogi-bhavya Dec 4, 2020
e1fac69
Adding tool icon [ci skip]
rastogi-bhavya Dec 4, 2020
ad72110
Revert "Adding tool icon [ci skip]"
rastogi-bhavya Dec 4, 2020
019db16
Shape Icon image [ci skip]
rastogi-bhavya Dec 4, 2020
ce860bb
Made suggested changes to the doc [ci skip]
rastogi-bhavya Dec 4, 2020
05d54f0
Adding space to make the content uniform
rastogi-bhavya Dec 4, 2020
b13fe8a
add a message to osd to open help page + remove unused code
RFSH Dec 5, 2020
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
28 changes: 26 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ HTML=login/index.html \
record/index.html \
recordedit/mdHelp.html \
lib/switchUserAccounts.html \
$(DIST)/chaise-dependencies.html
$(DIST)/chaise-dependencies.html \
help/index.html

# the minified files that need to be created
MIN=$(DIST)/$(SHARED_JS_VENDOR_ASSET_MIN) \
Expand All @@ -203,7 +204,8 @@ MIN=$(DIST)/$(SHARED_JS_VENDOR_ASSET_MIN) \
$(DIST)/$(RECORDSET_JS_SOURCE_MIN) \
$(DIST)/$(RECORDEDIT_JS_SOURCE_MIN) \
$(DIST)/$(VIEWER_JS_SOURCE_MIN) \
$(DIST)/$(LOGIN_JS_SOURCE_MIN)
$(DIST)/$(LOGIN_JS_SOURCE_MIN) \
$(DIST)/$(HELP_JS_SOURCE_MIN)

DIST=dist

Expand Down Expand Up @@ -515,6 +517,28 @@ lib/switchUserAccounts.html: lib/switchUserAccounts.html.in .make-switchuser-inc
$(info - creating lib/switchUserAccounts.html)
@$(call build_html,.make-switchuser-includes,lib/switchUserAccounts.html)

# -------------------------- help app -------------------------- #
HELP_JS_SOURCE=help/help.app.js

HELP_JS_SOURCE_MIN=help.min.js
$(DIST)/$(HELP_JS_SOURCE_MIN): $(HELP_JS_SOURCE)
$(call bundle_js_files,$(HELP_JS_SOURCE_MIN),$(HELP_JS_SOURCE))

HELP_CSS_SOURCE=

HELP_VENDOR_ASSET=

.make-help-includes: $(BUILD_VERSION)
@> .make-help-includes
$(info - creating .make-help-includes)
@$(call add_css_link,.make-help-includes,$(HELP_CSS_SOURCE))
@$(call add_js_script,.make-help-includes,$(SHARED_JS_VENDOR_BASE) $(DIST)/$(SHARED_JS_VENDOR_ASSET_MIN) $(HELP)/$(HELP_VENDOR_ASSET) $(JS_CONFIG) $(DIST)/$(SHARED_JS_SOURCE_MIN) $(DIST)/$(HELP_JS_SOURCE_MIN))
@$(call add_ermrestjs_script,.make-help-includes)

help/index.html: help/index.html.in .make-help-includes
$(info - creating help/index.html)
@$(call build_html,.make-help-includes,help/index.html)


# -------------------------- utility functions -------------------------- #

Expand Down
2 changes: 1 addition & 1 deletion common/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@

// TODO we might want to refactor this
function isChaise(link, dcctx) {
var appNames = ["record", "recordset", "recordedit", "login"];
var appNames = ["record", "recordset", "recordedit", "login", "help"];

// parses the url into a location object
var eleUrl = document.createElement('a');
Expand Down
39 changes: 39 additions & 0 deletions common/styles/scss/_help-app.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.help-container {
.app-content-container {
// TODO should be removed if we added breadcrumb to the top of the page
.main-container {
padding-top: 20px;
}

// distant footer and main body
.main-body {
padding-bottom: 20px;
}
}

// override the default that we have for markdown containers
.markdown-container {
h1 {
font-size: $h1-font-size;
}

h2 {
font-size: $h2-font-size;
}

h3 {
font-size: $h3-font-size;
}

h4 {
font-size: $h4-font-size;
}
}

.chaise-help-image {
width: 500px;
display: block;
margin-left: auto;
margin-right: auto;
}
}
1 change: 1 addition & 0 deletions common/styles/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@import "recordedit-app";
@import "viewer-app";
@import "switch-user-accounts";
@import "help-app";


// if we want to hide the page and then show navbar and content together
Expand Down
22 changes: 16 additions & 6 deletions common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,7 @@
* @param {Node=} parentContainer - the parent container. if undefined `body` will be used.
* @param {Node=} parentContainerSticky - the sticky area of parent. if undefined `#mainnav` will be used.
* @param {boolean} useDocHeight - whether we should use the doc height even if parentContainer is passed.
* @param {Node=} fixedContent - if there's a fixed element that we want to set the top
* Call this function once the DOM elements are loaded to attach resize sensors that will fix the height of bottom-panel-container
* If you don't pass any parentContainer, it will use the body
* It will assume the following structure in the given parentContainer:
Expand All @@ -1637,7 +1638,7 @@
* - .bottom-panel-container
* Three ResizeSensors will be created for app-content, top-panel and bottom-panel to watch their size change.
*/
function attachContainerHeightSensors(parentContainer, parentContainerSticky, useDocHeight) {
function attachContainerHeightSensors(parentContainer, parentContainerSticky, useDocHeight, fixedContent) {
try {
var parentUsableHeight,
appContent, // the container that we might set height for if container height is too small
Expand Down Expand Up @@ -1685,6 +1686,11 @@
// set the container's height
container.style.height = containerHeight + 'vh';

if (fixedContent) {
fixedContent.style.position = "fixed";
fixedContent.style.top = (100 - containerHeight) + "vh";
}

// now check based on actual pixel size
if (container.offsetHeight < 300) {
resetHeight();
Expand Down Expand Up @@ -2924,16 +2930,20 @@
}
}

function addTitle() {
function addTitle(title) {
var chaiseConfig = ConfigUtils.getConfigJSON();

if (typeof title !== "string" || title.length === 0) {
title = chaiseConfig.headTitle;
}

var titleTag = document.head.getElementsByTagName('title')[0];
if (titleTag) {
titleTag.innerHTML = chaiseConfig.headTitle;
titleTag.innerHTML = title;
} else {
var title = document.createElement("title");
title.innerHTML = chaiseConfig.headTitle;
document.head.appendChild(title);
titleTag = document.createElement("title");
titleTag.innerHTML = title;
document.head.appendChild(titleTag);
}
}

Expand Down
101 changes: 101 additions & 0 deletions help/help.app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
(function () {
'use strict';

angular.module('chaise.configure-help', ['chaise.config'])

.constant('appName', 'help')

.run(['$rootScope', function ($rootScope) {
// When the configuration module's run block emits the `configuration-done` event, attach the app to the DOM
$rootScope.$on("configuration-done", function () {

angular.element(document).ready(function(){
angular.bootstrap(document.getElementById("help"), ["chaise.help"]);
});
});
}]);

angular.module('chaise.help', [
'ngSanitize',
'ngCookies',
'ngAnimate',
'duScroll',
'chaise.alerts',
'chaise.errors',
'chaise.modal',
'chaise.navbar',
'chaise.html',
'chaise.utils',
'ermrestjs',
'ui.bootstrap',
'chaise.footer',
'chaise.resizable'
])

.config(['$compileProvider', '$cookiesProvider', '$logProvider', '$provide', '$uibTooltipProvider', 'ConfigUtilsProvider',
function($compileProvider, $cookiesProvider, $logProvider, $provide, $uibTooltipProvider, ConfigUtilsProvider) {
ConfigUtilsProvider.$get().configureAngular($compileProvider, $cookiesProvider, $logProvider, $uibTooltipProvider);

$provide.decorator('$templateRequest', ['ConfigUtils', 'UriUtils', '$delegate', function (ConfigUtils, UriUtils, $delegate) {
return ConfigUtils.decorateTemplateRequest($delegate, UriUtils.chaiseDeploymentPath());
}]);
}])

.constant('helpPages', {
'home': {
'file': 'home.md',
'title': 'Chaise help pages'
},
'viewer-annotation': {
'file': 'viewer-annotation.md',
'title': 'Viewer annotation drawing tools'
}
})

.run(['ConfigUtils', 'ERMrest', 'headInjector', 'UiUtils', 'UriUtils', 'helpPages', '$rootScope', '$timeout', '$window',
function (ConfigUtils, ERMrest, headInjector, UiUtils, UriUtils, helpPages, $rootScope, $timeout, $window) {

// find the help page based on the given query parameter
var pageName = UriUtils.getQueryParam($window.location.href, "page"), helpContent, page;

// remove the hash (the qetQueryParam doesn't do that properly)
if (typeof pageName === "string") {
var parts = pageName.split("#");
if (parts.length > 0) {
pageName = parts[0];
}
}

// if there are no pageName, go to home
if (!pageName || !(pageName in helpPages)) {
pageName = "home";
}

page = helpPages[pageName];

// change the title
headInjector.addTitle(page.title);

// fetch the help page
ConfigUtils.getHTTPService().get(UriUtils.chaiseDeploymentPath() + "help/" + page.file).then(function (response) {
helpContent = response.data;
return ERMrest.onload();
}).then(function () {
// show the content
$rootScope.helpContent = ERMrest.renderMarkdown(helpContent);
$rootScope.displayReady = true;

$timeout(function () {

// make sure the height is properly set
UiUtils.attachContainerHeightSensors(null, null, true);

// make sure footer position is correct
UiUtils.attachFooterResizeSensor(0);
});
}).catch(function (err) {
throw err;
});
}]);

})();
3 changes: 3 additions & 0 deletions help/home.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Chaise help pages

- [How to annotate an image](?page=viewer-annotation)
34 changes: 34 additions & 0 deletions help/index.html.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en" id="help">

<head>
<title>Wiki pages</title>
%INCLUDES%
</head>

<body class="chaise-body">
<div class="configure-container" ng-app="chaise.configure-help">
<loading-spinner></loading-spinner>
</div>
<div class="app-container help-container">
<navbar></navbar>
<loading-spinner ng-show="!displayReady"></loading-spinner>
<div class="app-content-container" ng-show="displayReady">
<!-- <div class="top-panel-container">

</div> -->
<div class="bottom-panel-container">
<div class="side-panel-resizable close-panel"></div>
<div class="main-container">
<div class="main-body container">
<div ng-bind-html="helpContent | trustedHTML" class="markdown-container help-content"></div>
</div>
<footer></footer>
</div>
</div>
</div>
</div>
</body>


</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading