Exemple #1
0
    def generate_activities_list_table_row(self,
                                           overview_page_data: dict) -> str:
        """
        Generates a new table row for activities list table

        overview_page_data -- Dict containing only the required data
                              for the overview page

        Returns:
        new_row -- String in wikitext format for a new table row
        """
        wikitext = WikiTextService()

        organisation_name = overview_page_data["organisation"][
            "name"].capitalize()
        organisation_page_title = f"{self.templates.oeg_page}/" f"{organisation_name}"

        organisation_link = wikitext.hyperlink_wiki_page(
            organisation_page_title, organisation_name)

        platform_link = wikitext.hyperlink_external_link(
            overview_page_data["platform"]["name"],
            overview_page_data["platform"]["url"],
        )

        new_row = f"\n| {organisation_link}\n| {platform_link}\n|-"
        return new_row
    def generate_projects_list_table_row(self,
                                         organisation_page_data: dict) -> str:
        """
        Generates a new table row for projects list table

        organisation_page_data -- Dict containing only the required data
                                  for the organisation page

        Returns:
        new_row -- String in wikitext format for a new table row
        """
        wikitext = WikiTextService()

        platform_url = wikitext.hyperlink_external_link(
            organisation_page_data["platform"]["name"],
            organisation_page_data["platform"]["url"],
        )

        project_wiki_page = wikitext.hyperlink_wiki_page(
            wiki_page=(
                f"{self.templates.oeg_page}/Projects/"
                f'{organisation_page_data["project"]["name"].capitalize()}'),
            text=organisation_page_data["project"]["name"].capitalize(),
        )

        new_row = (f"\n| {project_wiki_page}\n| {platform_url}\n| "
                   f"{organisation_page_data['project']['author']}\n| "
                   f"{organisation_page_data['project']['status']}\n|-")
        return new_row