mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-21 07:29:37 +01:00
Added icons, smoother animations, search readme's
This commit is contained in:
parent
8b3dc9072f
commit
1ddc1c68dc
56
lib/GUI/css/fontello.less
Normal file
56
lib/GUI/css/fontello.less
Normal file
@ -0,0 +1,56 @@
|
||||
@font-face {
|
||||
font-family: 'fontello';
|
||||
src: url('../static/fontello.eot?10872183');
|
||||
src: url('../static/fontello.eot?10872183#iefix') format('embedded-opentype'),
|
||||
url('../static/fontello.woff?10872183') format('woff'),
|
||||
url('../static/fontello.ttf?10872183') format('truetype'),
|
||||
url('../static/fontello.svg?10872183#fontello') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
|
||||
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
|
||||
/*
|
||||
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
||||
@font-face {
|
||||
font-family: 'fontello';
|
||||
src: url('../font/fontello.svg?10872183#fontello') format('svg');
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
[class^="icon-"]:before, [class*=" icon-"]:before {
|
||||
font-family: "fontello";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
speak: none;
|
||||
|
||||
display: inline-block;
|
||||
text-decoration: inherit;
|
||||
width: 1em;
|
||||
margin-right: .2em;
|
||||
text-align: center;
|
||||
/* opacity: .8; */
|
||||
|
||||
/* For safety - reset parent styles, that can break glyph codes*/
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
|
||||
/* fix buttons height, for twitter bootstrap */
|
||||
line-height: 1em;
|
||||
|
||||
/* Animation center compensation - margins should be symmetric */
|
||||
/* remove if not needed */
|
||||
margin-left: .2em;
|
||||
|
||||
/* you can be more comfortable with increased icons size */
|
||||
/* font-size: 120%; */
|
||||
|
||||
/* Uncomment for 3D effect */
|
||||
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
||||
}
|
||||
|
||||
.icon-search:before { content: '\e801'; } /* '' */
|
||||
.icon-cancel:before { content: '\e803'; } /* '' */
|
||||
.icon-right-open:before { content: '\e802'; } /* '' */
|
||||
.icon-angle-right:before { content: '\e800'; } /* '' */
|
@ -106,6 +106,7 @@ h2 {
|
||||
padding: 12px 15px 15px;
|
||||
.transition(height .3s);
|
||||
overflow: hidden;
|
||||
margin-bottom: 12px;
|
||||
|
||||
h3 {
|
||||
font-size: 24px;
|
||||
|
@ -9,7 +9,6 @@ $(function() {
|
||||
|
||||
//Close entry
|
||||
if($entry.hasClass('open')) {
|
||||
|
||||
$entry
|
||||
.height($entry.height())
|
||||
.removeClass('open');
|
||||
@ -27,10 +26,19 @@ $(function() {
|
||||
else {
|
||||
//Close open entries
|
||||
$('.entry.open').each(function() {
|
||||
var $this = $(this);
|
||||
$this
|
||||
.height($this.attr('data-height'))
|
||||
.removeClass('open');
|
||||
var $entry = $(this);
|
||||
$entry
|
||||
.height($entry.height())
|
||||
.removeClass('open');
|
||||
|
||||
setTimeout(function() {
|
||||
$entry.css('height', $entry.attr('data-height') + 'px');
|
||||
}, 0);
|
||||
|
||||
transitionComplete(function() {
|
||||
$entry.find('.readme').remove();
|
||||
$entry.css('height', 'auto');
|
||||
});
|
||||
});
|
||||
|
||||
//Add the open class
|
||||
|
@ -14,7 +14,7 @@ var express = require('express')
|
||||
, Handlebars = require('handlebars')
|
||||
, fs = require('fs')
|
||||
, localList = require('./local-list')
|
||||
, Search = require('./search')
|
||||
, search = require('./search')
|
||||
, _ = require('underscore')
|
||||
, marked = require('marked');
|
||||
|
||||
@ -30,8 +30,9 @@ function match(regexp) {
|
||||
|
||||
module.exports = function(config_hash) {
|
||||
var config = new Config(config_hash)
|
||||
, storage = new Storage(config)
|
||||
, search = new Search(storage);
|
||||
, storage = new Storage(config);
|
||||
|
||||
search.configureStorage(storage);
|
||||
|
||||
var can = function(action) {
|
||||
return function(req, res, next) {
|
||||
|
@ -29,7 +29,7 @@ LocalList.prototype = {
|
||||
return this.list;
|
||||
},
|
||||
sync: function() {
|
||||
fs.writeFile(listFilePath, JSON.stringify(this.list));
|
||||
fs.writeFileSync(listFilePath, JSON.stringify(this.list)); //Uses sync to prevent ugly race condition
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -9,7 +9,8 @@ var fs = require('fs')
|
||||
, Logger = require('./logger')
|
||||
, info_file = 'package.json'
|
||||
, localList = require('./local-list')
|
||||
, targz = require('tar.gz');
|
||||
, targz = require('tar.gz')
|
||||
, search = require('./search');
|
||||
|
||||
//
|
||||
// Implements Storage interface
|
||||
@ -47,7 +48,7 @@ Storage.prototype._internal_error = function(err, file, msg) {
|
||||
})
|
||||
}
|
||||
|
||||
Storage.prototype.add_package = function(name, metadata, callback) {
|
||||
Storage.prototype.add_package = function(name, package, callback) {
|
||||
this.storage(name).create_json(info_file, get_boilerplate(name), function(err) {
|
||||
if (err && err.code === 'EEXISTS') {
|
||||
return callback(new UError({
|
||||
@ -58,6 +59,9 @@ Storage.prototype.add_package = function(name, metadata, callback) {
|
||||
callback()
|
||||
})
|
||||
|
||||
console.log(package);
|
||||
|
||||
search.add(package.versions[package['dist-tags'].latest]);
|
||||
localList.add(name);
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,13 @@
|
||||
var lunr = require('lunr')
|
||||
, localList = require('./local-list');
|
||||
|
||||
var Search = function(storage) {
|
||||
this.storage = storage;
|
||||
|
||||
var Search = function() {
|
||||
this.index = lunr(function () {
|
||||
this.field('name', {boost: 10});
|
||||
this.field('description');
|
||||
this.field('author');
|
||||
this.field('name', {boost: 10});
|
||||
this.field('description', {boost: 4});
|
||||
this.field('author', {boost: 6});
|
||||
this.field('readme');
|
||||
});
|
||||
|
||||
this.reindex();
|
||||
};
|
||||
|
||||
Search.prototype = {
|
||||
@ -18,11 +15,16 @@ Search.prototype = {
|
||||
return this.index.search(q);
|
||||
},
|
||||
add: function(package) {
|
||||
this.index.add({
|
||||
id: package.name,
|
||||
name: package.name,
|
||||
description: package.description,
|
||||
author: package._npmUser.name
|
||||
var self = this;
|
||||
|
||||
this.storage.get_readme(package.name, package.version, function(readme) {
|
||||
self.index.add({
|
||||
id: package.name,
|
||||
name: package.name,
|
||||
description: package.description,
|
||||
author: package._npmUser.name,
|
||||
readme: readme
|
||||
});
|
||||
});
|
||||
},
|
||||
reindex: function() {
|
||||
@ -34,7 +36,11 @@ Search.prototype = {
|
||||
self.add(packages[i]);
|
||||
}
|
||||
});
|
||||
},
|
||||
configureStorage: function(storage) {
|
||||
this.storage = storage;
|
||||
this.reindex();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Search;
|
||||
module.exports = new Search();
|
BIN
lib/static/fontello.eot
Normal file
BIN
lib/static/fontello.eot
Normal file
Binary file not shown.
15
lib/static/fontello.svg
Normal file
15
lib/static/fontello.svg
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Copyright (C) 2014 by original authors @ fontello.com</metadata>
|
||||
<defs>
|
||||
<font id="fontello" horiz-adv-x="1000" >
|
||||
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
||||
<missing-glyph horiz-adv-x="1000" />
|
||||
<glyph glyph-name="search" unicode="" d="m643 386q0 103-74 176t-176 74-177-74-73-176 73-177 177-73 176 73 74 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69-80 0-153 31t-125 84-84 125-31 153 31 152 84 126 125 84 153 31 152-31 126-84 84-126 31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
|
||||
<glyph glyph-name="cancel" unicode="" d="m724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164 164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164 164-164q15-15 15-38z" horiz-adv-x="785.7" />
|
||||
<glyph glyph-name="right-open" unicode="" d="m613 386q0-29-20-51l-364-363q-21-21-50-21t-51 21l-42 42q-21 21-21 50 0 30 21 51l271 271-271 270q-21 22-21 51 0 30 21 50l42 42q20 21 51 21t50-21l364-363q20-21 20-50z" horiz-adv-x="642.9" />
|
||||
<glyph glyph-name="angle-right" unicode="" d="m332 314q0-7-6-13l-260-260q-5-5-12-5t-13 5l-28 28q-6 6-6 13t6 13l219 219-219 220q-6 5-6 12t6 13l28 28q5 6 13 6t12-6l260-260q6-5 6-13z" horiz-adv-x="357.1" />
|
||||
</font>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
BIN
lib/static/fontello.ttf
Normal file
BIN
lib/static/fontello.ttf
Normal file
Binary file not shown.
BIN
lib/static/fontello.woff
Normal file
BIN
lib/static/fontello.woff
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -42,7 +42,6 @@ $(function() {
|
||||
|
||||
//Close entry
|
||||
if($entry.hasClass('open')) {
|
||||
|
||||
$entry
|
||||
.height($entry.height())
|
||||
.removeClass('open');
|
||||
@ -60,10 +59,19 @@ $(function() {
|
||||
else {
|
||||
//Close open entries
|
||||
$('.entry.open').each(function() {
|
||||
var $this = $(this);
|
||||
$this
|
||||
.height($this.attr('data-height'))
|
||||
.removeClass('open');
|
||||
var $entry = $(this);
|
||||
$entry
|
||||
.height($entry.height())
|
||||
.removeClass('open');
|
||||
|
||||
setTimeout(function() {
|
||||
$entry.css('height', $entry.attr('data-height') + 'px');
|
||||
}, 0);
|
||||
|
||||
transitionComplete(function() {
|
||||
$entry.find('.readme').remove();
|
||||
$entry.css('height', 'auto');
|
||||
});
|
||||
});
|
||||
|
||||
//Add the open class
|
||||
|
Loading…
Reference in New Issue
Block a user