mirror of
https://github.com/ascribe/onion.git
synced 2025-01-06 19:55:42 +01:00
PR Feedback: rename wrapTextAtCharIndex to truncateTextAtCharIndex
This commit is contained in:
parent
9080c84fa9
commit
cb452ce7bf
@ -23,7 +23,7 @@ import GlobalNotificationActions from '../../actions/global_notification_actions
|
|||||||
import AclProxy from '../acl_proxy';
|
import AclProxy from '../acl_proxy';
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang_utils';
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
import { mergeOptions, wrapTextAtCharIndex } from '../../utils/general_utils';
|
import { mergeOptions, truncateTextAtCharIndex } from '../../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
let ContractSettings = React.createClass({
|
let ContractSettings = React.createClass({
|
||||||
@ -109,7 +109,7 @@ let ContractSettings = React.createClass({
|
|||||||
<ActionPanel
|
<ActionPanel
|
||||||
key={i}
|
key={i}
|
||||||
title={contract.name}
|
title={contract.name}
|
||||||
content={wrapTextAtCharIndex(contract.name, 120, '(...).pdf')}
|
content={truncateTextAtCharIndex(contract.name, 120, '(...).pdf')}
|
||||||
buttons={
|
buttons={
|
||||||
<div className="pull-right">
|
<div className="pull-right">
|
||||||
<AclProxy
|
<AclProxy
|
||||||
@ -151,7 +151,7 @@ let ContractSettings = React.createClass({
|
|||||||
<ActionPanel
|
<ActionPanel
|
||||||
key={i}
|
key={i}
|
||||||
title={contract.name}
|
title={contract.name}
|
||||||
content={wrapTextAtCharIndex(contract.name, 120, '(...).pdf')}
|
content={truncateTextAtCharIndex(contract.name, 120, '(...).pdf')}
|
||||||
buttons={
|
buttons={
|
||||||
<div className="pull-right">
|
<div className="pull-right">
|
||||||
<AclProxy
|
<AclProxy
|
||||||
|
@ -209,12 +209,12 @@ export function excludePropFromObject(obj, propList){
|
|||||||
/**
|
/**
|
||||||
* Takes a string and breaks it at the supplied index and replaces it
|
* Takes a string and breaks it at the supplied index and replaces it
|
||||||
* with a (potentially) short string that also has been provided
|
* with a (potentially) short string that also has been provided
|
||||||
* @param {string} text The string to wrap
|
* @param {string} text The string to truncate
|
||||||
* @param {number} charIndex The char number at which the text should be wrapped
|
* @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
|
* @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 = '';
|
let wrappedText = '';
|
||||||
|
|
||||||
wrappedText = text.slice(0, charIndex);
|
wrappedText = text.slice(0, charIndex);
|
||||||
|
Loading…
Reference in New Issue
Block a user