Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Commit

Permalink
Merge pull request #16 from SU-HSDO/MRCD8-159-event-display
Browse files Browse the repository at this point in the history
MRCD8-159 Set display settings for event nodes
  • Loading branch information
boznik authored Dec 6, 2017
2 parents 0ba1334 + 099abc4 commit 64dddde
Show file tree
Hide file tree
Showing 23 changed files with 168 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,48 @@ dependencies:
- field.field.node.stanford_event.field_s_event_status
- field.field.node.stanford_event.field_s_event_type
- field.field.node.stanford_event.field_s_event_video_recap
- image.style.large
- node.type.stanford_event
module:
- datetime_range
- ds
- image
- link
- telephone
- text
- user
- video_embed_field
third_party_settings:
ds:
layout:
id: pattern_node_event
library: null
disable_css: false
entity_classes: all_classes
settings:
pattern:
field_templates: only_content
regions:
date:
- field_s_event_date
image:
- field_s_event_image
description:
- body
location:
- field_s_event_location
map:
- field_s_event_map_link
sponsor:
- field_s_event_sponsor
email:
- field_s_event_contact_email
phone:
- field_s_event_contact_phone
admission:
- field_s_event_admission
embed_video:
- field_s_event_video_recap
_core:
default_config_hash: '--Z_oePhErkaBTiWo881iUr_LbanS3gn3S1XXxQDkW0'
id: node.stanford_event.default
Expand All @@ -36,7 +69,7 @@ content:
body:
type: text_default
weight: 4
region: content
region: description
label: hidden
settings: { }
third_party_settings: { }
Expand All @@ -46,60 +79,48 @@ content:
settings: { }
third_party_settings: { }
type: text_default
region: content
region: admission
field_s_event_contact_email:
weight: 8
label: hidden
settings: { }
third_party_settings: { }
type: basic_string
region: content
region: email
field_s_event_contact_phone:
weight: 9
label: hidden
settings:
title: ''
third_party_settings: { }
type: telephone_link
region: content
region: phone
field_s_event_date:
weight: 1
label: hidden
settings:
timezone_override: ''
format_type: events_date
date_format: 'l, F j, Y g:i A'
separator: To
third_party_settings: { }
type: daterange_default
region: content
type: daterange_custom
region: date
field_s_event_image:
type: image
weight: 2
region: content
region: image
label: hidden
settings:
image_style: ''
image_style: large
image_link: ''
third_party_settings: { }
field_s_event_link:
type: link
weight: 3
region: content
label: hidden
settings:
trim_length: 80
url_only: false
url_plain: false
rel: ''
target: ''
third_party_settings: { }
field_s_event_location:
weight: 5
label: hidden
settings: { }
third_party_settings: { }
type: basic_string
region: content
region: location
field_s_event_map_link:
weight: 6
label: hidden
Expand All @@ -111,14 +132,14 @@ content:
target: ''
third_party_settings: { }
type: link
region: content
region: map
field_s_event_sponsor:
weight: 7
label: hidden
settings: { }
third_party_settings: { }
type: basic_string
region: content
region: sponsor
field_s_event_video_recap:
weight: 11
label: hidden
Expand All @@ -129,14 +150,11 @@ content:
autoplay: false
third_party_settings: { }
type: video_embed_field_video
region: content
links:
weight: 0
region: content
settings: { }
third_party_settings: { }
region: embed_video
hidden:
field_s_event_audience: true
field_s_event_category: true
field_s_event_link: true
field_s_event_status: true
field_s_event_type: true
links: true
3 changes: 2 additions & 1 deletion modules/mrc_events/mrc_events.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ dependencies:
- pathauto
- datetime_range
- allowed_formats
- video_embed_field
- video_embed_field
- ui_patterns_ds
12 changes: 12 additions & 0 deletions modules/mrc_events/mrc_events.install
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,15 @@ function mrc_events_update_8001() {
$path = drupal_get_path('module', 'mrc_events') . '/config/install';
stanford_mrc_update_configs(TRUE, 'all', $path);
}

/**
* Reverts the entity display.
*/
function mrc_events_update_8002() {
if (!\Drupal::moduleHandler()->moduleExists('ui_patterns_ds')) {
\Drupal::service('module_installer')->install(['ui_patterns_ds']);
}
module_load_install('stanford_mrc');
$path = drupal_get_path('module', 'mrc_events') . '/config/install';
stanford_mrc_update_configs(TRUE, 'all', $path);
}
14 changes: 14 additions & 0 deletions modules/mrc_events/mrc_events.module
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\node\Entity\Node;

/**
* Implements hook_field_widget_form_alter().
Expand Down Expand Up @@ -48,3 +51,14 @@ function mrc_events_node_validate_date($form, FormStateInterface $form_state) {
$form_state->setValue('field_s_event_date', $date);
}
}

/**
* Implements hook_entity_view_alter().
*/
function mrc_events_entity_view_alter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
// Don't show the end date on the event node page.
if ($entity instanceof Node && $entity->bundle() == 'stanford_event') {
unset($build['field_s_event_date'][0]['end_date']);
unset($build['field_s_event_date'][0]['separator']);
}
}
2 changes: 1 addition & 1 deletion themes/math_research_center/math_research_center.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version: VERSION
core: 8.x
libraries:
- core/normalize
- math_research_center/mrc
- math_research_center/fontawesome

regions:
page_top: 'Page top'
Expand Down
13 changes: 9 additions & 4 deletions themes/math_research_center/math_research_center.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@
# css/pattern-library/theme/print.css: { media: print }

# CHANGE THE LIBRARY BELOW
mrc:
version: VERSION

fontawesome:
version: 4.7.0
remote: https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css
license:
name: FontAwesome
url: http://fontawesome.io/license/
css:
component:
css/components/components.css: {}
base:
https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css: {}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ event_card:
fields:
title:
label: "Title"
preview: "Card Title"
preview: "<a href=\"#\">Card Title</a>"
image:
label: "Image"
preview:
Expand All @@ -25,4 +25,4 @@ event_card:
css:
component:
css/event-card.css: {}
use: "@math_research_center/molecules/event-card/event-card.html.twig"
use: "@math_research_center/molecules/event-card/event-card.html.twig"
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}

.mrc-event-card__title {
margin-top: 0;
margin-top: 0.5em;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}

.mrc-featured-event-card__title {
margin-top: 0;
margin-top: 0.75em;
}

.mrc-featured-event-card__teaser {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ news_card:
fields:
title:
label: "Title"
preview: "<a href=\"#\">Title</a>"
preview: "<a href=\"#\">Card Title</a>"
image:
label: "Image"
preview:
Expand All @@ -24,4 +24,4 @@ news_card:
css:
component:
css/news-card.css: {}
use: "@math_research_center/molecules/news-card/news-card.html.twig"
use: "@math_research_center/molecules/news-card/news-card.html.twig"
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
}

.mrc-news-card__title {
margin-top: 0;
margin-top: 0.5em;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="mrc-postcard--horizontal">
{% if image %}
<div class="mrc-postcard--horizontal__img">
<div class="mrc-postcard__img">
{{ image }}
</div>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@
'../utilities/mixins/mixins';

.mrc-postcard--horizontal {

@include mrc-flex-medium;

.mrc-postcard--horizontal__img {
.mrc-postcard__img {
margin-right: 0;

img {
width: 100%;
}

@include media($medium-screen) {
margin-right: 30px;

Expand All @@ -35,4 +30,8 @@
}
}
}

.mrc-postcard__title {
margin-top: 0;
}
}
Loading

0 comments on commit 64dddde

Please sign in to comment.