Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Commit

Permalink
Add set dashboard as startpage link for readers
Browse files Browse the repository at this point in the history
Fixes #1681
  • Loading branch information
Edmundo Alvarez committed Nov 18, 2015
1 parent fb73da5 commit 27c5c18
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions javascript/src/components/dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* global jsRoutes */

import React from 'react';
import { DropdownButton } from 'react-bootstrap';
import { MenuItem } from 'react-bootstrap';
import { DropdownButton, MenuItem } from 'react-bootstrap';

import EditDashboardModalTrigger from './EditDashboardModalTrigger';
import PermissionsMixin from '../../util/PermissionsMixin';
Expand All @@ -15,7 +14,7 @@ const Dashboard = React.createClass({
permissions: React.PropTypes.arrayOf(React.PropTypes.string),
},
mixins: [PermissionsMixin],
render() {
_getDashboardActions() {
let dashboardActions;

if (this.isPermitted(this.props.permissions, [`dashboards:edit:${this.props.dashboard.id}`])) {
Expand All @@ -32,8 +31,20 @@ const Dashboard = React.createClass({
</DropdownButton>
</div>
);
} else {
dashboardActions = (
<div className="stream-actions">
<DropdownButton title="More actions" pullRight>
<MenuItem href={jsRoutes.controllers.StartpageController.set('dashboard', this.props.dashboard.id).url}>Set
as startpage</MenuItem>
</DropdownButton>
</div>
);
}

return dashboardActions;
},
render() {
const createdFromContentPack = (this.props.dashboard.content_pack ?
<i className="fa fa-cube" title="Created from content pack"></i> : null);

Expand All @@ -46,7 +57,7 @@ const Dashboard = React.createClass({
</h2>

<div className="stream-data">
{dashboardActions}
{this._getDashboardActions()}
<div className="stream-description">
{createdFromContentPack}
<span ref="dashboardDescription">{this.props.dashboard.description}</span>
Expand Down

0 comments on commit 27c5c18

Please sign in to comment.