Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
Added slide open support for views exposed filters
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofvanroy committed Apr 13, 2010
1 parent c6d3c8d commit 34b6248
Show file tree
Hide file tree
Showing 12 changed files with 139 additions and 17 deletions.
7 changes: 6 additions & 1 deletion css/nice_dash.css
Expand Up @@ -6,5 +6,10 @@
#nice-dashboard .right {float:right; width:49%;}
#nice-dashboard .clear {clear:both;}

/* Dashboard filter layout */
.filter-container {float:right; text-align:right;}
.filter-container .toggle-link {display:inline-block; padding: 0px 5px 5px 25px; background: url('../images/page_find.png') no-repeat 0 3px; }
.filter-container .clear{clear:both;}

/* Dashboard component layout */
.dashboard-component .content {padding: 10px;}
.dashboard-component .content {padding: 10px;}
Binary file added images/layout_add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/magnifier.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/magnifier_zoom_in.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/page_find.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/page_white_gear.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/zoom.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions js/dashboard.js
@@ -0,0 +1,16 @@
Drupal.NiceDash = Drupal.NiceDash || {};
$(document).ready(function(){
Drupal.NiceDash();
});
Drupal.NiceDash = function(){
initFilters();
function initFilters(){
$('.view-filters').parent().before('<div class="filter-container"><a href="" class="toggle-link">Toggle filter</a></div><br class="clear" />');
$('.view-filters').toggle();
$('.toggle-link').bind('click', toggleFilters);
}
function toggleFilters(e){
$(e.target).parent().parent().find('.view-filters').slideToggle();
e.preventDefault();
}
}
113 changes: 113 additions & 0 deletions js/widgets.js
@@ -0,0 +1,113 @@
// $Id: ds.js,v 1.1.2.7 2010/01/29 14:22:40 swentel Exp $

/**
* Move a field in the fields table from one region to another via select list.
*
* This behavior is dependent on the tableDrag behavior, since it uses the
* objects initialized in that behavior to update the row.
*
* Based on nodeform cols.
*/
Drupal.behaviors.fieldDrag = function(context) {
var table = $('table#fields');
var tableDrag = Drupal.tableDrag.fields; // Get the fields tableDrag object.

// Add a handler for when a row is swapped, update empty regions.
tableDrag.row.prototype.onSwap = function(swappedRow) {
checkEmptyRegions(table, this);
};

// A custom message for the fields page specifically.
Drupal.theme.tableDragChangedWarning = function () {
return '<div class="warning">' + Drupal.theme('tableDragChangedMarker') + ' ' + Drupal.t("The changes to these fields will not be saved until the <em>Save</em> button is clicked.") + '</div>';
};

// Add a handler so when a row is dropped, update fields dropped into new regions.
tableDrag.onDrop = function() {
dragObject = this;

if ($(dragObject.rowObject.element).prev('tr').is('.region-message')) {
var regionRow = $(dragObject.rowObject.element).prev('tr').get(0);
var regionName = regionRow.className.replace(/([^ ]+[ ]+)*region-([^ ]+)-message([ ]+[^ ]+)*/, '$2');
var regionField = $('select.field-region-select', dragObject.rowObject.element);
var weightField = $('select.field-weight', dragObject.rowObject.element);
var oldRegionName = weightField[0].className.replace(/([^ ]+[ ]+)*field-weight-([^ ]+)([ ]+[^ ]+)*/, '$2');

if (!regionField.is('.field-region-'+ regionName)) {
regionField.removeClass('field-region-' + oldRegionName).addClass('field-region-' + regionName);
weightField.removeClass('field-weight-' + oldRegionName).addClass('field-weight-' + regionName);
regionField.val(regionName);
}
// Manage classes to make it look disabled
if(regionName == 'disabled') {
$(dragObject.rowObject.element).addClass('region-css-disabled');
}
else {
$(dragObject.rowObject.element).removeClass('region-css-disabled');
}
}
};

// Add the behavior to each region select list.
$('select.field-region-select:not(.fieldregionselect-processed)', context).each(function() {
$(this).change(function(event) {
// Make our new row and select field.
var row = $(this).parents('tr:first');
var select = $(this);
tableDrag.rowObject = new tableDrag.row(row);

// Manage classes to make it look disabled
if(select[0].value == 'disabled') {
$(row).addClass('region-css-disabled');
}
else {
$(row).removeClass('region-css-disabled');
}

// Find the correct region and insert the row as the first in the region.
$('tr.region-message', table).each(function() {
if ($(this).is('.region-' + select[0].value + '-message')) {
// Add the new row and remove the old one.
$(this).after(row);
// Manually update weights and restripe.
tableDrag.updateFields(row.get(0));
tableDrag.rowObject.changed = true;
if (tableDrag.oldRowElement) {
$(tableDrag.oldRowElement).removeClass('drag-previous');
}
tableDrag.oldRowElement = row.get(0);
tableDrag.restripeTable();
tableDrag.rowObject.markChanged();
tableDrag.oldRowElement = row;
$(row).addClass('drag-previous');
}
});

// Modify empty regions with added or removed fields.
checkEmptyRegions(table, row);
// Remove focus from selectbox.
select.get(0).blur();
});
$(this).addClass('fieldregionselect-processed');
});

var checkEmptyRegions = function(table, rowObject) {
$('tr.region-message', table).each(function() {
// If the dragged row is in this region, but above the message row, swap it down one space.
if ($(this).prev('tr').get(0) == rowObject.element) {
// Prevent a recursion problem when using the keyboard to move rows up.
if ((rowObject.method != 'keyboard' || rowObject.direction == 'down')) {
rowObject.swap('after', this);
}
}
// This region has become empty
if ($(this).next('tr').is(':not(.draggable)') || $(this).next('tr').size() == 0) {
$(this).removeClass('region-populated').addClass('region-empty');
}
// This region has become populated.
else if ($(this).is('.region-empty')) {
$(this).removeClass('region-empty').addClass('region-populated');
}
});
};
};
1 change: 1 addition & 0 deletions plugins/nice_dash_comments/nice_dash_comments.module
Expand Up @@ -18,6 +18,7 @@ function nice_dash_comments_nice_dash_widgets(){


$widgets['latest_comments'] = array(
'title' => t('Latest comments'),
'callback' => 'nice_dash_comments_widget_latest_comments',
//'file' => 'nice_dash_content.widgets.inc'
);
Expand Down
16 changes: 1 addition & 15 deletions plugins/nice_dash_comments/nice_dash_comments.widgets.inc
Expand Up @@ -2,19 +2,5 @@

function nice_dash_comments_widget_latest_comments(){

/*$output .= '<div class="admin-panel">';
$output .= '<h3><strong>'.t('Latest comments').'</strong></h3>';
$output .= '<p class="description">'.t('An overview of the latest comments').'</p>';
$output .= '<dl class="admin-list">';
// Get latest nodes
foreach (comment_get_recent() as $comment) {
$output .= '<dt style="border-bottom:1px solid #ccc; padding: 2px;"><small>' . l($comment->subject, 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid)) .'<br />'. t('@time ago', array('@time' => format_interval(time() - $comment->timestamp))) .'</small></dt>';
}
$output .= '</dl>';
$output .= '<p class="description" style="padding-top: 10px;">' . l(t('View all comments'), 'admin/content/comment') .' - '. l(t('View approval queue'), 'admin/content/comment/approval') . '</p>';
$output .= '</div>';*/

return 'LATEST COMMENTS';
return theme('nice_dash_component', t('Latest comments'), t('An overview of the latest comments'), views_embed_view('nice_dash_comments','block_1'));
}
3 changes: 2 additions & 1 deletion theme/theme.inc
Expand Up @@ -5,6 +5,7 @@
* Theme callback for the dashboard page
*/
function template_preprocess_nice_dash_page(&$vars){
drupal_add_js(drupal_get_path('module', 'nice_dash') .'/js/dashboard.js');
drupal_add_css(drupal_get_path('module', 'nice_dash') .'/css/nice_dash.css');
}

Expand Down Expand Up @@ -50,7 +51,7 @@ function template_preprocess_nice_dash_settings_form(&$vars) {
}

drupal_add_js('misc/tableheader.js');
drupal_add_js(drupal_get_path('module', 'nice_dash') .'/js/nice_dash.js');
drupal_add_js(drupal_get_path('module', 'nice_dash') .'/js/widgets.js');
drupal_add_css(drupal_get_path('module', 'nice_dash') .'/css/nice_dash.css');

$regions = nice_dash_regions();
Expand Down

0 comments on commit 34b6248

Please sign in to comment.