parent
ab12c51e0f
commit
50d4d7a19d
@ -1,70 +0,0 @@
|
||||
var gulp = require('gulp');
|
||||
var handlebars = require('gulp-handlebars');
|
||||
var declare = require('gulp-declare');
|
||||
var concat = require('gulp-concat');
|
||||
var wrap = require('gulp-wrap');
|
||||
var livereload = require('gulp-livereload');
|
||||
var path = require('path');
|
||||
var streamqueue = require('streamqueue');
|
||||
var stripbom = require('gulp-stripbom');
|
||||
var compliler = require('handlebars');
|
||||
|
||||
var errorHandler = require('./helpers/errorHandler');
|
||||
var paths = require('./helpers/paths.js');
|
||||
|
||||
console.log('Handlebars (gulp) Version: ', compliler.VERSION);
|
||||
console.log('Handlebars (gulp) Compiler: ', compliler.COMPILER_REVISION);
|
||||
|
||||
gulp.task('handlebars', () => {
|
||||
var coreStream = gulp.src([
|
||||
paths.src.templates,
|
||||
'!*/**/*Partial.*'
|
||||
])
|
||||
.pipe(stripbom({
|
||||
showLog: false
|
||||
}))
|
||||
.pipe(handlebars({
|
||||
handlebars: compliler
|
||||
}))
|
||||
.on('error', errorHandler)
|
||||
.pipe(declare({
|
||||
namespace: 'T',
|
||||
noRedeclare: true,
|
||||
processName: (filePath) => {
|
||||
filePath = path.relative(paths.src.root, filePath);
|
||||
|
||||
return filePath.replace(/\\/g, '/')
|
||||
.toLocaleLowerCase()
|
||||
.replace('template', '')
|
||||
.replace('.js', '');
|
||||
}
|
||||
}));
|
||||
|
||||
var partialStream = gulp.src([paths.src.partials])
|
||||
.pipe(stripbom({
|
||||
showLog: false
|
||||
}))
|
||||
.pipe(handlebars({
|
||||
handlebars: compliler
|
||||
}))
|
||||
.on('error', errorHandler)
|
||||
.pipe(wrap('Handlebars.template(<%= contents %>)'))
|
||||
.pipe(wrap('Handlebars.registerPartial(<%= processPartialName(file.relative) %>, <%= contents %>)', {}, {
|
||||
imports: {
|
||||
processPartialName: function(fileName) {
|
||||
return JSON.stringify(
|
||||
path.basename(fileName, '.js')
|
||||
);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
return streamqueue({
|
||||
objectMode: true
|
||||
},
|
||||
partialStream,
|
||||
coreStream
|
||||
).pipe(concat('templates.js'))
|
||||
.pipe(gulp.dest(paths.dest.root))
|
||||
.pipe(livereload());
|
||||
});
|
@ -1,10 +0,0 @@
|
||||
var phantom = false;
|
||||
process.argv.forEach((val) => {
|
||||
if (val === '--phantom') {
|
||||
phantom = true;
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Phantom:', phantom);
|
||||
|
||||
module.exports = phantom;
|
@ -1,46 +0,0 @@
|
||||
const gulp = require('gulp');
|
||||
|
||||
const less = require('gulp-less');
|
||||
const postcss = require('gulp-postcss');
|
||||
const sourcemaps = require('gulp-sourcemaps');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
const livereload = require('gulp-livereload');
|
||||
const path = require('path');
|
||||
|
||||
const print = require('gulp-print');
|
||||
const paths = require('./helpers/paths');
|
||||
const errorHandler = require('./helpers/errorHandler');
|
||||
|
||||
gulp.task('less', () => {
|
||||
const src = [
|
||||
path.join(paths.src.content, 'Bootstrap', 'bootstrap.less'),
|
||||
path.join(paths.src.content, 'Vendor', 'vendor.less'),
|
||||
path.join(paths.src.content, 'sonarr.less')
|
||||
];
|
||||
|
||||
return gulp.src(src)
|
||||
.pipe(print())
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(less({
|
||||
paths: [paths.src.root],
|
||||
dumpLineNumbers: 'false',
|
||||
compress: true,
|
||||
yuicompress: true,
|
||||
ieCompat: true,
|
||||
strictImports: true
|
||||
}))
|
||||
.on('error', errorHandler)
|
||||
.pipe(postcss([autoprefixer({
|
||||
browsers: ['last 2 versions']
|
||||
})]))
|
||||
.on('error', errorHandler)
|
||||
|
||||
// not providing a path will cause the source map
|
||||
// to be embeded. which makes livereload much happier
|
||||
// since it doesn't reload the whole page to load the map.
|
||||
// this should be switched to sourcemaps.write('./') for production builds
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest(paths.dest.content))
|
||||
.on('error', errorHandler)
|
||||
.pipe(livereload());
|
||||
});
|
@ -1,21 +0,0 @@
|
||||
var Handlebars = require('handlebars');
|
||||
var FormatHelpers = require('Shared/FormatHelpers');
|
||||
|
||||
Handlebars.registerHelper('historyAge', function() {
|
||||
var age = this.age;
|
||||
var unit = FormatHelpers.plural(Math.round(age), 'day');
|
||||
var ageHours = parseFloat(this.ageHours);
|
||||
var ageMinutes = this.ageMinutes ? parseFloat(this.ageMinutes) : null;
|
||||
|
||||
if (age < 2) {
|
||||
age = ageHours.toFixed(1);
|
||||
unit = FormatHelpers.plural(Math.round(ageHours), 'hour');
|
||||
}
|
||||
|
||||
if (age < 2 && ageMinutes) {
|
||||
age = parseFloat(ageMinutes).toFixed(1);
|
||||
unit = FormatHelpers.plural(Math.round(ageMinutes), 'minute');
|
||||
}
|
||||
|
||||
return new Handlebars.SafeString(`<dt>Age (when grabbed):</dt><dd>${age} ${unit}</dd>`);
|
||||
});
|
@ -1,34 +0,0 @@
|
||||
var $ = require('jquery');
|
||||
var vent = require('vent');
|
||||
var HotkeysView = require('./HotkeysView');
|
||||
|
||||
$(document).on('keypress', function(e) {
|
||||
if ($(e.target).is('input') || $(e.target).is('textarea')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.charCode === 63) {
|
||||
vent.trigger(vent.Commands.OpenFullscreenModal, new HotkeysView());
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('keydown', function(e) {
|
||||
if (e.ctrlKey && e.keyCode === 83) {
|
||||
vent.trigger(vent.Hotkeys.SaveSettings);
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
if ($(e.target).is('input') || $(e.target).is('textarea')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.ctrlKey || e.metaKey || e.altKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.keyCode === 84) {
|
||||
vent.trigger(vent.Hotkeys.NavbarSearch);
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
@ -1,6 +0,0 @@
|
||||
var vent = require('vent');
|
||||
var Marionette = require('marionette');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template: 'Hotkeys/HotkeysViewTemplate'
|
||||
});
|
@ -1,45 +0,0 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon-sonarr-close-modal"></i></button>
|
||||
<h3>Keyboard Shortcuts</h3>
|
||||
</div>
|
||||
<div class="modal-body hotkeys-modal">
|
||||
<div class="row hotkey-group">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-5 col-md-offset-1">
|
||||
<h3>Focus Search Box</h3>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<kbd class="hotkey">t</kbd>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-11 col-md-offset-1">
|
||||
Pressing 't' puts the cursor in the search box below the navigation links
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row hotkey-group">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-5 col-md-offset-1">
|
||||
<h3>Save Settings</h3>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<kbd class="hotkey">ctrl + s</kbd>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-11 col-md-offset-1">
|
||||
Pressing ctrl + 's' saves your settings (only in settings)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
@ -1,23 +0,0 @@
|
||||
.hotkeys-modal {
|
||||
h3 {
|
||||
margin-top: 0px;
|
||||
margin-botton: 0px;
|
||||
}
|
||||
|
||||
.hotkey-group {
|
||||
&:first-of-type {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
&:last-of-type {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
margin-top: 25px;
|
||||
margin-bottom: 25px;
|
||||
|
||||
.hotkey {
|
||||
font-size: 22px;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue