//////////////////////////////////////////////////////////////////////////// // Information about the item, along with some controls // // Events: // * move-item-up User wants to move the item up // * mode-item-down User wants to move the item down // * delete-item User wants to delete the item // * edit-item-info User wants to edit item info // //////////////////////////////////////////////////////////////////////////// Vue.component('CategoryItemInfo', { props: { // Contents of the item item: {type: Object, required: true}, }, computed: { // Item group, e.g. "PCRE-based" or "POSIX-based" for regex libraries group: function() { return this.item.group_ || "other" }, // Link to the "official site" or something link: function () { return this.item.link || null }, // Link to the Hackage page (for Haskell packages) hackageLink: function () { return (this.item.kind.tag == "Library") ? this.item.kind.contents : (this.item.kind.tag == "Tool") ? this.item.kind.contents : null }, }, // TODO: this template is somewhat messy; styles should be moved out; // spans and divs used like here are weird, too template: `
#
{{ item.name }} {{ item.name }}
{{ group }}
up down edit delete
`, }); //////////////////////////////////////////////////////////////////////////// // Item info edit form // // Shown when you press the cog in the item titlebar. //////////////////////////////////////////////////////////////////////////// Vue.component('CategoryItemInfoEdit', { props: { // Contents of the item item: {type: Object, required: true}, }, // We use 'autocomplete=off' everywhere due to this: // http://stackoverflow.com/q/8311455 template: `
{{! When “new group” is selected in the list, we show a field for entering new group's name }}
`, });