diff --git a/ckanext/ubdc/assets/css/style.css b/ckanext/ubdc/assets/css/style.css index bbfdfd4..0db22d0 100644 --- a/ckanext/ubdc/assets/css/style.css +++ b/ckanext/ubdc/assets/css/style.css @@ -7194,6 +7194,205 @@ input[type=checkbox][name=consentName]:focus { height: 550px; } +.section_small-hero { + background-color: #f2f1fe; + border: 1px solid #dfe1e7; + border-bottom-style: none; + position: relative; + overflow: hidden; +} +.section_small-hero.padding-global { + padding-left: 2.5em; + padding-right: 2.5em; +} + +.container-small { + margin-right: auto !important; + margin-left: auto !important; + width: 100%; + max-width: 48em; +} + +.padding-section-medium.bigger { + padding-top: 6em; + padding-bottom: 6em; + position: relative; +} + +.text-align-center { + text-align: center; + margin-bottom: 0; +} + +.margin-right { + margin-top: 0 !important; + margin-bottom: 0 !important; + margin-left: 0 !important; +} + +.hero_head { + letter-spacing: -0.2vw; + margin-top: 0; + margin-bottom: 1vw; + font-size: 4em; + font-weight: 700; + line-height: 1.125; +} + +.margin-custom1 { + margin: 1.5rem; +} + +.hero_bg-img.left { + width: 20em; + height: 10em; + top: auto; + bottom: 0%; + left: 0%; + right: auto; + position: absolute; +} +.hero_bg-img.right { + width: 24.5781em; + height: 10.19em; + top: auto; + bottom: 0%; + left: auto; + right: 0%; + position: absolute; +} +.hero_bg-img.default { + width: 23.4404em; + height: 16.8373em; + position: absolute; +} + +.section_small-hero { + background-color: #f2f2f2; + border: 1px solid #dfe1e7; + border-bottom-style: none; + position: relative; + overflow: hidden; +} +.section_small-hero.padding-global { + padding-left: 2.5em; + padding-right: 2.5em; +} + +.container-small { + margin-right: auto !important; + margin-left: auto !important; + width: 100%; + max-width: 48em; +} + +.padding-section-medium { + padding-top: 5em; + padding-bottom: 5em; + position: relative; +} + +.rich-text-block-2 { + font-size: 1em; + line-height: 2.4em; + font-weight: 300; +} +.rich-text-block-2 h2 { + display: inline-block; + margin-top: 2vw; + margin-bottom: 1vw; + font-size: 2.3em; + line-height: 1.125em; +} + +.text-color-dark-green { + color: var(--dark-green); +} +.text-color-dark-green strong { + font-weight: 700; +} + +#cookies-table { + float: left; + width: 100%; +} +#cookies-table table { + width: 100%; + border-collapse: collapse; +} +#cookies-table table tr:nth-of-type(odd) { + background: #f2f2f2; +} +#cookies-table table th { + background: #184e44; + color: white; + font-weight: bold; + padding: 0.375em; + border: 0.125em solid #ccc; + text-align: left; +} +#cookies-table table td, +#cookies-table table th { + padding: 0.375em; + border: 0.125em solid #ccc; + text-align: left; +} +@media all and (max-width: 767px) { + #cookies-table table, + #cookies-table thead, + #cookies-table tbody, + #cookies-table th, + #cookies-table td, + #cookies-table tr { + display: block; + } + #cookies-table thead tr { + position: absolute; + top: -9999px; + left: -9999px; + } + #cookies-table tr { + border-left: 0.125em solid #ccc; + border-right: 0.125em solid #ccc; + border-bottom: 0.125em solid #ccc; + } + #cookies-table tr:nth-of-type(1) { + border-top: 0.125em solid #ccc; + } + #cookies-table td { + border: none; + border-bottom: 0.125em solid #eee; + position: relative; + padding-left: 50%; + } + #cookies-table td:before { + position: absolute; + top: 0.375em; + left: 0.375em; + width: 45%; + padding-right: 0.625em; + white-space: nowrap; + } + #cookies-table td:nth-of-type(1):before { + content: "Cookie"; + } + #cookies-table td:nth-of-type(2):before { + content: "Purpose"; + } + #cookies-table td:nth-of-type(3):before { + content: "More information"; + } +} + +.cursor-pointer { + cursor: pointer; +} + +.link-selected:hover { + color: #bd4e0a; + text-decoration: underline; +} + .tag { display: inline-block; margin-bottom: 4px; @@ -10209,7 +10408,7 @@ h4 small { background-repeat: no-repeat; display: flex; align-items: center; - border: 1px solid #DFE1E7; + border: 1px solid #dfe1e7; } .homepage .hero .wrap { display: flex; @@ -10705,6 +10904,18 @@ h4 small { background: #c2410c; } +input[type=search]::-webkit-search-cancel-button, +input[type=search]::-webkit-search-decoration { + -webkit-appearance: searchfield-cancel-button; + position: relative; + right: 20px; + height: 20px; + width: 20px; + border-radius: 10px; + background: url(/base/images/close.svg) no-repeat 50% 50%; + background-size: contain; +} + .account-masthead { min-height: 30px; color: #fff; @@ -10902,7 +11113,7 @@ h4 small { .masthead .site-search input { width: 40px; opacity: 0; - padding: 5px 10px; + padding: 10px; -webkit-transition: width 0.4s ease-in-out; transition: width 0.4s ease-in-out; } @@ -10911,6 +11122,7 @@ h4 small { cursor: default; font-size: 20px !important; color: #000000; + top: 40%; } .masthead .site-search input:focus { width: 200px; diff --git a/ckanext/ubdc/logic/action.py b/ckanext/ubdc/logic/action.py index 95fad52..91506e6 100644 --- a/ckanext/ubdc/logic/action.py +++ b/ckanext/ubdc/logic/action.py @@ -2,6 +2,7 @@ import datetime import logging import ckan.plugins.toolkit as tk +import ckan.plugins as p from ckan.lib.navl.dictization_functions import validate import ckan.lib.uploader as uploader from ckan.lib.mailer import mail_recipient @@ -143,3 +144,13 @@ def request_data_access_show(context, data_dict): data_dict = RequestDataAccess.get_by_id(data_dict["id"]) return data_dict.as_dict() + + +@p.toolkit.chained_action +@tk.side_effect_free +def package_search(up_func, context, data_dict): + if data_dict.get('q') and 'id' not in data_dict.get('q'): + data_dict['q'] = f"{data_dict.get('q')} OR title_ngram: {data_dict.get('q')}~1" + log.info(data_dict) + result = up_func(context, data_dict) + return result diff --git a/ckanext/ubdc/plugin.py b/ckanext/ubdc/plugin.py index 1796640..c95ebeb 100644 --- a/ckanext/ubdc/plugin.py +++ b/ckanext/ubdc/plugin.py @@ -50,6 +50,7 @@ def get_actions(self): "request_data_access_show": action.request_data_access_show, "request_data_access_update": action.request_data_access_update, "request_data_access_delete": action.request_data_access_delete, + "package_search": action.package_search } # IPackageController diff --git a/ckanext/ubdc/public/base/images/close.svg b/ckanext/ubdc/public/base/images/close.svg new file mode 100644 index 0000000..0119e30 --- /dev/null +++ b/ckanext/ubdc/public/base/images/close.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/ckanext/ubdc/public/base/scss/_custom.scss b/ckanext/ubdc/public/base/scss/_custom.scss index 6297307..5338069 100644 --- a/ckanext/ubdc/public/base/scss/_custom.scss +++ b/ckanext/ubdc/public/base/scss/_custom.scss @@ -82,4 +82,224 @@ input[type=checkbox][name="consentName"]:focus { .img-fluid-hero { height: 550px +} + + +.section_small-hero { + background-color: #f2f1fe; + border: 1px solid #dfe1e7; + border-bottom-style: none; + position: relative; + overflow: hidden; + + &.padding-global { + padding-left: 2.5em; + padding-right: 2.5em; + } +} + +.container-small { + margin-right: auto !important; + margin-left: auto !important; + width: 100%; + max-width: 48em; +} + +.padding-section-medium { + &.bigger { + padding-top: 6em; + padding-bottom: 6em; + position: relative; + } +} + +.text-align-center { + text-align: center; + margin-bottom: 0; +} + +.margin-right { + margin-top: 0 !important; + margin-bottom: 0 !important; + margin-left: 0 !important; +} + +.hero_head { + letter-spacing: -0.2vw; + margin-top: 0; + margin-bottom: 1vw; + font-size: 4em; + font-weight: 700; + line-height: 1.125; +} + +.margin-custom1 { + margin: 1.5rem; +} + +.hero_bg-img { + &.left { + width: 20em; + height: 10em; + top: auto; + bottom: 0%; + left: 0%; + right: auto; + position: absolute; + } + + &.right { + width: 24.5781em; + height: 10.19em; + top: auto; + bottom: 0%; + left: auto; + right: 0%; + position: absolute; + } + + &.default { + width: 23.4404em; + height: 16.8373em; + position: absolute; + } +} + +.section_small-hero { + background-color: $light-gray; + border: 1px solid #dfe1e7; + border-bottom-style: none; + position: relative; + overflow: hidden; + + &.padding-global { + padding-left: 2.5em; + padding-right: 2.5em; + } +} + +.container-small { + margin-right: auto !important; + margin-left: auto !important; + width: 100%; + max-width: 48em; +} + +.padding-section-medium { + padding-top: 5em; + padding-bottom: 5em; + position: relative; +} + +.rich-text-block-2 { + font-size: 1em; + line-height: 2.4em; + font-weight: 300; + h2 { + display: inline-block; + margin-top: 2vw; + margin-bottom: 1vw; + font-size: 2.3em; + line-height: 1.125em; + } +} + +.text-color-dark-green { + color: var(--dark-green); + strong { + font-weight: 700; + } +} + +#cookies-table { + float: left; + width: 100%; + + table { + width: 100%; + border-collapse: collapse; + + tr:nth-of-type(odd) { + background: $light-gray; + } + + th { + background: $dark-green; + color: white; + font-weight: bold; + padding: 0.375em; + border: 0.125em solid $medium-gray; + text-align: left; + } + + td, + th { + padding: 0.375em; + border: 0.125em solid $medium-gray; + text-align: left; + } + } + + @media all and (max-width: 767px) { + table, + thead, + tbody, + th, + td, + tr { + display: block; + } + + thead tr { + position: absolute; + top: -9999px; + left: -9999px; + } + + tr { + border-left: 0.125em solid $medium-gray; + border-right: 0.125em solid $medium-gray; + border-bottom: 0.125em solid $medium-gray; + + &:nth-of-type(1) { + border-top: 0.125em solid $medium-gray; + } + } + + td { + border: none; + border-bottom: 0.125em solid $lighter-gray; + position: relative; + padding-left: 50%; + + &:before { + position: absolute; + top: 0.375em; + left: 0.375em; + width: 45%; + padding-right: 0.625em; + white-space: nowrap; + } + + &:nth-of-type(1):before { + content: "Cookie"; + } + + &:nth-of-type(2):before { + content: "Purpose"; + } + + &:nth-of-type(3):before { + content: "More information"; + } + } + } +} + +.cursor-pointer { + cursor: pointer; +} +.link-selected:hover{ + color: #bd4e0a; + text-decoration: underline; } \ No newline at end of file diff --git a/ckanext/ubdc/public/base/scss/_homepage.scss b/ckanext/ubdc/public/base/scss/_homepage.scss index e96a37a..4d4a667 100644 --- a/ckanext/ubdc/public/base/scss/_homepage.scss +++ b/ckanext/ubdc/public/base/scss/_homepage.scss @@ -15,7 +15,7 @@ background-repeat: no-repeat; display: flex; align-items: center; - border: 1px solid #DFE1E7; + border: 1px solid #dfe1e7; .wrap { display: flex; justify-content: center; @@ -562,3 +562,15 @@ color: #fff; background: $orange-shade; } + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: searchfield-cancel-button; + position: relative; + right: 20px; + height: 20px; + width: 20px; + border-radius: 10px; + background: url(/base/images/close.svg) no-repeat 50% 50%; + background-size: contain; +} diff --git a/ckanext/ubdc/public/base/scss/_masthead.scss b/ckanext/ubdc/public/base/scss/_masthead.scss index 9da996e..52dea11 100644 --- a/ckanext/ubdc/public/base/scss/_masthead.scss +++ b/ckanext/ubdc/public/base/scss/_masthead.scss @@ -212,7 +212,7 @@ $notificationsBg: #c9403a; input { width: 40px; opacity: 0; - padding: calc($grid-gutter-width/6) calc($grid-gutter-width/3); + padding: 10px; -webkit-transition: width 0.4s ease-in-out; transition: width 0.4s ease-in-out; ~ .btn-search { @@ -220,6 +220,7 @@ $notificationsBg: #c9403a; cursor: default; font-size: 20px !important; color: $black; + top: 40%; } &:focus { width: 200px; diff --git a/ckanext/ubdc/public/base/scss/_variables.scss b/ckanext/ubdc/public/base/scss/_variables.scss index 584c8a3..c4f51e9 100644 --- a/ckanext/ubdc/public/base/scss/_variables.scss +++ b/ckanext/ubdc/public/base/scss/_variables.scss @@ -159,4 +159,8 @@ $heading-black-shade: #0d0d12; $text-black-shade: #36394a; $orange-shade: #c2410c; -$hero-height: 550px; \ No newline at end of file +$hero-height: 550px; +$dark-green: #184e44; +$light-gray: #f2f2f2; +$medium-gray: #ccc; +$lighter-gray: #eee; \ No newline at end of file diff --git a/ckanext/ubdc/templates/cookie/base.html b/ckanext/ubdc/templates/cookie/base.html new file mode 100644 index 0000000..ed706cc --- /dev/null +++ b/ckanext/ubdc/templates/cookie/base.html @@ -0,0 +1,134 @@ +{% extends "base.html" %} + +{%- block page -%} + + {% block skip %} +
{{ _('Skip to main content') }}
+ {% endblock %} + + {# + Override the header on a page by page basis by extending this block. If + making sitewide header changes it is preferable to override the header.html + file. + #} + {%- block header %} + {% include "header.html" %} + {% endblock -%} + + {# The content block allows you to replace the content of the page if needed #} + {%- block content %} + {% block maintag %}
{% endblock %} +
+ {% block main_content %} + {% block flash %} +
+ {% block flash_inner %} + {% for category, message in h.get_flashed_messages(with_categories=true) %} +
+ {{ h.literal(message) }} +
+ {% endfor %} + {% endblock %} +
+ {% endblock %} + + {% block toolbar %} + + {% endblock %} + +
+ {# + The pre_primary block can be used to add content to before the + rendering of the main content columns of the page. + #} + {% block pre_primary %} + {% endblock %} + + {% block secondary %} + + {% endblock %} + + {% block primary %} +
+ {# + The primary_content block can be used to add content to the page. + This is the main block that is likely to be used within a template. + + Example: + + {% block primary_content %} +

My page content

+

Some content for the page

+ {% endblock %} + #} + {% block primary_content %} +
+ {% block page_header %} + + {% endblock %} +
+ {% if self.page_primary_action() | trim %} +
+ {% block page_primary_action %}{% endblock %} +
+ {% endif %} + {% block primary_content_inner %} + {% endblock %} +
+
+ {% endblock %} +
+ {% endblock %} +
+ {% endblock %} +
+
+ {% endblock -%} + + {# + Override the footer on a page by page basis by extending this block. If + making sitewide header changes it is preferable to override the footer.html-u + file. + #} + {%- block footer %} + {% include "footer.html" %} + {% endblock -%} +{%- endblock -%} + +{%- block scripts %} + {% asset 'base/main' %} + {% asset 'base/ckan' %} + {{ super() }} +{% endblock -%} \ No newline at end of file diff --git a/ckanext/ubdc/templates/cookie/index.html b/ckanext/ubdc/templates/cookie/index.html new file mode 100644 index 0000000..e4c7a5c --- /dev/null +++ b/ckanext/ubdc/templates/cookie/index.html @@ -0,0 +1,33 @@ +{% extends "base.html" %} + +{%- block page -%} + +{%- block header %} +{% include "header.html" %} +{% endblock -%} + +{%- block content %} +{% block maintag %}
{% endblock %} +
+ {% block main_content %} + {% block primary %} +
+ {% snippet "cookie/snippets/hero.html"%} + {% snippet "cookie/snippets/content.html"%} +
+ {% endblock %} + {% endblock %} +
+
+{% endblock -%} + +{%- block footer %} +{% include "footer.html" %} +{% endblock -%} +{%- endblock -%} + +{%- block scripts %} +{% asset 'base/main' %} +{% asset 'base/ckan' %} +{{ super() }} +{% endblock -%} \ No newline at end of file diff --git a/ckanext/ubdc/templates/cookie/snippets/content.html b/ckanext/ubdc/templates/cookie/snippets/content.html new file mode 100644 index 0000000..780376b --- /dev/null +++ b/ckanext/ubdc/templates/cookie/snippets/content.html @@ -0,0 +1,51 @@ +
+
+
+
+
+
+

The Urban Big Data Centre (UBDC) uses cookies to ensure the website functions correctly, to + provide enhancing features and to analyse website performance. We may share information + about your use of our website with our social media and analytics partners who may combine + it with other information that you’ve provided to them or that they’ve collected from your + use of their services.

+

+

Cookies are small text files stored on your browser and they contain certain information + about you, or your website behaviour, such as your language preferences or whether you are a + new or returning user to our website. This allows us to give you a better website + experience.

+

+

The UBDC data catalogue uses a combination of first- and third-party cookies. First party + cookies are placed on your browser by the same website you are on (www.data.ubdc.ac.uk), + while third party cookies are placed on your browser by a different website than the one you + are on (i.e. Twitter).

+

Cookies table

+
+ {% snippet "cookie/snippets/table.html"%} +
+

How to manage cookies

+

At UBDC we respect your right to privacy, that is why we require your consent to use any + non-essential cookies. However, not allowing certain type of cookies may impact how the + website works. You can choose your cookies preference by using the consent preference + centre on the website (or clicking on the cookie button at the + bottom....).

+

+

Learn more about who we are, how you can contact us and how we process personal data in our + Privacy + Policy. +

+

+

Your consent applies to the following domains: www.data.ubdc.ac.uk. Please state your + consentID and date when you contact us regarding your consent. +

+
+
+
+
+
+
\ No newline at end of file diff --git a/ckanext/ubdc/templates/cookie/snippets/hero.html b/ckanext/ubdc/templates/cookie/snippets/hero.html new file mode 100644 index 0000000..8e28302 --- /dev/null +++ b/ckanext/ubdc/templates/cookie/snippets/hero.html @@ -0,0 +1,23 @@ +
+
+
+
+
+
+
+

Cookies Policy Page

+
+
+
+
+
+
+
\ No newline at end of file diff --git a/ckanext/ubdc/templates/cookie/snippets/table.html b/ckanext/ubdc/templates/cookie/snippets/table.html new file mode 100644 index 0000000..b2c9e0d --- /dev/null +++ b/ckanext/ubdc/templates/cookie/snippets/table.html @@ -0,0 +1,51 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CookiePurposeMore information
_gaA Google Analytics cookie which helps us understand how + visitors are using our website, so we can make it more useful.
+ Lifespan: Persistent
Tracks the number of times a visitor has been to our website, + when their first visit was, and when their last visit + occurred.
_ga_*A Google Analytics cookie which helps us understand how + visitors are using our website, so we can make it more useful.
+ Lifespan: 30 minutes
Tracks approximately how long a visitor stays on our + website.
ckanA cookie used to have ckan related functionality.
+ Lifespan: Until Logged Out
 
auth_tktA cookie used to enable customised options for a logged in + user.
+ Lifespan: Until Logged Out
 
CookieControlA cookie used to understand the consent of user for cookie acceptance.
+ Lifespan: At end of session
 
+ +
\ No newline at end of file diff --git a/ckanext/ubdc/templates/footer.html b/ckanext/ubdc/templates/footer.html index 720d40d..252872f 100644 --- a/ckanext/ubdc/templates/footer.html +++ b/ckanext/ubdc/templates/footer.html @@ -103,7 +103,7 @@

Connect

Privacy Policy
  • - Cookies Policy + Cookies Policy
  • Accessibility Policy @@ -135,13 +135,13 @@

    Connect

    -
    +
    {% endblock %} \ No newline at end of file diff --git a/ckanext/ubdc/templates/header.html b/ckanext/ubdc/templates/header.html index b1cc662..f4ed5bd 100644 --- a/ckanext/ubdc/templates/header.html +++ b/ckanext/ubdc/templates/header.html @@ -49,4 +49,15 @@
  • #} {% endif %} {% endblock %} +{% endblock %} +{% block header_site_search %} + {% endblock %} \ No newline at end of file diff --git a/ckanext/ubdc/view.py b/ckanext/ubdc/view.py index 1755027..fb1a405 100644 --- a/ckanext/ubdc/view.py +++ b/ckanext/ubdc/view.py @@ -14,7 +14,6 @@ import ckan.lib.navl.dictization_functions as dict_fns import ckan.lib.captcha as captcha - tuplize_dict = logic.tuplize_dict clean_dict = logic.clean_dict parse_params = logic.parse_params @@ -24,6 +23,14 @@ ubdc = Blueprint("ubdc", __name__) +def get_path(path, query_type, toolkit): + original_query = toolkit.request.query_string.decode("utf-8") + if original_query: + target_url = "/" + query_type + "/" + path + '?' + original_query + else: + target_url = "/" + query_type + "/" + path + return target_url + # Redirect organization pages to provider pages provider = Blueprint( "provider", @@ -60,7 +67,8 @@ def org_redirect_root(): @ubdc.route("/organization/") def org_redirect(path): - return redirect("/providers/{}".format(path)) + url = get_path(path, 'providers', tk) + return redirect(url) @ubdc.route("/group/") def group_redirect_root(): @@ -69,7 +77,8 @@ def group_redirect_root(): @ubdc.route("/group/") def group_redirect(path): - return redirect("/research-themes/{}".format(path)) + url = get_path(path, 'research-themes', tk) + return redirect(url) @ubdc.route("/dataset") @ubdc.route("/dataset/") @@ -84,7 +93,8 @@ def dataset_redirect_root(): @ubdc.route("/dataset/") def dataset_redirect(path): - return redirect("/datasets/{}".format(path)) + url = get_path(path, 'datasets', tk) + return redirect(url) class AccessRequestController(MethodView): @@ -207,8 +217,13 @@ def delete_all_resources(id): tk.abort(404, e.error_dict["message"]) return tk.redirect_to(f'/datasets/{id}') +def cookie_policy(): + return tk.render("cookie/index.html") + ubdc.add_url_rule("/data-service/access-request/view", view_func=access_request_list) +ubdc.add_url_rule("/cookie-policy", view_func=cookie_policy) + ubdc.add_url_rule( "/data-service/access-request/view/", view_func=access_request_view