Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
docs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
docs
Commits
ed12a65c
Commit
ed12a65c
authored
Apr 16, 2016
by
Tobias Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default arch download default to amd64
Remove the popular option as it only included a single item.
parent
4f04f9da
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
26 deletions
+30
-26
download.html
content/download.html
+2
-2
default.rb
lib/default.rb
+0
-18
download.rb
lib/helpers/download.rb
+21
-0
docs.js
static/docs.js
+7
-6
No files found.
content/download.html
View file @
ed12a65c
...
...
@@ -36,8 +36,8 @@ title: Download
<div
class=
"panel panel-default download-selection"
>
<div
class=
"panel-body"
>
Operating system
<
%=
dropdown
(
:os
,
Downloads
.
operating_systems
)
%
>
Architecture
<
%=
dropdown
(
:arch
,
Downloads
.
architectures
)
%
>
Operating system
<
%=
dropdown
(
:os
,
Downloads
.
operating_systems
,
:popular
,
popular:
%
w
(
darwin
linux
windows
)
)
%
>
Architecture
<
%=
dropdown
(
:arch
,
Downloads
.
architectures
,
:amd64
)
%
>
</div>
</div>
...
...
lib/default.rb
View file @
ed12a65c
...
...
@@ -24,21 +24,3 @@ module BlogHelper
end
end
include
BlogHelper
module
DownloadHelper
def
format_bytes
(
bytes
)
'%.2f MiB'
%
(
bytes
.
to_f
/
1024
/
1024
)
end
def
dropdown
(
name
,
items
)
caption
=
%(<span class="caption">all</span> <span class="caret"></span>)
button
=
%(<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">#{caption}</button>)
default
=
%(<li><a href="#">all</a></li><li><a href="#">popular</a></li><li role="separator" class="divider"></li>)
list
=
%(<ul class="dropdown-menu">#{default} #{items.map { |i| %(<li><a href="#">#{i}</a></li>) }.join('') }</ul>)
%(<div class="btn-group #{name}">#{button} #{list}</div>)
end
end
include
DownloadHelper
lib/helpers/download.rb
View file @
ed12a65c
...
...
@@ -114,4 +114,25 @@ module Downloads
@data
[
'size'
]
end
end
module
Helper
def
format_bytes
(
bytes
)
'%.2f MiB'
%
(
bytes
.
to_f
/
1024
/
1024
)
end
def
dropdown
(
name
,
items
,
default
,
groups
=
{})
additional
=
groups
.
map
do
|
name
,
items
|
%(<li data-group="#{items.join(' ')}"><a href="#">#{name}</a></li>)
end
.
join
(
''
)
caption
=
%(<span class="caption">#{default}</span> <span class="caret"></span>)
button
=
%(<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">#{caption}</button>)
header
=
%(<li><a href="#">all</a></li>#{additional}<li role="separator" class="divider"></li>)
list
=
%(<ul class="dropdown-menu">#{header} #{items.map { |i| %(<li><a href="#">#{i}</a></li>) }.join('') }</ul>)
%(<div class="btn-group #{name}">#{button} #{list}</div>)
end
end
end
include
Downloads
::
Helper
static/docs.js
View file @
ed12a65c
...
...
@@ -20,23 +20,25 @@ $(document).ready(function() {
$
(
this
).
replaceWith
(
link
);
});
var
selected
=
function
(
value
,
want
,
popular
)
{
var
selected
=
function
(
value
,
want
,
group
)
{
switch
(
want
)
{
case
'
all
'
:
return
true
;
case
'
popular
'
:
return
popular
.
indexOf
(
value
)
>
-
1
;
default
:
if
(
group
.
length
>
0
)
{
return
group
.
indexOf
(
value
)
>
-
1
;
}
return
value
===
want
;
}
}
var
selectDownloads
=
function
()
{
var
os
=
$
(
'
.download-selection .os .caption
'
).
text
();
var
osGroup
=
$
(
'
.download-selection .os li:contains("
'
+
os
+
'
")
'
).
data
(
"
group
"
);
var
arch
=
$
(
'
.download-selection .arch .caption
'
).
text
();
$
(
'
.downloads tbody tr
'
).
each
(
function
()
{
if
(
selected
(
$
(
this
).
data
(
'
os
'
).
toString
(),
os
,
[
'
darwin
'
,
'
linux
'
,
'
windows
'
])
&&
selected
(
$
(
this
).
data
(
'
arch
'
).
toString
(),
arch
,
[
'
amd64
'
]))
{
if
(
selected
(
$
(
this
).
data
(
'
os
'
).
toString
(),
os
,
osGroup
!==
undefined
?
osGroup
.
split
(
'
'
)
:
[
])
&&
selected
(
$
(
this
).
data
(
'
arch
'
).
toString
(),
arch
,
[]))
{
$
(
this
).
show
();
}
else
{
$
(
this
).
hide
();
...
...
@@ -44,7 +46,6 @@ $(document).ready(function() {
});
};
$
(
'
.download-selection button .caption
'
).
text
(
'
popular
'
);
selectDownloads
();
$
(
'
.download-selection a
'
).
on
(
'
click
'
,
function
()
{
...
...
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