Ticket #609 (closed enhancement: fixed)

Opened 4 years ago

Last modified 3 years ago

add toolbar macro separator param to insert "|" between items

Reported by: EricShulman Owned by: EricShulman
Priority: minor Milestone: 2.5.1
Component: core Version:
Severity: trivial Keywords:
Cc:

Description (last modified by FND) (diff)

Extend the <<toolbar>> macro parameters syntax to permit use of "|" as separators between item groups:

merge(config.macros.toolbar,{
	separator: "|"
	});

config.macros.toolbar.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
...
		switch(c) {
			case '|':  
			case '!':  // (alternative for use in ToolbarCommands slices)
				createTiddlyText(place,this.separator);
				break;
			case '>':
...

Attachments

ticket609.patch Download (1.0 KB) - added by FND 4 years ago.
ticket608_609.patch Download (1.7 KB) - added by EricShulman 3 years ago.
adds more/less toggle and separator syntax to toolbar handler

Change History

follow-up: ↓ 3   Changed 4 years ago by FND

Isn't this a presentation issue, and should thus be solved with CSS - e.g. something like this:

.toolbar {
    overflow: hidden;
    padding-right: -1px;
}

.toolbar .button {
    border: 1px solid;
    border-width: 0 1px;
    margin-right: -1px;
}

  Changed 4 years ago by FND

Correction - that CSS code should be:

.toolbar {
    overflow: hidden;
    padding-right: -1px;
}

.toolbar .button {
    border: 1px solid #000;
    border-width: 0 1px 0 0;
    margin-right: -1px;
}

in reply to: ↑ 1 ; follow-up: ↓ 4   Changed 4 years ago by EricShulman

Replying to FND: You've misunderstood the feature! The purpose is not to put a line between *every* item... it is to allow specfication of a separator bar as desired between specific items. This idea is similar to how you can selectively add separators between toolbar buttons in the browser to create logical groupings.

For example, using the standard toolbar for the ViewTemplate?:

closeTiddler closeOthers ! +editTiddler > fields ! syncing permalink references jump

would be displayed as:

close close others | edit more

...and when more is clicked:

close close others | edit fields | sync permalink references jump

in reply to: ↑ 3   Changed 4 years ago by FND

  • description modified (diff)

Replying to EricShulman:

You've misunderstood the feature!

I did indeed - sorry 'bout that. I've slightly modified the description accordingly.

  Changed 4 years ago by FND

  • owner changed from JeremyRuston to FND
  • status changed from new to assigned
  • description modified (diff)

follow-up: ↓ 7   Changed 4 years ago by EricShulman

In ticket609.patch, the 'separator' definition for config.macros.toolbar should be added to the existing 'merge(config.macros.toolbar' in lingo.js

That is, the existing code:

merge(config.macros.toolbar,{
	moreLabel: "more",
	morePrompt: "Reveal further commands"
	});

should be changed to:

merge(config.macros.toolbar,{
	moreLabel: "more",
	morePrompt: "Reveal further commands",
	separator: "|"
	});

rather than adding a separate merge for 'separator' by itself

Changed 4 years ago by FND

in reply to: ↑ 6   Changed 4 years ago by FND

  • milestone set to 2.5

Replying to EricShulman:

In ticket609.patch, the 'separator' definition for config.macros.toolbar should be added to the existing 'merge(config.macros.toolbar' in lingo.js

Good catch - done.

follow-up: ↓ 9   Changed 3 years ago by EricShulman

as per Developer Conference Call discussion on 10-Nov-2008, it was suggested that only one separator syntax, "|" (pipe) or "!" (exclamation), should be implemented. Due to the inability to use "|" within table-formatted slice definitions, such as those in ToolbarCommands?, it makes sense to go with "!" rather than "|".

in reply to: ↑ 8 ; follow-up: ↓ 10   Changed 3 years ago by FND

Replying to EricShulman:

Due to the inability to use "|" within table-formatted slice definitions, such as those in ToolbarCommands?, it makes sense to go with "!" rather than "|".

Actually, we've recently improved the slices RegEx? to support pipes within slice values:

[[GettingStarted]]: "|foo|bar|baz|"
store.getTiddlerSlice("GettingStarted", "foo"); // returns "bar|baz"

Thus using the pipe should be possible, which might be easier for users to grasp.

in reply to: ↑ 9 ; follow-up: ↓ 11   Changed 3 years ago by EricShulman

Replying to FND:

Actually, we've recently improved the slices RegEx? to support pipes within slice values: Thus using the pipe should be possible, which might be easier for users to grasp.

Hmmm... while 'pipe' might be a slight bit easier, using the | within the slice makes it harder to recognize the table cell boundaries when looking at the tiddler *source*, and may make errors more likely when editing the slice table. Using "!" within the slice to define toolbar separators provides a distinct but low-key difference in appearance that reduces that potential for confusion.

Also, and perhaps more importantly, suppose I write:

|ViewToolbar|close closeOthers | editTiddler|
|EditToolbar|saveTiddler cancelTiddler deleteTiddler|

while "close closeOthers | editTiddler" is treated as a single slice value, it will be *rendered* as three separate columns, instead of two... but the row following it has no toolbar separators, which *does* display as two cells (as expected). If a toolbar definition contains several separators, the table could render with a different number of cells in each row, which could result in some *very* odd appearances, where one very wide cell pushes all the remaining cells far to the right.

One last thought... there is a plugin somewhere (I think written by Lyall) that extends the slice table to allow multiple columns, as well as a proposed extension to the slice table syntax to support column headings to create simple 'database' lookup tables using references like "TiddlerName::SliceName::ColumnName?" or perhaps "TiddlerName::SliceName?(ColumnName?)". It seems to me that using "|" within a slice table definition would make that implementation problematic at best.

in reply to: ↑ 10   Changed 3 years ago by FND

Replying to EricShulman:

Good points, Eric - I concur that using an exclamation mark is probably the better solution then.

  Changed 3 years ago by FND

  • milestone changed from 2.5 to 2.4.2

  Changed 3 years ago by FND

  • milestone changed from 2.4.2 to 2.5.1

It appears more discussion is required here, so we've decided to push this to 2.5.1 to avoid delaying the 2.4.2 release.

  Changed 3 years ago by MartinBudden

  • owner changed from FND to EricShulman
  • status changed from assigned to new

Changed 3 years ago by EricShulman

adds more/less toggle and separator syntax to toolbar handler

  Changed 3 years ago by EricShulman

as per dicussion with Martin, I've attached a proper patch file for this change (add separators) as well as ticket #608 (more/less toggle)

  Changed 3 years ago by MartinBudden

  • status changed from new to closed
  • resolution set to fixed

Fixed in changeset:9528

Note: See TracTickets for help on using tickets.