BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e1b0ed39
Unverified
Commit
e1b0ed39
authored
Apr 08, 2017
by
Jacob Schatz
Committed by
Luke "Jared" Bennett
Apr 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show thumbnails and their titles.
parent
ef07200c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
index.js
app/assets/javascripts/blob/balsamiq/index.js
+18
-4
No files found.
app/assets/javascripts/blob/balsamiq/index.js
View file @
e1b0ed39
...
...
@@ -8,19 +8,33 @@ export default class BalsamiqViewer {
}
loadSqlFile
()
{
var
xhr
=
new
XMLHttpRequest
();
console
.
log
(
this
.
el
)
var
self
=
this
;
xhr
.
open
(
'GET'
,
this
.
el
.
dataset
.
endpoint
,
true
);
xhr
.
responseType
=
'arraybuffer'
;
xhr
.
onload
=
function
(
e
)
{
var
list
=
document
.
createElement
(
'ul'
);
var
uInt8Array
=
new
Uint8Array
(
this
.
response
);
var
db
=
new
SQL
.
Database
(
uInt8Array
);
var
contents
=
db
.
exec
(
"SELECT * FROM thumbnails"
);
console
.
log
(
contents
)
// contents is now [{columns:['col1','col2',...], values:[[first row], [second row], ...]}]
var
previews
=
contents
[
0
].
values
.
map
((
i
)
=>
{
return
JSON
.
parse
(
i
[
1
])});
previews
.
forEach
((
prev
)
=>
{
var
li
=
document
.
createElement
(
'li'
);
var
title
=
db
.
exec
(
`select * from resources where id = '
${
prev
.
resourceID
}
'`
)
var
template
=
`<div class="panel panel-default">
<div class="panel-heading">
${
JSON
.
parse
(
title
[
0
].
values
[
0
][
2
]).
name
}
</div>
<div class="panel-body">
<img class="img-thumbnail" src="data:image/png;base64,
${
prev
.
image
}
"/>
</div>
</div>`
;
li
.
innerHTML
=
template
;
list
.
appendChild
(
li
);
});
list
.
classList
+=
'list-inline'
;
self
.
el
.
appendChild
(
list
);
};
xhr
.
send
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment