Cotton code
425 lines · 8.7 KB · JSONRaw
{  "format_version": 1,  "id": "bin",  "name": "Binned record",  "plural": "Bin",  "picture": {    "photo": "photo:78ea5af271ac9c036a367d637ecb2c1f0e8bc7723056a3438454235fc63cdbf5",    "object": "tool-bin"  },  "builtin": true,  "engine": "bin",  "binned": {    "from": "table",    "restore": {      "state": "restored"    }  },  "columns": [    {      "key": "title",      "type": "text",      "readonly": true    },    {      "key": "table",      "name": "Table",      "type": "text",      "readonly": true    },    {      "key": "kind",      "name": "Kind",      "type": "choice",      "choices": [        "email",        "email_thread",        "secret",        "note",        "event",        "photo",        "video",        "document",        "message",        "todo",        "transaction",        "group",        "record",        "database"      ],      "labels": {        "email": "Email",        "email_thread": "Conversation",        "secret": "Password",        "note": "Note",        "event": "Event",        "photo": "Photo",        "video": "Video",        "document": "Document",        "message": "Message",        "todo": "Todo",        "transaction": "Money row",        "group": "Group",        "record": "Record",        "database": "Database"      },      "readonly": true    },    {      "key": "trashed_at",      "name": "Binned",      "type": "date",      "readonly": true    },    {      "key": "state",      "name": "State",      "type": "choice",      "choices": [        "binned",        "restored",        "database_binned"      ],      "readonly": true,      "labels": {        "binned": "Binned",        "restored": "Restored",        "database_binned": "Database binned"      }    },    {      "key": "table_name",      "name": "Kind",      "type": "text",      "readonly": true,      "fact": true    },    {      "key": "title_at",      "name": "Day",      "type": "date",      "readonly": true    },    {      "key": "removed_by",      "name": "Removed by",      "type": "text",      "readonly": true,      "fact": true,      "reading": "removed by {value}"    },    {      "key": "creator_name",      "name": "Deleted by",      "type": "text",      "readonly": true,      "fact": true,      "reading": "deleted by {value}"    },    {      "key": "binned_at",      "name": "Binned on",      "type": "date",      "readonly": true,      "fact": true,      "reading": "binned {date}"    },    {      "key": "kept_until",      "name": "Kept until",      "type": "date",      "readonly": true,      "fact": true,      "reading": "kept until {date}"    },    {      "key": "can_restore",      "name": "Can restore",      "type": "bool",      "readonly": true    },    {      "key": "database_id",      "name": "Database",      "type": "text",      "readonly": true    }  ],  "title": "title",  "voice_words": [],  "date": "trashed_at",  "project": null,  "order": null,  "sort": {    "column": "trashed_at",    "descending": true  },  "group": {    "column": "kind",    "sections": [      {        "heading": "Emails",        "values": [          "email"        ]      },      {        "heading": "Conversations",        "values": [          "email_thread"        ]      },      {        "heading": "Passwords",        "values": [          "secret"        ]      },      {        "heading": "Notes",        "values": [          "note"        ]      },      {        "heading": "Calendar",        "values": [          "event"        ]      },      {        "heading": "Photos",        "values": [          "photo"        ]      },      {        "heading": "Videos",        "values": [          "video"        ]      },      {        "heading": "Documents",        "values": [          "document"        ]      },      {        "heading": "Messages",        "values": [          "message"        ]      },      {        "heading": "Todos",        "values": [          "todo"        ]      },      {        "heading": "Money",        "values": [          "transaction"        ]      },      {        "heading": "Groups",        "values": [          "group"        ]      },      {        "heading": "Records",        "values": [          "record"        ]      },      {        "heading": "Databases",        "values": [          "database"        ]      }    ]  },  "count_words": {    "column": "state",    "units": {      "binned": {        "one": "item",        "other": "items"      },      "database_binned": {        "one": "database",        "other": "databases"      }    }  },  "dimmed": {    "column": "state",    "values": [      "binned"    ]  },  "delete_when": {    "column": "state",    "values": [      "binned"    ]  },  "deletion": {    "label": "Delete forever",    "confirm": "Delete forever",    "undo": false  },  "search": [    "title"  ],  "slip": {    "title": "title",    "title_fallback": "title_at",    "subtitle": [      "table_name",      "removed_by",      "creator_name"    ],    "trailing": null,    "photo": null,    "toggle": null,    "caption": {      "dates": [        "trashed_at"      ]    },    "answers": {      "column": "state",      "values": {        "restored": "Restore"      },      "when": [        "binned"      ],      "leaves": false    }  },  "tile": {    "face": "slip-list"  },  "empty": {    "title": "The bin is empty",    "message": "Records wait here until you restore or erase them. Database files and their media are kept for 30 days; only their creator can restore them."  },  "clear": {    "label": "Empty the bin",    "title": "Empty the bin?",    "message": "This erases Cotton's copy of all {count} — it cannot be undone. Your mail provider keeps its own bin, so mail you binned is still there until they clear it.",    "confirm": "Empty",    "done": "Bin emptied"  },  "page": [    {      "heading": null,      "columns": [        "title",        "removed_by",        "creator_name",        "trashed_at",        "kept_until"      ],      "answers": {        "column": "state",        "values": {          "restored": "Restore"        },        "when": [          "binned"        ]      }    }  ],  "instructions": "The one bin holds deleted records until they are restored or the bin is emptied, including money rows entered by hand. Restoring sets state to restored (restore_from_bin); deleting a row erases that record for good, and only the owner's Empty the bin does that. Database rows use state database_binned: only the creator may restore before 30 days; removed members cannot restore. A phone removed from a shared database lists that database here with removed_by (who removed it) in place of creator_name; it is hidden everywhere else, and only a new invitation brings it back, as a fresh copy. Database files and media are purged after 30 days, through the same retention path as removed copies. They cannot be erased early by Empty the bin.",  "commands": [    {      "id": "delete",      "label": "Delete forever",      "kind": "delete",      "verb": "delete_record",      "data": {        "table": "bin"      },      "bindings": {        "id": "$id"      },      "when": {        "state": "binned"      },      "confirm": "It is erased for good and cannot come back.",      "receipt": "Erased",      "does": "destroys",      "object": "bin"    },    {      "id": "restore_database",      "label": "Restore",      "kind": "update",      "object": "folder",      "method": "databases.restore",      "bindings": {        "databaseId": "database_id"      },      "when": {        "can_restore": true      },      "receipt": "Restored"    }  ],  "parts": {    "shape": "sheet",    "head": {      "facts": [        "removed_by",        "creator_name",        "binned_at",        "kept_until"      ]    },    "links": [],    "lists": [],    "acts": {      "more": [        "restore_database"      ],      "away": "delete"    },    "cards": []  },  "tool": {    "views": [      {        "id": "all",        "label": "All",        "is_default": true,        "visibility": "owner",        "read": {          "table": "bin"        }      }    ],    "name": "Bin",    "key": "bin",    "icon": "trash-2",    "card_stock": "grey",    "route": "/bin",    "purpose": "Deleted records you can restore or remove."  },  "tables": [],  "card": {    "face": "plain",    "fields": [      { "slot": "title", "column": "title" },      { "slot": "subtitle", "column": "table_name" },      { "slot": "facts", "column": "kind", "also": ["trashed_at", "removed_by", "creator_name", "kept_until"] }    ]  }}