Skip to content

Commit

Permalink
Step 11: Security
Browse files Browse the repository at this point in the history
  • Loading branch information
donker committed May 18, 2016
1 parent 0ea1ffc commit 0b2ffc3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Views/Home/Index.cshtml
Expand Up @@ -7,6 +7,7 @@
}
<div class="connectHitchARide"
data-rides="@(Newtonsoft.Json.JsonConvert.SerializeObject(Connect.HitchARide.Core.Repositories.RideRepository.Instance.GetRides(Dnn.ActiveModule.ModuleID)))"
data-moduleid="@Dnn.ActiveModule.ModuleID">
data-moduleid="@Dnn.ActiveModule.ModuleID"
data-security="@(Newtonsoft.Json.JsonConvert.SerializeObject(HitchARideModuleContext.Security))">
</div>

3 changes: 2 additions & 1 deletion js/src/HitchARide.jsx
Expand Up @@ -5,7 +5,8 @@ var RideTable = require('./RideTable.jsx');
$(document).ready(function() {
$('.connectHitchARide').each(function(i, el) {
ReactDOM.render(<RideTable rides={$(el).data('rides')}
service={new window.ConnectHitchARideService($, $(el).data('moduleid'))} />, el);
service={new window.ConnectHitchARideService($, $(el).data('moduleid'))}
security={$(el).data('security')} />, el);
});
});

Expand Down
13 changes: 8 additions & 5 deletions js/src/RideTable.jsx
Expand Up @@ -14,6 +14,13 @@ module.exports = React.createClass({
var rideRows = this.state.rides.map((item) => {
return <RideRow ride={item} key={item.RideId} />
});
var addPanel = this.props.security.IsTraveller ? (
<div className="row">
<div className="col-sm-12">
<a href="#" className="btn btn-primary" onClick={this.addClick}>Add</a>
</div>
</div>
) : null;
return (
<div class="container">
<div className="row">
Expand All @@ -32,11 +39,7 @@ module.exports = React.createClass({
</table>
</div>
</div>
<div className="row">
<div className="col-sm-12">
<a href="#" className="btn btn-primary" onClick={this.addClick}>Add</a>
</div>
</div>
{addPanel}

<div className="modal fade" id="editRide" tabindex="-1" role="dialog" aria-labelledby="editRideLabel">
<div className="modal-dialog" role="document">
Expand Down

0 comments on commit 0b2ffc3

Please sign in to comment.