mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	working on the tag system...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									84f737e554
								
							
						
					
					
						commit
						c9d3ad1736
					
				| @ -55,6 +55,105 @@ module.PersistentTags = core.ImageGridFeatures.Feature({ | |||||||
| //
 | //
 | ||||||
| 
 | 
 | ||||||
| var TagUIActions = actions.Actions({ | var TagUIActions = actions.Actions({ | ||||||
|  | 	config: { | ||||||
|  | 		// XXX should this be a list or a tree (list of paths)????
 | ||||||
|  | 		// XXX support tag chains...
 | ||||||
|  | 		// 		...a chain is a means to combine tags like:
 | ||||||
|  | 		// 			vehicle/car + color/red can be represented as car:red
 | ||||||
|  | 		// 			this would mean that an image both has a 'car' and 'red'
 | ||||||
|  | 		// 			but also specifically states that it contains a 'red car'
 | ||||||
|  | 		// 		...need to think of a good way to implement this...
 | ||||||
|  | 		// 			...the obvious way is when tagging with 'car:red' to
 | ||||||
|  | 		// 			tag the image with: 'car', 'red' and 'car:red'
 | ||||||
|  | 		// 			Q: is 'car:red' the same as 'red:car'??
 | ||||||
|  | 		// 			...feels that it should be...
 | ||||||
|  | 		// XXX support tag paths as tags???
 | ||||||
|  | 		// 		...a tag can be part of several paths, we should be able 
 | ||||||
|  | 		// 		to use a specific one...
 | ||||||
|  | 		// 		...an example would be something like:
 | ||||||
|  | 		// 			species/man
 | ||||||
|  | 		// 			people/man
 | ||||||
|  | 		// 		Q: do we need this???
 | ||||||
|  | 		// 		Q: can this be implemented via chains???
 | ||||||
|  | 		// XXX should we have associative aliases???
 | ||||||
|  | 		// 		like: 
 | ||||||
|  | 		// 			'men' is 'many:man'
 | ||||||
|  | 		// 			'women' is 'many:woman'
 | ||||||
|  | 		// 			...
 | ||||||
|  | 		// XXX need a tree api to query the tag tree...
 | ||||||
|  | 		// 		.tagParents(tag)
 | ||||||
|  | 		// 		.tagChildren(tag)
 | ||||||
|  | 		// 		.tagOrpahns()
 | ||||||
|  | 		// 		 ...
 | ||||||
|  | 		// XXX should this be here or in .data???
 | ||||||
|  | 		// XXX do a whitepaper (RFC?) on this system when done...
 | ||||||
|  | 		'base-tags': [ | ||||||
|  | 			'count', | ||||||
|  | 			'count/one', | ||||||
|  | 			'count/two', | ||||||
|  | 			'count/many', | ||||||
|  | 
 | ||||||
|  | 			'people', | ||||||
|  | 			'people/crowd', | ||||||
|  | 			'people/group', | ||||||
|  | 			'people/couple', | ||||||
|  | 			'people/man', | ||||||
|  | 			'people/woman', | ||||||
|  | 			'people/lady', | ||||||
|  | 			'people/girl', | ||||||
|  | 			'people/boy', | ||||||
|  | 			'people/child', | ||||||
|  | 
 | ||||||
|  | 			'name', | ||||||
|  | 
 | ||||||
|  | 			'role', | ||||||
|  | 			'role/photographer', | ||||||
|  | 			'role/artist', | ||||||
|  | 			'role/painter', | ||||||
|  | 
 | ||||||
|  | 			'color', | ||||||
|  | 			'color/red', | ||||||
|  | 			'color/green', | ||||||
|  | 			'color/blue', | ||||||
|  | 			'color/white', | ||||||
|  | 			'color/black', | ||||||
|  | 			'color/orange', | ||||||
|  | 			'color/yellow', | ||||||
|  | 			'color/gray', | ||||||
|  | 
 | ||||||
|  | 			// XXX should this be 'type' or something else???
 | ||||||
|  | 			'genre', | ||||||
|  | 			'genre/documentary', | ||||||
|  | 			'genre/landscape', | ||||||
|  | 			'genre/portrait', | ||||||
|  | 			'genre/wildlife', | ||||||
|  | 			'genre/macro', | ||||||
|  | 			'genre/abstract', | ||||||
|  | 			'genre/sport', | ||||||
|  | 
 | ||||||
|  | 			'activity', | ||||||
|  | 			'activity/sport', | ||||||
|  | 			'activity/sport/football', | ||||||
|  | 			'activity/sport/american-football', | ||||||
|  | 			'activity/sport/baseball', | ||||||
|  | 			'activity/sport/tennis', | ||||||
|  | 			// ...
 | ||||||
|  | 		], | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
|  | 	// Tag cloud/list...
 | ||||||
|  | 	//
 | ||||||
|  | 	// XXX move this to the base tags feature...
 | ||||||
|  | 	get tags(){ | ||||||
|  | 		return [] | ||||||
|  | 			// XXX load this from a file...
 | ||||||
|  | 			.concat((this.config['base-tags'] || []) | ||||||
|  | 				// split tag paths...
 | ||||||
|  | 				.map(function(e){ return e.split(/[\\\/]/g) }) | ||||||
|  | 				.flat())  | ||||||
|  | 			.concat(Object.keys((this.data || {}).tags || {})) | ||||||
|  |    			.unique() }, | ||||||
|  | 
 | ||||||
| 	// XXX use global tag list... (???) 
 | 	// XXX use global tag list... (???) 
 | ||||||
| 	// XXX make this reusable...
 | 	// XXX make this reusable...
 | ||||||
| 	showTagCloud: ['Tag|Edit|Image/$Tags...', | 	showTagCloud: ['Tag|Edit|Image/$Tags...', | ||||||
| @ -94,7 +193,7 @@ var TagUIActions = actions.Actions({ | |||||||
| 				// 			- partial	- some are tagged
 | 				// 			- partial	- some are tagged
 | ||||||
| 				// 			- off		- none are tagged
 | 				// 			- off		- none are tagged
 | ||||||
| 				// XXX add key binding to delete a tag...
 | 				// XXX add key binding to delete a tag...
 | ||||||
| 				Object.keys(that.data.tags || {}) | 				that.tags | ||||||
| 					.sort() | 					.sort() | ||||||
| 					.map(function(tag){ | 					.map(function(tag){ | ||||||
| 						return make(tag, { | 						return make(tag, { | ||||||
| @ -155,6 +254,14 @@ var TagUIActions = actions.Actions({ | |||||||
| 		widgets.makeUIDialog(function(){ | 		widgets.makeUIDialog(function(){ | ||||||
| 			// XXX
 | 			// XXX
 | ||||||
| 		})], | 		})], | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	// Tag tree...
 | ||||||
|  | 	//
 | ||||||
|  | 	get tagTree(){ | ||||||
|  | 		// XXX
 | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user