diff options
author | alexwl <alexey.a.kiryushin@gmail.com> | 2018-10-02 13:17:04 +0300 |
---|---|---|
committer | alexwl <alexey.a.kiryushin@gmail.com> | 2018-10-02 13:17:04 +0300 |
commit | cf2c56c7061b7ed40fdd3b40a352ddb9c9b7371f (patch) | |
tree | b1de9ada0f1b1cb064e3a9e0d4042d1f519085bd /javascript/app/templates |
Initial commit
Diffstat (limited to 'javascript/app/templates')
25 files changed, 382 insertions, 0 deletions
diff --git a/javascript/app/templates/application.hbs b/javascript/app/templates/application.hbs new file mode 100644 index 0000000..bd64fdb --- /dev/null +++ b/javascript/app/templates/application.hbs @@ -0,0 +1,26 @@ +<div class="absolute-container"> + <div class="flex-container"> + <div class="header"> + <img src="/assets/haskell.ico"> + <div class="container"> + <span class="header-item">{{#link-to 'packages'}}Haskell packages{{/link-to}}</span> + <span class="header-item"><a target="_blank" href="https://github.com/alexwl/haskell-code-explorer">About</a></span> + <span class="header-item"> + {{#each themes as |theme|}} + {{#radio-button + value=theme.id + groupValue=currentTheme + changed="themeChanged"}} + <span>{{theme.name}}</span> + {{/radio-button}} + {{/each}} + </span> + </div> + </div> + <div class="content"> + <div class="absolute-container"> + {{outlet}} + </div> + </div> + </div> +</div> diff --git a/javascript/app/templates/bad-url.hbs b/javascript/app/templates/bad-url.hbs new file mode 100644 index 0000000..6b36386 --- /dev/null +++ b/javascript/app/templates/bad-url.hbs @@ -0,0 +1,6 @@ +<div class="container"> + <div style="margin-top:10px"> + <h1>Not found</h1> + <div><a href="/">Main page</a></div> + </div> +</div> diff --git a/javascript/app/templates/components/.gitkeep b/javascript/app/templates/components/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/javascript/app/templates/components/.gitkeep diff --git a/javascript/app/templates/components/bottom-panel.hbs b/javascript/app/templates/components/bottom-panel.hbs new file mode 100644 index 0000000..26b1919 --- /dev/null +++ b/javascript/app/templates/components/bottom-panel.hbs @@ -0,0 +1,9 @@ +<div class="bottom-panel-header"> + <span class="bottom-panel-header-content">{{yield "header"}}</span> + <span class="bottom-panel-header-options"> + <a href="#" {{action "close"}}>Close</a> + </span> +</div> +<div class="bottom-panel-content"> + {{yield "body"}} +</div> diff --git a/javascript/app/templates/components/expression-info.hbs b/javascript/app/templates/components/expression-info.hbs new file mode 100644 index 0000000..509fb24 --- /dev/null +++ b/javascript/app/templates/components/expression-info.hbs @@ -0,0 +1,8 @@ +<div class="expressions"> + {{#each expressions as |expression|}} + <div class="expression"> + <span class="source-code">{{expression.sourceCode}}</span> + <br/>:: {{type-signature type=expression.info.exprType identifiers=identifiers currentLineNumber=currentLineNumber}} + </div> + {{/each}} +</div> diff --git a/javascript/app/templates/components/file-tree.hbs b/javascript/app/templates/components/file-tree.hbs new file mode 100644 index 0000000..b5e38ef --- /dev/null +++ b/javascript/app/templates/components/file-tree.hbs @@ -0,0 +1,8 @@ +<div class="file-tree-header"> + <div class="input-group"> + {{input class="form-control" value=query placeholder="Filename"}}<a class="hide-file-tree" href="#" {{action "hide"}}>Hide</a> + </div> +</div> +<div class="file-tree-content"> + <div class="file-tree"></div> +</div> diff --git a/javascript/app/templates/components/haskell-module.hbs b/javascript/app/templates/components/haskell-module.hbs new file mode 100644 index 0000000..77b9df7 --- /dev/null +++ b/javascript/app/templates/components/haskell-module.hbs @@ -0,0 +1,57 @@ +<div class="source-code-container"></div> +{{#if declarations}} + <div class="declarations"> + <div class="declarations-header"> + <div class="input-group"> + {{input class="form-control" value=query placeholder="Identifier"}}<a class="hide-declarations" href="#" {{action "toggleShowDeclarations"}}>{{showDeclarationsLabel}}</a> + </div> + </div> + {{#if showDeclarations}} + <div id="declarations-content" class="declarations-content"> + <ul> + {{#infinite-list containerElementId="declarations-content" elements=filteredDeclarations perPage=30 as |declaration|}} + <li class="declaration"> + <div class="declaration"> + <a {{action "goToLine" declaration.lineNumber}} href="#"><span class="source-code-font">{{declaration.name}}{{#if declaration.declType}} :: {{type-signature-text components=declaration.declType.components}}{{/if}}</span> + </a><span>{{#unless declaration.isExported}}<i>(not exported)</i>{{/unless}}</span> + </div> + </li> + {{/infinite-list}} + </ul> + </div> + {{/if}} + </div> +{{/if}} +{{#info-window + targetElement=selectedIdentifier + isHoveredOverIdentifier=isHoveredOverIdentifier + hasSelectedExpression=hasSelectedExpression + containerElementId="right-panel" as |section|}} + {{#if (eq section "header")}} + {{#if hasSelectedExpression}} + <div>Selected expressions</div> + {{else}} + {{identifier-name + identifierInfo=identifierInfo + identifierOccurrence=identifierOccurrence + identifierElement=selectedIdentifier + currentPackageId=packageId + isBinder=identifierOccurrence.isBinder + currentLineNumber=currentLineNumber + findReferences=findReferences}} + {{/if}} + {{else}} + {{#unless hasSelectedExpression}} + {{identifier-info + identifierInfo=identifierInfo + identifierOccurrence=identifierOccurrence + identifiers=identifiers + currentLineNumber=currentLineNumber}} + {{else}} + {{expression-info + expressions=expressions + identifiers=identifiers + currentLineNumber=currentLineNumber}} + {{/unless}} + {{/if}} +{{/info-window}} diff --git a/javascript/app/templates/components/identifier-info.hbs b/javascript/app/templates/components/identifier-info.hbs new file mode 100644 index 0000000..7146a2e --- /dev/null +++ b/javascript/app/templates/components/identifier-info.hbs @@ -0,0 +1,39 @@ +{{#if (or identifierInfo identifierOccurrence.idOccType)}} + <div class="identifier-info"> + {{#if identifierInfo}} + {{#if isNaughtyRecSel}} + <i>This record selector can never be called because its type mentions a type variable that isn't in the result type of the constructor</i> + {{else}} + {{type-signature + type=identifierInfo.idType + identifiers=identifiers + currentLineNumber=currentLineNumber}} + {{/if}} + {{/if}} + {{#if (and identifierInfo identifierOccurrence identifierOccurrence.idOccType)}} + <div style="height:10px"></div> + {{/if}} + {{#if (and identifierOccurrence identifierOccurrence.idOccType)}} + {{type-signature + type=identifierOccurrence.idOccType + identifiers=identifiers + currentLineNumber=currentLineNumber}} + {{/if}} + <div class="documentation"> + {{{identifierInfo.doc}}} + {{{downloadedDocumentation}}} + </div> + {{#if identifierOccurrence.instanceResolution}} + <div style="height:10px"></div> + {{/if}} + <div> + {{#if identifierOccurrence.instanceResolution}} + {{instance-info + instance=identifierOccurrence.instanceResolution + identifiers=identifiers + nestedLevel=0 + currentLineNumber=currentLineNumber}} + {{/if}} + </div> + </div> +{{/if}} diff --git a/javascript/app/templates/components/identifier-name.hbs b/javascript/app/templates/components/identifier-name.hbs new file mode 100644 index 0000000..ca16e23 --- /dev/null +++ b/javascript/app/templates/components/identifier-name.hbs @@ -0,0 +1,12 @@ +<div> + <span class="source-code-font break-word identifier-menu-item" style={{style}}>{{#if identifierInfo.demangledOccName}}{{identifierInfo.demangledOccName}}{{else}}{{name}}{{/if}}</span> + {{#unless isBinder}} + {{#if location}} + <span class="identifier-menu-item">{{location}}</span> + <span class="link identifier-menu-item" onmouseup={{action "goToDefinition"}}>Go to definition</span> + {{/if}} + {{/unless}} + {{#if isExternalIdentifier}} + <span class="link identifier-menu-item" onmouseup={{action "findReferences" identifierInfo currentPackageId}}>Find references</span> + {{/if}} +</div> diff --git a/javascript/app/templates/components/infinite-list.hbs b/javascript/app/templates/components/infinite-list.hbs new file mode 100644 index 0000000..ab103d4 --- /dev/null +++ b/javascript/app/templates/components/infinite-list.hbs @@ -0,0 +1,3 @@ +{{#each renderedElements as |element|}} + {{yield element}} +{{/each}} diff --git a/javascript/app/templates/components/info-window.hbs b/javascript/app/templates/components/info-window.hbs new file mode 100644 index 0000000..003e2c5 --- /dev/null +++ b/javascript/app/templates/components/info-window.hbs @@ -0,0 +1,12 @@ +<div class="info-window"> + <div class="info-window-header"> + <div class="info-window-options"> + <a href="#" {{action "pin"}}>{{#if isPinned}}Unpin{{else}}Pin{{/if}}</a> + <a href="#" {{action "close"}}>Close</a> + </div> + {{yield "header"}} + </div> + <div class="info-window-content"> + {{yield "body"}} + </div> +</div> diff --git a/javascript/app/templates/components/input-with-autocomplete.hbs b/javascript/app/templates/components/input-with-autocomplete.hbs new file mode 100644 index 0000000..eb0100d --- /dev/null +++ b/javascript/app/templates/components/input-with-autocomplete.hbs @@ -0,0 +1,19 @@ +<div class="input-group"> + {{input class="form-control search-input" value=query placeholder=placeholder}} + <div class="autocomplete-container"> + {{# if items}} + <ul class="autocomplete-items"> + {{#each items as |item index|}} + <li class="{{if (eq index highlightedItemIndex) "highlighted"}}" onclick={{action "goToDefinition" item}}> + <div class="autocomplete-item"> + {{yield item}} + </div> + </li> + {{/each}} + </ul> + {{/if}} + </div> + <div class="input-group-append"> + <button id="search-input" class="btn btn-outline-secondary" {{action "onSubmit" query}}>Search</button> + </div> +</div> diff --git a/javascript/app/templates/components/instance-info.hbs b/javascript/app/templates/components/instance-info.hbs new file mode 100644 index 0000000..b5c2fdf --- /dev/null +++ b/javascript/app/templates/components/instance-info.hbs @@ -0,0 +1,10 @@ +{{#if instance}} + <div style={{style}}> + <span class="source-code-font"> + instance {{type-signature type=instance.instanceType identifiers=identifiers currentLineNumber=currentLineNumber noExpand=true}}</span> + (<span class="link" onclick={{action "goToDefinition"}}>Go to definition</span>) + {{#each instance.instances as |inst|}} + {{instance-info instance=inst identifiers=identifiers nestedLevel=nextNestedLevel currentLineNumber=currentLineNumber}} + {{/each}} + </div> +{{/if}} diff --git a/javascript/app/templates/components/paginated-list.hbs b/javascript/app/templates/components/paginated-list.hbs new file mode 100644 index 0000000..2ae9813 --- /dev/null +++ b/javascript/app/templates/components/paginated-list.hbs @@ -0,0 +1,17 @@ +<div class="paginated-list-header"> + <span>Found {{total}}</span> + {{#if (or next prev)}} + + + <span> + {{#if first}}<button class="btn btn-outline-secondary btn-sm" {{action "update" first.href}}><<</button>{{/if}} + {{#if prev}}<button button class="btn btn-outline-secondary btn-sm" {{action "update" prev.href}}><</button>{{/if}} + {{firstItemOnPage}} - {{lastItemOnPage}} + {{#if next}}<button button class="btn btn-outline-secondary btn-sm" {{action "update" next.href}}>></button>{{/if}} + {{#if last}}<button button class="btn btn-outline-secondary btn-sm" {{action "update" last.href}}>>></button>{{/if}} + </span> + {{/if}} +</div> +<div class="paginated-list-content"> + {{yield items}} +</div> diff --git a/javascript/app/templates/components/resizable-panel.hbs b/javascript/app/templates/components/resizable-panel.hbs new file mode 100644 index 0000000..0fd3aa7 --- /dev/null +++ b/javascript/app/templates/components/resizable-panel.hbs @@ -0,0 +1,5 @@ +<div class="absolute-container">{{yield (action "hide")}} + <div onclick={{action "hide"}} class="show-left-panel-button"> + {{{hideButtonLabel}}} + </div> +</div> diff --git a/javascript/app/templates/components/text-file.hbs b/javascript/app/templates/components/text-file.hbs new file mode 100644 index 0000000..6a50453 --- /dev/null +++ b/javascript/app/templates/components/text-file.hbs @@ -0,0 +1,3 @@ +<div class="source-code-container"> +{{{html}}} +</div> diff --git a/javascript/app/templates/components/type-component.hbs b/javascript/app/templates/components/type-component.hbs new file mode 100644 index 0000000..775324e --- /dev/null +++ b/javascript/app/templates/components/type-component.hbs @@ -0,0 +1,3 @@ +{{#if (and expanded identifierInfo)}}({{/if}} +<span class="source-code {{linkClass}}" onmouseup={{action "onmouseup"}}>{{occName}}</span> +{{#if (and expanded identifierInfo)}} :: {{type-signature type=identifierInfo.idType identifiers=identifiers noExpand=true}}){{/if}} diff --git a/javascript/app/templates/components/type-signature-text.hbs b/javascript/app/templates/components/type-signature-text.hbs new file mode 100644 index 0000000..505a466 --- /dev/null +++ b/javascript/app/templates/components/type-signature-text.hbs @@ -0,0 +1,2 @@ +{{!-- No newlines to get rid of spaces between spans --}} +{{#each components as |typeComponent|}}{{#if (eq typeComponent.tag "Text")}}{{typeComponent.contents}}{{else}}{{typeComponent.name}}{{/if}}{{/each}} diff --git a/javascript/app/templates/components/type-signature.hbs b/javascript/app/templates/components/type-signature.hbs new file mode 100644 index 0000000..249f1b8 --- /dev/null +++ b/javascript/app/templates/components/type-signature.hbs @@ -0,0 +1,10 @@ +{{!-- No newlines to get rid of spaces between spans --}} +{{#each components as |typeComponent|}}{{#if (eq typeComponent.tag "Text")}}<span class="source-code">{{typeComponent.contents}}</span>{{else}}{{type-component occName=typeComponent.name internalId=typeComponent.internalId identifiers=identifiers currentLineNumber=currentLineNumber}}{{/if}}{{/each}} +{{#unless noExpand}} + {{#if type.componentsExpanded}} + <div style="margin-top:5px"> + <button class="btn btn-outline-secondary btn-sm" {{action "toggleExpandTypeSynonyms"}}>{{expandTypeSynonymsLabel}} + </button> + </div> + {{/if}} +{{/unless}} diff --git a/javascript/app/templates/package.hbs b/javascript/app/templates/package.hbs new file mode 100644 index 0000000..c8ed0dc --- /dev/null +++ b/javascript/app/templates/package.hbs @@ -0,0 +1,57 @@ +<div class="flex-container"> + <div class="package-header"> + <span class="package-header-package-name">{{#link-to 'package' model}}{{model.id}}{{/link-to}}</span> + <span class="package-header-input"> + {{#input-with-autocomplete + onSubmit=(action 'searchIdentifier') + createSearchUrlFunction=createSearchUrlFunction + maxItems=10 + selectItem=(action 'showIdentifier') + placeholder="Identifier" as |identifier|}} + <span class="source-code-font">{{identifier.demangledOccName}} :: {{type-signature-text components=identifier.idType.components}}</span> + <div class="module-name"> + {{#if identifier.locationInfo.modulePath}} + {{identifier.locationInfo.modulePath}} + {{else}} + {{identifier.locationInfo.moduleName}} + {{/if}} + </div> + {{/input-with-autocomplete}} + </span> + {{#if currentFile}} + <span class="package-header-filename"> + {{currentFile}} + </span> + {{/if}} + </div> + <div class="package-content"> + {{#resizable-panel class="left-panel" alsoResizeElementId="#right-panel" as |hide|}} + <div class="file-tree-container"> + {{file-tree directoryTree=model.directoryTree openFile="openFile" currentFile=currentFile packageId=model.id hide=hide}} + </div> + {{/resizable-panel}} + <div id="right-panel" class="right-panel"> + <div id="file-container" class="file-container"> + {{outlet}} + </div> + {{#bottom-panel visible=bottomPanelVisible topPanelElementId="#file-container" containerElementId="#right-panel" as |section|}} + {{#if (eq section "header")}} + References to <b><span class="source-code">{{occName}}</span></b> in <span class="source-code">{{packageId}}</span> + {{else}} + {{#paginated-list url=referencesUrl as |files|}} + <ul> + {{#each files as |file|}} + <li> + <div class="file-name"><a href="/package/{{packageId}}/show/{{file.name}}">{{file.name}}</a></div> + {{#each file.references as |reference|}} + <a class="source-code source-code-snippet" href="/package/{{packageId}}/show/{{file.name}}#L{{reference.idSrcSpan.line}}">{{{reference.sourceCodeHtml}}}</a> + {{/each}} + </li> + {{/each}} + </ul> + {{/paginated-list}} + {{/if}} + {{/bottom-panel}} + </div> + </div> +</div> diff --git a/javascript/app/templates/package/index.hbs b/javascript/app/templates/package/index.hbs new file mode 100644 index 0000000..e9bc592 --- /dev/null +++ b/javascript/app/templates/package/index.hbs @@ -0,0 +1,12 @@ +<div class="package-modules"> + <div class="module-search-input"> + {{input class="form-control" type="text" value=query placeholder="Module name"}} + </div> + <ul class="modules"> + {{#each modulesFiltered as |module|}} + <li> + <a href="/package/{{model.id}}/show/{{module}}">{{module}}</a> + </li> + {{/each}} + </ul> +</div> diff --git a/javascript/app/templates/package/search.hbs b/javascript/app/templates/package/search.hbs new file mode 100644 index 0000000..ebc4d52 --- /dev/null +++ b/javascript/app/templates/package/search.hbs @@ -0,0 +1,21 @@ +<div class="search-results-header"> + Query : {{model.query}} +</div> +<div class="search-results-content"> + {{#paginated-list url=model.url as |identifiers|}} + <ul> + {{#each identifiers as |identifier|}} + <li class="search-result"> + <span class="source-code" >{{identifier.demangledOccName}} :: {{type-signature-text components=identifier.idType.components}}</span> + <div><a href="#" onmouseup={{action "goToDefinition" identifier.locationInfo}}>Go to definition</a></div> + <div class="identifier-module"> + {{#if identifier.locationInfo.modulePath}} + Defined in <a href="/package/{{identifier.locationInfo.packageId.name}}-{{identifier.locationInfo.packageId.version}}/show/{{identifier.locationInfo.modulePath}}">{{identifier.locationInfo.modulePath}}</a> + {{/if}} + </div> + <div>{{{identifier.doc}}}</div> + </li> + {{/each}} + </ul> + {{/paginated-list}} +</div> diff --git a/javascript/app/templates/package/show.hbs b/javascript/app/templates/package/show.hbs new file mode 100644 index 0000000..c24cd68 --- /dev/null +++ b/javascript/app/templates/package/show.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/javascript/app/templates/package/show/file.hbs b/javascript/app/templates/package/show/file.hbs new file mode 100644 index 0000000..b127fd7 --- /dev/null +++ b/javascript/app/templates/package/show/file.hbs @@ -0,0 +1,16 @@ +{{#if model.isHaskellModule}} + {{haskell-module + path=model.id + name=model.name + packageId=model.packageId + componentId=model.componentId + html=model.sourceCodeHtml + identifiers=model.identifiers + occurrences=model.occurrences + colorTheme=settings.colorTheme + declarations=model.declarations + findReferences=(action "findReferences") + }} +{{else}} + {{text-file text=model.text path=model.id}} +{{/if}} diff --git a/javascript/app/templates/packages.hbs b/javascript/app/templates/packages.hbs new file mode 100644 index 0000000..6dc4b7b --- /dev/null +++ b/javascript/app/templates/packages.hbs @@ -0,0 +1,26 @@ +<div class="flex-container container"> + <div> + <!-- <p class="lead"><b>Haskell code explorer</b> </p> --> + <div class="package-search-form"> + {{input class="form-control" type="text" value=query placeholder="Package name"}} + <span>Number of packages : {{packages.length}}</span> + </div> + </div> + <div id="packages" class="packages"> + <ul> + {{#infinite-list containerElementId="packages" elements=packages perPage=80 as |package|}} + <li> + {{#each package.versions as |version index|}} + {{#link-to 'package' (concat package.name "-" version)}} + {{#if (gt index 0)}} + {{version}} + {{else}} + {{package.name}}-{{version}} + {{/if}} + {{/link-to}} + {{/each}} + </li> + {{/infinite-list}} + </ul> + </div> +</div> |