Commit 7fff252c authored by Mateu Aguiló Bosch's avatar Mateu Aguiló Bosch
Browse files

Minor fixes after first testing

parent f977ee9f
......@@ -29,23 +29,25 @@ You can also override settings in settings.php, allowing you to have different
settings for each of your environments. If you choose to detect your environment using settings.php, then all configuration variables can be
overridden in settings.php, but the most common three are:
- environment_indicator_overwrite
A boolean value indicating whether the Environment Indicator should use the settings.php variables for the indicator. On your production environment, you should probably set this to FALSE. e.g:
$conf['environment_indicator_overwrite'] = FALSE
- environment_indicator_overwritten_name
The text that will be displayed on the indicator. e.g:
$conf['environment_indicator_overwritten_name'] = 'Staging'
- environment_indicator_overwritten_color
A valid css color. e.g:
$conf['environment_indicator_overwritten_color'] = 'red'
- environment_indicator_overwritten_position
Where your indicator may appear. Allowed values are "top" and "bottom".
e.g:
$conf['environment_indicator_overwritten_position'] = 'top'
- environment_indicator_overwritten_fixed
A boolean value indicating whether the Environment Indicator should be
fixed at the top/bottom of the screen. e.g:
$conf['environment_indicator_overwritten_fixed'] = FALSE
- environment_indicator_overwrite
A boolean value indicating whether the Environment Indicator should use
the settings.php variables for the indicator. On your production
environment, you should probably set this to FALSE. e.g:
$conf['environment_indicator_overwrite'] = FALSE
- environment_indicator_overwritten_name
The text that will be displayed on the indicator. e.g:
$conf['environment_indicator_overwritten_name'] = 'Staging'
- environment_indicator_overwritten_color
A valid css color. e.g:
$conf['environment_indicator_overwritten_color'] = 'red'
- environment_indicator_overwritten_position
Where your indicator may appear. Allowed values are "top" and "bottom".
e.g:
$conf['environment_indicator_overwritten_position'] = 'top'
- environment_indicator_overwritten_fixed
A boolean value indicating whether the Environment Indicator should be
fixed at the top/bottom of the screen. e.g:
$conf['environment_indicator_overwritten_fixed'] = FALSE
-- CONTACT --
......
......@@ -12,7 +12,7 @@ function environment_indicator_settings() {
$form['environment_indicator_suppress_pages'] = array(
'#type' => 'textarea',
'#title' => t('Turn off Environment Indicator on these pages'),
'#default_value' => variable_get('environment_indicator_suppress_pages', "imagecrop/*\nmedia/browser"),
'#default_value' => variable_get('environment_indicator_suppress_pages', ""),
'#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '<em>blog</em>' for the blog page and '<em>blog/*</em>' for every personal blog. '<em>&lt;front&gt;</em>' is the front page."),
);
return system_settings_form($form);
......
......@@ -46,8 +46,8 @@
Drupal.behaviors.environment_indicatorSwitcher = {
attach: function (context, settings) {
$('#environment_indicator .environment-indicator-name, #toolbar .environment-indicator-name-wrapper', context).live('click', function () {
$('#environment_indicator .item-list, #toolbar .item-list', context).slideToggle('fast');
$('#environment-indicator .environment-indicator-name, #toolbar .environment-indicator-name-wrapper', context).live('click', function () {
$('#environment-indicator .item-list, #toolbar .item-list', context).slideToggle('fast');
});
}
}
......@@ -55,7 +55,9 @@
Drupal.behaviors.environment_indicator_admin = {
attach: function() {
// Add the farbtastic tie-in
Drupal.settings.environment_indicator_color_picker = $.farbtastic('#environment-indicator-color-picker', '#edit-environment-indicator-color');
if ($.isFunction($.farbtastic)) {
Drupal.settings.environment_indicator_color_picker = $('#environment-indicator-color-picker').farbtastic('#ctools-export-ui-edit-item-form #edit-color');
};
}
}
......
......@@ -38,7 +38,7 @@ function environment_indicator_help($path, $arg) {
*/
function environment_indicator_menu() {
$items['admin/config/development/environment-indicator/settings'] = array(
'title' => 'Environment indicator',
'title' => 'Settings',
'description' => 'Adjust settings for the Environment Indicator.',
'page callback' => 'drupal_get_form',
'page arguments' => array('environment_indicator_settings'),
......@@ -113,9 +113,6 @@ function environment_indicator_ctools_plugin_directory($module, $type) {
* System settings form
*/
function environment_indicator_ctools_export_ui_form(&$form, &$form_state) {
drupal_add_library('system', 'farbtastic');
drupal_add_js(drupal_get_path('module', 'environment_indicator') .'/environment_indicator.js');
$environment = $form_state['item'];
$environment->color = '';
$environment->weight = '';
......@@ -154,11 +151,20 @@ function environment_indicator_ctools_export_ui_form(&$form, &$form_state) {
'#description' => t('The hostname you want to detect. You can use a regular expression in this field. This regular expression will be run against the current URL to determine wether the environment is active or not. If you use a regular expression here this environment will <strong>not be availabe</strong> for environment switch.'),
'#default_value' => $environment->regexurl,
);
$form['color_picker'] = array(
'#markup' => '<div id="environment-indicator-color-picker"></div>',
);
$form['color'] = array(
'#type' => 'textfield',
'#title' => t('Color'),
'#description' => t('Color for the indicator. Ex: #D0D0D0.'),
'#default_value' => $environment->color,
'#attached' => array(
// Add Farbtastic color picker.
'library' => array(
array('system', 'farbtastic'),
),
),
);
$form['weight'] = array(
'#type' => 'textfield',
......@@ -251,7 +257,7 @@ function environment_indicator_admin_menu_output_alter(&$content) {
'#value' => theme('environment_indicator_indicator_name', $environment_info),
'#weight' => 50,
'#attributes' => array(
'id' => 'environment_indicator',
'id' => 'environment-indicator',
'style' => 'background-color: ' . $environment_info['color'],
),
);
......@@ -278,8 +284,8 @@ function environment_indicator_get_active() {
}
if (variable_get('environment_indicator_overwrite', FALSE)) {
$env = array(
'name' => 'overwritten_environment',
'machine' => variable_get('environment_indicator_overwritten_name', t('Loaded environment')),
'machine' => 'overwritten_environment',
'name' => variable_get('environment_indicator_overwritten_name', t('Loaded environment')),
'weight' => -99,
'color' => variable_get('environment_indicator_overwritten_color', '#777'),
'position' => variable_get('environment_indicator_overwritten_position', 'top'),
......@@ -332,7 +338,7 @@ function environment_indicator_get_all($fixed = FALSE) {
*/
function environment_indicator_check_access() {
// Do not show the indicator on select pages.
$off_pages = variable_get('environment_indicator_suppress_pages', "imagecrop/*\nmedia/browser");
$off_pages = variable_get('environment_indicator_suppress_pages', "");
$path = drupal_get_path_alias($_GET['q']);
// Compare with the internal and path alias (if any).
$page_match = drupal_match_path($path, $off_pages);
......
......@@ -43,7 +43,7 @@ function theme_environment_indicator_indicator_bar($variables) {
'position-' . $info['position'],
'fixed-' . ($info['fixed'] ? 'yes' : 'no'),
),
'id' => 'environment_indicator',
'id' => 'environment-indicator',
'style' => 'background-color: ' . $info['color'],
),
'name' => array(
......
......@@ -10,7 +10,7 @@ $plugin = array(
// Define the menu item.
'menu' => array(
'menu prefix' => 'admin/config/development',
'menu item' => 'environment_indicator',
'menu item' => 'environment-indicator',
'menu title' => 'Environment indicators',
'menu description' => 'Administer environment indicators.',
),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment