Skip to content

Commit

Permalink
lint fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
helloyou2012 committed Nov 9, 2018
1 parent 96dc8f0 commit 2c4e1d1
Show file tree
Hide file tree
Showing 20 changed files with 5,364 additions and 395 deletions.
6 changes: 5 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ coverage
test
src/
assets/
.nyc_output
.nyc_output
.babelrc
.editorconfig
.eslintrc
.travis.yml
9 changes: 7 additions & 2 deletions assets/admin.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
window.$ = window.jQuery = require('jquery');
require('bootstrap');

const Select = require('./select');

function cookie(name) {
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null);
}

$(function() {
const elem = $('#J_userList');
new Select(elem, {
data: function(q, cb) {
$.post(elem.data('url'), { q }).done(cb);
const _csrf = cookie('XSRF-TOKEN');
$.post(elem.data('url'), { q, _csrf }).done(cb);
}
});
});
10 changes: 8 additions & 2 deletions assets/login.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
window.$ = window.jQuery = require('jquery');
import $ from 'jquery';
import '!file-loader?name=[name].[ext]!./logo.png';

function cookie(name) {
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null);
}

$(function() {
$('#J_send').on('click', e => {
Expand All @@ -21,7 +27,7 @@ $(function() {
}
}, 1000);
$.post('/send_token', {
_csrf: $('#J_csrf').val(),
_csrf: cookie('XSRF-TOKEN'),
email: $('#J_email').val()
}, null, 'json').done(() => {
$('#J_tips').removeClass('alert-danger').addClass('alert-success')
Expand Down
Binary file modified assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions assets/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,6 @@ a {
color: #1b7943;
}

.logo {
background-image: url(logo.png);
}

@media (min-width:576px) {
.container {
max-width: 540px;
Expand Down
4 changes: 3 additions & 1 deletion examples/example1.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ if (!module.parent) {
// Sync Database to generate tables
server.orm.database().sync({
force: true
}).then(function() { console.log('Sync done.'); });
}).then(() => {
console.log('Sync done.');
});
}
31 changes: 16 additions & 15 deletions examples/example2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const join = require('path').join;
const App = require('../app');
const co = require('co');

Expand All @@ -12,13 +11,13 @@ const app = App({
name: 'minimal',
version: '0.1.0',
send: function(mail, callback) {
let input = mail.message.createReadStream();
let chunks = [];
const input = mail.message.createReadStream();
const chunks = [];
input.on('data', function(chunk) {
chunks.push(chunk);
});
input.on('end', function() {
let data = Buffer.concat(chunks).toString();
const data = Buffer.concat(chunks).toString();
console.log(data);
callback(null, true);
});
Expand All @@ -28,46 +27,48 @@ const app = App({

/** Start **/
if (!module.parent) {
app.listen(8888);
const port = 8888;
app.listen(port);
co(function*() {
const orm = app.orm.database();
yield orm.sync({
const { sync, User, Client, DicRole } = app.orm.database();
yield sync({
force: true
});
yield orm.User.add({
yield User.add({
id: 10001,
password: 'nick',
email: 'nick@example.com',
totp_key: '1234',
is_admin: true
});
yield orm.User.add({
yield User.add({
id: 10002,
password: 'ken',
email: 'ken@example.com',
totp_key: '1234',
is_admin: true
});
yield orm.Client.create({
yield Client.create({
id: '740a1d6d-9df8-4552-a97a-5704681b8039',
name: 'local',
secret: '12345678',
redirect_uri: 'http://localhost:8080'
});
yield orm.Client.create({
yield Client.create({
id: 'bd0e56c1-8f02-49f3-b502-129da70b6f09',
name: 'test',
secret: '12345678',
redirect_uri: 'http://localhost:9090'
});
yield orm.DicRole.create({
yield DicRole.create({
name: 'user',
description: 'Normal user'
});
yield orm.DicRole.create({
yield DicRole.create({
name: 'document',
description: 'Document department'
});
}).then(function() {});
console.log(`Running site at: http://127.0.0.1:8888`);
}).then(() => {
console.log(`Running site at: http://127.0.0.1:${port}`);
});
}
Loading

0 comments on commit 2c4e1d1

Please sign in to comment.