Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into TAN-3247/projectsshowpage-simplified
  • Loading branch information
brentguf committed Dec 6, 2024
2 parents 5b47dd1 + 725d6cf commit f6d71eb
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 60 deletions.
8 changes: 0 additions & 8 deletions back/app/controllers/web_api/v1/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

class WebApi::V1::ProjectsController < ApplicationController
before_action :set_project, only: %i[show update reorder destroy index_xlsx votes_by_user_xlsx votes_by_input_xlsx delete_inputs refresh_preview_token destroy_participation_data]
before_action :empty_data_for_visitor, only: [:index_for_followed_item]

skip_before_action :authenticate_user
skip_after_action :verify_policy_scoped, only: :index
Expand Down Expand Up @@ -341,13 +340,6 @@ def base_render_mini_index
include: %i[project_images current_phase]
)
end

def empty_data_for_visitor
unless current_user
render json: { data: [] }, status: :ok
nil
end
end
end

WebApi::V1::ProjectsController.include(AggressiveCaching::Patches::WebApi::V1::ProjectsController)
3 changes: 3 additions & 0 deletions back/app/services/projects_finder_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def participation_possible
# ordered by the follow created_at (most recent first).
# => [Project]
def followed_by_user
# return empty collection if user is not signed in
return Project.none unless @user

subquery = Follower
.where(user_id: @user.id)
.where.not(followable_type: 'Initiative')
Expand Down
2 changes: 1 addition & 1 deletion back/config/locales/sr-Latn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ sr-Latn:
title: Obrazovanje
ideas:
title:
title: Naslov
title: Наслов
description:
body:
title: Opis
Expand Down
1 change: 1 addition & 0 deletions back/config/tenant_templates/e2etests_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ models:
color: '#04884C'
description_multiloc: idea_statuses.implemented_description
participation_method: ideation
-
title_multiloc: idea_statuses.prescreening
ordering: 0
code: prescreening
Expand Down
6 changes: 3 additions & 3 deletions back/engines/free/email_campaigns/config/locales/el-GR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ el:
yesterday: Χθες
comment_on_idea_you_follow:
cta_reply_to: 'Απάντηση στο %{commentAuthor}'
event_description: '%{authorNameFull} placed a reaction on ''%{inputTitle}''. Click the button below to continue the conversation with %{authorName}.'
event_description: '%{authorNameFull} αντέδρασε στην ιδέα σας ''%{inputTitle}''. Κάντε κλικ στο παρακάτω κουμπί για να συνεχίσετε τη συζήτηση με το %{authorName}.'
main_header:
idea: '%{authorName} σχολίασε μια ιδέα που ακολουθείτε'
question: '%{authorName} σχολίασε μια ερώτηση που ακολουθείτε'
Expand All @@ -309,7 +309,7 @@ el:
proposal: '%{authorName} σχολιάσατε μια πρόταση που ακολουθείτε'
initiative: '%{authorName} σχολιάσατε μια πρωτοβουλία που ακολουθείτε'
petition: '%{authorName} σχολίασε μια αίτηση που ακολουθείς'
subject: 'There''s a new comment on "%{input_title}"'
subject: 'Υπάρχει ένα νέο σχόλιο στο "%{input_title}"'
preheader: '%{authorName} άφησε ένα σχόλιο για μια ιδέα για το %{organizationName}'
comment_on_initiative_you_follow:
cta_reply_to: 'Απάντηση στο %{commentAuthor}'
Expand Down Expand Up @@ -391,7 +391,7 @@ el:
main_header: '''%{post}'' έχει ένα νέο εσωτερικό σχόλιο'
preheader: '''%{post}'' έχει ένα νέο εσωτερικό σχόλιο'
official_feedback_on_idea_you_follow:
header_message: '%{feedback_author_name} gave an update on ''%{input_title}''.'
header_message: 'Ο/η %{feedback_author_name} ενημέρωσε για την %{input_title}''.'
header_title: 'There''s an update on "%{input_title}"'
subject: 'Official feedback was posted on "%{input_title}"'
preheader: 'There''s an update on an input you follow'
Expand Down
4 changes: 2 additions & 2 deletions back/spec/acceptance/ideas_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def public_input_params(spec)
input.reload,
'changed_manual_votes_amount',
author,
input.updated_at.to_i,
anything,
payload: { change: [nil, manual_votes_amount] },
project_id: input.project_id
).exactly(1).times
Expand Down Expand Up @@ -709,7 +709,7 @@ def public_input_params(spec)
input.reload,
'changed_manual_votes_amount',
admin,
input.updated_at.to_i,
anything,
payload: { change: [nil, manual_votes_amount] },
project_id: input.project_id
).exactly(1).times
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ const CLSurveyPageLayout = memo(
maxWidth={isMapPage ? '1100px' : '700px'}
w="100%"
position="fixed"
bottom={isMobileOrSmaller ? '0' : '40px'}
role="progressbar"
aria-valuemin={0}
aria-valuemax={100}
Expand All @@ -476,6 +475,13 @@ const CLSurveyPageLayout = memo(
style={{ transition: 'width 0.3s ease-in-out' }}
/>
</Box>
</Box>
<Box
maxWidth={isMapPage ? '1100px' : '700px'}
w="100%"
position="fixed"
bottom={isMobileOrSmaller ? '0' : '40px'}
>
<PageControlButtons
handleNextAndSubmit={handleNextAndSubmit}
handlePrevious={handlePrevious}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import React from 'react';

import { Box, Text, Icon, Title } from '@citizenlab/cl2-component-library';
import {
Box,
Text,
Icon,
Title,
useBreakpoint,
} from '@citizenlab/cl2-component-library';

import { IAdminPublicationData } from 'api/admin_publications/types';
import useProjectFolderImage from 'api/project_folder_images/useProjectFolderImage';
Expand All @@ -17,7 +23,7 @@ import Link from 'utils/cl-router/Link';
import { truncate } from 'utils/textUtils';

import { CardContainer, CardImage } from '../../BaseCard';
import { CARD_WIDTH } from '../constants';
import { BIG_CARD_WIDTH, SMALL_CARD_WIDTH } from '../constants';

import messages from './messages';
import { getPublicationURL } from './utils';
Expand Down Expand Up @@ -49,6 +55,9 @@ export const AdminPublicationCard = ({
}: InnerProps) => {
const { formatMessage } = useIntl();
const localize = useLocalize();
const isSmallerThanPhone = useBreakpoint('phone');

const cardWidth = isSmallerThanPhone ? SMALL_CARD_WIDTH : BIG_CARD_WIDTH;

const {
visible_children_count,
Expand All @@ -62,7 +71,7 @@ export const AdminPublicationCard = ({
<CardContainer
as={Link}
tabIndex={0}
w={`${CARD_WIDTH}px`}
w={`${cardWidth}px`}
ml={ml}
mr={mr}
to={getPublicationURL(adminPublication)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const CARD_WIDTH = 376;
export { CARD_WIDTH as SMALL_CARD_WIDTH } from '../ProjectCarrousel/constants';
export const BIG_CARD_WIDTH = 376;
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '../BaseCarrousel/utils';

import AdminPublicationCard from './AdminPublicationCard';
import { CARD_WIDTH } from './constants';
import { BIG_CARD_WIDTH, SMALL_CARD_WIDTH } from './constants';

interface Props {
title: string;
Expand All @@ -50,6 +50,7 @@ const AdminPublicationsCarrousel = ({
const isSmallerThanPhone = useBreakpoint('phone');
const instanceId = useInstanceId();
const endId = `end-carrousel-${instanceId}`;
const cardWidth = isSmallerThanPhone ? SMALL_CARD_WIDTH : BIG_CARD_WIDTH;

const { ref } = useInView({
onChange: (inView) => {
Expand Down Expand Up @@ -95,8 +96,8 @@ const AdminPublicationsCarrousel = ({
if (e.code === 'Tab' && scrollContainerRef) {
setTimeout(() => {
e.shiftKey
? (scrollContainerRef.scrollLeft -= CARD_WIDTH + CARD_GAP)
: (scrollContainerRef.scrollLeft += CARD_WIDTH + CARD_GAP);
? (scrollContainerRef.scrollLeft -= cardWidth + CARD_GAP)
: (scrollContainerRef.scrollLeft += cardWidth + CARD_GAP);
}, 50);
}
};
Expand Down Expand Up @@ -135,8 +136,8 @@ const AdminPublicationsCarrousel = ({
<CardContainer>
<Box
ref={ref}
w={`${CARD_WIDTH}px`}
h={`${CARD_WIDTH / CARD_IMAGE_ASPECT_RATIO}px`}
w={`${cardWidth}px`}
h={`${cardWidth / CARD_IMAGE_ASPECT_RATIO}px`}
display="flex"
justifyContent="center"
alignItems="center"
Expand All @@ -153,7 +154,7 @@ const AdminPublicationsCarrousel = ({
top="200px"
onClick={() => {
if (!scrollContainerRef) return;
scrollContainerRef.scrollLeft -= CARD_WIDTH + CARD_GAP;
scrollContainerRef.scrollLeft -= cardWidth + CARD_GAP;
}}
/>
<Gradient variant="left" />
Expand All @@ -166,7 +167,7 @@ const AdminPublicationsCarrousel = ({
top="200px"
onClick={() => {
if (!scrollContainerRef) return;
scrollContainerRef.scrollLeft += CARD_WIDTH + CARD_GAP;
scrollContainerRef.scrollLeft += cardWidth + CARD_GAP;
}}
/>
<Gradient variant="right" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const CarrouselContainer = ({ children }: CarrouselContainerProps) => {
py={DEFAULT_Y_PADDING}
w="100%"
display="flex"
overflowX="hidden"
justifyContent="center"
>
<StyledBox w="100%" maxWidth="1200px" position="relative">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const ProjectCarrousel = ({ title, projects, hasMore, onLoadMore }: Props) => {
onLoadMore();
}
},
threshold: 0.4,
});

const handleButtonVisiblity = useCallback(
Expand Down
1 change: 0 additions & 1 deletion front/app/translations/ach-UG.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@
"app.components.FilterBoxes.statusTitle": "crwdns213060:0crwdne213060:0",
"app.components.FilterBoxes.topicsTitle": "crwdns213062:0crwdne213062:0",
"app.components.FiltersModal.filters": "crwdns213066:0crwdne213066:0",
"app.components.FiltersModal.resetFilters": "crwdns213068:0crwdne213068:0",
"app.components.FolderFolderCard.a11y_folderDescription": "crwdns213070:0crwdne213070:0",
"app.components.FolderFolderCard.a11y_folderTitle": "crwdns213072:0crwdne213072:0",
"app.components.FolderFolderCard.archived": "crwdns213074:0crwdne213074:0",
Expand Down
32 changes: 16 additions & 16 deletions front/app/translations/sr-Latn.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"app.components.FilterBoxes.all": "Sve",
"app.components.FilterBoxes.areas": "Filtriraj po oblasti",
"app.components.FilterBoxes.inputs": "inputs",
"app.components.FilterBoxes.noValuesFound": "No values available.",
"app.components.FilterBoxes.noValuesFound": "Trenutno nema filtriranja po temama.",
"app.components.FilterBoxes.showLess": "Show less",
"app.components.FilterBoxes.showTagsWithNumber": "Show all ({numberTags})",
"app.components.FilterBoxes.statusTitle": "Status",
Expand All @@ -187,20 +187,20 @@
"app.components.HorizontalScroll.scrollRightLabel": "Scroll right.",
"app.components.IdeaCards.a11y_ideasHaveBeenSorted": "{sortOder} ideas have loaded.",
"app.components.IdeaCards.filters": "Filters",
"app.components.IdeaCards.filters.mostDiscussed": "Most discussed",
"app.components.IdeaCards.filters.newest": "New",
"app.components.IdeaCards.filters.oldest": "Old",
"app.components.IdeaCards.filters.popular": "Most liked",
"app.components.IdeaCards.filters.random": "Random",
"app.components.IdeaCards.filters.sortBy": "Sort by",
"app.components.IdeaCards.filters.sortChangedScreenreaderMessage": "Sorting changed to: {currentSortType}",
"app.components.IdeaCards.filters.trending": "Trending",
"app.components.IdeaCards.filters.mostDiscussed": "Najviše komentara",
"app.components.IdeaCards.filters.newest": "Najnovije",
"app.components.IdeaCards.filters.oldest": "Najstarije",
"app.components.IdeaCards.filters.popular": "Najviše glasova",
"app.components.IdeaCards.filters.random": "Nasumično",
"app.components.IdeaCards.filters.sortBy": "Prikaži",
"app.components.IdeaCards.filters.sortChangedScreenreaderMessage": "Trenutni prikaz: {currentSortType}",
"app.components.IdeaCards.filters.trending": "Najpopularnije",
"app.components.IdeaCards.showMore": "Prikaži više",
"app.components.IdeasMap.a11y_hideIdeaCard": "Sakrij karticu sa idejom.",
"app.components.IdeasMap.a11y_mapTitle": "Prikaz mape",
"app.components.IdeasMap.clickOnMapToAdd": "Kliknite na mapu kako biste dodali svoj unos",
"app.components.IdeasMap.clickOnMapToAddAdmin2": "As an admin, you can click on the map to add your input, even if this phase is not active.",
"app.components.IdeasMap.filters": "Filters",
"app.components.IdeasMap.filters": "Filteri",
"app.components.IdeasMap.multipleInputsAtLocation": "Multiple inputs at this location",
"app.components.IdeasMap.noFilteredResults": "Filteri koje ste odabrali nisu dali rezultat",
"app.components.IdeasMap.noResults": "Nisu pronađeni rezultati",
Expand Down Expand Up @@ -1168,10 +1168,10 @@
"app.containers.IdeaCards.a11y_totalItems": "Ukupno unosa: {ideasCount}",
"app.containers.IdeaCards.all": "Sve",
"app.containers.IdeaCards.allStatuses": "Svi statusi",
"app.containers.IdeaCards.contributions": "Contributions",
"app.containers.IdeaCards.ideaTerm": "Ideas",
"app.containers.IdeaCards.contributions": "Doprinosi",
"app.containers.IdeaCards.ideaTerm": "Ideje",
"app.containers.IdeaCards.ideasFilterSidebarTitle": "{inputTerm} ({numberIdeas})",
"app.containers.IdeaCards.initiatives": "Initiatives",
"app.containers.IdeaCards.initiatives": "Инитиативес",
"app.containers.IdeaCards.issueTerm": "Issues",
"app.containers.IdeaCards.list": "Lista",
"app.containers.IdeaCards.map": "Mapa",
Expand All @@ -1180,13 +1180,13 @@
"app.containers.IdeaCards.noFilteredResults": "Nisu pronađeni rezultati. Molimo vas pokušajte sa drugim filterom ili terminom pretrage.",
"app.containers.IdeaCards.numberResults": "Results ({postCount})",
"app.containers.IdeaCards.oldest": "Najstarije",
"app.containers.IdeaCards.optionTerm": "Options",
"app.containers.IdeaCards.optionTerm": "Solucije",
"app.containers.IdeaCards.petitions": "Petitions",
"app.containers.IdeaCards.popular": "Najviše glasano",
"app.containers.IdeaCards.projectFilterTitle": "Projekti",
"app.containers.IdeaCards.projectTerm": "Projects",
"app.containers.IdeaCards.projectTerm": "Projekti",
"app.containers.IdeaCards.proposals": "Proposals",
"app.containers.IdeaCards.questionTerm": "Questions",
"app.containers.IdeaCards.questionTerm": "Pitanja",
"app.containers.IdeaCards.random": "Nasumično",
"app.containers.IdeaCards.resetFilters": "Poništi filtere",
"app.containers.IdeaCards.showXResults": "Prikaži {ideasCount, plural, one {# rezultat} other {# rezultata}}",
Expand Down
34 changes: 17 additions & 17 deletions front/app/translations/sr-SP.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@
"app.components.FilterBoxes.all": "Све",
"app.components.FilterBoxes.areas": "Филтрирајте по области",
"app.components.FilterBoxes.inputs": "inputs",
"app.components.FilterBoxes.noValuesFound": "No values available.",
"app.components.FilterBoxes.noValuesFound": "Тренутно нема филтрирања по темама.",
"app.components.FilterBoxes.showLess": "Show less",
"app.components.FilterBoxes.showTagsWithNumber": "Show all ({numberTags})",
"app.components.FilterBoxes.statusTitle": "Статус",
"app.components.FilterBoxes.topicsTitle": "Тема",
"app.components.FilterBoxes.topicsTitle": "Teme",
"app.components.FiltersModal.filters": "Филтери",
"app.components.FolderFolderCard.a11y_folderDescription": "Опис фасцикле:",
"app.components.FolderFolderCard.a11y_folderTitle": "Наслов фолдера:",
Expand All @@ -187,20 +187,20 @@
"app.components.HorizontalScroll.scrollRightLabel": "Scroll right.",
"app.components.IdeaCards.a11y_ideasHaveBeenSorted": "{sortOder} ideas have loaded.",
"app.components.IdeaCards.filters": "Filters",
"app.components.IdeaCards.filters.mostDiscussed": "Most discussed",
"app.components.IdeaCards.filters.newest": "New",
"app.components.IdeaCards.filters.oldest": "Old",
"app.components.IdeaCards.filters.popular": "Most liked",
"app.components.IdeaCards.filters.random": "Random",
"app.components.IdeaCards.filters.sortBy": "Sort by",
"app.components.IdeaCards.filters.sortChangedScreenreaderMessage": "Sorting changed to: {currentSortType}",
"app.components.IdeaCards.filters.trending": "Trending",
"app.components.IdeaCards.filters.mostDiscussed": "Највише коментара",
"app.components.IdeaCards.filters.newest": "Најновије",
"app.components.IdeaCards.filters.oldest": "Најстарије",
"app.components.IdeaCards.filters.popular": "Највише гласова",
"app.components.IdeaCards.filters.random": "Насумично",
"app.components.IdeaCards.filters.sortBy": "Прикажи",
"app.components.IdeaCards.filters.sortChangedScreenreaderMessage": "Тренутни приказ: {currentSortType}'",
"app.components.IdeaCards.filters.trending": "Најпопуларније",
"app.components.IdeaCards.showMore": "Прикажи више",
"app.components.IdeasMap.a11y_hideIdeaCard": "Сакриј картицу идеја.",
"app.components.IdeasMap.a11y_mapTitle": "Преглед мапе",
"app.components.IdeasMap.clickOnMapToAdd": "Кликните на мапу да додате свој унос",
"app.components.IdeasMap.clickOnMapToAddAdmin2": "As an admin, you can click on the map to add your input, even if this phase is not active.",
"app.components.IdeasMap.filters": "Filters",
"app.components.IdeasMap.filters": "Филтери",
"app.components.IdeasMap.multipleInputsAtLocation": "Multiple inputs at this location",
"app.components.IdeasMap.noFilteredResults": "Филтери које сте изабрали нису дали резултате",
"app.components.IdeasMap.noResults": "Нема резултата",
Expand Down Expand Up @@ -1168,10 +1168,10 @@
"app.containers.IdeaCards.a11y_totalItems": "Укупно постова: {ideasCount}",
"app.containers.IdeaCards.all": "Све",
"app.containers.IdeaCards.allStatuses": "Сви статуси",
"app.containers.IdeaCards.contributions": "Contributions",
"app.containers.IdeaCards.ideaTerm": "Ideas",
"app.containers.IdeaCards.contributions": "Прилози",
"app.containers.IdeaCards.ideaTerm": "Идеје",
"app.containers.IdeaCards.ideasFilterSidebarTitle": "{inputTerm} ({numberIdeas})",
"app.containers.IdeaCards.initiatives": "Initiatives",
"app.containers.IdeaCards.initiatives": "Иницијативе",
"app.containers.IdeaCards.issueTerm": "Issues",
"app.containers.IdeaCards.list": "Листа",
"app.containers.IdeaCards.map": "Мапа",
Expand All @@ -1180,13 +1180,13 @@
"app.containers.IdeaCards.noFilteredResults": "Нема резултата. Покушајте са другим филтером или термином за претрагу.",
"app.containers.IdeaCards.numberResults": "Results ({postCount})",
"app.containers.IdeaCards.oldest": "Најстарији",
"app.containers.IdeaCards.optionTerm": "Options",
"app.containers.IdeaCards.optionTerm": "Опције",
"app.containers.IdeaCards.petitions": "Petitions",
"app.containers.IdeaCards.popular": "Највише гласано",
"app.containers.IdeaCards.projectFilterTitle": "Пројекти",
"app.containers.IdeaCards.projectTerm": "Projects",
"app.containers.IdeaCards.projectTerm": "Пројекти",
"app.containers.IdeaCards.proposals": "Proposals",
"app.containers.IdeaCards.questionTerm": "Questions",
"app.containers.IdeaCards.questionTerm": "Питања",
"app.containers.IdeaCards.random": "Насумично",
"app.containers.IdeaCards.resetFilters": "Ресетујте филтере",
"app.containers.IdeaCards.showXResults": "Прикажи {ideasCount, plural, one {# резултат} other {# резултата}}",
Expand Down

0 comments on commit f6d71eb

Please sign in to comment.