Macrura

Dashboard (redux)

Recommended Posts

Sometimes you have clients who will login to the admin, and they perhaps only need to access a few areas of the site, such as:

  • a product or blog list (ListerPro)
  • site settings
  • formbuilder entries
  • specific front end pages
  • documentation
  • helpdesk
  • backup interface
  • Server health or server status (for example site5 has a page for every server to see it's status)
  • Link to a bookmark (page tree bookmark for example) - this is awesome by the way
  • Run a special action like clear a wirecache or other custom caching
  • Add a billing or late payment notice
  • Add an alert about upcoming server maintenance

The Problem:

How can you collate all of these diverse links and messages into 1 page, as fast and easy as possible, make it hassle-free to add stuff to it, maybe some messages, change the order of the links etc.

In some systems this is called the Dashboard. You can make one in a few minutes using:

1.) Admin Custom Pages

2.) ready.php in your site folder

Steps:

  1. Install ACP
  2. create a file inside templates for your dashboard (e.g. _ac_dashboard.php).
  3. Create your dashboard page below the admin branch of the page tree, assign it to ACP, and set the template to use to the one you created.
  4. This example will display a table of quicklinks.

Contents of the dasboard file:

<?php
wire('modules')->get('MarkupAdminDataTable');
?>

<h3>Title of site here</h3>

    <div id='ProcessFieldList'>

        <table id='AdminDataTable1' class='AdminDataTable AdminDataList AdminDataTableResponsive AdminDataTableSortable'>
            <thead>
            <tr>
                <th>Item</th>
                <th>Comment</th>
            </tr>
            </thead>
            <tbody>
                <tr>
                    <td><a href='<?php echo $config->urls->admin?>blog/'>Blog</a></td>
                    <td>Filterable/Searchable listing of blog posts.</td>
                </tr>
                <tr>
                    <td><a href='<?php echo $config->urls->admin?>news/'>News</a></td>
                    <td>Filterable/Searchable listing of news items.</td>
                </tr>
                <tr>
                    <td><a href='<?php echo $config->urls->admin?>projects/'>Projects</a></td>
                    <td>Filterable/Searchable listing of projects.</td>
                </tr>
                <tr>
                    <td><a href='<?php echo $config->urls->admin?>page/'>Page Tree</a></td>
                    <td>A hierarchical listing of the pages in your site.</td>
                </tr>
                <tr>
                    <td><a href='<?php echo $config->urls->admin?>settings/'>Site Settings</a></td>
                    <td>Global site settings</td>
                </tr>
            </tbody>
        </table>

        <script>AdminDataTable.initTable($('#AdminDataTable1'));</script>

    </div><!--/#ProcessFieldList-->

You only need this if you want to redirect logins to the dashboard:

add to ready.php

(where 1234 is the ID of your dashboard page):

if($page->template=="admin" && $page->id == 2) $session->redirect($pages->get(1234)->url);

post-136-0-30797000-1444428347_thumb.png

Edited by Macrura
removed duplicate content div
  • Like 15

Share this post


Link to post
Share on other sites

You only need this if you want to redirect logins to the dashboard:

add to ready.php

(where 1234 is the ID of your dashboard page):

if($page->template=="admin" && $page->id == 2) $session->redirect($pages->get(1234)->url);

You can also install my ProcessPageAdmin module to do this https://github.com/ocorreiododiogo/ProcessHomeAdmin :)

  • Like 3

Share this post


Link to post
Share on other sites

cool - thanks! loving to hear more suggestions and enhancements.

This simple recipe is going to make things at least 50% easier for my clients, especially those who seldom access their sites and then when they do they can't remember where anything is... arriving at the page tree for about 70% of my sites is a non-sequitur; 

For example on New Focus Recordings, we use almost exclusively listers, so better to login and land on a quicklink list so you can get where you need and maybe not even see the (wonderful) page tree at all.

Share this post


Link to post
Share on other sites

I'll spend a little snippet to render a nice admin table in such kinds of dashboard.... ;)

//lets's show some last events
//rootpage of articles is XXXX
// Find some pages
$events = $pages->find("template=event,check_active=0,limit=5,sort=event_start_date,sort=event_start_time");
$table = $modules->get("MarkupAdminDataTable");
$table->headerRow( ["Title", "Created", "User"] );
$table->setSortable(false);
$table->action(array(
	'New Event' => $config->urls->admin . 'page/add/?parent_id=XXXX',
	'All Events' => $config->urls->admin . 'page/events/',
));

foreach($events as $page){
  $data = array(
    // Values with a sting key are converter to a link: title => link
    $page->title => $config->urls->admin."page/edit/?id=".$page->id,
    date("F j, Y", $page->created),
    $page->createdUser->full_name
  );
  $table->row($data);
}

// $table->footerRow( $someArray );
echo '<div class="someclass">';											">';
echo $table->render();
echo '</div>';

renders something like this:

post-2327-0-62647400-1444813529_thumb.jp

have fun

  • Like 7

Share this post


Link to post
Share on other sites

Update:

So I've been using Pete's dashboard module instead of the technique described above;

it's quicker to setup, and easier to clone to other installs, and no need to have code in various places like the themes folder and in ready.php

The hope/plan is to turn it into a full widget enabled dashboard module that i can install on various installations

a) without having to do any hardcoding

b) enable control over which widgets are shown on the dashboard (by user/role/permission)

c) allow for easy configuration of colors, icons, columns, etc.

To achieve this I setup some templates for different widget types, one is a shortcuts widget, another is a page lister widget;

these each have pages and fields to configure them; i can set them to appear by user/role.

in the future i can add different types of widgets as needed and then include them in the needed user's dashboard.

post-136-0-27630900-1453138914_thumb.png

This is using a combination of a free (MIT licensed) admin theme for bootstrap, but instead of using bootstrap as the css layout, it uses a tiny grid called rwdgrid which i s 2KB; it uses the box, and other widget classes from the admin theme.

  • Like 15

Share this post


Link to post
Share on other sites

Sometimes you have clients who will login to the admin, and they perhaps only need to access a few areas of the site, such as:

  • a product or blog list (ListerPro)
  • site settings
  • formbuilder entries
  • specific front end pages
  • documentation
  • helpdesk
  • backup interface
  • Server health or server status (for example site5 has a page for every server to see it's status)
  • Link to a bookmark (page tree bookmark for example) - this is awesome by the way
  • Run a special action like clear a wirecache or other custom caching
  • Add a billing or late payment notice
  • Add an alert about upcoming server maintenance

The Problem:

How can you collate all of these diverse links and messages into 1 page, as fast and easy as possible, make it hassle-free to add stuff to it, maybe some messages, change the order of the links etc.

In some systems this is called the Dashboard. You can make one in a few minutes using:

1.) Admin Custom Pages

2.) ready.php in your site folder

Steps:

  1. Install ACP
  2. create a file inside templates for your dashboard (e.g. _ac_dashboard.php).
  3. Create your dashboard page below the admin branch of the page tree, assign it to ACP, and set the template to use to the one you created.
  4. This example will display a table of quicklinks.

Contents of the dasboard file:

<?php
wire('modules')->get('MarkupAdminDataTable');
?>

<h3>Title of site here</h3>

    <div id='ProcessFieldList'>

        <table id='AdminDataTable1' class='AdminDataTable AdminDataList AdminDataTableResponsive AdminDataTableSortable'>
            <thead>
            <tr>
                <th>Item</th>
                <th>Comment</th>
            </tr>
            </thead>
            <tbody>
                <tr>
                    <td><a href='<?php echo $config->urls->admin?>blog/'>Blog</a></td>
                    <td>Filterable/Searchable listing of blog posts.</td>
                </tr>
                <tr>
                    <td><a href='<?php echo $config->urls->admin?>news/'>News</a></td>
                    <td>Filterable/Searchable listing of news items.</td>
                </tr>
                <tr>
                    <td><a href='<?php echo $config->urls->admin?>projects/'>Projects</a></td>
                    <td>Filterable/Searchable listing of projects.</td>
                </tr>
                <tr>
                    <td><a href='<?php echo $config->urls->admin?>page/'>Page Tree</a></td>
                    <td>A hierarchical listing of the pages in your site.</td>
                </tr>
                <tr>
                    <td><a href='<?php echo $config->urls->admin?>settings/'>Site Settings</a></td>
                    <td>Global site settings</td>
                </tr>
            </tbody>
        </table>

        <script>AdminDataTable.initTable($('#AdminDataTable1'));</script>

    </div><!--/#ProcessFieldList-->

You only need this if you want to redirect logins to the dashboard:

add to ready.php

(where 1234 is the ID of your dashboard page):

if($page->template=="admin" && $page->id == 2) $session->redirect($pages->get(1234)->url);

attachicon.gifexample dashboard.png

which admin theme used in the screen shot ?

Share this post


Link to post
Share on other sites
which admin theme used in the screen shot ?

Reno - it's included in most recent versions.

Sometimes you have clients who will login to the admin, and they perhaps only need to access a few areas of the site, such as:

Just noticed the logo you have for the Blog menu item :D

  • Like 1

Share this post


Link to post
Share on other sites

@Pete - thanks for noticing.. yeah there isn't really a 'blog' icon in fontawesome, so i just used that one..., and i also have some questions/comments about the dashboard module, but i'll do those over on the module thread..

@Mike - yeah, i should probably change to a rocket, but the idea of 're-routing' something seemed also to communicate what that does... any sort of looped arrow i guess would work...

  • Like 1

Share this post


Link to post
Share on other sites

@Mike - yeah, i should probably change to a rocket, but the idea of 're-routing' something seemed also to communicate what that does... any sort of looped arrow i guess would work...

Honestly, I prefer yours. Hehe!

Share this post


Link to post
Share on other sites

which admin theme used in the screen shot ?

Do you mean which PW theme, or which theme is used in the dashboard area (which uses a mini admin theme style-scoped into the dashboard container)

Share this post


Link to post
Share on other sites

Update:

So I've been using Pete's dashboard module instead of the technique described above;

it's quicker to setup, and easier to clone to other installs, and no need to have code in various places like the themes folder and in ready.php

The hope/plan is to turn it into a full widget enabled dashboard module that i can install on various installations

a) without having to do any hardcoding

b) enable control over which widgets are shown on the dashboard (by user/role/permission)

c) allow for easy configuration of colors, icons, columns, etc.

To achieve this I setup some templates for different widget types, one is a shortcuts widget, another is a page lister widget;

these each have pages and fields to configure them; i can set them to appear by user/role.

in the future i can add different types of widgets as needed and then include them in the needed user's dashboard.

attachicon.gifdashb_example.png

This is using a combination of a free (MIT licensed) admin theme for bootstrap, but instead of using bootstrap as the css layout, it uses a tiny grid called rwdgrid which i s 2KB; it uses the box, and other widget classes from the admin theme.

How you implement shortcut widgets?

Two different template file and included in the dashboard page ?

And, the those site shortcuts links are hard-coded in template?

Share this post


Link to post
Share on other sites

I installed Pete's Dashboard module. It behave slightly different from Macrura posted screenshot

post-2272-0-48991400-1453252067_thumb.pn

After logged in, Dashboard is not the default page and, the Dashboard tab is not in the first order.

Share this post


Link to post
Share on other sites

Update:

So I've been using Pete's dashboard module instead of the technique described above;

it's quicker to setup, and easier to clone to other installs, and no need to have code in various places like the themes folder and in ready.php

The hope/plan is to turn it into a full widget enabled dashboard module that i can install on various installations

a) without having to do any hardcoding

b) enable control over which widgets are shown on the dashboard (by user/role/permission)

c) allow for easy configuration of colors, icons, columns, etc.

To achieve this I setup some templates for different widget types, one is a shortcuts widget, another is a page lister widget;

these each have pages and fields to configure them; i can set them to appear by user/role.

in the future i can add different types of widgets as needed and then include them in the needed user's dashboard.

attachicon.gifdashb_example.png

This is using a combination of a free (MIT licensed) admin theme for bootstrap, but instead of using bootstrap as the css layout, it uses a tiny grid called rwdgrid which i s 2KB; it uses the box, and other widget classes from the admin theme.

Hi Macrura,

This is very impressive. Any tutorial or resources to show us how to do it?? Thanks.

Gideon

Share this post


Link to post
Share on other sites

I installed Pete's Dashboard module. It behave slightly different from Macrura posted screenshot

attachicon.gifBaiduShurufa_2016-1-20_9-4-59.png

After logged in, Dashboard is not the default page and, the Dashboard tab is not in the first order.

can you try moving the page up to the top, in the admin page branch?

Hi Macrura,

This is very impressive. Any tutorial or resources to show us how to do it?? Thanks.

Gideon

sure, i can try, and the plan is to eventually make a module...

but in the meantime i'll try and make a tutorial, because until the module is made, it's just a lot of fields, templates and pages in the admin; then 1 dashboard.php, and 3 css files

  • Like 3

Share this post


Link to post
Share on other sites

can you try moving the page up to the top, in the admin page branch?

sure, i can try, and the plan is to eventually make a module...

but in the meantime i'll try and make a tutorial, because until the module is made, it's just a lot of fields, templates and pages in the admin; then 1 dashboard.php, and 3 css files

Good. Waiting for your great tutorial.

Gideon

Share this post


Link to post
Share on other sites

How you implement shortcut widgets?

Two different template file and included in the dashboard page ?

And, the those site shortcuts links are hard-coded in template?

the latest screenshot i use pages for the shortcut widgets as follows; this is a basic setup and will be expanded upon gradually:

the widgets are pages

post-136-0-66928000-1453262816_thumb.png

this is the template for making shortcuts; the shortcuts are configured first, and then added to the widget;

this way shortcuts can be used in any widget

post-136-0-37215300-1453262818_thumb.png

this is the page for configuring a shortcut widget

post-136-0-19009700-1453262819_thumb.png

this is the shortcut page showing the page select for the shortcuts

post-136-0-55615400-1453262817_thumb.png

there is one template file dashboard.php which controls the contents of the dashboard.

the shortcut widgets are generated automatically based on being setup in the admin;

the lister widgets are currently hardcoded but the plan is to make them configurable using a selector field

  • Like 2

Share this post


Link to post
Share on other sites

can you try moving the page up to the top, in the admin page branch?

I see.

From OP, using login redirect to redirect to dashboard.

if($page->template=="admin" && $page->id == 2) $session->redirect($pages->get(1234)->url)

what is the $page->id == 2   ?

Share this post


Link to post
Share on other sites

The dashboard module itself does a redirect, but it looks for the first child of the admin page:

if ($this->page->id == 2) {
            $this->session->redirect($this->page->child->url);
        }
The first child of this page. Returns a Page. See also $page->child($selector). more

using the method described in the first post gives you more control if you want to keep everything in your templates folder and do the redirect within ready.php; the dashboard module changes process on the admin page which may not be wanted;

also if you do end up using the dashboard module, it may be prudent to rename the module so that any customizations or additions are not overridden in case of a module update.

Share this post


Link to post
Share on other sites

@Macrura I like where you are going with this. Every user needs a good starting point and a comprehensive Dashboard is a proven and effective way of doing it. Exciting times :)

  • Like 2

Share this post


Link to post
Share on other sites
On 1/19/2016 at 11:10 PM, Macrura said:

the latest screenshot i use pages for the shortcut widgets as follows; this is a basic setup and will be expanded upon gradually:

the widgets are pages

post-136-0-66928000-1453262816_thumb.png

this is the template for making shortcuts; the shortcuts are configured first, and then added to the widget;

this way shortcuts can be used in any widget

post-136-0-37215300-1453262818_thumb.png

this is the page for configuring a shortcut widget

post-136-0-19009700-1453262819_thumb.png

this is the shortcut page showing the page select for the shortcuts

post-136-0-55615400-1453262817_thumb.png

there is one template file dashboard.php which controls the contents of the dashboard.

the shortcut widgets are generated automatically based on being setup in the admin;

the lister widgets are currently hardcoded but the plan is to make them configurable using a selector field

@Macrura I am very interested in this, is it available as a package or module for download?

Share this post


Link to post
Share on other sites

The ProcessDashboards module which is the latest iteration of this is back to being a simple helper module, close to the original Dashboard module by @Pete, but with some additional features, and that the module no longer changes anything in the admin, meaning that it doesn't auto-change the admin page to use the process; instead you create one or more dashboards, and input the path to a php file to render the dashboard;

if you want to use one of them as the admin home screen, then you just change that admin page's process to use this module (ProcessDashboards). Since making dashboards is fundamentally creating markup, it is better to keep all of the files for the dashboard in the templates folder. Also, if there were to be any dashboard module that output markup, it could become difficult to support multiple admin themes. Users of UIKit theme could build a simple dashboard using all native UIKit markup and not have to include a css framework (as i have done for the examples, which run inside the reno theme).

Since this type of setup is not really suitable for a standalone module, or a site profile, i see it more as a construction kit. You need the base module; if you want to use the shortcuts and widgets functionality, there is another module that installs all of the fields & templates for that setup; You need the files that generate the dashboard(s) and the widgets that go in the templates folder, including css/js, libraries, widget partials, and functions. Hopefully this can all be on GitHub soon, once i sort out some issues with my current dev computer (old os no longer being able to connect to github)...

  • Like 7

Share this post


Link to post
Share on other sites
On 3/24/2018 at 12:29 PM, Macrura said:

Hopefully this can all be on GitHub soon, once i sort out some issues with my current dev computer (old os no longer being able to connect to github)

That would be very nice, hope you can get the machine working soon.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By louisstephens
      So I was going to build a todo tracking app for myself to test/broaden my knowledge of processwire, and so far it has been taxing 😓.  My Site structure is:
      - Project One - Phase One - Task - Task - Task - Phase Two - Task - Task - Task So far it was pretty easy, I can easily foreach through the Project and get the phases with their tasks. However, it gets a bit muddled when I have more than one project as I was trying to have a dashboard where the content switches out to the selected project as opposed to accessing each project via their own url. How would yall handle this?
      My next hurdle is each task has a select field (for project status) that I want to update via ajax (for the smooth transitioning).
      Scenario: You finish a task, change the option from "new" to "completed", and an onclick changes the status drop down background to green (which I have working), but then posts/saves a field on the backend to the new option.
       
      I have a page called "Actions" set up with url segments using
      if ($config->ajax && $input->urlSegment1 == 'change-status') { //save update field on admin } However, I am a little fuzzy on how to actually pass the current page along with the new selected status to actually update the page (task). I guess I am not very far into my endeavor. Any help would be greatly appreciated.
    • By abdus
      After this tutorial you'll have learned how to:
      Build a Process module Make an AJAX request to backend Serve JSON as response Let's say you want to display the latest orders in a dashboard that you can access from admin panel. And you want it to refresh its content with a button click. Most straightforward and proper way (that I know of) is to create a Process module, as they're built for this purpose.
      First, create a directory under /site/modules/, call it ProcessDashboard, and create a file named ProcessDashboard.module under that directory. Following is about the least amount of code you need to create a Process module.
      <?php namespace ProcessWire; class ProcessDashboard extends Process { public static function getModuleInfo() { return [ 'title' => 'Orders Dashboard', 'summary' => 'Shows latest orders', 'version' => '0.0.1', 'author' => 'abdus', 'autoload' => true, // to automatically create process page 'page' => [ 'name' => 'order-dashboard', 'title' => 'Orders', 'template' => 'admin' ] ]; } public function ___execute() { return 'hello'; } } Once you refresh module cache from Modules > Refresh, you'll see your module. Install it.

      It will create an admin page under admin (/processwire/) and will show up as a new item in top menu, and when you click on it, it will show the markup we've built in execute() function.

       
      All right, now let's make it do something useful. Let's add create a data list to display latest orders. We'll change execute() function to render a data table.
      public function ___execute() { /* @var $table MarkupAdminDataTable */ $table = $this->modules->MarkupAdminDataTable; $table->setID($this->className . 'Table'); // "#ProcessDashboardTable" $table->headerRow([ 'Product', 'Date', 'Total' ]); // fill the table foreach ($this->getLatest(10) as $order) { $table->row([ $order['title'], $order['date'], $order['total'] ]); } // to refresh items $refreshButton = $this->modules->InputfieldSubmit; $refreshButton->name = 'refresh'; $refreshButton->id = $this->className . 'Refresh'; // "#ProcessDashboardRefresh" $refreshButton->value = 'Refresh'; // label of the button return $table->render() . $refreshButton->render(); } where getLatest() function finds and returns the latest orders (with only title, date and total fields)
      protected function getLatest($limit = 5, $start = 0) { // find last $limit orders, starting from $start $orders = $this->pages->find("template=order, sort=-created, limit=$limit, start=$start"); // Only return what's necessary return $orders->explode(function ($order) { return [ 'title' => $order->title, 'date' => date('Y-m-d h:i:s', $order->created), 'total' => $order->total ]; }); } When you refresh the page, you should see a table like this

      Now we'll make that Refresh button work. When the button is clicked, it will make an AJAX request to ./latest endpoint, which will return a JSON of latest orders. We need some JS to make AJAX request and render new values. Create a JS file ./assets/dashboard.js inside the module directory.
      window.addEventListener('DOMContentLoaded', function () { let refresh = document.querySelector('#ProcessDashboardRefresh'); let table = document.querySelector('#ProcessDashboardTable'); refresh.addEventListener('click', function (e) { // https://developer.mozilla.org/en/docs/Web/API/Event/preventDefault e.preventDefault(); // Send a GET request to ./latest // http://api.jquery.com/jquery.getjson/ $.getJSON('./latest', { limit: 10 }, function (data) { // check if data is how we want it // if (data.length) {} etc // it's good to go, update the table updateTable(data); }); }); function renderRow(row) { return `<tr> <td>${row.title}</td> <td>${row.date}</td> <td>${row.total}</td> </tr>`; } function updateTable(rows) { table.tBodies[0].innerHTML = rows.map(renderRow).join(''); } }); And we'll add this to list of JS that runs on backend inside init() function
      public function init() { $scriptUrl = $this->urls->$this . 'assets/dashboard.js'; $this->config->scripts->add($scriptUrl); } Requests to ./latest will be handled by ___executeLatest() function inside the module, just creating the function is enough, PW will do the routing. Here you should notice how we're getting query parameters that are sent with the request.
      // handles ./latest endpoint public function ___executeLatest() { // get limit from request, if not provided, default to 10 $limit = $this->sanitizer->int($this->input->get->limit) ?? 10; return json_encode($this->getRandom($limit)); } Here getRandom() returns random orders to make it look like there's new orders coming in. 
      protected function getRandom($limit = 5) { $orders = $this->pages->find("template=order, sort=random, limit=$limit"); return $orders->explode(function ($order) { return [ 'title' => $order->title, 'date' => date('Y-m-d h:i:s', $order->created), 'total' => $order->total ]; }); } And we're done. When refresh button is clicked, the table is refreshed with new data.
      Here it is in action: 
      2017-04-29_19-01-40.mp4 (227KB MP4, 0m4sec)
      Here's the source code:
      https://gist.github.com/abdusco/2bb649cd2fc181734a132b0e660f64a2
       
      [Enhancement] Converting page titles to edit links
      If we checkout the source of MarkupAdminDataTable module, we can see we actually have several options on how columns are built.
      /** * Add a row to the table * * @param array $a Array of columns that will each be a `<td>`, where each element may be one of the following: * - `string`: converts to `<td>string</td>` * - `array('label' => 'url')`: converts to `<td><a href='url'>label</a></td>` * - `array('label', 'class')`: converts to `<td class='class'>label</td>` * @param array $options Optionally specify any one of the following: * - separator (bool): specify true to show a stronger visual separator above the column * - class (string): specify one or more class names to apply to the `<tr>` * - attrs (array): array of attr => value for attributes to add to the `<tr>` * @return $this * */ public function row(array $a, array $options = array()) {} This means, we can convert a column to link or add CSS classes to it.
      // (ProcessDashboard.module, inside ___execute() method) // fill the table foreach ($this->getLatest(10) as $order) { $table->row([ $order['title'] => $order['editUrl'], // associative -> becomes link $order['date'], // simple -> becomes text [$order['total'], 'some-class'] // array -> class is added ]); } Now, we need to get page edit urls. By changing getLatest() and getRandom() methods to return edit links in addition to previous fields
      protected function getLatest($limit = 5, $start = 0) { // find last $limit orders, starting from $offset $orders = $this->pages->find("template=order, sort=-created, limit=$limit, start=$start"); return $orders->explode(function ($order) { return [ 'title' => $order->title, 'date' => date('Y-m-d h:i:s', $order->created), 'total' => $order->total, 'editUrl' => $order->editUrl ]; }); } protected function getRandom($limit = 5) { $orders = $this->pages->find("template=order, sort=random, limit=$limit"); return $orders->explode(function ($order) { return [ 'title' => $order->title, 'date' => date('Y-m-d h:i:s', $order->created), 'total' => $order->total, 'editUrl' => $order->editUrl ]; }); } and tweaking JS file to render first column as links
      function renderRow(row) { return `<tr> <td><a href="${row.editUrl}">${row.title}</a></td> <td>${row.date}</td> <td>${row.total}</td> </tr>`; } we get a much more practical dashboard.

       
    • By louisstephens
      I have been wanting to set up a quick "dashboard" for a recent project, and was considering using ajax to get a "real time" update/refresh on the page (some of my output depends on the datetime field). I know how to get the desired output using php with some if statements comparing todays date to the date stored in the field, however, I am a bit at a lose of how to interact with the ProcessWire API using ajax to get the desired effect. I found the following 
       
      and know that I need to start off with: 
      <?php if($config->ajax) { // page was requested from ajax } Unfortunately, as I mentioned earlier, how would one actual find pages using a template and get the field contents from them using AJAX? I apologize if this seems bit broad, but I am stil getting a grasp of using AJAX to deliver content to get a real time update on a page without refresh.
    • By awebcreature
      Hi to all!
      I want to create custom dashboard page in administration , with buttons to add new pages where current user role can create. Like the new button "add new" in Pages.
      I use the module "Process Dashboard" but that customisation is hard to me.
      Any help will be greatly appreciated.
      Thanks in advance!
    • By Raymond Geerts
      I'm building a dashboard, based on the dashboard from Kongondo's Blog.
      In there i have Articles and Widgets. Articles are sorted by some date, but for the widgets i want to be able to use manual drag-n-drop sorting.
      Widgets are all child pages from a certain parent page.
      Is this possible and how would i be able to approach this?
      Would it be possible to build manual sorting into MarkupAdminDataTable or should i use PageTable instead?

      update: Im looking in to ProcessPageSort to see if i can use that. Seems it needs an AJAX call.
      update: Changed title of post