esoergel / peacecorps

Random Hacks of Kindness - Boston
2 stars 7 forks source link

Implement JSON #4

Closed beechnut closed 11 years ago

beechnut commented 11 years ago

Create a few sample JSON objects to work with during UI implementation.

The backend team will build JSON feed based on the samples.

beechnut commented 11 years ago

Sent to @esoergel, who is now implementing.

beechnut commented 11 years ago

# Initial view: no filter

{
  "type": "FeatureCollection",
  "features":
  [
    {
      "type": "Feature",
      "geometry":
      {
        "type": "Point",
        "coordinates": [ {{lng}} , {{lat}} ],
        "properties":
        {
          "post_count": {{integer}}
          "href": # AJAX request to add this country as filter criteria
        }
      }
    }
  ]

}

# When filtering: 

{
  ### if the only filter criteria applied is "country" --
  "country":
  {
    "type": "Point",
    "coordinates": [ {{lng}} , {{lat}} ],
    "properties":
    {
      "zoomlevel": {{integer_from_database}}
    }
  }
  ### endif

  "posts":
  [
    {
      "title": "Title of Post"
      "text":  "This is the body of the blog post..."
      "slug":  ""
      "date":  "{{datestamp}}"
      "tags": ["tag1", "tag2"]
      "user":
      {
        "name": "Firstname Lastname"
        "sector": "Environment"
        "photo": "{{path_to_photo}}"
        "href": # AJAX request to return only posts by this user
        "country":
        {
          "name": "Uganda"
          "feature":
          {
            "type": "Feature",
            "geometry":
            {
              "type": "Point",
              "coordinates": [ {{lng}} , {{lat}} ],
              "properties":
              {
                "post_count": {{integer}}
                "href": # AJAX request to add this country as filter criteria
              }
            }
          }
        }
      }
    }
    .
    .
    .
  ]

}