mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-19 01:39:15 +00:00
prune commit message at build item
This commit is contained in:
parent
9b0895a4e7
commit
e1b1d5e688
@ -40,7 +40,7 @@ Ui fixes
|
|||||||
* current successfully streak icons at project page
|
* current successfully streak icons at project page
|
||||||
* ~~don't appear build from other project on project page~~
|
* ~~don't appear build from other project on project page~~
|
||||||
* ~~update project info changes (avg duration, etc) on the fly - project page~~
|
* ~~update project info changes (avg duration, etc) on the fly - project page~~
|
||||||
* long commit comment breakes build card makeup
|
* ~~long commit comment breakes build card makeup~~
|
||||||
* ~~comment start/duration should be on same place during all steps~~
|
* ~~comment start/duration should be on same place during all steps~~
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
12
lib/utils.js
12
lib/utils.js
@ -1,15 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
exports.prune = function(str, length) {
|
var _ = require('underscore'),
|
||||||
var result = '',
|
sharedUtils = require('../static/js/shared/utils');
|
||||||
words = str.split(' ');
|
|
||||||
|
|
||||||
do {
|
_(exports).extend(sharedUtils);
|
||||||
result += words.shift() + ' ';
|
|
||||||
} while (words.length && result.length < length);
|
|
||||||
|
|
||||||
return result.replace(/ $/, words.length ? '...' : '');
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.lpad = function(str, length, chr) {
|
exports.lpad = function(str, length, chr) {
|
||||||
chr = chr || '0';
|
chr = chr || '0';
|
||||||
|
@ -70,7 +70,7 @@ mixin statusText(build)
|
|||||||
span.build_info
|
span.build_info
|
||||||
i.fa.fa-fw.fa-comment-o
|
i.fa.fa-fw.fa-comment-o
|
||||||
|
|
|
|
||||||
span= build.scm.rev.comment
|
span= utils.prune(build.scm.rev.comment, 40)
|
||||||
|
|
|
|
||||||
|
|
||||||
.build_controls
|
.build_controls
|
||||||
|
@ -3,11 +3,13 @@
|
|||||||
define([
|
define([
|
||||||
'react', 'react-router', 'app/actions/project',
|
'react', 'react-router', 'app/actions/project',
|
||||||
'app/actions/build', 'templates/app/components/builds/item',
|
'app/actions/build', 'templates/app/components/builds/item',
|
||||||
'app/components/terminal/terminal',
|
'app/components/terminal/terminal', 'app/components/common/index',
|
||||||
'app/components/common/index'
|
'app/utils'
|
||||||
], function(
|
], function(
|
||||||
React, Router, ProjectActions, BuildActions, template,
|
React, Router, ProjectActions,
|
||||||
TerminalComponent, CommonComponents
|
BuildActions, template,
|
||||||
|
TerminalComponent, CommonComponents,
|
||||||
|
utils
|
||||||
) {
|
) {
|
||||||
template = template.locals({
|
template = template.locals({
|
||||||
DateTime: CommonComponents.DateTime,
|
DateTime: CommonComponents.DateTime,
|
||||||
@ -15,7 +17,8 @@ define([
|
|||||||
Progress: CommonComponents.Progress,
|
Progress: CommonComponents.Progress,
|
||||||
Scm: CommonComponents.Scm,
|
Scm: CommonComponents.Scm,
|
||||||
Terminal: TerminalComponent,
|
Terminal: TerminalComponent,
|
||||||
Link: Router.Link
|
Link: Router.Link,
|
||||||
|
utils: utils
|
||||||
});
|
});
|
||||||
|
|
||||||
var Component = React.createClass({
|
var Component = React.createClass({
|
||||||
|
9
static/js/app/utils.js
Normal file
9
static/js/app/utils.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
define(['underscore', 'shared/utils'], function(_, sharedUtils) {
|
||||||
|
var utils = {};
|
||||||
|
|
||||||
|
_(utils).extend(sharedUtils);
|
||||||
|
|
||||||
|
return utils;
|
||||||
|
});
|
32
static/js/shared/utils.js
Normal file
32
static/js/shared/utils.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
(function(root, factory) {
|
||||||
|
|
||||||
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
// CommonJS
|
||||||
|
module.exports = factory();
|
||||||
|
} else if (typeof define === 'function' && define.amd) {
|
||||||
|
// AMD
|
||||||
|
define(function() {
|
||||||
|
return factory();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}(this, function() {
|
||||||
|
|
||||||
|
var utils = {};
|
||||||
|
|
||||||
|
utils.prune = function(str, length) {
|
||||||
|
var result = '',
|
||||||
|
words = str.split(' ');
|
||||||
|
|
||||||
|
do {
|
||||||
|
result += words.shift() + ' ';
|
||||||
|
} while (words.length && result.length < length);
|
||||||
|
|
||||||
|
return result.replace(/ $/, words.length ? '...' : '');
|
||||||
|
};
|
||||||
|
|
||||||
|
return utils;
|
||||||
|
|
||||||
|
}));
|
Loading…
Reference in New Issue
Block a user