Этот коммит содержится в:
Asaad Mahmood
2015-07-08 22:40:28 +05:00
родитель 689692b22d c721a3deac
Коммит 235beeb829
4 изменённых файлов: 91 добавлений и 21 удалений

Просмотреть файл

@@ -61,6 +61,10 @@ module.exports = React.createClass({
render: function() { render: function() {
var server_error = this.state.server_error ? <div className='form-group has-error'><label className='control-label'>{ this.state.server_error }</label></div> : null; var server_error = this.state.server_error ? <div className='form-group has-error'><label className='control-label'>{ this.state.server_error }</label></div> : null;
var outter = this; var outter = this;
var moreChannels;
if (this.state.channels != null)
moreChannels = this.state.channels;
return ( return (
<div className="modal fade" id="more_channels" ref="modal" tabIndex="-1" role="dialog" aria-hidden="true"> <div className="modal fade" id="more_channels" ref="modal" tabIndex="-1" role="dialog" aria-hidden="true">
@@ -75,25 +79,34 @@ module.exports = React.createClass({
<button data-toggle="modal" data-target="#new_channel" data-channeltype={this.state.channel_type} type="button" className="btn btn-primary channel-create-btn" onClick={this.handleNewChannel}>Create New Channel</button> <button data-toggle="modal" data-target="#new_channel" data-channeltype={this.state.channel_type} type="button" className="btn btn-primary channel-create-btn" onClick={this.handleNewChannel}>Create New Channel</button>
</div> </div>
<div className="modal-body"> <div className="modal-body">
{this.state.channels.length ? {moreChannels ?
<table className="more-channel-table table"> (moreChannels.length ?
<tbody> <table className="more-channel-table table">
{this.state.channels.map(function(channel) { <tbody>
return ( {moreChannels.map(function(channel) {
<tr key={channel.id}> return (
<td> <tr key={channel.id}>
<p className="more-channel-name">{channel.display_name}</p> <td>
<p className="more-channel-description">{channel.description}</p> <p className="more-channel-name">{channel.display_name}</p>
</td> <p className="more-channel-description">{channel.description}</p>
<td className="td--action"><button onClick={outter.handleJoin.bind(outter, channel.id)} className="pull-right btn btn-primary">Join</button></td> </td>
</tr> <td className="td--action"><button onClick={outter.handleJoin.bind(outter, channel.id)} className="pull-right btn btn-primary">Join</button></td>
) </tr>
})} )
</tbody> })}
</table> </tbody>
: <div className="no-channel-message"> </table>
<p className="primary-message">No more channels to join</p> : <div className="no-channel-message">
<p className="secondary-message">Click 'Create New Channel' to make a new one</p> <p className="primary-message">No more channels to join</p>
<p className="secondary-message">Click 'Create New Channel' to make a new one</p>
</div>)
: <div ref="loadingscreen" className="channel-loading-message">
<div className="loading__content">
<h3>Loading</h3>
<div id="round_1" className="round"></div>
<div id="round_2" className="round"></div>
<div id="round_3" className="round"></div>
</div>
</div>} </div>}
{ server_error } { server_error }
</div> </div>

Просмотреть файл

@@ -192,7 +192,7 @@ var ChannelStore = assign({}, EventEmitter.prototype, {
sessionStorage.setItem("more_channels", JSON.stringify(channels)); sessionStorage.setItem("more_channels", JSON.stringify(channels));
}, },
_getMoreChannels: function() { _getMoreChannels: function() {
var channels = []; var channels;
try { try {
channels = JSON.parse(sessionStorage.more_channels); channels = JSON.parse(sessionStorage.more_channels);
} }

Просмотреть файл

@@ -104,7 +104,7 @@ module.exports.updateLastViewedAt = function() {
module.exports.getMoreChannels = function(force) { module.exports.getMoreChannels = function(force) {
if (isCallInProgress("getMoreChannels")) return; if (isCallInProgress("getMoreChannels")) return;
if (ChannelStore.getMoreAll().length == 0 || force) { if (!ChannelStore.getMoreAll() || force) {
callTracker["getMoreChannels"] = utils.getTimestamp(); callTracker["getMoreChannels"] = utils.getTimestamp();
client.getMoreChannels( client.getMoreChannels(

Просмотреть файл

@@ -66,3 +66,60 @@
} }
} }
} }
.channel-loading-screen {
position: absolute;
text-align: center;
padding: 2em 1em;
}
.channel-loading-message {
.loading__content {
.round {
background-color: #444;
width: 4px;
height: 4px;
display: inline-block;
margin: 0 1px;
opacity: 0.1;
@include border-radius(10px);
-moz-animation: move 0.75s infinite linear;
-webkit-animation: move 0.75s infinite linear;
}
#round_1 {
-moz-animation-delay: .2s;
-webkit-animation-delay: .2s;
}
#round_2 {
-moz-animation-delay: .4s;
-webkit-animation-delay: .4s;
}
#round_3 {
-moz-animation-delay: .6s;
-webkit-animation-delay: .6s;
}
@-moz-keyframes move {
0% {
opacity: 1;
}
100% {
opacity: 0.1;
};
}
@-webkit-keyframes move {
0% {
opacity: 1;
}
100% {
opacity: 0.1;
};
}
}
}