mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-14 00:29: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
|
||||
* ~~don't appear build from other project on 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~~
|
||||
|
||||
## Roadmap
|
||||
|
12
lib/utils.js
12
lib/utils.js
@ -1,15 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
exports.prune = function(str, length) {
|
||||
var result = '',
|
||||
words = str.split(' ');
|
||||
var _ = require('underscore'),
|
||||
sharedUtils = require('../static/js/shared/utils');
|
||||
|
||||
do {
|
||||
result += words.shift() + ' ';
|
||||
} while (words.length && result.length < length);
|
||||
|
||||
return result.replace(/ $/, words.length ? '...' : '');
|
||||
};
|
||||
_(exports).extend(sharedUtils);
|
||||
|
||||
exports.lpad = function(str, length, chr) {
|
||||
chr = chr || '0';
|
||||
|
@ -70,7 +70,7 @@ mixin statusText(build)
|
||||
span.build_info
|
||||
i.fa.fa-fw.fa-comment-o
|
||||
|
|
||||
span= build.scm.rev.comment
|
||||
span= utils.prune(build.scm.rev.comment, 40)
|
||||
|
|
||||
|
||||
.build_controls
|
||||
|
@ -3,11 +3,13 @@
|
||||
define([
|
||||
'react', 'react-router', 'app/actions/project',
|
||||
'app/actions/build', 'templates/app/components/builds/item',
|
||||
'app/components/terminal/terminal',
|
||||
'app/components/common/index'
|
||||
'app/components/terminal/terminal', 'app/components/common/index',
|
||||
'app/utils'
|
||||
], function(
|
||||
React, Router, ProjectActions, BuildActions, template,
|
||||
TerminalComponent, CommonComponents
|
||||
React, Router, ProjectActions,
|
||||
BuildActions, template,
|
||||
TerminalComponent, CommonComponents,
|
||||
utils
|
||||
) {
|
||||
template = template.locals({
|
||||
DateTime: CommonComponents.DateTime,
|
||||
@ -15,7 +17,8 @@ define([
|
||||
Progress: CommonComponents.Progress,
|
||||
Scm: CommonComponents.Scm,
|
||||
Terminal: TerminalComponent,
|
||||
Link: Router.Link
|
||||
Link: Router.Link,
|
||||
utils: utils
|
||||
});
|
||||
|
||||
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