Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Dev Docs menu to accessory #10

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions dev_docs/acc.dev_docs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
* Dev Docs Accessory
*
* Hook into the CP Menu and add a Dev Docs flyout
*
* @package Dev Docs
* @author Minds On Design Lab, Inc. <[email protected]>
* @copyright Copyright (c) 2012 Minds On Design Lab, Inc.
* @link https://github.com/Minds-On-Design-Lab/dev_docs.ee_addon
* @license MIT http://opensource.org/licenses/mit-license.php
*/

require_once(PATH_THIRD . 'dev_docs/config/dev_docs.php');

class Dev_docs_acc {
var $name = "Dev Docs Accessory";
var $id = 'dev_docs_acc';
var $version = '1.0';
var $description = "Adds a Dev Docs dropdown menu to the CP main menu";
var $sections = array();
/**
* Constructor
*/
public function Dev_docs_acc() {
$this->EE =& get_instance();

$this->EE->load->add_package_path(PATH_THIRD . 'dev_docs');
$this->EE->load->config('dev_docs');
$this->EE->load->model('dev_docs_model');
$this->EE->load->library('Docs_library');
// Lang file isn't auto-loaded for some reason
$this->EE->lang->loadfile('dev_docs');

$this->_url_base = $this->EE->config->item('dd:mod_url_base');
}

public function set_sections() {

$r = '';
$this->sections[] = '<script type="text/javascript" charset="utf-8">$("#accessoryTabs a.dev_docs_acc").parent().remove();</script>';

$installed_modules = $this->EE->cp->get_installed_modules();


if(array_key_exists('dev_docs', $installed_modules)) {

$pages = $this->EE->dev_docs_model->get_pages();

foreach ($pages as $page) {

$title = $page['heading'];
$link = $this->_url_base . AMP . 'docs_page=' . $page['short_name'];
$r .= '<li><a href=\''. $link .'\'>'. $title .'</a></li>';

}


$this->EE->cp->add_to_head('
<script type="text/javascript">
$(document).ready(function(){

var ddpages = "'.$r.'";
var dev_docs_menu = "<li class=\'parent\'><a class=\'first_level\' href=\'#\'>Dev Docs</a><ul>" + ddpages + "<li class=\'bubble_footer\'></li></ul></li>";

$("ul#navigationTabs > li.parent:nth-child(3)").before(dev_docs_menu);

});
</script>
');

}

}

public function update() {
return TRUE;
}

}

/* End of file acc.dev_docs.php */
/* Location: ./system/expressionengine/third_party/dev_docs/acc.dev_docs.php */
16 changes: 1 addition & 15 deletions dev_docs/config/dev_docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Also define the version constant to be
* used in the extension and accessory files
*/
$config['dd:version'] = "0.1.5";
$config['dd:version'] = "0.1.6";
if ( ! defined('DD_VERSION'))
{
define('DD_VERSION',$config['dd:version']);
Expand Down Expand Up @@ -62,19 +62,5 @@
$config['dd:default_settings'] = array();


/**
* @var array Extension hook setup (multi-dimensional for multiple hooks)
*/
$config['dd:ext_hook'] = array(
'class' => 'Dev_docs_ext',
'method' => 'cp_menu_array',
'hook' => 'cp_menu_array',
'settings' => serialize($config['dd:default_settings']),
'priority' => 10,
'version' => $config['dd:version'],
'enabled' => 'y'
);


/* End of file dev_docs.php */
/* Location: ./system/expressionengine/third_party/dev_docs/config/dev_docs.php */
196 changes: 0 additions & 196 deletions dev_docs/ext.dev_docs.php

This file was deleted.

48 changes: 0 additions & 48 deletions dev_docs/models/dev_docs_setup_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,54 +64,6 @@ public function insert_module($mod_data, $action_array = FALSE)
}
// End function insert_module()




/**
* Insert Extension
*
* Activate extension
* This is usually in the ext file but I want to guarantee
* that the ext is installed with the module so it's in the
* upd file instead.
*
* @param array Default extension settings
* @access public
* @author Erik Reagan <[email protected]>
* @return void
*/
public function insert_extension($data)
{
$this->_EE->db->insert('extensions', $data);
}
// End function insert_extension()




/**
* Delete Extension
*
* Activate extension
* This is usually in the ext file but I want to guarantee
* that the ext is installed with the module so it's in the
* upd file instead.
*
* @param array Default extension settings
* @access public
* @author Erik Reagan <[email protected]>
* @return void
*/
public function delete_extension()
{
$this->_EE->db->where('class', 'Dev_docs_ext')
->delete('extensions');
}
// End function delete_extension()




/**
* Create tables
*
Expand Down
Loading