1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00

Fixed jsxhint errors

This commit is contained in:
ivaosthu 2015-03-23 18:47:23 +01:00
parent ac66ccaaf2
commit 1147b27c4c
5 changed files with 49 additions and 26 deletions

View File

@ -3,8 +3,6 @@ var FeatureForm = require('./FeatureForm');
var LogEntryList = require('../log/LogEntryList'); var LogEntryList = require('../log/LogEntryList');
var eventStore = require('../../stores/EventStore'); var eventStore = require('../../stores/EventStore');
var Feature = React.createClass({ var Feature = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
@ -34,7 +32,7 @@ var Feature = React.createClass({
}, },
archiveFeature: function() { archiveFeature: function() {
if (confirm("Are you sure you want to delete " + this.props.feature.name + "?")) { if (window.confirm("Are you sure you want to delete " + this.props.feature.name + "?")) {
this.props.onArchive(this.props.feature); this.props.onArchive(this.props.feature);
} }
}, },
@ -60,7 +58,8 @@ var Feature = React.createClass({
<tbody className="feature"> <tbody className="feature">
<tr className={this.state.editMode ? "edit bg-lilac-xlt" : ""}> <tr className={this.state.editMode ? "edit bg-lilac-xlt" : ""}>
<td width="20"> <td width="20">
<span className={this.props.feature.enabled ? "toggle-active" : "toggle-inactive"} title="Status"> <span className=
{this.props.feature.enabled ? "toggle-active" : "toggle-inactive"} title="Status">
</span> </span>
</td> </td>
<td> <td>
@ -77,17 +76,25 @@ var Feature = React.createClass({
<td width="150"> <td width="150">
<div className="line"> <div className="line">
<div className="unit size1of3"> <div className="unit size1of3">
<button title='Archive' onClick={this.archiveFeature} title="Remove"> <button
title='Archive'
onClick={this.archiveFeature}>
<span className="icon-kryss1" /> <span className="icon-kryss1" />
</button> </button>
</div> </div>
<div className="unit size1of3"> <div className="unit size1of3">
<button className={this.state.editMode ? "primary" : ""} title='Edit' onClick={this.toggleEditMode}> <button
className={this.state.editMode ? "primary" : ""}
title='Edit'
onClick={this.toggleEditMode}>
<span className="icon-redigere" /> <span className="icon-redigere" />
</button> </button>
</div> </div>
<div className="unit size1of3"> <div className="unit size1of3">
<button className={this.state.showHistory ? "primary" : ""} title='History' onClick={this.toggleHistory}> <button
className={this.state.showHistory ? "primary" : ""}
title='History'
onClick={this.toggleHistory}>
<span className="icon-visning_liste" /> <span className="icon-visning_liste" />
</button> </button>
</div> </div>

View File

@ -90,7 +90,10 @@ var FeatureForm = React.createClass({
<div className="formelement"> <div className="formelement">
<label htmlFor={idPrefix + "-strategy"}>Strategy</label> <label htmlFor={idPrefix + "-strategy"}>Strategy</label>
<div className="input select"> <div className="input select">
<select id={idPrefix + "-strategy"} ref="strategy" value={this.state.currentStrategy} onChange={this.onStrategyChange}> <select id={idPrefix + "-strategy"}
ref="strategy"
value={this.state.currentStrategy}
onChange={this.onStrategyChange}>
{this.renderStrategyOptions()} {this.renderStrategyOptions()}
</select> </select>
</div> </div>
@ -100,8 +103,13 @@ var FeatureForm = React.createClass({
<div className="input"> <div className="input">
<ul className="inputs-list"> <ul className="inputs-list">
<li> <li>
<input id={idPrefix + "-active"} ref="enabled" type="checkbox" defaultChecked={feature.enabled} /> <input id={idPrefix + "-active"}
<label htmlFor={idPrefix + "-active"}>Active</label> ref="enabled"
type="checkbox"
defaultChecked={feature.enabled} />
<label htmlFor={idPrefix + "-active"}>
Active
</label>
</li> </li>
</ul> </ul>
</div> </div>
@ -138,7 +146,7 @@ var FeatureForm = React.createClass({
name={param.name} name={param.name}
label={param.name} label={param.name}
ref={param.name} ref={param.name}
value={param.value} /> value={param.value} />;
}); });
}, },

View File

@ -6,14 +6,14 @@ var DIFF_PREFIXES = {
E: ' ', E: ' ',
D: '-', D: '-',
N: '+' N: '+'
} };
var SPADEN_CLASS = { var SPADEN_CLASS = {
A: 'blue', // array edited A: 'blue', // array edited
E: 'blue', // edited E: 'blue', // edited
D: 'negative', // deleted D: 'negative', // deleted
N: 'positive', // added N: 'positive', // added
} };
var LogEntry = React.createClass({ var LogEntry = React.createClass({
propTypes: { propTypes: {
@ -47,13 +47,15 @@ var LogEntry = React.createClass({
var prettyPrinted = JSON.stringify(localEventData, null, 2); var prettyPrinted = JSON.stringify(localEventData, null, 2);
return (<code className='JSON smalltext man'>{prettyPrinted}</code>) return (<code className='JSON smalltext man'>{prettyPrinted}</code>);
}, },
renderEventDiff: function() { renderEventDiff: function() {
if (!this.props.showFullEvents && this.props.event.diffs) { if (!this.props.showFullEvents && this.props.event.diffs) {
var changes = this.props.event.diffs.map(this.buildDiff); var changes = this.props.event.diffs.map(this.buildDiff);
return (<code className='smalltext man'>{changes.length === 0 ? '(no changes)' : changes}</code>) return (
<code className='smalltext man'>{changes.length === 0 ? '(no changes)' : changes}</code>
);
} else { } else {
return this.renderFullEventData(); return this.renderFullEventData();
} }
@ -71,13 +73,13 @@ var LogEntry = React.createClass({
</div> </div>
); );
} else { } else {
var spadenClass = SPADEN_CLASS[diff.kind] var spadenClass = SPADEN_CLASS[diff.kind];
var prefix = DIFF_PREFIXES[diff.kind]; var prefix = DIFF_PREFIXES[diff.kind];
change = (<div className={spadenClass}>{prefix} {key}: {JSON.stringify(diff.rhs)}</div>) change = (<div className={spadenClass}>{prefix} {key}: {JSON.stringify(diff.rhs)}</div>);
} }
return (<div key={idx}>{change}</div>) return (<div key={idx}>{change}</div>);
} }
}); });

View File

@ -7,7 +7,8 @@ var Strategy = React.createClass({
onRemove: function(event) { onRemove: function(event) {
event.preventDefault(); event.preventDefault();
if (confirm("Are you sure you want to delete strategy '"+this.props.strategy.name+"'?")) { if (window.confirm("Are you sure you want to delete strategy '"+
this.props.strategy.name+"'?")) {
this.props.onRemove(this.props.strategy); this.props.onRemove(this.props.strategy);
} }
}, },
@ -17,7 +18,9 @@ var Strategy = React.createClass({
<div className="line mal"> <div className="line mal">
<div className="unit"> <div className="unit">
<strong>{this.props.strategy.name} </strong> <strong>{this.props.strategy.name} </strong>
<a href="" title="Delete strategy" onClick={this.onRemove}>(remove)</a><br /> <a href=""
title="Delete strategy"
onClick={this.onRemove}>(remove)</a><br />
<em>{this.props.strategy.description}</em><br /> <em>{this.props.strategy.description}</em><br />
</div> </div>
</div> </div>

View File

@ -50,7 +50,6 @@ var StrategyForm = React.createClass({
onRemoveParam: function(event) { onRemoveParam: function(event) {
event.preventDefault(); event.preventDefault();
var id = this.state.parameters.length + 1;
var params = this.state.parameters.slice(0, -1); var params = this.state.parameters.slice(0, -1);
this.setState({parameters: params}); this.setState({parameters: params});
@ -118,7 +117,7 @@ var StrategyForm = React.createClass({
</div> </div>
</div> </div>
</div> </div>
) );
}); });
}, },
@ -131,7 +130,11 @@ var StrategyForm = React.createClass({
if(this.state.parameters.length > 0) { if(this.state.parameters.length > 0) {
return ( return (
<div className="formelement mtn"> <div className="formelement mtn">
<a href="#add" className="negative" onClick={this.onRemoveParam}>- Remove parameter</a> <a href="#add"
className="negative"
onClick={this.onRemoveParam}>
- Remove parameter
</a>
</div> </div>
); );
} }