Skip to content

Instantly share code, notes, and snippets.

{
"label":"Discover",
"heading":"Discover what the library has to offer",
"primary":[
{
"name":"Library Website",
"description":"Go to the library's home on the web.",
"href":"https://www.lib.umich.edu/"
},
{
@jonearley
jonearley / drupal-jsonapi-views.md
Last active December 13, 2018 15:44
Requirements for extending the Drupal json api for node pages with views to include breadcrumbs and weight.

Task: Add weight and breadcrumbs attributes to node pages.

Using the json api for "Jobs at the Library" Drupal node page as the example. For full: https://dev.lib.umich.edu/web/jsonapi/node/page/68bd39d6-5546-4789-9b3c-0724782b2508

Breadcrumb specs:

  • Start at the homepage.
  • Attach property of breadcrumbs with an array of objects as the value.
  • Each object in the array contains text and to. text is the page title. to is the alias to that page.
<% @wmon = (1..12).to_a.unshift('--') %>
<% @wday = (1..31).to_a.unshift('--') %>
<div class="form-group <% if f.object.class.multiple? key %>multi_value<% end %>">
<p class="text-bold">Date Coverage</p>
<p class="help-block">The date range the work's data was created, as determined by the creator.</p>
<% if f.object.class.multiple? key %>
<ul class="listing">
@jonearley
jonearley / designer.html
Last active August 29, 2015 14:21
designer
<link rel="import" href="../notification-elements/notification-alert.html">
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-app.html">
<polymer-element name="my-element">
<template>
<style>
:host {
@jonearley
jonearley / gist:caf879bddcd46878db2b
Last active August 29, 2015 14:20
Self correcting Semantic URL slugs, Stack Overflow style.
'''
Self correcting Semantic URL slugs, Stack Overflow style.
Format:
website.com/obj/<pk>/<slug>
For example, we have obj with pk: 1, title: "Hello World", and slug: "hello-world"
website.com/obj/1/ -> website.com/obj/1/hello-world
website.com/obj/1/hello-moon/ -> website.com/obj/1/hello-world