Name
Link sharing

Description
Hacker news clone: link sharing and discussion

Pack
{
  "pages": [
    {
      "name": "Home",
      "title": "Slackernews - for hackers who are too lazy to code",
      "layout": {
        "above": [
          {
            "name": "835eb7",
            "type": "view",
            "view": "Posts",
            "state": "shared"
          },
          {
            "type": "container",
            "block": true,
            "bgType": "None",
            "hAlign": "left",
            "vAlign": "top",
            "bgColor": "#ffffff",
            "contents": {
              "type": "blank",
              "contents": "Log on or create an account to create a new post",
              "isFormula": {}
            },
            "imageSize": "contain",
            "isFormula": {},
            "textColor": "#ffffff",
            "borderStyle": "solid",
            "showForRole": [
              null,
              false,
              null,
              null,
              false,
              null,
              null,
              null,
              false
            ]
          }
        ]
      },
      "min_role": 10,
      "menu_label": "Posts",
      "description": "",
      "fixed_states": {},
      "root_page_for_roles": [
        "admin",
        "staff",
        "user",
        "public"
      ]
    }
  ],
  "views": [
    {
      "name": "Posts",
      "table": "Posts",
      "min_role": 10,
      "menu_label": "Posts",
      "on_root_page": false,
      "viewtemplate": "Feed",
      "configuration": {
        "cols_lg": 1,
        "cols_md": 1,
        "cols_sm": 1,
        "cols_xl": 1,
        "in_card": false,
        "viewname": "Posts",
        "show_view": "Peek post",
        "descending": true,
        "order_field": "score",
        "rows_per_page": 20,
        "view_to_create": "New Post",
        "create_view_display": "Link"
      },
      "default_render_page": null
    },
    {
      "name": "New Post",
      "table": "Posts",
      "min_role": 8,
      "menu_label": "Submit",
      "on_root_page": false,
      "viewtemplate": "Edit",
      "configuration": {
        "fixed": {
          "user": null,
          "posted": null,
          "preset_user": "LoggedIn",
          "preset_posted": "Now"
        },
        "layout": {
          "above": [
            {
              "widths": [
                2,
                10
              ],
              "besides": [
                {
                  "above": [
                    null,
                    {
                      "type": "blank",
                      "contents": "title"
                    }
                  ]
                },
                {
                  "above": [
                    null,
                    {
                      "type": "field",
                      "fieldview": "edit",
                      "field_name": "title"
                    }
                  ]
                }
              ]
            },
            {
              "type": "line_break"
            },
            {
              "widths": [
                2,
                10
              ],
              "besides": [
                {
                  "above": [
                    null,
                    {
                      "type": "blank",
                      "contents": "url"
                    }
                  ]
                },
                {
                  "above": [
                    null,
                    {
                      "type": "field",
                      "fieldview": "edit",
                      "field_name": "url"
                    }
                  ]
                }
              ]
            },
            {
              "type": "line_break"
            },
            {
              "type": "action",
              "minRole": 10,
              "action_name": "Save"
            }
          ]
        },
        "columns": [
          {
            "type": "Field",
            "fieldview": "edit",
            "field_name": "title"
          },
          {
            "type": "Field",
            "fieldview": "edit",
            "field_name": "url"
          },
          {
            "type": "Action",
            "minRole": 10,
            "action_name": "Save"
          }
        ],
        "viewname": "New Post",
        "view_when_done": "Posts"
      },
      "default_render_page": null
    },
    {
      "name": "PostList",
      "table": "Posts",
      "min_role": 1,
      "on_root_page": false,
      "viewtemplate": "List",
      "configuration": {
        "layout": {
          "above": [
            null,
            {
              "widths": [
                2,
                10
              ],
              "besides": [
                {
                  "above": [
                    null,
                    {
                      "type": "blank",
                      "block": false,
                      "contents": "title",
                      "textStyle": ""
                    }
                  ]
                },
                {
                  "above": [
                    null,
                    {
                      "type": "field",
                      "block": false,
                      "fieldview": "as_text",
                      "textStyle": "",
                      "field_name": "title"
                    }
                  ]
                }
              ]
            },
            {
              "type": "line_break"
            },
            {
              "widths": [
                2,
                10
              ],
              "besides": [
                {
                  "above": [
                    null,
                    {
                      "type": "blank",
                      "block": false,
                      "contents": "url",
                      "textStyle": ""
                    }
                  ]
                },
                {
                  "above": [
                    null,
                    {
                      "type": "field",
                      "block": false,
                      "fieldview": "as_text",
                      "textStyle": "",
                      "field_name": "url"
                    }
                  ]
                }
              ]
            },
            {
              "type": "line_break"
            },
            {
              "widths": [
                2,
                10
              ],
              "besides": [
                {
                  "above": [
                    null,
                    {
                      "type": "blank",
                      "block": false,
                      "contents": "posted",
                      "textStyle": ""
                    }
                  ]
                },
                {
                  "above": [
                    null,
                    {
                      "type": "field",
                      "block": false,
                      "fieldview": "show",
                      "textStyle": "",
                      "field_name": "posted"
                    }
                  ]
                }
              ]
            },
            {
              "type": "line_break"
            }
          ]
        },
        "columns": [
          {
            "stat": "Count",
            "type": "Field",
            "view": "Own:New Post",
            "fieldview": "as_text",
            "field_name": "title",
            "join_field": "",
            "view_label": "",
            "action_name": "Delete",
            "state_field": "on",
            "action_label": "",
            "agg_relation": ""
          },
          {
            "stat": "Count",
            "type": "Field",
            "view": "Own:New Post",
            "fieldview": "as_text",
            "field_name": "url",
            "join_field": "",
            "view_label": "",
            "action_name": "Delete",
            "state_field": "on",
            "action_label": "",
            "agg_relation": ""
          },
          {
            "stat": "Count",
            "type": "Field",
            "view": "Own:New Post",
            "fieldview": "show",
            "field_name": "posted",
            "join_field": "",
            "view_label": "",
            "action_name": "Delete",
            "state_field": "on",
            "action_label": "",
            "agg_relation": ""
          },
          {
            "stat": "Count",
            "type": "ViewLink",
            "view": "Own:Peek post",
            "fieldview": "as_text",
            "field_name": "title",
            "join_field": "",
            "view_label": "Peek",
            "action_name": "Delete",
            "state_field": "on",
            "action_label": "",
            "agg_relation": ""
          },
          {
            "stat": "Count",
            "type": "ViewLink",
            "view": "Own:Peek post",
            "fieldview": "as_text",
            "field_name": "title",
            "join_field": "",
            "view_label": "Edit",
            "action_name": "Delete",
            "state_field": "on",
            "action_label": "",
            "agg_relation": ""
          },
          {
            "stat": "Count",
            "type": "Action",
            "view": "Own:New Post",
            "fieldview": "as_text",
            "field_name": "title",
            "join_field": "",
            "view_label": "",
            "action_name": "Delete",
            "state_field": "on",
            "action_label": "",
            "agg_relation": ""
          }
        ],
        "viewname": "PostList",
        "default_state": {
          "url": "",
          "title": "",
          "posted": null
        },
        "view_to_create": "New Post",
        "create_view_label": "",
        "create_view_display": "Link"
      },
      "default_render_page": null
    },
    {
      "name": "CommentTree",
      "table": "Comments",
      "min_role": 10,
      "on_root_page": false,
      "viewtemplate": "CommentTree",
      "configuration": {
        "viewname": "CommentTree",
        "show_view": "ShowComment",
        "descending": true,
        "order_field": "posted",
        "label_create": "Reply",
        "parent_field": "parent",
        "view_to_create": "NewComment",
        "top_create_display": "Embedded",
        "tree_create_display": "Link"
      },
      "default_render_page": null
    },
    {
      "name": "ShowComment",
      "table": "Comments",
      "min_role": 1,
      "on_root_page": false,
      "viewtemplate": "Show",
      "configuration": {
        "layout": {
          "above": [
            {
              "type": "container",
              "bgType": "None",
              "hAlign": "left",
              "vAlign": "top",
              "bgColor": "#ffffff",
              "contents": {
                "above": [
                  {
                    "type": "field",
                    "fieldview": "relative",
                    "field_name": "posted"
                  },
                  {
                    "type": "blank",
                    "contents": " by ",
                    "isFormula": {}
                  },
                  {
                    "type": "join_field",
                    "join_field": "user.username"
                  }
                ]
              },
              "imageSize": "contain",
              "textColor": "#8a8a8a",
              "borderStyle": "solid",
              "setTextColor": true
            },
            {
              "type": "field",
              "fieldview": "showAll",
              "field_name": "body"
            },
            {
              "type": "line_break"
            }
          ]
        },
        "columns": [
          {
            "type": "Field",
            "fieldview": "relative",
            "field_name": "posted"
          },
          {
            "type": "JoinField",
            "join_field": "user.username"
          },
          {
            "type": "Field",
            "fieldview": "showAll",
            "field_name": "body"
          }
        ],
        "viewname": "ShowComment"
      },
      "default_render_page": null
    },
    {
      "name": "PostAndComments",
      "table": "Posts",
      "min_role": 10,
      "on_root_page": false,
      "viewtemplate": "ListShowList",
      "configuration": {
        "viewname": "PostAndComments",
        "list_view": "",
        "show_view": "Peek post",
        "subtables": {
          "ChildList:NewComment.Comments.post": false,
          "ChildList:CommentTree.Comments.post": true
        }
      },
      "default_render_page": null
    },
    {
      "name": "NewUser",
      "table": "users",
      "min_role": 1,
      "on_root_page": false,
      "viewtemplate": "Edit",
      "configuration": {
        "fixed": {
          "email": ""
        },
        "layout": {
          "above": [
            {
              "type": "blank",
              "contents": "Please choose a username",
              "isFormula": {}
            },
            {
              "type": "line_break"
            },
            {
              "type": "field",
              "fieldview": "edit",
              "field_name": "username"
            },
            {
              "type": "line_break"
            },
            {
              "type": "action",
              "minRole": 10,
              "action_name": "Save"
            }
          ]
        },
        "columns": [
          {
            "type": "Field",
            "fieldview": "edit",
            "field_name": "username"
          },
          {
            "type": "Action",
            "minRole": 10,
            "action_name": "Save"
          }
        ],
        "viewname": "NewUser",
        "view_when_done": "Posts"
      },
      "default_render_page": null
    },
    {
      "name": "Peek post",
      "table": "Posts",
      "min_role": 10,
      "on_root_page": false,
      "viewtemplate": "Show",
      "configuration": {
        "layout": {
          "above": [
            {
              "url": "url",
              "text": "title",
              "type": "link",
              "block": true,
              "isFormula": {
                "url": true,
                "text": true
              }
            },
            {
              "type": "container",
              "bgType": "None",
              "hAlign": "left",
              "vAlign": "top",
              "bgColor": "#ffffff",
              "contents": {
                "above": [
                  {
                    "type": "action",
                    "rndid": "6d915a",
                    "minRole": "8",
                    "isFormula": {},
                    "action_name": "insert_joined_row",
                    "action_label": "▲",
                    "action_style": "btn-link",
                    "configuration": {
                      "joined_table": "PostLike.post"
                    }
                  },
                  {
                    "stat": "Count",
                    "type": "aggregation",
                    "agg_field": "user",
                    "agg_relation": "PostLike.post"
                  },
                  {
                    "type": "blank",
                    "contents": " likes by ",
                    "isFormula": {}
                  },
                  {
                    "type": "join_field",
                    "join_field": "user.username"
                  },
                  {
                    "type": "blank",
                    "contents": " ",
                    "isFormula": {}
                  },
                  {
                    "type": "field",
                    "fieldview": "relative",
                    "field_name": "posted"
                  },
                  {
                    "type": "blank",
                    "contents": " | ",
                    "isFormula": {}
                  },
                  {
                    "stat": "Count",
                    "type": "aggregation",
                    "agg_field": "body",
                    "agg_relation": "Comments.post"
                  },
                  {
                    "type": "view_link",
                    "view": "Own:PostAndComments",
                    "minRole": 10,
                    "view_label": " comments"
                  }
                ]
              },
              "imageSize": "contain",
              "textColor": "#606665",
              "borderStyle": "solid",
              "setTextColor": true
            },
            {
              "type": "line_break"
            }
          ]
        },
        "columns": [
          {
            "type": "Action",
            "rndid": "6d915a",
            "minRole": "8",
            "isFormula": {},
            "action_name": "insert_joined_row",
            "action_label": "▲",
            "action_style": "btn-link",
            "configuration": {
              "joined_table": "PostLike.post"
            }
          },
          {
            "stat": "Count",
            "type": "Aggregation",
            "agg_field": "user",
            "agg_relation": "PostLike.post"
          },
          {
            "type": "JoinField",
            "join_field": "user.username"
          },
          {
            "type": "Field",
            "fieldview": "relative",
            "field_name": "posted"
          },
          {
            "stat": "Count",
            "type": "Aggregation",
            "agg_field": "body",
            "agg_relation": "Comments.post"
          },
          {
            "type": "ViewLink",
            "view": "Own:PostAndComments",
            "minRole": 10
          }
        ],
        "viewname": "Peek post"
      },
      "default_render_page": null
    },
    {
      "name": "CommentList",
      "table": "Comments",
      "min_role": 1,
      "on_root_page": false,
      "viewtemplate": "List",
      "configuration": {
        "layout": {
          "above": [
            null,
            {
              "widths": [
                2,
                10
              ],
              "besides": [
                {
                  "above": [
                    null,
                    {
                      "type": "blank",
                      "block": false,
                      "contents": "Body",
                      "textStyle": ""
                    }
                  ]
                },
                {
                  "above": [
                    null,
                    {
                      "type": "field",
                      "block": false,
                      "fieldview": "showAll",
                      "textStyle": "",
                      "field_name": "body"
                    }
                  ]
                }
              ]
            },
            {
              "type": "line_break"
            },
            {
              "widths": [
                2,
                10
              ],
              "besides": [
                {
                  "above": [
                    null,
                    {
                      "type": "blank",
                      "block": false,
                      "contents": "Post",
                      "textStyle": ""
                    }
                  ]
                },
                {
                  "above": [
                    null,
                    {
                      "type": "join_field",
                      "block": false,
                      "textStyle": "",
                      "join_field": "post.title"
                    }
                  ]
                }
              ]
            },
            {
              "type": "line_break"
            },
            {
              "widths": [
                2,
                10
              ],
              "besides": [
                {
                  "above": [
                    null,
                    {
                      "type": "blank",
                      "block": false,
                      "contents": "Parent",
                      "textStyle": ""
                    }
                  ]
                },
                {
                  "above": [
                    null,
                    {
                      "type": "join_field",
                      "block": false,
                      "textStyle": "",
                      "join_field": "parent.body"
                    }
                  ]
                }
              ]
            },
            {
              "type": "line_break"
            },
            {
              "widths": [
                2,
                10
              ],
              "besides": [
                {
                  "above": [
                    null,
                    {
                      "type": "blank",
                      "block": false,
                      "contents": "Posted",
                      "textStyle": ""
                    }
                  ]
                },
                {
                  "above": [
                    null,
                    {
                      "type": "field",
                      "block": false,
                      "fieldview": "show",
                      "textStyle": "",
                      "field_name": "posted"
                    }
                  ]
                }
              ]
            },
            {
              "type": "line_break"
            },
            {
              "type": "line_break"
            }
          ]
        },
        "columns": [
          {
            "stat": "Count",
            "type": "Field",
            "view": "Own:ShowComment",
            "link_url": "",
            "agg_field": "body",
            "fieldview": "showAll",
            "link_text": "",
            "field_name": "body",
            "join_field": "post.title",
            "view_label": "",
            "action_name": "Delete",
            "state_field": "on",
            "action_label": "",
            "agg_relation": "Comments.parent"
          },
          {
            "stat": "Count",
            "type": "JoinField",
            "view": "Own:ShowComment",
            "link_url": "",
            "agg_field": "body",
            "fieldview": "showAll",
            "link_text": "",
            "field_name": "body",
            "join_field": "post.title",
            "view_label": "",
            "action_name": "Delete",
            "action_label": "",
            "agg_relation": "Comments.parent"
          },
          {
            "stat": "Count",
            "type": "Field",
            "view": "Own:ShowComment",
            "link_url": "",
            "agg_field": "body",
            "fieldview": "show",
            "link_text": "",
            "field_name": "posted",
            "join_field": "post.title",
            "view_label": "",
            "action_name": "Delete",
            "state_field": "on",
            "action_label": "",
            "agg_relation": "Comments.parent"
          },
          {
            "stat": "Count",
            "type": "ViewLink",
            "view": "Own:ShowComment",
            "link_url": "",
            "agg_field": "body",
            "fieldview": "showAll",
            "link_text": "",
            "field_name": "body",
            "join_field": "post.title",
            "view_label": "Show",
            "action_name": "Delete",
            "state_field": "on",
            "action_label": "",
            "agg_relation": "Comments.parent"
          },
          {
            "stat": "Count",
            "type": "Action",
            "view": "Own:ShowComment",
            "link_url": "",
            "agg_field": "body",
            "fieldview": "showAll",
            "link_text": "",
            "field_name": "body",
            "join_field": "post.title",
            "view_label": "",
            "action_name": "Delete",
            "state_field": "on",
            "action_label": "",
            "agg_relation": "Comments.parent"
          }
        ],
        "viewname": "CommentList",
        "default_state": {
          "body": "",
          "posted": null
        },
        "view_to_create": "",
        "create_view_label": "",
        "create_view_display": "Link"
      },
      "default_render_page": null
    },
    {
      "name": "NewComment",
      "table": "Comments",
      "min_role": 8,
      "on_root_page": false,
      "viewtemplate": "Edit",
      "configuration": {
        "fixed": {
          "post": 1,
          "user": null,
          "parent": null,
          "posted": null,
          "preset_user": "LoggedIn",
          "preset_posted": "Now"
        },
        "layout": {
          "above": [
            {
              "type": "field",
              "fieldview": "textarea",
              "field_name": "body"
            },
            {
              "type": "line_break"
            },
            {
              "type": "action",
              "minRole": 10,
              "action_name": "Save"
            }
          ]
        },
        "columns": [
          {
            "type": "Field",
            "fieldview": "textarea",
            "field_name": "body"
          },
          {
            "type": "Action",
            "minRole": 10,
            "action_name": "Save"
          }
        ],
        "viewname": "NewComment",
        "view_when_done": "Posts"
      },
      "default_render_page": null
    }
  ],
  "tables": [
    {
      "name": "Comments",
      "fields": [
        {
          "name": "body",
          "type": "String",
          "label": "Body",
          "stored": false,
          "required": true,
          "is_unique": false,
          "attributes": {
            "options": ""
          },
          "calculated": false,
          "expression": null
        },
        {
          "name": "post",
          "type": "Key",
          "label": "Post",
          "stored": false,
          "required": true,
          "is_unique": false,
          "attributes": {
            "summary_field": "title"
          },
          "calculated": false,
          "expression": null,
          "reftable_name": "Posts"
        },
        {
          "name": "parent",
          "type": "Key",
          "label": "Parent",
          "stored": false,
          "required": false,
          "is_unique": false,
          "attributes": {
            "summary_field": "body"
          },
          "calculated": false,
          "expression": null,
          "reftable_name": "Comments"
        },
        {
          "name": "posted",
          "type": "Date",
          "label": "Posted",
          "stored": false,
          "required": true,
          "is_unique": false,
          "attributes": {},
          "calculated": false,
          "expression": null
        },
        {
          "name": "user",
          "type": "Key",
          "label": "User",
          "stored": false,
          "required": false,
          "is_unique": false,
          "attributes": {
            "summary_field": "email"
          },
          "calculated": false,
          "expression": null,
          "reftable_name": "users"
        }
      ],
      "triggers": [],
      "versioned": false,
      "constraints": [],
      "min_role_read": 1,
      "min_role_write": 1
    },
    {
      "name": "Posts",
      "fields": [
        {
          "name": "title",
          "type": "String",
          "label": "title",
          "stored": false,
          "required": true,
          "is_unique": false,
          "attributes": {
            "options": ""
          },
          "calculated": false,
          "expression": null
        },
        {
          "name": "url",
          "type": "String",
          "label": "url",
          "stored": false,
          "required": false,
          "is_unique": false,
          "attributes": {
            "options": ""
          },
          "calculated": false,
          "expression": null
        },
        {
          "name": "posted",
          "type": "Date",
          "label": "posted",
          "stored": false,
          "required": true,
          "is_unique": false,
          "attributes": {},
          "calculated": false,
          "expression": null
        },
        {
          "name": "user",
          "type": "Key",
          "label": "User",
          "stored": false,
          "required": true,
          "is_unique": false,
          "attributes": {
            "summary_field": "email"
          },
          "calculated": false,
          "expression": null,
          "reftable_name": "users"
        },
        {
          "name": "score",
          "type": "Float",
          "label": "score",
          "stored": false,
          "required": false,
          "is_unique": false,
          "attributes": {
            "max": null,
            "min": null,
            "units": "",
            "decimal_places": null
          },
          "calculated": false,
          "expression": null
        }
      ],
      "triggers": [],
      "versioned": false,
      "constraints": [],
      "min_role_read": 10,
      "min_role_write": 8
    },
    {
      "name": "users",
      "fields": [
        {
          "name": "email",
          "type": "String",
          "label": "Email",
          "stored": false,
          "required": false,
          "is_unique": false,
          "attributes": {},
          "calculated": false,
          "expression": null
        },
        {
          "name": "username",
          "type": "String",
          "label": "Username",
          "stored": false,
          "required": true,
          "is_unique": true,
          "attributes": {
            "options": "",
            "max_length": null,
            "min_length": 2
          },
          "calculated": false,
          "expression": null
        }
      ],
      "triggers": [],
      "versioned": false,
      "constraints": [],
      "min_role_read": 1,
      "min_role_write": 1
    },
    {
      "name": "PostLike",
      "fields": [
        {
          "name": "user",
          "type": "Key",
          "label": "user",
          "stored": false,
          "required": true,
          "is_unique": false,
          "attributes": {
            "summary_field": "email"
          },
          "calculated": false,
          "expression": null,
          "reftable_name": "users"
        },
        {
          "name": "post",
          "type": "Key",
          "label": "post",
          "stored": false,
          "required": true,
          "is_unique": false,
          "attributes": {
            "summary_field": "title"
          },
          "calculated": false,
          "expression": null,
          "reftable_name": "Posts"
        }
      ],
      "triggers": [],
      "versioned": false,
      "constraints": [
        {
          "type": "Unique",
          "configuration": {
            "fields": [
              "user",
              "post"
            ]
          }
        }
      ],
      "min_role_read": 1,
      "min_role_write": 1
    }
  ],
  "plugins": [
    {
      "name": "markdown",
      "source": "npm",
      "location": "@saltcorn/markdown"
    },
    {
      "name": "comment-tree",
      "source": "npm",
      "location": "@saltcorn/comment-tree"
    },
    {
      "name": "any-bootstrap-theme",
      "source": "npm",
      "location": "@saltcorn/any-bootstrap-theme"
    }
  ]
}