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

Highlight #34

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 20 additions & 18 deletions app/go
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<title>rekon v1.0.2</title>
<link href='screen.css' media='screen, projection' rel='stylesheet' type='text/css' />
<title>rekon v1.0.2</title>
<link href='screen.css' media='screen, projection' rel='stylesheet' type='text/css' />
<link rel="icon" type="image/png" href="riaklogo.png">
<script src='jquery-1.5.1.min.js' type='text/javascript'></script>
<script src='sammy-0.6.3.min.js' type='text/javascript'></script>
<script src='sammy.template-0.6.3.min.js' type='text/javascript'></script>
<script src='sammy.nested_params-0.6.3.min.js' type='text/javascript'></script>
<script src='jquery.quicksearch.js' type='text/javascript'></script>
<script src='json2.js' type='text/javascript'></script>
<script src='riak.js' type='text/javascript'></script>
<script src='rekon.js' type='text/javascript'></script>
<link rel="stylesheet" href="highlight-default.css">
<script src="highlight.pack.js"></script>
<script src='jquery-1.5.1.min.js' type='text/javascript'></script>
<script src='sammy-0.6.3.min.js' type='text/javascript'></script>
<script src='sammy.template-0.6.3.min.js' type='text/javascript'></script>
<script src='sammy.nested_params-0.6.3.min.js' type='text/javascript'></script>
<script src='jquery.quicksearch.js' type='text/javascript'></script>
<script src='json2.js' type='text/javascript'></script>
<script src='riak.js' type='text/javascript'></script>
<script src='rekon.js' type='text/javascript'></script>
</head>
<body>
<div id='container'>
<div id='home'>
<a href='#'>rekon <code>1.0.2</code></a>
</div>
<div id='content'>
<div id='container'>
<div id='home'>
<a href='#'>rekon <code>1.0.2</code></a>
</div>
<div id='content'>
<h1></h1>
<div id='main'></div>
<ul id='footer-navi'>
<li class="perm">
<a href="#/stats">Stats</a>
</li>
<li class="perm">
<a href="#/buckets">Buckets</a>
<a href="#/buckets">Buckets</a>
</li>
</ul>
</div>
</ul>
</div>
</div>
</body>
</html>
152 changes: 152 additions & 0 deletions app/highlight-default.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
/*

Original style from softwaremaniacs.org (c) Ivan Sagalaev <[email protected]>

*/

.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #f0f0f0;
}

.hljs,
.hljs-subst,
.hljs-tag .hljs-title,
.lisp .hljs-title,
.clojure .hljs-built_in,
.nginx .hljs-title {
color: black;
}

.hljs-string,
.hljs-title,
.hljs-constant,
.hljs-parent,
.hljs-tag .hljs-value,
.hljs-rules .hljs-value,
.hljs-preprocessor,
.hljs-pragma,
.haml .hljs-symbol,
.ruby .hljs-symbol,
.ruby .hljs-symbol .hljs-string,
.hljs-template_tag,
.django .hljs-variable,
.smalltalk .hljs-class,
.hljs-addition,
.hljs-flow,
.hljs-stream,
.bash .hljs-variable,
.apache .hljs-tag,
.apache .hljs-cbracket,
.tex .hljs-command,
.tex .hljs-special,
.erlang_repl .hljs-function_or_atom,
.asciidoc .hljs-header,
.markdown .hljs-header,
.coffeescript .hljs-attribute {
color: #800;
}

.smartquote,
.hljs-comment,
.hljs-annotation,
.hljs-template_comment,
.diff .hljs-header,
.hljs-chunk,
.asciidoc .hljs-blockquote,
.markdown .hljs-blockquote {
color: #888;
}

.hljs-number,
.hljs-date,
.hljs-regexp,
.hljs-literal,
.hljs-hexcolor,
.smalltalk .hljs-symbol,
.smalltalk .hljs-char,
.go .hljs-constant,
.hljs-change,
.lasso .hljs-variable,
.makefile .hljs-variable,
.asciidoc .hljs-bullet,
.markdown .hljs-bullet,
.asciidoc .hljs-link_url,
.markdown .hljs-link_url {
color: #080;
}

.hljs-label,
.hljs-javadoc,
.ruby .hljs-string,
.hljs-decorator,
.hljs-filter .hljs-argument,
.hljs-localvars,
.hljs-array,
.hljs-attr_selector,
.hljs-important,
.hljs-pseudo,
.hljs-pi,
.haml .hljs-bullet,
.hljs-doctype,
.hljs-deletion,
.hljs-envvar,
.hljs-shebang,
.apache .hljs-sqbracket,
.nginx .hljs-built_in,
.tex .hljs-formula,
.erlang_repl .hljs-reserved,
.hljs-prompt,
.asciidoc .hljs-link_label,
.markdown .hljs-link_label,
.vhdl .hljs-attribute,
.clojure .hljs-attribute,
.asciidoc .hljs-attribute,
.lasso .hljs-attribute,
.coffeescript .hljs-property,
.hljs-phony {
color: #88f;
}

.hljs-keyword,
.hljs-id,
.hljs-title,
.hljs-built_in,
.css .hljs-tag,
.hljs-javadoctag,
.hljs-phpdoc,
.hljs-yardoctag,
.smalltalk .hljs-class,
.hljs-winutils,
.bash .hljs-variable,
.apache .hljs-tag,
.go .hljs-typename,
.tex .hljs-command,
.asciidoc .hljs-strong,
.markdown .hljs-strong,
.hljs-request,
.hljs-status {
font-weight: bold;
}

.asciidoc .hljs-emphasis,
.markdown .hljs-emphasis {
font-style: italic;
}

.nginx .hljs-built_in {
font-weight: normal;
}

.coffeescript .javascript,
.javascript .xml,
.lasso .markup,
.tex .hljs-formula,
.xml .javascript,
.xml .vbscript,
.xml .css,
.xml .hljs-cdata {
opacity: 0.5;
}
8 changes: 8 additions & 0 deletions app/highlight.pack.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 23 additions & 8 deletions app/rekon.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ rekonApp = Sammy('#container', function(){
$('#row_search').quicksearch(selector, {selector: 'th'});
};

normalizeContentType = function(contentType) {
if (contentType.indexOf('application/json; charset=') == 0) {
normalized = 'application/json';
} else {
normalized = contentType;
}
return normalized;
}

this.use('Template');
this.use('NestedParams');

Expand Down Expand Up @@ -92,7 +101,7 @@ rekonApp = Sammy('#container', function(){
/* bind the limit based off of the n_val */
Rekon.capControlsSelector();
/* reselect cap control vals based off of nval */
for(i=0; i<$selects.length;i++) {
for(i=0; i<$selects.length;i++) {
$select = $($selects[i]);
$select.val($select.attr('data-select-value'));
}
Expand Down Expand Up @@ -121,16 +130,19 @@ rekonApp = Sammy('#container', function(){
context.render('key-meta.html.template', {object: object}).appendTo('#key tbody');
}).appendTo('#key tbody');

switch(object.contentType) {
contentType = normalizeContentType(object.contentType);

switch(contentType) {
case 'image/png':
case 'image/jpeg':
case 'image/jpg':
case 'image/gif':
context.render('value-image.html.template', {bucket: name, key: key}).appendTo('#value');
return;
case 'application/json':
value = JSON.stringify(object.body, null, 4);
break;
value = hljs.highlightAuto(JSON.stringify(object.body, null, 4)).value;
context.render('value-json.html.template', {value: value}).appendTo('#value');
return;
default:
value = object.body;
break;
Expand All @@ -154,7 +166,10 @@ rekonApp = Sammy('#container', function(){
context.render('edit-key.html.template', {bucket: name, key: key}).appendTo('#main');

bucket.get(key, function(status, object) {
switch(object.contentType) {

contentType = normalizeContentType(object.contentType);

switch(contentType) {
case 'image/png':
case 'image/jpeg':
case 'image/jpg':
Expand Down Expand Up @@ -228,7 +243,7 @@ rekonApp = Sammy('#container', function(){
});
});

this.post('#/buckets/:bucket/keys/:key', function(context){
this.post('#/buckets/:bucket/keys/:key', function(context){
var app = this;
var name = encode(this.params['bucket']);
var key = encode(this.params['key']);
Expand Down Expand Up @@ -335,12 +350,12 @@ Rekon = {
if (value) {
$select.val($select.find('option:last').val());
}
}
}
else if (endVal < nVal) {
while(endVal < nVal) {
endVal++;
$('<option>').val(endVal).html(endVal).appendTo($select);
}
}
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/riak.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ function RiakObject(bucketName, key, client, body, contentType, vclock) {
else {
this.contentType = contentType;
}
if (contentType === 'application/json') {
if (contentType === 'application/json' || contentType.indexOf('application/json; charset=') == 0) {
if (body !== undefined) {
try {
this.body = JSON.parse(body);
Expand Down
1 change: 1 addition & 0 deletions app/value-json.html.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<pre><%! value %></pre>