Skip to content

Commit

Permalink
Generalise projectSection
Browse files Browse the repository at this point in the history
Update the projectSection helper to include organisations. Update main Talk page and recent comments to use projectSection.
  • Loading branch information
eatyourgreens committed Aug 27, 2022
1 parent 0ee5d93 commit 4d86436
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/pages/organization/talk/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React from 'react';
import { Helmet } from 'react-helmet';
import { Link } from 'react-router';
import counterpart from 'counterpart';
import projectSection from '../../../talk/lib/project-section'
import TalkBreadcrumbs from '../../../talk/breadcrumbs';
import TalkSearchInput from '../../../talk/search-input';
import TalkFootnote from '../../../talk/footnote';

export default function OrgTalkPage(props) {
const { organization, user } = props;
const section = `org-${organization.id}`;
const project = organization
const section = projectSection(organization);
const pageTitle = `${organization.display_name} » ${counterpart('orgTalk.title')}`;
return (
<div className="project-text-content talk project">
Expand Down
6 changes: 5 additions & 1 deletion app/talk/lib/project-section.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# takes in a project id and returns a correctly formatted talk section for that project

module.exports = (project) -> "project-#{project.id}"
module.exports = (project) ->
type = project._type._name
switch type
when 'organizations' then "org-#{project.id}"
when 'projects' then "project-#{project.id}"
3 changes: 2 additions & 1 deletion app/talk/recents.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Comment = require './comment'
apiClient = require 'panoptes-client/lib/api-client'
talkClient = require 'panoptes-client/lib/talk-client'
Paginator = require './lib/paginator'
projectSection = require './lib/project-section'
updateQueryParams = require './lib/update-query-params'
Loading = require('../components/loading-indicator').default
talkConfig = require './config'
Expand Down Expand Up @@ -52,7 +53,7 @@ module.exports = createReactClass
if @props.params.board
params.board_id = @props.params.board if @props.params.board
else if @props.project
params.section = "project-#{ @props.project.id }"
params.section = projectSection(@props.project)
else
params.section = 'zooniverse'
params
Expand Down

0 comments on commit 4d86436

Please sign in to comment.