cross-platform-navigation

Provides scala representation of the navigation menus for the www.theguardian.com and guardian apps

License

License

Categories

Categories

ORM Data
GroupId

GroupId

com.gu
ArtifactId

ArtifactId

cross-platform-navigation_2.11
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

cross-platform-navigation
Provides scala representation of the navigation menus for the www.theguardian.com and guardian apps
Project URL

Project URL

https://github.com/guardian/cross-platform-navigation
Project Organization

Project Organization

com.gu
Source Code Management

Source Code Management

https://github.com/guardian/cross-platform-navigation

Download cross-platform-navigation_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/com.gu/cross-platform-navigation_2.11/ -->
<dependency>
    <groupId>com.gu</groupId>
    <artifactId>cross-platform-navigation_2.11</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.gu/cross-platform-navigation_2.11/
implementation 'com.gu:cross-platform-navigation_2.11:1.0'
// https://jarcasting.com/artifacts/com.gu/cross-platform-navigation_2.11/
implementation ("com.gu:cross-platform-navigation_2.11:1.0")
'com.gu:cross-platform-navigation_2.11:jar:1.0'
<dependency org="com.gu" name="cross-platform-navigation_2.11" rev="1.0">
  <artifact name="cross-platform-navigation_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.gu', module='cross-platform-navigation_2.11', version='1.0')
)
libraryDependencies += "com.gu" % "cross-platform-navigation_2.11" % "1.0"
[com.gu/cross-platform-navigation_2.11 "1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.8
com.typesafe.play : play-json_2.11 jar 2.6.6
org.slf4j : slf4j-api jar 1.7.25

test (1)

Group / Artifact Type Version
org.specs2 : specs2-core_2.11 jar 3.8.6

Project Modules

There are no modules declared in this project.

Cross Platform Navigation Cross Platform Navigation

A library to provide define and provide scala representations of the navigation across theguardian.com and the guardian's cohort of mobile apps

Scala Usage

Add the following to your build.sbt file, setting the version number to the latest [version]

libraryDepencies += "com.gu" %% "cross-platform navigation" % "z,y"

Use whatever method you wish to retrieve the desired json file to s3 and pass the content as a string to get a Navigation object. This will contain the content and structure of the navigation. You can den do something like

    val navigationProvider = new GarnettNavigationProvider
    navigationProvider.

Updating the navigation

The directory json contains the definition for each of the guardians 4 editions as json files. Altering these files and releasing the project via riff-raff causes the updated files to be provisioned to s3. Your application can then retrieve (and cache) the json as you wish and use it at described above

Json Format

There is a json file for each edition of theguardian.com. Each one describes the navigation structure as a series of 'pillars', each of which contains one or more sections( which can, themselves contain further sections). Here is a cut down example containing two cut-down pllars

Here, there are only two pillars, with a cut down set of sections to indicate how the json is structured. Each section contains to flag values, along with a title and path. The editionalised flag indicated that the path shuld be suffixed with the correct edition. Here, the 'politics' section in the 'News' pillar should have a path that resolves as '/uk/politics' for the uk edition. The mobileOverride value is to indicate to Mapi (old nav) whether this section should be a link to a front or a tag list

{
  "pillars" : [
    {
      "title": "",
      "path": "/",
      "editionalised": true,
      "sections": [
        {
          "title": "UK",
          "path": "/uk-news",
          "editionalised": false,
          "sections": [
            {"title": "UK", "path": "/uk-news", "editionalised": false},
            {"title": "UK politics", "path": "/politics", "editionalised": true}
          ]
        }
      ]
    },     
    {
      "title": "sport",
      "path": "/sport",
      "editionalised" : true,
      "sections": [
        { "title": "football", "path": "/football", "editionalised": false,
          "sections": [
            { "title": "football", "path": "/football", "editionalised": false },
            { "title": "live scores", "path": "/football/live", "editionalised": false },
            { "title": "tables", "path": "/football/tables", "editionalised": false },
            { "title": "competitions", "path": "/football/competitions", "editionalised": false },
            { "title": "results", "path": "/football/results", "editionalised": false },
            { "title": "fixtures", "path": "/football/fixtures", "editionalised": false },
            { "title": "clubs", "path": "/football/teams", "editionalised": false }
          ]
        },
        { "title": "rugby union", "path": "/sport/rugby-union", "mobileOverride" : true, "editionalised": false },
      ]
    }
  ]
}

Publishing and Deploying

Update the scala functionality and publish to maven, making sure you update the version and the changelog.

Deploying the project via riff-raff will upload the latest editionalised json files to s3, via teamcity. This process checks the validity of the json in order to build successfully

com.gu

The Guardian

The source code of the world's leading liberal voice

Versions

Version
1.0