Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
75d3ed9a
Commit
75d3ed9a
authored
Apr 10, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Spinner class
parent
80745bc8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
3 deletions
+49
-3
app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js
app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js
+10
-3
app/assets/javascripts/spinner.js
app/assets/javascripts/spinner.js
+28
-0
app/assets/stylesheets/framework/files.scss
app/assets/stylesheets/framework/files.scss
+11
-0
No files found.
app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js
View file @
75d3ed9a
/* global Flash */
import
Spinner
from
'
../../spinner
'
;
import
sqljs
from
'
sql.js
'
;
class
BalsamiqViewer
{
constructor
(
viewer
)
{
this
.
viewer
=
viewer
;
this
.
endpoint
=
this
.
viewer
.
dataset
.
endpoint
;
this
.
spinner
=
new
Spinner
(
this
.
viewer
);
}
loadFile
()
{
...
...
@@ -17,10 +19,14 @@ class BalsamiqViewer {
xhr
.
onload
=
this
.
renderFile
.
bind
(
this
);
xhr
.
onerror
=
BalsamiqViewer
.
onError
;
this
.
spinner
.
start
();
xhr
.
send
();
}
renderFile
(
loadEvent
)
{
this
.
spinner
.
stop
();
const
container
=
document
.
createElement
(
'
ul
'
);
this
.
initDatabase
(
loadEvent
.
target
.
response
);
...
...
@@ -29,7 +35,7 @@ class BalsamiqViewer {
const
renderedPreviews
=
previews
.
map
(
preview
=>
this
.
renderPreview
(
preview
,
container
));
container
.
innerHTML
=
renderedPreviews
.
join
(
''
);
container
.
classList
.
add
(
'
list-inline
'
);
container
.
classList
.
add
(
'
list-inline
'
,
'
previews
'
);
this
.
viewer
.
appendChild
(
container
);
}
...
...
@@ -41,14 +47,15 @@ class BalsamiqViewer {
}
getPreviews
()
{
const
thumnails
=
this
.
database
.
exec
(
'
SELECT * FROM thumbnails
'
);
const
thum
b
nails
=
this
.
database
.
exec
(
'
SELECT * FROM thumbnails
'
);
return
thumnails
[
0
].
values
.
map
(
BalsamiqViewer
.
parsePreview
);
return
thum
b
nails
[
0
].
values
.
map
(
BalsamiqViewer
.
parsePreview
);
}
renderPreview
(
preview
)
{
const
previewElement
=
document
.
createElement
(
'
li
'
);
previewElement
.
classList
.
add
(
'
preview
'
);
previewElement
.
innerHTML
=
this
.
renderTemplate
(
preview
);
return
previewElement
.
outerHTML
;
...
...
app/assets/javascripts/spinner.js
0 → 100644
View file @
75d3ed9a
class
Spinner
{
constructor
(
renderable
)
{
this
.
renderable
=
renderable
;
this
.
container
=
Spinner
.
createContainer
();
}
start
()
{
this
.
renderable
.
prepend
(
this
.
container
);
}
stop
()
{
this
.
container
.
remove
();
}
static
createContainer
()
{
const
container
=
document
.
createElement
(
'
div
'
);
container
.
classList
.
add
(
'
loading
'
);
container
.
innerHTML
=
Spinner
.
TEMPLATE
;
return
container
;
}
}
Spinner
.
TEMPLATE
=
'
<i class="fa fa-spinner fa-spin"></i>
'
;
export
default
Spinner
;
app/assets/stylesheets/framework/files.scss
View file @
75d3ed9a
...
...
@@ -168,6 +168,17 @@
&
.code
{
padding
:
0
;
}
.list-inline.previews
{
display
:
flex
;
flex-wrap
:
wrap
;
justify-content
:
space-between
;
padding
:
$gl-padding
;
.preview
{
flex-shrink
:
0
;
}
}
}
}
...
...
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