Skip to content

Commit

Permalink
Merge pull request #7677 from pdelboca/remove-homepage-style-config
Browse files Browse the repository at this point in the history
Remove homepage_style config
  • Loading branch information
smotornyuk committed Jul 25, 2023
2 parents 31333cb + 2118e0b commit 9956f92
Show file tree
Hide file tree
Showing 28 changed files with 75 additions and 350 deletions.
1 change: 1 addition & 0 deletions changes/7677.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`homepage_style` variable has been removed. `layout1.html` code has been moved into `home/index.html` as it will be the only layout available.
5 changes: 0 additions & 5 deletions ckan/config/config_declaration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1185,11 +1185,6 @@ groups:
.. note:: This info only shows if debug is set to True.
- key: ckan.homepage_style
default: "1"
description: Pre-configured homepage style to use. Allowed values are 1, 2 or 3.
editable: true

- key: ckan.site_custom_css
description: Custom CSS directives to include on all CKAN pages.
editable: true
Expand Down
11 changes: 0 additions & 11 deletions ckan/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2465,17 +2465,6 @@ def get_group(id: str):
return groups_data


@core_helper
def get_site_statistics() -> dict[str, int]:
stats = {}
stats['dataset_count'] = logic.get_action('package_search')(
{}, {"rows": 1})['count']
stats['group_count'] = len(logic.get_action('group_list')({}, {}))
stats['organization_count'] = len(
logic.get_action('organization_list')({}, {}))
return stats


_RESOURCE_FORMATS: dict[str, Any] = {}


Expand Down
1 change: 0 additions & 1 deletion ckan/logic/action/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,6 @@ def config_option_update(
get_action('config_option_update)({}, {
'ckan.site_title': 'My Open Data site',
'ckan.homepage_layout': 2,
})
:param key: a configuration option key (eg ``ckan.site_title``). It must
Expand Down
2 changes: 0 additions & 2 deletions ckan/logic/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,6 @@ def default_update_resource_view_schema_changes(not_missing: Validator,

@validator_args
def default_update_configuration_schema(unicode_safe: Validator,
is_positive_integer: Validator,
ignore_missing: Validator) -> Schema:
return {
'ckan.site_title': [ignore_missing, unicode_safe],
Expand All @@ -750,7 +749,6 @@ def default_update_configuration_schema(unicode_safe: Validator,
'ckan.site_intro_text': [ignore_missing, unicode_safe],
'ckan.site_custom_css': [ignore_missing, unicode_safe],
'ckan.theme': [ignore_missing, unicode_safe],
'ckan.homepage_style': [ignore_missing, is_positive_integer],
'logo_upload': [ignore_missing, unicode_safe],
'clear_logo_upload': [ignore_missing, unicode_safe],
}
Expand Down
40 changes: 0 additions & 40 deletions ckan/public/base/css/main-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -13409,55 +13409,15 @@ td.diff_header {
float: left;
margin: 5px 10px 0 0;
}
.homepage .module-stats {
margin-top: 1rem;
color: #444;
}
.homepage .module-stats .card {
padding: 1.5rem 1.75rem;
}
.homepage .module-stats .card ul {
margin: 0;
list-style: none;
padding: 0;
}
.homepage .module-stats .card ul::after {
display: block;
clear: both;
content: "";
}
.homepage .module-stats .card ul li {
float: left;
width: 25%;
font-weight: 300;
}
.homepage .module-stats .card ul li a {
display: block;
}
.homepage .module-stats .card ul li a b {
display: block;
font-size: 0.875rem;
line-height: 1.5;
}
.homepage .module-stats .card ul li a:hover {
text-decoration: none;
}
.homepage .module-feeds {
padding: 2rem 0;
background: #eee url("../../../base/images/bg.png");
}
.homepage .module-feeds .module-stats {
margin-top: 0;
}

@media (max-width: 767.98px) {
.homepage .module-search {
margin-top: 0.5rem;
}
.homepage .module-stats {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.homepage .module-feeds .card {
margin-top: 1rem;
margin-bottom: 1rem;
Expand Down
40 changes: 0 additions & 40 deletions ckan/public/base/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -13409,55 +13409,15 @@ td.diff_header {
float: left;
margin: 5px 10px 0 0;
}
.homepage .module-stats {
margin-top: 1rem;
color: #444;
}
.homepage .module-stats .card {
padding: 1.5rem 1.75rem;
}
.homepage .module-stats .card ul {
margin: 0;
list-style: none;
padding: 0;
}
.homepage .module-stats .card ul::after {
display: block;
clear: both;
content: "";
}
.homepage .module-stats .card ul li {
float: left;
width: 25%;
font-weight: 300;
}
.homepage .module-stats .card ul li a {
display: block;
}
.homepage .module-stats .card ul li a b {
display: block;
font-size: 0.875rem;
line-height: 1.5;
}
.homepage .module-stats .card ul li a:hover {
text-decoration: none;
}
.homepage .module-feeds {
padding: 2rem 0;
background: #eee url("../../../base/images/bg.png");
}
.homepage .module-feeds .module-stats {
margin-top: 0;
}

@media (max-width: 767.98px) {
.homepage .module-search {
margin-top: 0.5rem;
}
.homepage .module-stats {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.homepage .module-feeds .card {
margin-top: 1rem;
margin-bottom: 1rem;
Expand Down
38 changes: 2 additions & 36 deletions ckan/public/base/scss/_homepage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.module-search {
color: $mastheadTextColor;
padding: 10px;
border: 1px solid #ccc;
border: 1px solid #ccc;
.search-form {
@include border-radius($card-border-radius);
background-color: $mastheadBackgroundColor;
Expand Down Expand Up @@ -49,51 +49,17 @@
}
}
}
.module-stats {
margin-top: $spacer * 1;
color: $layoutTextColor;
.card {
padding: ($spacer * 1.5) ($spacer * 1.75);
ul {
@include list-unstyled;
@include clearfix;
padding: 0;
li {
float: left;
width: 25%;
font-weight: 300;
a {
display: block;
b {
display: block;
font-size: $font-size-base;
line-height: 1.5;
}
&:hover {
text-decoration: none;
}
}
}
}
}
}
.module-feeds {
padding: $spacer * 2 0;
background: $layoutBackgroundColor url($bgPath);
.module-stats {
margin-top: 0
}
}
}

@include media-breakpoint-down(md){
.homepage {
.module-search {
margin-top: $spacer * .5;
}
.module-stats {
margin-top: $spacer * .5;
margin-bottom: $spacer * .5;
}
.module-feeds {
.card {
margin-top: $spacer * 1;
Expand Down
5 changes: 1 addition & 4 deletions ckan/templates/admin/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@
{% set is_upload = data[field_url] and not data[field_url].startswith('http') %}
{% set is_url = data[field_url] and data[field_url].startswith('http') %}
{{ form.image_upload(data, errors, is_upload_enabled=h.uploads_enabled(), is_url=is_url, is_upload=is_upload, upload_label = _('Site logo'), url_label=_('Site logo'), field_url=field_url, field_upload='logo_upload', field_clear='clear_logo_upload' )}}

{{ form.markdown('ckan.site_about', id='field-ckan-site-about', label=_('About'), value=data['ckan.site_about'], error=error, placeholder=_('About page text')) }}

{{ form.markdown('ckan.site_intro_text', id='field-ckan-site-intro-text', label=_('Intro Text'), value=data['ckan.site_intro_text'], error=error, placeholder=_('Text on home page')) }}

{{ form.textarea('ckan.site_custom_css', id='field-ckan-site-custom-css', label=_('Custom CSS'), value=data['ckan.site_custom_css'], error=error, placeholder=_('Customisable css inserted into the page header')) }}

{{ form.select('ckan.homepage_style', id='field-homepage-style', label=_('Homepage'), options=homepages, selected=data['ckan.homepage_style'], error=error) }}
{% endblock %}
<div class="form-actions">
<a href="{% url_for 'admin.reset_config' %}" class="btn btn-danger pull-left" data-module="confirm-action" data-module-content="{{ _('Are you sure you want to reset the config?') }}">{{ _('Reset') }}</a>
Expand Down Expand Up @@ -63,8 +62,6 @@ <h2 class="module-heading">
<code>&lt;head&gt;</code> tag of every page. If you wish to customize
the templates more fully we recommend
<a href="{{ docs_url }}" target="_blank" rel="noreferrer">reading the documentation</a>.</p>
<p><strong>Homepage:</strong> This is for choosing a predefined layout for
the modules that appear on your homepage.</p>
{% endtrans %}
{% endblock %}
</div>
Expand Down
54 changes: 46 additions & 8 deletions ckan/templates/home/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,56 @@
{% extends "page.html" %}
{% set homepage_style = ( g.homepage_style or '1' ) %}

{% block subtitle %}{{ _("Welcome") }}{% endblock %}

{% block maintag %}{% endblock %}
{% block toolbar %}{% endblock %}

{% block content %}
<div class="homepage layout-{{ homepage_style }}">
<div id="content" class="container">
{{ self.flash() }}
<div class="homepage">
<div id="content" class="container">
{{ self.flash() }}
</div>
{% block primary_content %}
<div role="main">
<div class="main hero">
<div class="container">
<div class="row">
<div class="col-md-6">
{% block promoted %}
{% snippet 'home/snippets/promoted.html' %}
{% endblock %}
</div>
<div class="col-md-6">
{% block search %}
{% snippet 'home/snippets/search.html', search_facets=search_facets %}
{% endblock %}
</div>
</div>
</div>
</div>

<div class="main module-feeds">
<div class="container">
<div class="row">
<div class="col-md-6">
{# Note: this featured_group block is used as an example in the theming
tutorial in the docs! If you change this code, be sure to check
whether you need to update the docs. #}
{# Start template block example. #}
{% block featured_group %}
{% snippet 'home/snippets/featured_group.html' %}
{% endblock %}
{# End template block example. #}
</div>
<div class="col-md-6">
{% block featured_organization %}
{% snippet 'home/snippets/featured_organization.html' %}
{% endblock %}
</div>
</div>
</div>
</div>
{% block primary_content %}
{% snippet "home/layout{0}.html".format(homepage_style), search_facets=search_facets %}
{% endblock %}
</div>
{% endblock %}
{% endblock %}
</div>
{% endblock %}
40 changes: 0 additions & 40 deletions ckan/templates/home/layout1.html

This file was deleted.

35 changes: 0 additions & 35 deletions ckan/templates/home/layout2.html

This file was deleted.

0 comments on commit 9956f92

Please sign in to comment.