Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#771 add a little perspective for viewing the current hawtio website
  • Loading branch information
jstrachan committed Nov 22, 2013
1 parent 0670538 commit d82c9fb
Show file tree
Hide file tree
Showing 16 changed files with 224 additions and 72 deletions.
80 changes: 80 additions & 0 deletions docs/Community.html
@@ -0,0 +1,80 @@
<div id="content-header">
<div class="container">
<h1>Community</h1>
</div>
</div>
<div class="container">
<div id="content">
<div id="intro">
<p>Welcome to the <b>hawtio</b> community! We <a href="../Contributing.md">love contributions</a>!</p>

<p><a class="btn btn-primary btn-large" href="../Contributing.md">How To Contribute</a></p>

<p>Please dive in wherever takes your fancy! It's <i>hawt</i> but stay cool!</p>
</div>

<div class="section">
<h2 class="icon github"><img src="/app/site/doc/images/octocat_social.png"/> Issue Tracker</h2>

<p>The project tracks bugs, feature requests, and other issues through the Github issue tracking system.</p>

<p><a class="btn btn-primary btn-large" href="https://github.com/hawtio/hawtio/issues">hawtio issue tracker</a>
</p>

<p>To file new issues or comment on existing issues you need to register for a <a href="http://github.com/">Github
account</a> which is quick and easy!
</p>
</div>

<div class="section">
<h2 class="icon forum"><img style="max-width: 48px; max-height: 48px;" src="/app/site/doc/images/stackoverflow.png">Mailing List</h2>

<p>We prefer to use the <a href="https://github.com/hawtio/hawtio/issues">issue tracker</a> for dealing with ideas
and
issues, but if you just want to chat about all things hawtio please join us on the mailing list.
Its pretty low volume though as we love <a href="https://github.com/hawtio/hawtio/issues">github issues</a></p>

<p><a class="btn btn-primary btn-large" href="https://groups.google.com/forum/#!forum/hawtio">hawtio mailing
list</a>
</p>
</div>

<div class="section">
<h2 class="icon chat"><img style="max-width: 48px; max-height: 48px;" src="/app/site/doc/images/stackoverflow.png">Chat (IRC)</h2>

<p>We invite you to join us in the <b>#hawtio</b> channel on <b>irc.freenode.net</b> to chat about hawtio</p>

<p>This channel is logged to <a class="btn"
href="http://transcripts.jboss.org/channel/irc.freenode.org/%23hawtio/2013/index.html">transcripts.jboss.org</a>
by JBossBot. The JBossBot is also present to expand issue numbers from the issue tracker.</p>
</div>

<div class="section">
<h2 class="h2"><img style="max-width: 48px; max-height: 48px;" src="/app/site/doc/images/stackoverflow.png">
Stack Overflow
</h2>

<p>We also keep an eye out on Stack Overflow for questions which makes it really easy to find answers to questions
and commonly found problems. Though if you're running into an issue please use our
<a href="https://github.com/hawtio/hawtio/issues">issue tracker</a> instead.</p>

<p>
<a class="btn btn-primary btn-large" href="http://stackoverflow.com/questions/tagged/hawtio">Stack Overflow</a>
</p>
</div>

<div class="section">
<h2 class="h2"><img src="/app/site/doc/images/octocat_social.png"/> Source Repository</h2>

<p>All the hawtio source code is managed using the distributed version system <a href="http://git-scm.com">git</a>
and hosted on <a href="http://github.com/">github</a>.</p>

<p><a class="btn btn-primary btn-large" href="http://github.com/hawtio/hawtio">hawtio @ github</a></p>


<p>Both git and Github are awesome for collaboration! To make improvements or bug fixes to the hawtio project,
simply
fork the project, commit your changes, and send a pull request.</p>
</div>
</div>
</div>
12 changes: 12 additions & 0 deletions docs/developers/index.md
@@ -0,0 +1,12 @@
### Developers

* [Developer Guide](../../DEVELOPERS.md)
* [Building](../../BUILDING.md)
* [Directives](../Directives.html)
* [How Plugins Work](../HowPluginsWork.md)
* [How To Make UI Stuff](../HowToMakeUIStuff.md)

### Committers

* [Coding Conventions](../CodingConventions.md)
* [Release Guide](../ReleaseGuide.md)
Binary file added docs/images/octocat_social.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/post_to_twitter.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/stackoverflow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions docs/index.md
Expand Up @@ -13,15 +13,3 @@
* [Change Log](../CHANGES.md)
* [Contributing](../CONTRIBUTING.md)

### Developers

* [Developer Guide](../DEVELOPERS.md)
* [Building](../BUILDING.md)
* [Directives](Directives.html)
* [How Plugins Work](HowPluginsWork.md)
* [How To Make UI Stuff](HowToMakeUIStuff.md)

### Committers

* [Coding Conventions](CodingConventions.md)
* [Release Guide](ReleaseGuide.md)
5 changes: 3 additions & 2 deletions hawtio-web/pom.xml
Expand Up @@ -308,15 +308,16 @@
<configuration>
<target>
<!-- copy the markdown docs into the site plugin -->
<copy todir="${basedir}/src/main/webapp/app/site" overwrite="true">
<copy todir="${webapp-outdir}/app/site" overwrite="true">
<fileset dir="${basedir}/..">
<include name="*.md" />
</fileset>
</copy>
<copy todir="${basedir}/src/main/webapp/app/site/doc" overwrite="true">
<copy todir="${webapp-outdir}/app/site/doc" overwrite="true">
<fileset dir="${basedir}/../docs">
<include name="**/*.md" />
<include name="**/*.html" />
<include name="images/*.*" />
</fileset>
</copy>
</target>
Expand Down
44 changes: 44 additions & 0 deletions hawtio-web/src/main/webapp/app/perspective/js/metadata.ts
Expand Up @@ -76,6 +76,50 @@ module Perspective {
}
]
}
},
website: {
label: "WebSite",
lastPage: "#/site/doc/index.md",
topLevelTabs: {
includes: [
{
content: "Getting Started",
title: "How to get started using hawtio",
href: () => "#/site/doc/GetStarted.md",
isValid: () => Site.isSiteNavBarValid()
},
{
content: "FAQ",
title: "Frequently Asked Questions",
href: () => "#/site/FAQ.md",
isValid: () => Site.isSiteNavBarValid()
},
{
content: "User Guide",
title: "All the docs on using hawtio",
href: () => "#/site/doc/index.md",
isValid: () => Site.isSiteNavBarValid()
},
{
content: "Community",
title: "Come on in and join our community!",
href: () => "#/site/doc/Community.html",
isValid: () => Site.isSiteNavBarValid()
},
{
content: "Developers",
title: "Resources for developers if you want to hack on hawtio or provide your own plugins",
href: () => "#/site/doc/developers/index.md",
isValid: () => Site.isSiteNavBarValid()
},
{
content: "github",
title: "Hawtio's source code and issue tracker",
href: () => "https://github.com/hawtio/hawtio",
isValid: () => Site.isSiteNavBarValid()
}
]
}
}
};

Expand Down
Expand Up @@ -56,10 +56,18 @@ module Perspective {
var id = tabSpec.id;
var rhref = tabSpec.rhref;
if (href) {
var hrefValue = href;
if (angular.isFunction(href)) {
hrefValue = href();
}
var tab = workspace.topLevelTabs.find((t) => {
var thref = t.href();
return thref && thref.startsWith(href);
return thref && thref.startsWith(hrefValue);
});
if (!tab && !id && tabSpec.content) {
// lets assume the tab is the tabSpec
tab = tabSpec;
}
if (tab) {
answer.push(tab);
}
Expand Down
2 changes: 0 additions & 2 deletions hawtio-web/src/main/webapp/app/site/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions hawtio-web/src/main/webapp/app/site/doc/.gitignore

This file was deleted.

3 changes: 3 additions & 0 deletions hawtio-web/src/main/webapp/app/site/js/book.ts
Expand Up @@ -5,8 +5,11 @@ module Site {
var log:Logging.Logger = Logger.get("Site");
var pageId = $routeParams["page"];
if (!pageId) {
pageId = "README.md";
/*
$location.path("/site/doc/index.md");
return;
*/
}

if (!pageId.startsWith("/") && pageId.indexOf(":/") < 0 && pageId.indexOf("app/site/") < 0) {
Expand Down
6 changes: 6 additions & 0 deletions hawtio-web/src/main/webapp/app/site/js/siteHelpers.ts
@@ -0,0 +1,6 @@
module Site {

export function isSiteNavBarValid() {
return true;
}
}
13 changes: 2 additions & 11 deletions hawtio-web/src/main/webapp/app/site/js/sitePlugin.ts
Expand Up @@ -14,24 +14,15 @@ module Site {
workspace.topLevelTabs.push({
content: "Site",
title: "View the documentation for Hawtio",
isValid: (workspace:Workspace) => true,
href: () => "#/site/doc/index.md"
isValid: (workspace:Workspace) => false,
href: () => "#/site"
});

/*
helpRegistry.addUserDoc('log', 'app/log/doc/help.md', () => {
return workspace.treeContainsDomainAndProperties('org.fusesource.insight', {type: 'LogQuery'});
});
*/
/*
workspace.subLevelTabs.push({
content: '<i class="icon-list-alt"></i> Log',
title: "View the logs in this process",
isValid: (workspace:Workspace) => workspace.hasDomainAndProperties('org.fusesource.insight', {type: 'LogQuery'}),
href: () => "#/logs"
});
*/
});

Expand Down
46 changes: 46 additions & 0 deletions hawtio-web/src/main/webapp/app/wiki/js/wikiHelpers.ts
Expand Up @@ -391,4 +391,50 @@ module Wiki {
}
return null;
}

/**
* Adjusts a relative or absolute link from a wiki or file system to one using the hash bang syntax
*/
export function adjustHref($scope, $location, href, fileExtension) {
var extension = fileExtension ? "." + fileExtension : "";

// if the last part of the path has a dot in it lets
// exclude it as we are relative to a markdown or html file in a folder
// such as when viewing readme.md or index.md
var path = $location.path();
var folderPath = path;
var idx = path.lastIndexOf("/");
if (idx > 0) {
var lastName = path.substring(idx + 1);
if (lastName.indexOf(".") >= 0) {
folderPath = path.substring(0, idx);
}
}

// Deal with relative URLs first...
if (href.startsWith('../')) {
var parts = href.split('/');
var pathParts = folderPath.split('/');
var parents = parts.filter((part) => {
return part === "..";
});
parts = parts.last(parts.length - parents.length);
pathParts = pathParts.first(pathParts.length - parents.length);

return '#' + pathParts.join('/') + '/' + parts.join('/') + extension + $location.hash();
}

// Turn an absolute link into a wiki link...
if (href.startsWith('/')) {
return Wiki.branchLink($scope.branch, href + extension, $location) + extension;
}

if (!Wiki.excludeAdjustmentPrefixes.any((exclude) => {
return href.startsWith(exclude);
})) {
return '#' + folderPath + "/" + href + extension + $location.hash();
} else {
return null;
}
}
}
61 changes: 19 additions & 42 deletions hawtio-web/src/main/webapp/app/wiki/js/wikiPlugin.ts
Expand Up @@ -49,58 +49,35 @@ module Wiki {

$element.bind('DOMNodeInserted', (event) => {
var ays = $element.find('a');

angular.forEach(ays, (a) => {
if (a.hasAttribute('no-adjust')) {
return;
}

a = $(a);

var href = (a.attr('href') || "").trim();
var fileExtension = a.attr('file-extension');
var extension = fileExtension ? "." + fileExtension : "";

// if the last part of the path has a dot in it lets
// exclude it as we are relative to a markdown or html file in a folder
// such as when viewing readme.md or index.md
var path = $location.path();
var folderPath = path;
var idx = path.lastIndexOf("/");
if (idx > 0) {
var lastName = path.substring(idx + 1);
if (lastName.indexOf(".") >= 0) {
folderPath = path.substring(0, idx);
if (href) {
var fileExtension = a.attr('file-extension');
var newValue = Wiki.adjustHref($scope, $location, href, fileExtension);
if (newValue) {
a.attr('href', newValue);
}
}

// Deal with relative URLs first...
if (href.startsWith('../')) {
var parts = href.split('/');
var pathParts = folderPath.split('/');
var parents = parts.filter((part) => {
return part === "..";
});
parts = parts.last(parts.length - parents.length);
pathParts = pathParts.first(pathParts.length - parents.length);

a.attr('href', '#' + pathParts.join('/') + '/' + parts.join('/') + extension + $location.hash());
Core.$apply($scope);
return;
}

// Turn an absolute link into a wiki link...
if (href.startsWith('/')) {
a.attr('href', Wiki.branchLink($scope.branch, href + extension, $location) + extension);
});
var imgs = $element.find('img');
angular.forEach(imgs, (a) => {
if (a.hasAttribute('no-adjust')) {
return;
}

if (!Wiki.excludeAdjustmentPrefixes.any((exclude) => {
return href.startsWith(exclude);
})) {
a.attr('href', '#' + folderPath + "/" + href + extension + $location.hash());
Core.$apply($scope);
return;
a = $(a);
var href = (a.attr('src') || "").trim();
if (href) {
if (href.startsWith("/")) {
href = url(href);
a.attr('src', href);

// lets avoid this element being reprocessed
a.attr('no-adjust', 'true');
}
}
});
})
Expand Down

0 comments on commit d82c9fb

Please sign in to comment.