1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-23 01:36:28 +02:00

PR Feedback: rename wrapTextAtCharIndex to truncateTextAtCharIndex

This commit is contained in:
Tim Daubenschütz 2015-09-25 15:22:16 +02:00
parent 9080c84fa9
commit cb452ce7bf
2 changed files with 7 additions and 7 deletions

View File

@ -23,7 +23,7 @@ import GlobalNotificationActions from '../../actions/global_notification_actions
import AclProxy from '../acl_proxy';
import { getLangText } from '../../utils/lang_utils';
import { mergeOptions, wrapTextAtCharIndex } from '../../utils/general_utils';
import { mergeOptions, truncateTextAtCharIndex } from '../../utils/general_utils';
let ContractSettings = React.createClass({
@ -109,7 +109,7 @@ let ContractSettings = React.createClass({
<ActionPanel
key={i}
title={contract.name}
content={wrapTextAtCharIndex(contract.name, 120, '(...).pdf')}
content={truncateTextAtCharIndex(contract.name, 120, '(...).pdf')}
buttons={
<div className="pull-right">
<AclProxy
@ -151,7 +151,7 @@ let ContractSettings = React.createClass({
<ActionPanel
key={i}
title={contract.name}
content={wrapTextAtCharIndex(contract.name, 120, '(...).pdf')}
content={truncateTextAtCharIndex(contract.name, 120, '(...).pdf')}
buttons={
<div className="pull-right">
<AclProxy

View File

@ -209,12 +209,12 @@ export function excludePropFromObject(obj, propList){
/**
* Takes a string and breaks it at the supplied index and replaces it
* with a (potentially) short string that also has been provided
* @param {string} text The string to wrap
* @param {number} charIndex The char number at which the text should be wrapped
* @param {string} text The string to truncate
* @param {number} charIndex The char number at which the text should be truncated
* @param {String} replacement All text after charIndex will be replaced with this string
* @return {string} The wrapped text
* @return {string} The truncated text
*/
export function wrapTextAtCharIndex(text, charIndex, replacement = '...') {
export function truncateTextAtCharIndex(text, charIndex, replacement = '...') {
let wrappedText = '';
wrappedText = text.slice(0, charIndex);