Skip to content

Commit

Permalink
Merge pull request linnovate#112 from istolar/OI-71-media-components
Browse files Browse the repository at this point in the history
OI-71: Implemented a slideshow, and another slideshow on image click.
  • Loading branch information
db-Matroskeen committed Aug 10, 2020
2 parents 8400e5f + 82792a3 commit f418b21
Show file tree
Hide file tree
Showing 29 changed files with 525 additions and 156 deletions.
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
"drupal/votingapi_widgets": "1.x-dev",
"npm-asset/dropzone": "^5.7",
"npm-asset/jquery-bar-rating": "^1.2",
"npm-asset/swiper": "^6.1",
"npm-asset/photoswipe": "^4.1",
"oomphinc/composer-installers-extender": "^1.1"
},
"provide": {
Expand Down
2 changes: 2 additions & 0 deletions config/install/block.block.idea_statistics_sidebar_block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ settings:
label: 'Rating and statistics'
provider: openideal_statistics
label_display: visible
context_mapping:
node: '@node.node_route_context:node'
visibility:
node_type:
id: node_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ third_party_settings:
label: Slideshow
provider: openideal_slideshow
label_display: visible
context_mapping: { }
context_mapping:
node: layout_builder.entity
additional: { }
weight: 4
92cc127c-acca-4271-8303-6648766cf18a:
Expand Down
6 changes: 4 additions & 2 deletions config/install/core.entity_view_display.node.idea.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ third_party_settings:
label: Slideshow
provider: openideal_slideshow
label_display: '0'
context_mapping: { }
context_mapping:
node: layout_builder.entity
additional: { }
weight: 1
6f6bbc35-927a-4c57-b10f-b5c0b4f5edc2:
Expand Down Expand Up @@ -219,7 +220,8 @@ third_party_settings:
label: 'Statistics and status block'
provider: openideal_statistics
label_display: '0'
context_mapping: { }
context_mapping:
node: layout_builder.entity
additional:
layout_builder_styles_style: mobile_status_and_statistics
weight: 13
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ third_party_settings:
label: 'Idea statistics block'
provider: openideal_statistics
label_display: '0'
context_mapping: { }
context_mapping:
node: layout_builder.entity
additional: { }
weight: 1
third_party_settings: { }
Expand Down
6 changes: 6 additions & 0 deletions config/install/user.role.authenticated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ is_admin: false
permissions:
- 'access comments'
- 'access content'
- 'access openideal_file_browser entity browser pages'
- 'access openideal_image_browser entity browser pages'
- 'access openideal_images_browser entity browser pages'
- 'access shortcuts'
- 'access site-wide contact form'
- 'access user profiles'
- 'administer entity browsers'
- 'avatars avatar_generator user gravatar_generator'
- 'avatars avatar_generator user user_upload'
- 'clear own vote on comment:comment:field_voting_comment'
Expand All @@ -20,7 +24,9 @@ permissions:
- 'create idea content'
- 'create reaction on comment:comment:field_like'
- 'create reaction on node:idea:field_like'
- 'display eu cookie compliance popup'
- 'dropzone upload files'
- 'edit own comments'
- 'edit own idea content'
- 'edit own vote on comment:comment:field_voting_comment'
- 'edit own vote on node:idea:field_voting'
Expand Down
5 changes: 3 additions & 2 deletions modules/openideal_comment/openideal_comment.module
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ function openideal_comment_comment_links_alter(array &$links, CommentInterface $
* Implements hook_form_FORM_ID_alter().
*/
function openideal_comment_form_comment_comment_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$img = '<img src="' . base_path() . \Drupal::theme()->getActiveTheme()->getPath() . '/misc/icons/paper_plane.png">';
$theme = \Drupal::service('theme_handler')->getTheme('openideal_theme');
$img = '<img src="' . base_path() . $theme->getPath() . '/misc/icons/paper_plane.png">';
$form['comment_body']['widget'][0]['#title'] = t('Add comment');
$form['actions']['submit']['#value'] = t('SEND');
$form['actions']['submit']['#value'] = t('Send');
$form['actions']['submit']['#prefix'] = '<div class="font-submit-btn-wrapper">' . $img;
$form['actions']['submit']['#suffix'] = '</div>';
$form['actions']['cancel'] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Extension\ThemeHandler;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Theme\ThemeManager;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand All @@ -24,7 +24,7 @@ class OpenidealFooterPoweredByBlock extends BlockBase implements ContainerFactor
*
* @var \Drupal\Core\Theme\ThemeManager
*/
protected $themeManager;
protected $themeHandler;

/**
* Config factory.
Expand All @@ -39,11 +39,11 @@ class OpenidealFooterPoweredByBlock extends BlockBase implements ContainerFactor
public function __construct(array $configuration,
$plugin_id,
$plugin_definition,
ThemeManager $themeManager,
ThemeHandler $theme_handler,
ConfigFactory $config_factory
) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->themeManager = $themeManager;
$this->themeHandler = $theme_handler;
$this->configFactory = $config_factory;
}

Expand All @@ -52,7 +52,7 @@ public function __construct(array $configuration,
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition,
$container->get('theme.manager'),
$container->get('theme_handler'),
$container->get('config.factory')
);
}
Expand All @@ -62,7 +62,7 @@ public static function create(ContainerInterface $container, array $configuratio
*/
public function build() {
$config = $this->configFactory->get('openideal_footer.openideal_footer_links_config');
$path = $this->themeManager->getActiveTheme()->getPath();
$path = $this->themeHandler->getTheme('openideal_theme')->getPath();
$base_theme_path = base_path() . $path;
return [
'#theme' => 'openideal_powered_by',
Expand Down
3 changes: 2 additions & 1 deletion modules/openideal_idea/openideal_idea.module
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ function openideal_idea_group_content_access(EntityInterface $entity, $operation
* Implements hook_rrssb_buttons_alter().
*/
function openideal_idea_rrssb_buttons_alter(&$buttons) {
$theme_path = \Drupal::theme()->getActiveTheme()->getPath();
$theme = \Drupal::service('theme_handler')->getTheme('openideal_theme');
$theme_path = $theme->getPath();
$buttons['facebook']['svg'] = $theme_path . '/misc/icons/facebook.svg';
$buttons['copy_url']['svg'] = $theme_path . '/misc/icons/clipboard.svg';
$buttons['twitter']['svg'] = $theme_path . '/misc/icons/twitter.svg';
Expand Down
24 changes: 24 additions & 0 deletions modules/openideal_slideshow/css/slideshow.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.openideal-slideshow {
overflow: hidden;
}

ul.swiper-wrapper {
list-style-type: none;
margin: 0;
padding: 0;
}

ul.swiper-wrapper img {
width: 100%;
}

/* Swiper container */
.swiper-container {
max-width: 100%;
}

/* swiper responive image */
.openideal-slideshow img {
width: 100%;
height: auto;
}
23 changes: 0 additions & 23 deletions modules/openideal_slideshow/js/slick-configuration.js

This file was deleted.

Loading

0 comments on commit f418b21

Please sign in to comment.