Add panels and styling to group page

Append the new-style formatting to group page, and add the missing
subscription, group activity and group members blocks to the page.
All group page related ui features included in the groups_page module.

Change-Id: Id1f3c0ab6d4157e5c3b3162f9e47e673818382da
This commit is contained in:
Marton Kiss 2014-10-29 07:40:54 +01:00
parent 08d52386f2
commit f7c93a08b2
9 changed files with 442 additions and 1 deletions

View File

@ -154,3 +154,4 @@ dependencies[] = groups_common
dependencies[] = groups_auth
dependencies[] = groups_feeds
dependencies[] = groups_events_pages
dependencies[] = groups_pages

View File

@ -153,6 +153,16 @@ function groups_update_7105() {
variable_set('theme_default', 'openstack_bootstrap');
}
/**
* Enable groups_pages module.
*/
function groups_update_7104() {
if (!module_exists('groups_pages')) {
module_enable(array('groups_pages'));
drupal_flush_all_caches();
}
}
/**
* Add markdown filter with permissions.
*/

View File

@ -0,0 +1,17 @@
<?php
/**
* @file
* groups_pages.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function groups_pages_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "panelizer" && $api == "panelizer") {
return array("version" => "1");
}
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}

View File

@ -0,0 +1,18 @@
name = Groups Group Pages
description = Enhances the appearance of group landing pages and allows them to be customized.
core = 7.x
package = Groups - Landing pages
version = 7.x-1.0
project = groups_pages
dependencies[] = commons_activity_streams
dependencies[] = commons_activity_streams_groups
dependencies[] = commons_bw
dependencies[] = ctools
dependencies[] = groups_groups
dependencies[] = panelizer
dependencies[] = strongarm
features[ctools][] = panelizer:panelizer:1
features[ctools][] = strongarm:strongarm:1
features[features_api][] = api:2
features[panelizer_defaults][] = node:group:default
features[variable][] = panelizer_defaults_node_group

View File

@ -0,0 +1,9 @@
<?php
/**
* Implements hook_enable()
*/
function groups_pages_enable() {
// Enable node_view page required for panelizer
variable_set('page_manager_node_view_disabled', FALSE);
}

View File

@ -0,0 +1,37 @@
<?php
/**
* @file
* Code for the Group pages feature.
*/
include_once 'groups_pages.features.inc';
/**
* Implements hook_preprocess_field()
*
* Override markup of organic group subscribtion field.
*
* @see http://drupal.stackexchange.com/questions/28105/how-to-change-og-subscribe-to-group-link-text
*/
function groups_pages_preprocess_field(&$variables) {
if (($variables['element']['#field_name'] == 'group_group') &&
($variables['element']['#formatter'] == 'og_group_subscribe')) {
// determine login status from element class
$item = $variables['items'][0];
$class = isset($item['#options']) ? $item['#options']['attributes']['class'] : NULL;
$class = isset($item['#attributes']['class']) ? $item['#attributes']['class'] : $class;
$class = is_array($class) ? reset($class) : $class;
switch ($class) {
case 'group subscribe':
$variables['items'][0]['#title'] = t('Join us!');
$variables['items'][0]['#options']['attributes']['class'][] = 'btn';
$variables['items'][0]['#options']['attributes']['class'][] = 'btn-default';
$variables['items'][0]['#prefix'] = '<p>'.t('Join to our user group, participate on local events, contribute to our community, and stay informed about latest news.').'</p>';
break;
case 'group unsubscribe':
$variables['items'][0]['#title'] = 'x '.$variables['items'][0]['#title'];
$variables['items'][0]['#prefix'] = '<p>'.t('You are an active member of this group.').'</p>';
break;
}
}
}

View File

@ -0,0 +1,191 @@
<?php
/**
* @file
* groups_pages.panelizer.inc
*/
/**
* Implements hook_panelizer_defaults().
*/
function groups_pages_panelizer_defaults() {
$export = array();
$panelizer = new stdClass();
$panelizer->disabled = FALSE; /* Edit this to true to make a default panelizer disabled initially */
$panelizer->api_version = 1;
$panelizer->name = 'node:group:default';
$panelizer->title = 'Default';
$panelizer->panelizer_type = 'node';
$panelizer->panelizer_key = 'group';
$panelizer->no_blocks = FALSE;
$panelizer->css_id = '';
$panelizer->css = '';
$panelizer->pipeline = 'standard';
$panelizer->contexts = array();
$panelizer->relationships = array();
$panelizer->access = array();
$panelizer->view_mode = 'page_manager';
$panelizer->css_class = '';
$panelizer->title_element = 'H2';
$panelizer->link_to_entity = TRUE;
$panelizer->extra = array();
$display = new panels_display();
$display->layout = 'two_66_33';
$display->layout_settings = array();
$display->panel_settings = array(
'style_settings' => array(
'default' => NULL,
'two_66_33_top' => NULL,
'two_66_33_first' => NULL,
'two_66_33_second' => NULL,
'two_66_33_bottom' => NULL,
),
);
$display->cache = array();
$display->title = '%node:title';
$display->uuid = 'E6B07C18-BB1E-460D-BFDA-18B5E5E701AD';
$display->content = array();
$display->panels = array();
$pane = new stdClass();
$pane->pid = 'new-D535E2E0-1D0E-4B62-9093-D9DE4722EB29';
$pane->panel = 'two_66_33_first';
$pane->type = 'entity_field';
$pane->subtype = 'node:body';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'label' => 'hidden',
'formatter' => 'text_default',
'delta_limit' => 0,
'delta_offset' => '0',
'delta_reversed' => FALSE,
'formatter_settings' => array(),
'context' => 'panelizer',
'override_title' => 0,
'override_title_text' => '',
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 0;
$pane->locks = array();
$pane->uuid = 'D535E2E0-1D0E-4B62-9093-D9DE4722EB29';
$display->content['new-D535E2E0-1D0E-4B62-9093-D9DE4722EB29'] = $pane;
$display->panels['two_66_33_first'][0] = 'new-D535E2E0-1D0E-4B62-9093-D9DE4722EB29';
$pane = new stdClass();
$pane->pid = 'new-4D07DA83-5650-4EE6-AA34-DEBDE8467ADB';
$pane->panel = 'two_66_33_first';
$pane->type = 'entity_field';
$pane->subtype = 'node:field_resource_links';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'label' => 'hidden',
'formatter' => 'field_property_list_raw',
'delta_limit' => '0',
'delta_offset' => '0',
'delta_reversed' => 0,
'formatter_settings' => array(),
'context' => 'panelizer',
'override_title' => 0,
'override_title_text' => '',
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 1;
$pane->locks = array();
$pane->uuid = '4D07DA83-5650-4EE6-AA34-DEBDE8467ADB';
$display->content['new-4D07DA83-5650-4EE6-AA34-DEBDE8467ADB'] = $pane;
$display->panels['two_66_33_first'][1] = 'new-4D07DA83-5650-4EE6-AA34-DEBDE8467ADB';
$pane = new stdClass();
$pane->pid = 'new-0702E7C9-CCB9-4EA3-B2C5-7D1ACDF55BD5';
$pane->panel = 'two_66_33_second';
$pane->type = 'entity_field';
$pane->subtype = 'node:group_group';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'label' => 'hidden',
'formatter' => 'og_group_subscribe',
'delta_limit' => 0,
'delta_offset' => '0',
'delta_reversed' => FALSE,
'formatter_settings' => array(
'field_name' => '0',
),
'context' => 'panelizer',
'override_title' => 0,
'override_title_text' => '',
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 0;
$pane->locks = array();
$pane->uuid = '0702E7C9-CCB9-4EA3-B2C5-7D1ACDF55BD5';
$display->content['new-0702E7C9-CCB9-4EA3-B2C5-7D1ACDF55BD5'] = $pane;
$display->panels['two_66_33_second'][0] = 'new-0702E7C9-CCB9-4EA3-B2C5-7D1ACDF55BD5';
$pane = new stdClass();
$pane->pid = 'new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA';
$pane->panel = 'two_66_33_second';
$pane->type = 'views_panes';
$pane->subtype = 'activity_group-panel_pane_1';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'items_per_page' => '5',
'arguments' => array(
'gid' => '%node:nid',
),
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 1;
$pane->locks = array();
$pane->uuid = 'B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA';
$display->content['new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA'] = $pane;
$display->panels['two_66_33_second'][1] = 'new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA';
$pane = new stdClass();
$pane->pid = 'new-737D0A90-738F-4637-ABE7-39AF64CC3A1F';
$pane->panel = 'two_66_33_second';
$pane->type = 'views_panes';
$pane->subtype = 'commons_contributors_group-panel_pane_2';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'context' => array(
0 => 'panelizer',
),
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 2;
$pane->locks = array();
$pane->uuid = '737D0A90-738F-4637-ABE7-39AF64CC3A1F';
$display->content['new-737D0A90-738F-4637-ABE7-39AF64CC3A1F'] = $pane;
$display->panels['two_66_33_second'][2] = 'new-737D0A90-738F-4637-ABE7-39AF64CC3A1F';
$display->hide_title = PANELS_TITLE_FIXED;
$display->title_pane = '0';
$panelizer->display = $display;
$export['node:group:default'] = $panelizer;
return $export;
}

View File

@ -0,0 +1,80 @@
<?php
/**
* @file
* groups_pages.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function groups_pages_strongarm() {
$export = array();
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'panelizer_defaults_node_group';
$strongarm->value = array(
'status' => 1,
'view modes' => array(
'page_manager' => array(
'status' => 1,
'default' => 1,
'choice' => 0,
),
'default' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
'full' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
'teaser' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
'rss' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
'search_index' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
'search_result' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
'ical' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
'diff_standard' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
'token' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
'revision' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
),
);
$export['panelizer_defaults_node_group'] = $strongarm;
return $export;
}

View File

@ -181,6 +181,84 @@
}
/* === Groups page === */
.two-66-33 {
@extend .container;
.region-two-66-33-first {
@extend .col-md-8;
}
.region-two-66-33-second {
@extend .col-md-4;
}
}
.page-node {
h2.pane-title {
color: #2A4E68;
font-weight: 300;
font-size: 18px;
margin-bottom: 25px;
}
.pane-node-body {
margin-top: 25px;
font-size: 16px;
color: #888;
line-height: 1.4;
a {
color: #30739C;
text-decoration: underline;
}
}
.pane-node-field-resource-links {
border-top: 1px dotted #C5E2EA;
margin-top: 25px;
padding-top: 25px;
.property-title {
background: #C4E0E9;
display: inline-block;
color: #254C7C;
padding: 0px 10px;
}
a {
color: #30739C;
text-decoration: underline;
}
}
.pane-node-group-group {
margin-top: 25px;
background: #EDF2F7;
padding: 10px;
border-radius: 4px;
text-align: right;
p {
text-align: left;
}
.group.unsubscribe {
font-size: 10px;
}
}
}
.view-profile-badges {
h3 {
color: #CF2F19;
font-size: 16px;
font-weight: 300;
}
}
.profile-badges {
list-style: none;
padding-left: 0px;
li {
float: left;
margin-right: 10px;
margin-bottom: 10px;
}
}
/* === Groups directory === */
.two-33-66 {