mirror of
https://github.com/ascribe/onion.git
synced 2025-01-05 03:15:09 +01:00
PR Feedback: rename wrapTextAtCharIndex to truncateTextAtCharIndex
This commit is contained in:
parent
9080c84fa9
commit
cb452ce7bf
js
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user