Skip to content

Commit

Permalink
Updates for Elgg 5
Browse files Browse the repository at this point in the history
  • Loading branch information
RiverVanRain committed Jun 10, 2023
1 parent d9138de commit bf0eb87
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Elgg Landing Theme
==================
![Elgg 4.3](https://img.shields.io/badge/Elgg-4.3-green.svg?style=flat-square)
![Elgg 5.0](https://img.shields.io/badge/Elgg-5.0-green.svg?style=flat-square)

Responsive Elgg theme with landing page.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}
],
"conflict": {
"elgg/elgg": "<4.3",
"elgg/elgg": "<5.0",
"elgg/custom_index": "*"
},
"support": {
Expand Down
2 changes: 1 addition & 1 deletion elgg-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
return [
'plugin' => [
'name' => 'Elgg Landing Theme',
'version' => '1.1.0',
'version' => '2.0.0',
'dependencies' => [
'activity' => [
'position' => 'after',
Expand Down
11 changes: 5 additions & 6 deletions views/default/js/elgg_theme/settings.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
define(['jquery', 'elgg'], function ($, elgg) {
elgg.provide('elgg.settings');
define(['jquery'], function ($) {

elgg.settings.landing_action = function(elem) {
landing_action = function(elem) {
if ($(elem).is(':checked')) {
$('#settings-landing-action').show();
} else {
$('#settings-landing-action').hide();
}
};

elgg.settings.display_members = function(elem) {
display_members = function(elem) {
if ($(elem).is(':checked')) {
$('#settings-display-members').show();
} else {
$('#settings-display-members').hide();
}
};

elgg.settings.display_groups = function(elem) {
display_groups = function(elem) {
if ($(elem).is(':checked')) {
$('#settings-display-groups').show();
} else {
$('#settings-display-groups').hide();
}
};

elgg.settings.activity_sidebar = function(elem) {
activity_sidebar = function(elem) {
if ($(elem).is(':checked')) {
$('#settings-activity-sidebar').show();
} else {
Expand Down
6 changes: 6 additions & 0 deletions views/default/page/layouts/front_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

echo elgg_view('elgg_theme/elements/featured');

$action_content = '';
$members_content = '';
$groups_content = '';

// call to action section
if ((bool) $entity->landing_action) {
$header = '';
Expand Down Expand Up @@ -46,6 +50,7 @@
]);

$header = '';
$items = '';

if (!empty($entity->members_h1)) {
$h1 = elgg_format_element('h1', [], $entity->members_h1);
Expand Down Expand Up @@ -96,6 +101,7 @@
]);

$header = '';
$group_items = '';

if (!empty($entity->groups_h1)) {
$h1 = elgg_format_element('h1', [], elgg_view('output/url', [
Expand Down
8 changes: 4 additions & 4 deletions views/default/plugins/elgg_theme/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'name' => 'params[landing_action]',
'checked' => (bool) $entity->landing_action,
'switch' => true,
'onchange' => 'elgg.settings.landing_action(this);',
'onchange' => 'landing_action(this);',
]);

echo elgg_view_field([
Expand Down Expand Up @@ -82,7 +82,7 @@
'name' => 'params[display_members]',
'checked' => (bool) $entity->display_members,
'switch' => true,
'onchange' => 'elgg.settings.display_members(this);',
'onchange' => 'display_members(this);',
]);

echo elgg_view_field([
Expand All @@ -106,7 +106,7 @@
'name' => 'params[display_groups]',
'checked' => (bool) $entity->display_groups,
'switch' => true,
'onchange' => 'elgg.settings.display_groups(this);',
'onchange' => 'display_groups(this);',
]);

echo elgg_view_field([
Expand Down Expand Up @@ -134,7 +134,7 @@
'name' => 'params[activity_sidebar]',
'checked' => (bool) $entity->activity_sidebar,
'switch' => true,
'onchange' => 'elgg.settings.activity_sidebar(this);',
'onchange' => 'activity_sidebar(this);',
],
],
]);
Expand Down
7 changes: 3 additions & 4 deletions views/default/resources/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
} else if (elgg_is_logged_in() && !$activity_enable) {
$title = elgg_echo('welcome:user', [$user->getDisplayName()]);

echo elgg_view_page(null, [
echo elgg_view_page('', [
'title' => $title,
'content' => elgg_echo('index:content'),
'sidebar' => false,
'filter' => false,
'filter_id' => 'index',
]);
} else {
elgg_push_context('elgg_theme');
$class = ['class' => 'elgg-landing-page'];

$body = elgg_view_layout('front_page');
echo elgg_view_page(null, $body, 'default', ['body_attrs' => $class]);
echo elgg_view_page('', $body, 'default', ['body_attrs' => $class]);
}
2 changes: 1 addition & 1 deletion views/default/resources/walled_garden.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$class = ['class' => 'elgg-landing-page'];

$body = elgg_view_layout('front_page');
echo elgg_view_page(null, $body, 'default', ['body_attrs' => $class]);
echo elgg_view_page('', $body, 'default', ['body_attrs' => $class]);
} else {
echo elgg_view_page('', [
'content' => elgg_view('core/account/login_box', ['title' => false]),
Expand Down

0 comments on commit bf0eb87

Please sign in to comment.