1 module deepmagic.dom.complex.widgets.dashboard.dashboard;
2 
3 import deepmagic.dom;
4 
5 class DashboardWidget : DivElement{
6 	string _title = "Dashboard";
7 	DashboardDatastructure datastructure;
8 
9 	this(DashboardDatastructure datastructure){
10 		super();
11 		this.datastructure = datastructure;
12 		this.init();
13 	}
14 
15 	override void init(){
16 		this ~= new H4Element(
17 			Attributes(null, [new Sass("page-title")]),
18 			this._title
19 		);
20 		this ~= new ShortcutArea(this.datastructure);
21 	}
22 
23 	class ShortcutArea : DivElement{
24 		this(DashboardDatastructure datastructure){
25 			super();
26 			this ~= new Sass("block-area");
27 			this ~= new Sass("shortcut-area");
28 
29 			foreach(int i, Dashboard dashboard; datastructure.dashboards){
30 				this ~= new AElement(
31 					Attributes(null, [new Sass("shortcut"), new Sass("tile")]),
32 					[
33 						new ImgElement(
34 							Attributes(
35 								null,
36 								null,
37 								[
38 									"src" : dashboard.uri,
39 									"alt" : dashboard.name
40 								]
41 							),
42 							""
43 						),
44 						new SmallElement(
45 							Attributes(
46 								null,
47 								[
48 									new Sass("t-overflow")
49 								]
50 							),
51 							dashboard.name
52 						)
53 					]
54 				);
55 			}
56 		}
57 	}
58 }