Skip to content

Commit b137433

Browse files
author
Nick Dunn
committed
Batch update: make Dashboard menu item a single link (no child); allow Dashboard to be author's default after logging in; numerous CSS/UI tweaks
1 parent d9c4284 commit b137433

10 files changed

+329
-285
lines changed

README.markdown

+12-9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ To provide a Dashboard summary screen for users. Dashboard "panels" can contain
1414
2. Enable it by selecting "Dashboard" in the list, choose Enable from the with-selected menu, then click Apply
1515
3. Navigate to the Dashboard from the "Dashboard" link in the primary navigation
1616

17+
## Setting the Dashboard as the user's default
18+
19+
Once installed "Dashboard" will appear in the "Default area" dropdown when you create a new author. If you choose this, the author will be shown the dashboard when they log in.
1720

1821
## Core panel types
1922

@@ -51,19 +54,20 @@ To provide panels your extension needs to implement (subscribe to) three delegat
5154

5255
### DashboardPanelTypes
5356

54-
The callback function should return the handle and name of your panel(s):
57+
The callback function should return the handle and name of your panel(s) by adding a new key to the `types` array:
5558

5659
public function dashboard_panel_types($context) {
5760
$context['types']['my_dashboard_panel'] = 'My Amazing Dashboard Panel';
5861
}
5962

60-
This will create a panel of type `my_dashboard_panel`. Make this name as unique as possible so it doesn't conflict with others.
63+
This will define a panel of type `my_dashboard_panel`. Make this name as unique as possible so it doesn't conflict with others.
6164

6265
### DashboardPanelOptions
6366

64-
Each panel has a configuration screen. There are default options for all panels (Label and Position), but you can add additional elements to the configuration form using the `DashboardPanelOptions` delegate:
67+
Each panel has a configuration screen. There are default options for all panels ("Label" and "Position"), but you can add additional elements to the configuration form using the `DashboardPanelOptions` delegate:
6568

6669
public function dashboard_panel_options($context) {
70+
// make sure it's your own panel type, as this delegate fires for all panel types!
6771
if ($context['type'] != 'my_dashboard_panel') return;
6872
6973
$config = $context['existing_config'];
@@ -78,13 +82,13 @@ Each panel has a configuration screen. There are default options for all panels
7882

7983
}
8084

81-
The above code creates a fieldset which will be appended to the panel configuration form. The fielset contains a single textfield "Option 1". The `$config` array contains existing saved config, so you can pre-populate your form fields when editing an existing panel.
85+
The above code creates a fieldset which will be appended to the panel configuration form. The fieldset contains a single textfield with the label "Option 1". The `$config` array contains existing saved options, so you can pre-populate your form fields when editing an existing panel.
8286

83-
Upon saving any form fields prefixed with `config` will be saved with this panel instance, and provided to the panel when it renders.
87+
Upon saving, all form fields named in the `config[...]` array will be saved with this panel instance, and provided to the panel as an array when it renders.
8488

8589
### DashboardPanelRender
8690

87-
Subscribe to the `DashboardPanelRender` delegate to actually render your panel.
91+
Subscribe to the `DashboardPanelRender` delegate to render your panel on the dashboard.
8892

8993
public function render_panel($context) {
9094
if ($context['type'] != 'my_dashboard_panel') return;
@@ -93,10 +97,9 @@ Subscribe to the `DashboardPanelRender` delegate to actually render your panel.
9397
$context['panel']->appendChild(new XMLElement('div', 'The value of Option 1 is: ' . $config['option-1']));
9498
}
9599

96-
First check that you should output your own panel. `$context['panel']` contains an `XMLElement` that is a panel container to which you can append children. The saved configuration for the panel is presented in the `$context['config']` array.
100+
First check that you should output your own panel. `$context['panel']` contains an `XMLElement` that is an empty panel container to which you can append children. The saved configuration for the panel is presented in the `$context['config']` array.
97101

98102
* * *
99103

100104
## Known issues
101-
* when selecting an item from the Create New menu, the menu does not disappear until it loses focus
102-
* adding more than one Markdown Text Panel produces a PHP error
105+
* adding Markdown panels using different versions of the Markdown formatter will cause an error. Be sure to always use the same Markdown formatter for all panels

assets/dashboard.backend.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#nav .dashboard ul {
2+
display: none;
3+
}

assets/dashboard.backend.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
jQuery(document).ready(function() {
2+
3+
var dashboard_menu_item = jQuery('#nav a[href$="/extension/dashboard/"]');
4+
5+
dashboard_menu_item.parents('li:last')
6+
.addClass('dashboard')
7+
.bind('click', function() {
8+
window.location.href = dashboard_menu_item.attr('href');
9+
});
10+
11+
});

assets/dashboard.css assets/dashboard.index.css

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/* DASHBOARD */
32

43
html {
@@ -28,14 +27,13 @@ h2 select {
2827
}
2928

3029
#save-panel {
31-
background: #fbfbfb;
30+
background: #fafafa;
3231
z-index: 90;
3332
position: relative;
3433
margin: 0 -19px;
3534
padding: 0 19px;
3635
display: none;
3736
overflow: hidden;
38-
3937
-moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.05);
4038
-webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.1);
4139
border-bottom: 1px solid #ddd;
@@ -99,24 +97,22 @@ h2 select {
9997
padding: 5px 10px;
10098
border: 1px solid #fff;
10199
min-height: 200px;
102-
103100
-moz-border-radius: 7px;
104101
-webkit-border-radius: 7px;
105102
border-radius: 7px;
106103
}
107104

108105
#dashboard .sortable-container.hover {
109-
border: 1px solid #eee;
110106
background: #fafafa;
111107
}
112108

113109
#dashboard .sortable-container.active {
114-
border: 1px solid #ccc !important;
110+
115111
}
116112

117113
.panel {
118114
background: #FBFBFB;
119-
border: 1px solid #bbb;
115+
border: 1px solid #ddd;
120116
margin: 10px 0;
121117
position: relative;
122118

@@ -125,6 +121,12 @@ h2 select {
125121
border-radius: 5px;
126122
}
127123

124+
.panel.ui-sortable-helper {
125+
-moz-box-shadow: 1px 2px 6px #ddd;
126+
-webkit-box-shadow: 1px 2px 6px #ddd;
127+
border-color: #ccc;
128+
}
129+
128130
.panel-inner {
129131
overflow: hidden;
130132
padding: 10px;
@@ -149,6 +151,8 @@ h2 select {
149151
-moz-border-radius: 7px;
150152
-webkit-border-radius: 7px;
151153
border-radius: 7px;
154+
155+
border: 1px dashed #bbb;
152156
}
153157

154158
.panel h3 {
@@ -160,7 +164,7 @@ h2 select {
160164
color: #555;
161165

162166
border-top: 1px solid #fff;
163-
border-bottom: 1px solid #bbb;
167+
border-bottom: 1px solid #bfbfbf;
164168

165169
-moz-border-radius: 4px;
166170
-moz-border-radius-bottomleft: 0;

0 commit comments

Comments
 (0)