mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-03 03:37:52 +02:00
Monstra Dashboard #204
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// Add plugin navigation link
|
// Add plugin navigation link
|
||||||
Navigation::add(__('Blocks', 'blocks'), 'content', 'blocks', 2);
|
Navigation::add(__('Blocks', 'blocks'), 'content', 'blocks', 2);
|
||||||
|
Dashboard::addNewItem('blocks', __('Blocks', 'blocks'), 'index.php?id=blocks&action=add_block', 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blocks Admin Class
|
* Blocks Admin Class
|
||||||
|
@@ -76,6 +76,9 @@ class DashboardAdmin extends Backend
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dashboard
|
||||||
|
*/
|
||||||
class Dashboard
|
class Dashboard
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -90,17 +93,30 @@ class Dashboard
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function addNewItem()
|
public static function addNewItem($id, $title, $url, $priority = 1)
|
||||||
{
|
{
|
||||||
Dashboard::$items[] = array(
|
Dashboard::$items[] = array(
|
||||||
'name' => (string) $name,
|
'id' => (string) $id,
|
||||||
'url' => (string) $url,
|
'title' => (string) $title,
|
||||||
|
'url' => (string) $url,
|
||||||
|
'priority' => (int) $priority,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
public static function drawItems()
|
public static function drawItems()
|
||||||
{
|
{
|
||||||
|
// Sort items by priority
|
||||||
|
$items = Arr::subvalSort(Dashboard::$items, 'priority');
|
||||||
|
|
||||||
|
foreach ($items as $item) {
|
||||||
|
echo '<li>';
|
||||||
|
echo Html::anchor($item['title'], $item['url'], array('title' => $item['title']));
|
||||||
|
echo '</li>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -10,9 +10,7 @@
|
|||||||
<?php echo __('Create New', 'dashboard'); ?> <span class="caret"></span>
|
<?php echo __('Create New', 'dashboard'); ?> <span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">
|
||||||
<li><?php echo ( Html::anchor(__('Page', 'pages'), 'index.php?id=pages&action=add_page', array('title' => __('Page', 'pages')))); ?></li>
|
<?php Dashboard::drawItems(); ?>
|
||||||
<li><?php echo ( Html::anchor(__('Blocks', 'blocks'), 'index.php?id=blocks&action=add_block', array('title' => __('Block', 'pages')))); ?></li>
|
|
||||||
<li><?php echo ( Html::anchor(__('Snippets', 'snippets'), 'index.php?id=snippets&action=add_snippet', array('title' => __('Snippet', 'pages')))); ?></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php echo ( Html::anchor(__('Upload File', 'filesmanager'), 'index.php?id=filesmanager', array('title' => __('Upload File', 'filesmanager'), 'class' => 'btn btn-primary'))); ?>
|
<?php echo ( Html::anchor(__('Upload File', 'filesmanager'), 'index.php?id=filesmanager', array('title' => __('Upload File', 'filesmanager'), 'class' => 'btn btn-primary'))); ?>
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// Add plugin navigation link
|
// Add plugin navigation link
|
||||||
Navigation::add(__('Pages', 'pages'), 'content', 'pages', 1);
|
Navigation::add(__('Pages', 'pages'), 'content', 'pages', 1);
|
||||||
|
Dashboard::addNewItem('pages', __('Page', 'pages'), 'index.php?id=pages&action=add_page', 1);
|
||||||
|
|
||||||
// Add action on admin_pre_render hook
|
// Add action on admin_pre_render hook
|
||||||
Action::add('admin_pre_render','PagesAdmin::_pageExpandAjax');
|
Action::add('admin_pre_render','PagesAdmin::_pageExpandAjax');
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// Add plugin navigation link
|
// Add plugin navigation link
|
||||||
Navigation::add(__('Snippets', 'snippets'), 'extends', 'snippets', 3);
|
Navigation::add(__('Snippets', 'snippets'), 'extends', 'snippets', 3);
|
||||||
|
Dashboard::addNewItem('snippets', __('Snippets', 'snippet'), 'index.php?id=snippets&action=add_snippet', 3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Snippets Admin Class
|
* Snippets Admin Class
|
||||||
|
Reference in New Issue
Block a user