mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 09:30:28 +00:00
Starting to introduce list views
These are custom modules for visualising list manipulations and navigations
This commit is contained in:
parent
5ced636abf
commit
c087228b33
@ -22,7 +22,9 @@ exports.info = {
|
||||
templateText: {byName: true, type: "text"},
|
||||
editTemplate: {byName: true, type: "tiddler"},
|
||||
editTemplateText: {byName: true, type: "text"},
|
||||
emptyMessage: {byName: true, type: "text"}
|
||||
emptyMessage: {byName: true, type: "text"},
|
||||
listviewTiddler: {byName: true, type: "tiddler"},
|
||||
listview: {byName: true, type: "text"}
|
||||
}
|
||||
};
|
||||
|
||||
@ -59,6 +61,22 @@ exports.executeMacro = function() {
|
||||
return this.listFrame;
|
||||
};
|
||||
|
||||
exports.postRenderInDom = function() {
|
||||
// Instantiate the list view
|
||||
var listviewName;
|
||||
if(this.hasParameter("listviewTiddler")) {
|
||||
listviewName = this.wiki.getTextReference(this.params.listviewTiddler);
|
||||
}
|
||||
if(!listviewName && this.hasParameter("listview")) {
|
||||
listviewName = this.params.listview;
|
||||
}
|
||||
var ListView = this.wiki.macros.list.listviews[listviewName];
|
||||
this.listview = ListView ? new ListView(this) : null;
|
||||
if(this.listview) {
|
||||
this.listview.test();
|
||||
}
|
||||
};
|
||||
|
||||
exports.getTiddlerList = function() {
|
||||
var filter;
|
||||
if(this.hasParameter("type")) {
|
||||
|
25
core/modules/macros/list/listviews/classic.js
Normal file
25
core/modules/macros/list/listviews/classic.js
Normal file
@ -0,0 +1,25 @@
|
||||
/*\
|
||||
title: $:/core/modules/macros/list/listviews/classic.js
|
||||
type: application/javascript
|
||||
module-type: listview
|
||||
|
||||
Views the list as a linear sequence
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
function ClassicListView(listMacro) {
|
||||
this.listMacro = listMacro;
|
||||
};
|
||||
|
||||
ClassicListView.prototype.test = function() {
|
||||
alert("In ClassicListView");
|
||||
};
|
||||
|
||||
exports["classic"] = ClassicListView;
|
||||
|
||||
})();
|
@ -35,6 +35,7 @@ exports.startup = function() {
|
||||
$tw.wiki.initEditors();
|
||||
$tw.wiki.initFieldViewers();
|
||||
$tw.wiki.initStoryViews();
|
||||
$tw.wiki.initListViews();
|
||||
$tw.wiki.initParsers();
|
||||
// Set up the command modules
|
||||
$tw.Commander.initCommands();
|
||||
|
@ -533,7 +533,7 @@ exports.initEditors = function(moduleType) {
|
||||
};
|
||||
|
||||
/*
|
||||
Install field viewer modules for the edit macro
|
||||
Install field viewer modules for the view macro
|
||||
*/
|
||||
exports.initFieldViewers = function(moduleType) {
|
||||
moduleType = moduleType || "fieldviewer";
|
||||
@ -544,6 +544,18 @@ exports.initFieldViewers = function(moduleType) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Install list viewer modules for the list macro
|
||||
*/
|
||||
exports.initListViews = function(moduleType) {
|
||||
moduleType = moduleType || "listview";
|
||||
var listMacro = this.macros.list;
|
||||
if(listMacro) {
|
||||
listMacro.listviews = {};
|
||||
$tw.modules.applyMethods(moduleType,listMacro.listviews);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Install view modules for the story macro
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user