diff --git a/.gitignore b/.gitignore index e9876d10..914c4483 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,7 @@ nosetests.xml coverage.xml # Sphinx documentation -docs/_build/ \ No newline at end of file +docs/_build/ + +# Editors +.idea \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index 52550024..7ec10e7e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include README.rst include LICENSE include requirements.txt -recursive-include ckanext/justicehub_theme *.html *.json *.js *.less *.css *.mo \ No newline at end of file +recursive-include ckanext/justicehub_theme *.html *.json *.js *.less *.css *.mo *.png *.svg \ No newline at end of file diff --git a/ckan_license.json b/ckan_license.json new file mode 100644 index 00000000..d12d1090 --- /dev/null +++ b/ckan_license.json @@ -0,0 +1,135 @@ +[ + { + "domain_content": false, + "domain_data": true, + "domain_software": false, + "family": "", + "id": "PDDL-1.0", + "legacy_ids": [ + "ODC-PDDL-1.0" + ], + "maintainer": "", + "od_conformance": "approved", + "osd_conformance": "not reviewed", + "status": "active", + "title": "Open Data Commons Public Domain Dedication and License (PDDL)", + "url": "https://opendatacommons.org/licenses/pddl/" + }, + { + "domain_content": false, + "domain_data": true, + "domain_software": false, + "family": "", + "id": "ODbL-1.0", + "maintainer": "", + "od_conformance": "approved", + "osd_conformance": "not reviewed", + "status": "active", + "title": "Open Data Commons Open Database License (ODBL)", + "url": "https://opendatacommons.org/licenses/odbl/" + }, + { + "domain_content": false, + "domain_data": true, + "domain_software": false, + "family": "", + "id": "ODC-BY-1.0", + "maintainer": "Open Data Commons", + "od_conformance": "approved", + "osd_conformance": "not reviewed", + "status": "active", + "title": "Open Data Commons Attribution License (ODC-By)", + "url": "https://opendatacommons.org/licenses/by/" + }, + { + "domain_content": true, + "domain_data": true, + "domain_software": true, + "family": "", + "id": "CC0-1.0", + "maintainer": "Creative Commons", + "od_conformance": "approved", + "osd_conformance": "not reviewed", + "status": "active", + "title": "CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", + "url": "https://creativecommons.org/publicdomain/zero/1.0/" + }, + { + "domain_content": true, + "domain_data": true, + "domain_software": false, + "family": "", + "id": "CC-BY-4.0", + "maintainer": "Creative Commons", + "od_conformance": "approved", + "osd_conformance": "not reviewed", + "status": "active", + "title": "Creative Commons Attribution 4.0 International (CC BY 4.0)", + "url": "https://creativecommons.org/licenses/by/4.0/" + }, + { + "domain_content": true, + "domain_data": true, + "domain_software": false, + "family": "", + "id": "CC-BY-SA-4.0", + "maintainer": "Creative Commons", + "od_conformance": "approved", + "osd_conformance": "not reviewed", + "status": "active", + "title": "Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)", + "url": "https://creativecommons.org/licenses/by-sa/4.0/" + }, + { + "domain_content": true, + "domain_data": true, + "domain_software": false, + "family": "Creative Commons", + "id": "CC-BY-NC-4.0", + "maintainer": "Creative Commons", + "od_conformance": "rejected", + "osd_conformance": "not reviewed", + "status": "active", + "title": "Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)", + "url": "https://creativecommons.org/licenses/by-nc/4.0/" + }, + { + "domain_content": true, + "domain_data": true, + "domain_software": false, + "family": "", + "id": "CC-BY-NC-SA-4.0", + "maintainer": "Creative Commons", + "od_conformance": "approved", + "osd_conformance": "not reviewed", + "status": "active", + "title": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)", + "url": "https://creativecommons.org/licenses/by-nc-sa/4.0/" + }, + { + "domain_content": true, + "domain_data": true, + "domain_software": false, + "family": "", + "id": "CC-BY-ND-4.0", + "maintainer": "Creative Commons", + "od_conformance": "approved", + "osd_conformance": "not reviewed", + "status": "active", + "title": "Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)", + "url": "https://creativecommons.org/licenses/by-nd/4.0/" + }, + { + "domain_content": true, + "domain_data": true, + "domain_software": false, + "family": "", + "id": "CC-BY-NC-ND-4.0", + "maintainer": "Creative Commons", + "od_conformance": "approved", + "osd_conformance": "not reviewed", + "status": "active", + "title": "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)", + "url": "https://creativecommons.org/licenses/by-nc-nd/4.0/" + } +] diff --git a/ckan_sources.json b/ckan_sources.json new file mode 100644 index 00000000..ca8b6069 --- /dev/null +++ b/ckan_sources.json @@ -0,0 +1,172 @@ +[ + { + "name": "National Crime Records Bureau ", + "code": "NCRB ", + "link": "https://ncrb.gov.in/en/crime-india" + }, + { + "name": "District courts (eCourts India Services) ", + "code": "DC ", + "link": "https://districts.ecourts.gov.in/" + }, + { + "name": "High Courts ", + "code": "HC ", + "link": "https://ecourts.gov.in/ecourts_home/static/highcourts.php" + }, + { + "name": "Supreme Court ", + "code": "SC ", + "link": "https://supremecourtofindia.nic.in/" + }, + { + "name": "First Information Report ", + "code": "FIR ", + "link": "" + }, + { + "name": "Data on Police Organizations, Bureau of Police Research and Development (BPR&D) ", + "code": "BPRD ", + "link": "https://bprd.nic.in/content/62_1_DataonPoliceOrganizations.aspx" + }, + { + "name": "Combined Finance and Revenue Accounts of the Union and State Governments in India, Comptroller and Auditor General of India ", + "code": "CAG, India ", + "link": "https://cag.gov.in/audit-reports" + }, + { + "name": "Open Budgets India ", + "code": "OBI ", + "link": "openbudgetsindia.org/" + }, + { + "name": "Primary Census Abstract, Census 2011 ", + "code": "Census, 2011 ", + "link": "https://censusindia.gov.in/2011-common/censusdata2011.html" + }, + { + "name": "Prison Statistics India ", + "code": "PSI ", + "link": "https://ncrb.gov.in/en/prison-statistics-india" + }, + { + "name": "Court News, Supreme Court of India ", + "code": "Court News, SC ", + "link": "https://supremecourtofindia.nic.in/" + }, + { + "name": "Right to Information ", + "code": "RTI ", + "link": "" + }, + { + "name": "Department of Justice (courthalls) ", + "code": "CourtHalls, DoJ ", + "link": "https://doj.gov.in/" + }, + { + "name": "National Judicial Data Grid ", + "code": "NJDG ", + "link": "https://njdg.ecourts.gov.in/" + }, + { + "name": "National Legal Services Authority ", + "code": "NALSA ", + "link": "https://nalsa.gov.in/statistics" + }, + { + "name": "SCC Online ", + "code": "SCC ", + "link": "https://www.scconline.com/" + }, + { + "name": "IndianKanoon ", + "code": "IndianKanoon ", + "link": "https://indiankanoon.org/" + }, + { + "name": "Gazette of India ", + "code": "Gazette ", + "link": "http://egazette.nic.in/(S(l1hxo4md0ybkknii4dlynavg))/default.aspx?AcceptsCookies=yes" + }, + { + "name": "Newspaper Reports ", + "code": "Media ", + "link": "" + }, + { + "name": "International Organisations ", + "code": "IO ", + "link": "" + }, + { + "name": "National Family Health Survey ", + "code": "NFHS ", + "link": "http://rchiips.org/nfhs/" + }, + { + "name": "Ministry of Tribal Affairs ", + "code": "", + "link": "https://tribal.nic.in/" + }, + { + "name": "Common Service Centres ", + "code": "CSC ", + "link": "https://www.csc.gov.in/" + }, + { + "name": "National Informatics Centre ", + "code": "NIC ", + "link": "https://www.nic.in/" + }, + { + "name": "Ministry of Housing and Urban Affairs ", + "code": "MoHU ", + "link": "https://www.mohua.gov.in/" + }, + { + "name": "National Sample Survey Office ", + "code": "NSSO ", + "link": "http://www.mospi.gov.in/nsso" + }, + { + "name": "Association for Democratic Reforms ", + "code": "ADR ", + "link": "http://myneta.info" + }, + { + "name": "Twitter ", + "code": "Twitter ", + "link": "https://twitter.com/" + }, + { + "name": "Household Survey ", + "code": "Survey ", + "link": "" + }, + { + "name": "Organisations Reports ", + "code": "OR ", + "link": "" + }, + { + "name": "National Human Rights Commission ", + "code": "NHRC ", + "link": "https://nhrc.nic.in/" + }, + { + "name": "National Institutes of Health ", + "code": "NIH ", + "link": "https://www.ncbi.nlm.nih.gov/" + }, + { + "name": "UN Office on Drugs & Crime Ministry of Women and Child Development (India) ", + "code": "UNDOC ", + "link": "https://www.unodc.org/pdf/india/publications/India%20Country%20Report.pdf" + }, + { + "name": "Researve Bank of India ", + "code": "RBI ", + "link": "https://www.rbi.org.in/" + } +] diff --git a/ckanext/justicehub_theme/controllers/controller.py b/ckanext/justicehub_theme/controllers/controller.py index a27b1a19..5b300ce1 100644 --- a/ckanext/justicehub_theme/controllers/controller.py +++ b/ckanext/justicehub_theme/controllers/controller.py @@ -11,6 +11,7 @@ import ckan.logic as logic import ckan.model as model from ckan.common import c, request +import ckan.lib.helpers as h clean_dict = logic.clean_dict parse_params = logic.parse_params @@ -103,3 +104,10 @@ def subscribe(self): tag_response = requests.request("POST", tag_url, headers=headers, data = json.dumps(payload)) return response.text.encode('utf8') + + def upload(self): + if c.user: + return plugins.toolkit.render('dataupload/index.html') + else: + #TO DO: change hardcoded value "/upload" to directly pick from requester url + h.redirect_to('/login?came_from=/upload') diff --git a/ckanext/justicehub_theme/controllers/dataset.py b/ckanext/justicehub_theme/controllers/dataset.py new file mode 100644 index 00000000..5d338fe7 --- /dev/null +++ b/ckanext/justicehub_theme/controllers/dataset.py @@ -0,0 +1,464 @@ +import logging +from flask import request, jsonify +from ckan.common import _, g, request + +import ckan.logic as logic +import ckan.lib.helpers as h +import ckan.model as model +import ckan.plugins as p +import ckan.lib.base as base +from ckan.common import config, _, c, OrderedDict + +from urllib import urlencode +from six import string_types, text_type +from paste.deploy.converters import asbool + +from ckan.lib.plugins import lookup_package_plugin + + +NotFound = logic.NotFound +NotAuthorized = logic.NotAuthorized +check_access = logic.check_access +get_action = logic.get_action +tuplize_dict = logic.tuplize_dict +clean_dict = logic.clean_dict +parse_params = logic.parse_params +flatten_to_string_key = logic.flatten_to_string_key +ValidationError = logic.ValidationError + +log = logging.getLogger(__name__) +render = base.render +abort = base.abort + + +import logging + +from ckan.common import config +from paste.deploy.converters import asbool +from six import text_type + +import ckan.lib.base as base +import ckan.model as model +import ckan.lib.helpers as h +import ckan.authz as authz +import ckan.logic as logic +import ckan.logic.schema as schema +import ckan.lib.captcha as captcha +import ckan.lib.mailer as mailer +import ckan.lib.navl.dictization_functions as dictization_functions +import ckan.lib.authenticator as authenticator +import ckan.plugins as p + +from ckan.common import _, c, request, response + +log = logging.getLogger(__name__) + + +abort = base.abort +render = base.render + +check_access = logic.check_access +get_action = logic.get_action +NotFound = logic.NotFound +NotAuthorized = logic.NotAuthorized +ValidationError = logic.ValidationError +UsernamePasswordError = logic.UsernamePasswordError + +DataError = dictization_functions.DataError +unflatten = dictization_functions.unflatten + + +def _encode_params(params): + return [(k, v.encode('utf-8') if isinstance(v, string_types) else str(v)) + for k, v in params] + +def url_with_params(url, params): + params = _encode_params(params) + return url + u'?' + urlencode(params) + + +def search_url(params, package_type=None): + if not package_type or package_type == 'dataset': + url = h.url_for(controller='package', action='search') + else: + url = h.url_for('{0}_search'.format(package_type)) + return url_with_params(url, params) + +class PackageNewController(base.BaseController): + + def _package_form(self, package_type=None): + return lookup_package_plugin(package_type).package_form() + + def _setup_template_variables(self, context, data_dict, package_type=None): + return lookup_package_plugin(package_type).\ + setup_template_variables(context, data_dict) + + def _new_template(self, package_type): + return lookup_package_plugin(package_type).new_template() + + def _edit_template(self, package_type): + return lookup_package_plugin(package_type).edit_template() + + def _search_template(self, package_type): + return lookup_package_plugin(package_type).search_template() + + def _read_template(self, package_type): + return lookup_package_plugin(package_type).read_template() + + def _history_template(self, package_type): + return lookup_package_plugin(package_type).history_template() + + def _resource_form(self, package_type): + # backwards compatibility with plugins not inheriting from + # DefaultDatasetPlugin and not implmenting resource_form + plugin = lookup_package_plugin(package_type) + if hasattr(plugin, 'resource_form'): + result = plugin.resource_form() + if result is not None: + return result + return lookup_package_plugin().resource_form() + + def _resource_template(self, package_type): + # backwards compatibility with plugins not inheriting from + # DefaultDatasetPlugin and not implmenting resource_template + plugin = lookup_package_plugin(package_type) + if hasattr(plugin, 'resource_template'): + result = plugin.resource_template() + if result is not None: + return result + return lookup_package_plugin().resource_template() + + def _guess_package_type(self, expecting_name=False): + """ + Guess the type of package from the URL handling the case + where there is a prefix on the URL (such as /data/package) + """ + + # Special case: if the rot URL '/' has been redirected to the package + # controller (e.g. by an IRoutes extension) then there's nothing to do + # here. + if request.path == '/': + return 'dataset' + + parts = [x for x in request.path.split('/') if x] + + idx = -1 + if expecting_name: + idx = -2 + + pt = parts[idx] + if pt == 'package': + pt = 'dataset' + + return pt + + def search(self): + from ckan.lib.search import SearchError, SearchQueryError + + package_type = self._guess_package_type() + + try: + context = {'model': model, 'user': c.user, + 'auth_user_obj': c.userobj} + check_access('site_read', context) + except NotAuthorized: + abort(403, _('Not authorized to see this page')) + + # unicode format (decoded from utf8) + q = c.q = request.params.get('q', u'') + c.query_error = False + page = h.get_page_number(request.params) + + limit = int(config.get('ckan.datasets_per_page', 20)) + + # most search operations should reset the page counter: + params_nopage = [(k, v) for k, v in request.params.items() + if k != 'page'] + + def drill_down_url(alternative_url=None, **by): + return h.add_url_param(alternative_url=alternative_url, + controller='package', action='search', + new_params=by) + + c.drill_down_url = drill_down_url + + def remove_field(key, value=None, replace=None): + return h.remove_url_param(key, value=value, replace=replace, + controller='package', action='search', + alternative_url=package_type) + + c.remove_field = remove_field + + sort_by = request.params.get('sort', None) + params_nosort = [(k, v) for k, v in params_nopage if k != 'sort'] + + def _sort_by(fields): + """ + Sort by the given list of fields. + Each entry in the list is a 2-tuple: (fieldname, sort_order) + eg - [('metadata_modified', 'desc'), ('name', 'asc')] + If fields is empty, then the default ordering is used. + """ + params = params_nosort[:] + + if fields: + sort_string = ', '.join('%s %s' % f for f in fields) + params.append(('sort', sort_string)) + return search_url(params, package_type) + + c.sort_by = _sort_by + if not sort_by: + c.sort_by_fields = [] + else: + c.sort_by_fields = [field.split()[0] + for field in sort_by.split(',')] + + def pager_url(q=None, page=None): + params = list(params_nopage) + params.append(('page', page)) + return search_url(params, package_type) + + c.search_url_params = urlencode(_encode_params(params_nopage)) + + try: + c.fields = [] + # c.fields_grouped will contain a dict of params containing + # a list of values eg {'tags':['tag1', 'tag2']} + c.fields_grouped = {} + search_extras = {} + fq = '' + for (param, value) in request.params.items(): + if param not in ['q', 'page', 'sort'] \ + and len(value) and not param.startswith('_'): + if not param.startswith('ext_'): + c.fields.append((param, value)) + fq += ' +%s:"%s"' % (param, value) + if param not in c.fields_grouped: + c.fields_grouped[param] = [value] + else: + c.fields_grouped[param].append(value) + else: + search_extras[param] = value + + context = {'model': model, 'session': model.Session, + 'user': c.user, 'for_view': True, + 'auth_user_obj': c.userobj} + + # Unless changed via config options, don't show other dataset + # types any search page. Potential alternatives are do show them + # on the default search page (dataset) or on one other search page + search_all_type = config.get( + 'ckan.search.show_all_types', 'dataset') + search_all = False + + try: + # If the "type" is set to True or False, convert to bool + # and we know that no type was specified, so use traditional + # behaviour of applying this only to dataset type + search_all = asbool(search_all_type) + search_all_type = 'dataset' + # Otherwise we treat as a string representing a type + except ValueError: + search_all = True + + if not package_type: + package_type = 'dataset' + + if not search_all or package_type != search_all_type: + # Only show datasets of this particular type + fq += ' +dataset_type:{type}'.format(type=package_type) + + facets = OrderedDict() + + default_facet_titles = { + 'publisher_name': _('Data Contributors'), + 'groups': _('Groups'), + 'tags': _('Tags'), + 'res_format': _('Formats'), + 'license_id': _('Licenses'), + 'region': _('Geography'), + } + + for facet in h.facets(): + if facet in default_facet_titles: + facets[facet] = default_facet_titles[facet] + else: + facets[facet] = facet + + # Facet titles + for plugin in p.PluginImplementations(p.IFacets): + facets = plugin.dataset_facets(facets, package_type) + + c.facet_titles = facets + + data_dict = { + 'q': q, + 'fq': fq.strip(), + 'facet.field': facets.keys(), + 'rows': limit, + 'start': (page - 1) * limit, + 'sort': sort_by, + 'extras': search_extras, + 'include_private': asbool(config.get( + 'ckan.search.default_include_private', True)), + } + + query = get_action('package_search')(context, data_dict) + c.sort_by_selected = query['sort'] + + c.page = h.Page( + collection=query['results'], + page=page, + url=pager_url, + item_count=query['count'], + items_per_page=limit + ) + c.search_facets = query['search_facets'] + c.page.items = query['results'] + except SearchQueryError as se: + # User's search parameters are invalid, in such a way that is not + # achievable with the web interface, so return a proper error to + # discourage spiders which are the main cause of this. + log.info('Dataset search query rejected: %r', se.args) + abort(400, _('Invalid search query: {error_message}') + .format(error_message=str(se))) + except SearchError as se: + # May be bad input from the user, but may also be more serious like + # bad code causing a SOLR syntax error, or a problem connecting to + # SOLR + log.error('Dataset search error: %r', se.args) + c.query_error = True + c.search_facets = {} + c.page = h.Page(collection=[]) + except NotAuthorized: + abort(403, _('Not authorized to see this page')) + + c.search_facets_limits = {} + for facet in c.search_facets.keys(): + try: + limit = int(request.params.get('_%s_limit' % facet, + int(config.get('search.facets.default', 10)))) + except ValueError: + abort(400, _('Parameter "{parameter_name}" is not ' + 'an integer').format( + parameter_name='_%s_limit' % facet)) + c.search_facets_limits[facet] = limit + + self._setup_template_variables(context, {}, + package_type=package_type) + + return render(self._search_template(package_type), + extra_vars={'dataset_type': package_type}) + +def set_repoze_user(user_id): + '''Set the repoze.who cookie to match a given user_id''' + if 'repoze.who.plugins' in request.environ: + rememberer = request.environ['repoze.who.plugins']['friendlyform'] + identity = {'repoze.who.userid': user_id} + response.headerlist += rememberer.remember(request.environ, + identity) + +class UserNewController(base.BaseController): + def __before__(self, action, **env): + base.BaseController.__before__(self, action, **env) + try: + context = {'model': model, 'user': c.user, + 'auth_user_obj': c.userobj} + check_access('site_read', context) + except NotAuthorized: + if c.action not in ('login', 'request_reset', 'perform_reset',): + abort(403, _('Not authorized to see this page')) + + # hooks for subclasses + new_user_form = 'user/new_user_form.html' + edit_user_form = 'user/edit_user_form.html' + + def _new_form_to_db_schema(self): + return schema.user_new_form_schema() + + def _db_to_new_form_schema(self): + '''This is an interface to manipulate data from the database + into a format suitable for the form (optional)''' + + def _edit_form_to_db_schema(self): + return schema.user_edit_form_schema() + + def _db_to_edit_form_schema(self): + '''This is an interface to manipulate data from the database + into a format suitable for the form (optional)''' + + def _setup_template_variables(self, context, data_dict): + c.is_sysadmin = authz.is_sysadmin(c.user) + try: + user_dict = get_action('user_show')(context, data_dict) + except NotFound: + h.flash_error(_('Not authorized to see this page')) + h.redirect_to(controller='user', action='login') + except NotAuthorized: + abort(403, _('Not authorized to see this page')) + + c.user_dict = user_dict + c.is_myself = user_dict['name'] == c.user + c.about_formatted = h.render_markdown(user_dict['about']) + + # end hooks + + def _get_repoze_handler(self, handler_name): + '''Returns the URL that repoze.who will respond to and perform a + login or logout.''' + return getattr(request.environ['repoze.who.plugins']['friendlyform'], + handler_name) + + def index(self): + page = h.get_page_number(request.params) + c.q = request.params.get('q', '') + c.order_by = request.params.get('order_by', 'name') + + context = {'return_query': True, 'user': c.user, + 'auth_user_obj': c.userobj} + + data_dict = {'q': c.q, + 'order_by': c.order_by} + + limit = int( + request.params.get('limit', config.get('ckan.user_list_limit', 20)) + ) + try: + check_access('user_list', context, data_dict) + except NotAuthorized: + abort(403, _('Not authorized to see this page')) + + users_list = get_action('user_list')(context, data_dict) + + c.page = h.Page( + collection=users_list, + page=page, + url=h.pager_url, + item_count=users_list.count(), + items_per_page=limit + ) + return render('user/list.html') + + def read(self, id=None): + context = {'model': model, 'session': model.Session, + 'user': c.user, 'auth_user_obj': c.userobj, + 'for_view': True} + data_dict = {'id': id, + 'user_obj': c.userobj, + 'include_datasets': True, + 'include_num_followers': True} + + self._setup_template_variables(context, data_dict) + + # The legacy templates have the user's activity stream on the user + # profile page, new templates do not. + if asbool(config.get('ckan.legacy_templates', False)): + c.user_activity_stream = get_action('user_activity_list_html')( + context, {'id': c.user_dict['id']}) + if not c.user: + url = '/login?came_from=' + request.url + h.redirect_to(url) + + return render('user/read.html') + + diff --git a/ckanext/justicehub_theme/fanstatic/dataset/dataset.css b/ckanext/justicehub_theme/fanstatic/dataset/dataset.css new file mode 100644 index 00000000..f2fd2e76 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/dataset/dataset.css @@ -0,0 +1,215 @@ +.dataset-page { + margin-top: 50px; + margin-bottom: 100px; + min-height: 50vh; +} + +.dataset-sidebar-module { + background-color: white; + border: 1px solid #898989; + border-radius: 5px; + margin-bottom: 8px; +} + +.dataset-sidebar-module > * { + padding: 6px 12px; +} + +.dataset-sidebar-module .header { + background-color: #e5e5e5; + border-top-right-radius: 5px; + border-top-left-radius: 5px; + color: #6c666f; +} + +.dataset-main__header .relevancy-info { + display: flex; + color: #898989; + font-size: 14px; +} + +.dataset-main__header .relevancy-info p { + margin-right: 40px; +} + +.dataset-main__header .title-row { + display: flex; + justify-content: space-between; + align-items: center; +} + +.dataset-sidebar-module .header h3 { + margin: 0; + font-weight: 500; + font-size: 16px; +} + +.dataset-sidebar-module .body, +.dataset-sidebar-module .footer { + font-size: 14px; +} + +.dataset-sidebar-module .body { + padding-top: 14px; + padding-bottom: 14px; +} + +.dataset-sidebar-module .body ol { + padding-left: 12px; +} + +.dataset-sidebar-module .body li { + margin: 4px 0; +} + +.dataset-sidebar-module .body a { + text-decoration: none; +} + +.dataset-main { + border: 0.75px solid #898989; + border-radius: 4px; + background-color: white; +} + +.dataset-main__header { + padding: 24px; +} + +.dataset-main__header h1 { + margin: 0; +} + +.dataset-main__header h1 span { + font-weight: 300; + font-size: 14px; + color: #898989; +} + +.dataset-main__header .relevancy-info { + margin: 24px 0 18px 0; +} + +.dataset-main__header .license-description { + font-size: 12px; + margin: 0; +} + +.dataset-main__header .license-description a { + color: inherit; +} + +.dataset-main__header .license-description a:hover { + text-decoration: none; +} + +.dataset-main__header .dataset-description { + margin-top: 18px; +} + +.dataset-file-info { + padding: 28px; + border-top: 0.75px solid #898989; + display: flex; + flex-direction: column; +} + +.dataset-file-info__body { + display: flex; + justify-content: space-between; +} + +.dataset-file-info .format-label { + transform: scale(1.2); + margin-right: 40px; +} + +.dataset-file-info__title { + margin: 0; + font-size: 16px; + font-weight: 400; + line-height: 1.25em; +} + +.dataset-file-info__description { + font-weight: 300; + margin: 8px auto; + font-size: 14px; + line-height: 25px; +} + +.dataset-file-info__footer { + display: flex; + justify-content: flex-end; + align-items: center; +} + +.dataset-file-info__footer p { + font-size: 12px; + font-weight: 300; + color: #6c666f; + margin: 0 4px; +} + +.dataset-file-info__footer .btn { + font-size: 14px !important; + font-family: Roboto !important; + font-weight: 400 !important; +} + +.dataset-file-info__footer .btn-primary-outline { + text-transform: uppercase; + border-radius: 0; + padding: 6px 8px; +} + +@media (max-width: 768px) { + .dataset-sidebar-module { + box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.25); + border: none; + border-radius: 2px; + margin-bottom: 14px; + } + + .dataset-primary { + padding: 0; + box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25); + } + + .dataset-main { + border: none; + } + + .dataset-main__header h1 { + size: 14px; + } + + .dataset-main__header .relevancy-info { + margin: 9px 0; + font-size: 10px; + } + + .dataset-main__header .relevancy-info p { + margin-right: 12px; + } + + .dataset-file-info { + border-top: 0.25px solid #a6a6a6; + } + + .dataset-file-info__footer { + flex-direction: column; + } + + .dataset-file-info .btn { + width: 100% !important; + border: 1px solid var(--primary-color-dark) !important; + color: var(--primary-color-dark) !important; + border-radius: 0 !important; + margin: 9px auto !important; + } + + .dataset-file-info .btn i { + display: none !important; + } +} diff --git a/ckanext/justicehub_theme/fanstatic/dataset/resource.css b/ckanext/justicehub_theme/fanstatic/dataset/resource.css new file mode 100644 index 00000000..03668189 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/dataset/resource.css @@ -0,0 +1,31 @@ +.file-description { + margin-top: 20px; +} + +.file-actions { + margin-top: 30px; +} + +.file-actions .btn-primary-text { + padding-left: 0; + margin-right: 8px; +} + +.file-actions .btn { + font-size: 16px !important; + font-weight: 400; + font-family: Roboto !important; + text-transform: uppercase; +} + +.module-resource { + border: none !important; +} + +a[data-module="resource-view-embed"] { + display: none !important; +} + +.resource-view-filters { + margin-left: 28px !important; +} diff --git a/ckanext/justicehub_theme/fanstatic/exploredatasets/filter_box.css b/ckanext/justicehub_theme/fanstatic/exploredatasets/filter_box.css new file mode 100644 index 00000000..ad560195 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/exploredatasets/filter_box.css @@ -0,0 +1,6 @@ +.module-heading { + background-color: var(--primary-background-color); + color: white; + text-transform: capitalize; + font-size: 14px; +} diff --git a/ckanext/justicehub_theme/fanstatic/exploredatasets/package_item.css b/ckanext/justicehub_theme/fanstatic/exploredatasets/package_item.css new file mode 100644 index 00000000..c2473793 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/exploredatasets/package_item.css @@ -0,0 +1,157 @@ +.dataset-item { + padding-bottom: 0; + box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25); + border-bottom: none; + background-color: #fff; +} + +.dataset-content { + border: 1px solid #f2f2f2; + padding-left: 15px; + padding-right: 15px; +} + +.dataset-title-container { + background-color: var(--primary-background-color); + border: 0.5px solid var(--primary-background-color); +} + +.dataset-title { + margin-bottom: 0; + margin-top: 10px; +} + +.dataset-title a { + color: var(--primary-color); + font-size: 20px; + font-weight: 500; + text-decoration: none; +} + +.dataset-org { + margin-bottom: 10px; +} + +.dataset-org span { + color: white; + font-size: 12px; + font-weight: 300; +} + +.dataset-org span a, +.datset-org span a:hover { + color: white; + font-weight: 400; + text-decoration: none; +} + +.file-info { + display: grid; + grid-template-columns: 6fr 3fr 1fr; + align-items: center; + border-top: 0.5px solid #898989; +} + +.dataset-content .file-info:first-of-type { + border-top: none; +} + +.file-info__text { + padding-right: 10px; + display: flex; + justify-content: space-between; + align-items: center; + padding-top: 10px; + padding-bottom: 10px; +} + +.file-info__text div { + margin-left: 8px; +} + +.file-info__text p { + font-family: 'Montserrat'; + font-size: 12px; + line-height: 18px; + color: #6c666f; +} + +.file-info__stats { + display: flex; + justify-content: space-between; + border-right: 0.5px solid #898989; + border-left: 0.5px solid #898989; + padding: 10px; +} + +.file-info__stats a.btn-primary-text { + font-size: 12px; + font-family: 'Roboto'; +} + +.file-info__stats p { + font-family: 'Montserrat'; + font-size: 10px; + color: #6c666f; + margin-bottom: 0; +} + +.file-info__stats p span { + display: inline-block; + width: 2px; + height: 2px; + border-radius: 50%; +} + +.file-info__stats .btn-primary-text { + font-family: 'Roboto'; + font-size: 12px; +} + +.file-info__link { + display: flex; + justify-content: flex-end; +} + +.file-info__link a { + color: var(--primary-color); + text-decoration: none; +} + +.view-more-files { + background-color: #f2f2f2; + border: 0.5px solid #f2f2f2; + display: flex; + justify-content: space-around; + padding-top: 12px; + padding-bottom: 12px; +} + +.view-more-files .btn-primary-text { + font-family: 'Roboto'; + font-size: 16px; +} + +.dataset-status { + display: flex; + font-size: 14px; + align-items: center; +} + +.dataset-status p { + margin-bottom: 0; + margin-right: 12px; +} + +@media (max-width: 768px) { + .file-info { + grid-template-columns: 9fr 1fr; + } + .file-info__stats { + display: none; + } + .view-more-files { + padding-top: 4px; + padding-bottom: 4px; + } +} diff --git a/ckanext/justicehub_theme/fanstatic/exploredatasets/search.css b/ckanext/justicehub_theme/fanstatic/exploredatasets/search.css new file mode 100644 index 00000000..8546aa66 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/exploredatasets/search.css @@ -0,0 +1,90 @@ +.search-landing { + padding-top: 60px; + padding-bottom: 40px; + background-color: #2a242d; + color: white; + background: linear-gradient(90deg, rgba(64, 54, 68, 0.95) 1.18%, rgba(41, 34, 43, 0.95) 98.6%), + url('../../public/assets/explore_background.png'); +} + +.search-landing h2 { + font-size: 28px; + font-weight: 500; + line-height: 45px; + margin-top: -20px; + margin-bottom: 20px; + padding-left: 25px; + color: var(--primary-color); + border-left: 3px solid var(--primary-color); +} + +.search-landing__content p { + font-weight: 500; + line-height: 30px; + font-family: 'Montserrat'; + font-size: 16px; +} + +.search-categories { + background-color: transparent; + color: white; + margin-top: 32px; +} + +.search-categories h4 { + font-size: 18px; +} + +.search-categories__row { + display: flex; + flex-wrap: wrap; + width: 100%; +} + +.search-categories__row a { + padding: 2px 12px; + border: 2px solid white; + border-radius: 20px; + margin-right: 8px; + margin-bottom: 12px; + color: white; + text-decoration: none; +} + +.explore-search { + margin-top: 40px; + margin-bottom: -20px; +} + +.search-filters section.module { + margin-top: 20px; + margin-bottom: 20px; + box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25); +} + +.input-group.pull-right { + display: flex; + align-items: center; + justify-content: space-around; +} + +.input-group.pull-right span { + display: inline-block; + width: 25%; +} + +.overflowauto { + overflow: auto; +} + +#field-order-by { + border: none; + color: var(--primary-color); + background-color: transparent; + padding: 0; + width: 45%; +} + +#dataset-search-form { + border: 1px solid transparent; +} diff --git a/ckanext/justicehub_theme/fanstatic/exploredatasets/search.js b/ckanext/justicehub_theme/fanstatic/exploredatasets/search.js new file mode 100644 index 00000000..3eb38edd --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/exploredatasets/search.js @@ -0,0 +1,14 @@ +(function () { + const params = new URLSearchParams(window.location.search); + const activeGroup = params.get('groups'); + + const linkElements = document.querySelectorAll('.category-link'); + + linkElements.forEach((element) => { + const group = element.innerHTML.toLowerCase().split(' ').join('-'); + if (group === activeGroup) { + element.style.borderColor = 'var(--primary-color)'; + element.style.color = 'var(--primary-color)'; + } + }); +})(); diff --git a/ckanext/justicehub_theme/fanstatic/home-old.js b/ckanext/justicehub_theme/fanstatic/home-old.js new file mode 100644 index 00000000..f0e0d757 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/home-old.js @@ -0,0 +1,96 @@ +(function () { + const categoriesRow = document.querySelector('.categories__row'); + + const categories = [ + { name: 'Courts', icon: '/assets/icons/courts.svg' }, + { name: 'Policing', icon: '/assets/icons/policing.svg' }, + { name: 'Corporate', icon: '/assets/icons/corporate.svg' }, + { name: 'Child Rights', icon: '/assets/icons/childrights.svg' }, + { name: 'Land Rights', icon: '/assets/icons/landrights.svg' }, + { name: 'Education', icon: '/assets/icons/education.svg' }, + { name: 'Health', icon: '/assets/icons/health.svg' }, + { name: 'Economy', icon: '/assets/icons/economy.svg' }, + { name: 'Migration', icon: '/assets/icons/migration.svg' }, + { name: 'Legal Aid', icon: '/assets/icons/legalaid.svg' }, + { name: 'Human Rights', icon: '/assets/icons/humanrights.svg' }, + { name: 'Consititution', icon: '/assets/icons/constitution.svg' } + ]; + + function categoryTemplate(category) { + return ` +
+
+ ${category.name} +
+

${category.name}

+
+ `; + } + + categories.forEach((category) => (categoriesRow.innerHTML += categoryTemplate(category))); + + // Code for adding contributors to the homepage + + const contributors = [ + { name: `AKP Legal`, imagePath: '/assets/company_1.png' }, + { name: `Legal Check`, imagePath: '/assets/company_2.png' }, + { name: `Marcelo D'Cruz`, imagePath: '/assets/person_1.png' }, + { name: `Pavithra K`, imagePath: '/assets/person_2.png' } + ]; + + function contributorTemplate(contributor) { + return ` +
+
+ ${contributor.name} +

${contributor.name}

+
+
+ `; + } + + const contributorsRow = document.querySelector('.contributors-row'); + + contributors.forEach((contributor) => (contributorsRow.innerHTML += contributorTemplate(contributor))); + + const mobileMenu = document.querySelector('.mobile-menu'); + const closeNavButton = document.querySelector('.closebtn'); + + mobileMenu.addEventListener('click', openNav); + closeNavButton.addEventListener('click', closeNav); + + function openNav() { + document.getElementById('side-nav').style.width = '280px'; + document.getElementById('side-nav').style.paddingLeft = '25px'; + document.body.style.backgroundColor = 'rgba(0,0,0,0.5)'; + document.body.style.overflowY = 'hidden'; + } + function closeNav() { + document.getElementById('side-nav').style.width = '0'; + document.getElementById('side-nav').style.paddingLeft = '0'; + document.body.style.backgroundColor = ''; + document.body.style.overflowY = ''; + } + + const switchToSignIn = document.querySelector('.click-to-login'); + const switchToSignUp = document.querySelector('.click-to-signup'); + const switchToForgot = document.querySelector('.click-to-forgot'); + + switchToSignIn.addEventListener('click', () => { + $('#signUpModal').removeClass('fade').modal('hide'); + $('#signInModal').addClass('fade').modal('show'); + }); + + switchToSignUp.addEventListener('click', () => { + alert ("testtt"); + $('#signInModal').removeClass('fade').modal('hide'); + $('#signUpModal').addClass('fade').modal('show'); + }); + + switchToForgot.addEventListener('click', () => { + $('#signInModal').removeClass('fade').modal('hide'); + $('#signUpModal').removeClass('fade').modal('hide'); + $('#forgotPasswordModal').addClass('fade').modal('show'); + }); + +})(); diff --git a/ckanext/justicehub_theme/fanstatic/justicehub_theme.js b/ckanext/justicehub_theme/fanstatic/justicehub_theme.js index d5722983..8d8567b6 100644 --- a/ckanext/justicehub_theme/fanstatic/justicehub_theme.js +++ b/ckanext/justicehub_theme/fanstatic/justicehub_theme.js @@ -31,6 +31,14 @@ $(document).ready(function() { $(this).prev().toggle(); return false; }); + + $('#howToUploadVideoContainer').on('hide.bs.modal', function() { + $('#howToUploadVideoContainer iframe').attr('src', '') + }); + + $("#howToUploadVideoContainer").on('show.bs.modal', function() { + $("#howToUploadVideoContainer iframe").attr('src', 'https://www.youtube.com/embed/7wrBtB_coJc'); + }); }); @@ -73,7 +81,8 @@ ckan.module('justicehub_theme_tabs', function ($) { onTabClick: function () { // https://stackoverflow.com/a/9393768/3860168 - window.location.hash = this.hash; + //window.location.hash = this.hash; + window.location = this; } }; }); diff --git a/ckanext/justicehub_theme/fanstatic/otherstyles/about.css b/ckanext/justicehub_theme/fanstatic/otherstyles/about.css new file mode 100644 index 00000000..a0286a49 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/otherstyles/about.css @@ -0,0 +1,70 @@ +.about-block { + margin-bottom: 32px; +} + +.about-block .logos-container { + display: flex; + align-items: center; +} + +.about-block .logos-container a { + display: block; +} + +.about-block .logos-container img { + width: 150px; + height: auto; +} + +.team-members-container { + display: grid; + grid-template-columns: 1fr 1fr 1fr 1fr; + row-gap: 48px; + margin: 24px auto; +} + +.member { + display: flex; + flex-direction: column; + align-items: center; +} + +.member img { + width: 150px; + height: auto; + border-radius: 50%; + margin-bottom: 12px; +} + +.member p { + font-weight: 500; +} + +.about-block p span { + font-weight: 500; +} + +@media(max-width: 767px) { + .about-block p { + margin: 18px 0; + line-height: 25px; + } + + .team-members-container { + grid-template-columns: 1fr 1fr 1fr; + row-gap: 36px; + } +} + +@media(max-width: 550px) { + .team-members-container { + grid-template-columns: 1fr 1fr; + row-gap: 24px; + } +} + +@media(max-width: 400px) { + .team-members-container { + grid-template-columns: 1fr; + } +} diff --git a/ckanext/justicehub_theme/fanstatic/otherstyles/about.js b/ckanext/justicehub_theme/fanstatic/otherstyles/about.js new file mode 100644 index 00000000..e5bb7ebc --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/otherstyles/about.js @@ -0,0 +1,25 @@ +const members = [ + { name: 'Abhinav Singh', image: '/assets/team/abhinav.png' }, + { name: 'Akhil Sagiraju', image: '/assets/team/akhil.jpeg' }, + { name: 'Apoorv Anand', image: '/assets/team/apoorv.png' }, + { name: 'Gaurav Godhwani', image: '/assets/team/gaurav.jpg' }, + { name: 'Saurabh Karn', image: '/assets/team/saurabh.jpg' }, + { name: 'Shashank Sharma', image: '/assets/team/shashank.jpg' }, + { name: 'Supriya Sankaran', image: '/assets/team/supriya.jpg' }, + { name: 'Varun Hemachandran', image: '/assets/team/varun.jpg' } +]; + +function teamTemplate(member) { + return ` +
+
+ ${member.name} +
+

${member.name}

+
+ `; +} + +const teamContainer = document.querySelector('.team-members-container'); + +members.forEach((member) => (teamContainer.innerHTML += teamTemplate(member))); diff --git a/ckanext/justicehub_theme/fanstatic/package_item.js b/ckanext/justicehub_theme/fanstatic/package_item.js new file mode 100644 index 00000000..2d677182 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/package_item.js @@ -0,0 +1,39 @@ +const datasetStatusChangeDropdowns = document.querySelectorAll('.dataset-status-change'); + +datasetStatusChangeDropdowns.forEach((dropdown) => { + dropdown.addEventListener('change', (event) => { + const pkgDetails = event.target.value.split(','); + const pkgName = pkgDetails[0]; + const pkgState = pkgDetails[1]; + const requestBody = { name: pkgName, state: pkgState }; + console.log(requestBody); + + const fullURL = window.location.href; + const splitURL = fullURL.split('/'); + + const BASE_URL = `${splitURL[0]}//${splitURL[2]}`; + + fetch(`${BASE_URL}/api/dataset/status`, { + method: 'POST', + headers: { + 'Content-type': 'application/json' + }, + body: JSON.stringify(requestBody) + }) + .then((response) => { + response + .json() + .then(() => { + if (confirm(`Status updated successfully! Please click OK.`)) { + window.location.reload(); + } + }) + .catch(() => { + alert('Sorry, that did not work. Please try again.'); + }); + }) + .catch(() => { + alert('Sorry, that did not work. Please try again.'); + }); + }); +}); diff --git a/ckanext/justicehub_theme/fanstatic/user/profilepage.css b/ckanext/justicehub_theme/fanstatic/user/profilepage.css new file mode 100644 index 00000000..147f0768 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/user/profilepage.css @@ -0,0 +1,56 @@ +.custom-container-parent { + background-color: var(--primary-background-color); + min-height: 280px; +} + +section.module-content { + padding-top: 64px !important; + padding-bottom: 64px !important; +} + +.profile-header { + display: flex; + justify-content: space-between; + align-items: center; + color: white; +} + +.profile-header__info { + display: flex; + align-items: center; +} + +.profile-header__info .image { + margin-right: 32px; +} + +.profile-header__info h1 { + font-size: 24px !important; + font-weight: 500; +} + +.image { + height: 125px; + width: 125px; + border-radius: 100%; +} + +.dataset-list { + margin-top: 32px; +} + +@media (max-width: 450px) { + .profile-header { + flex-direction: column; + } + + .profile-header__info { + flex-direction: column; + text-align: center; + margin-bottom: 24px; + } + .profile-header__info .image { + margin-right: 0; + margin-bottom: 12px; + } +} diff --git a/ckanext/justicehub_theme/fanstatic/widget/auth/forgot.js b/ckanext/justicehub_theme/fanstatic/widget/auth/forgot.js new file mode 100644 index 00000000..2b351b3e --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/widget/auth/forgot.js @@ -0,0 +1,17 @@ +$(document).ready(function(){ + forgotPasswordFormOnSubmit = function() { + var user = $("#forgot-password-user").val(); + $.post("/user/reset", {user: user}, function (result_data) { + var result = JSON.parse(result_data); + console.log(result); + if (result.success) { + console.log("Success"); + showModal("#feedbackModal"); + } else { + console.log(result.error.message); + $("#error-forgotPasswordModal").html(result.error.message); + } + }); + return false; + }; +}); \ No newline at end of file diff --git a/ckanext/justicehub_theme/fanstatic/widget/auth/reset.js b/ckanext/justicehub_theme/fanstatic/widget/auth/reset.js new file mode 100644 index 00000000..e1246335 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/widget/auth/reset.js @@ -0,0 +1,30 @@ +$(document).ready(function(){ + const post_url = window.location.pathname + window.location.search; + resetPasswordFormOnSubmit = function(){ + console.log("Reset form submitted"); + var $this = $(this); + var password1 = $("#reset-password-one").val(); + var password2 = $("#reset-password-two").val(); + if (password1 && password2){ + var url = post_url; + var data = { + password1: password1, + password2: password2 + }; + + $.post(url, data, function(result_data){ + var result = JSON.parse(result_data); + console.log(result); + if (result.success){ + console.log("Success"); + window.location = "/" + } else { + console.log("Error"); + console.log(result.error.message); + $("#error-resetPasswordModal").html(result.error.message); + } + }); + } + return false; + }; +}); diff --git a/ckanext/justicehub_theme/fanstatic/widget/auth/signup.js b/ckanext/justicehub_theme/fanstatic/widget/auth/signup.js new file mode 100644 index 00000000..f233c0f4 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/widget/auth/signup.js @@ -0,0 +1,42 @@ +$(document).ready(function () { + signupFormOnSubmit = function () { + console.log('Signup form submitted'); + $('.input-error').remove(); + var $this = $(this); + var fullname = $('#signup-fullname').val(); + var email = $('#signup-email').val(); + var username = $('#signup-username').val(); + var password = $('#signup-password').val(); + + if(!$("#signup-form")[0].checkValidity()) { + $("#signup-form")[0].reportValidity(); + console.log('Form validation failed'); + return false; + } + + if (password && email) { + var url = '/user/register_email'; + var data = { + fullname: fullname, + email: email, + name: username, + password: password + }; + + $.post(url, data, function (result_data) { + var result = JSON.parse(result_data); + console.log(result); + if (result.success) { + console.log('Success'); + console.log(result); + window.location = '/dashboard'; + } else { + console.log('Error'); + console.log(result.error.message); + $("#error-signupModal").html(result.error.message); + } + }); + } + return false; + }; +}); diff --git a/ckanext/justicehub_theme/fanstatic/widget/popup/popup.css b/ckanext/justicehub_theme/fanstatic/widget/popup/popup.css new file mode 100644 index 00000000..e69de29b diff --git a/ckanext/justicehub_theme/fanstatic/widget/popup/popup.js b/ckanext/justicehub_theme/fanstatic/widget/popup/popup.js new file mode 100644 index 00000000..800b8614 --- /dev/null +++ b/ckanext/justicehub_theme/fanstatic/widget/popup/popup.js @@ -0,0 +1,35 @@ +var activeModalId = false; +const USER_STATUSES = { + "platform_login": "#loginModal", + "platform_register": "#signupModal", + "platform_forgot_password": "#forgotPasswordModal", + "platform_logout": "", + "platform_first_login": "", + "platform_reset": "#resetPasswordModal", + "platform_feedback": "#feedbackModal", + "message_dataset_success": "#datasetFeedbackModal" +} + + +function showModal(id, elid, val) { + $("#error-" + id.substring(1)).html(""); + let delay = 0; // Delay for transition between different modals + if (activeModalId && activeModalId !== id) { + $(activeModalId).modal('hide'); + delay = 250; // If something is hiding, then delay by 250ms before showing new one + } + activeModalId = id; + setTimeout(() => { + $(id).addClass('fade').modal('show'); + $(id).find("input[type!='button']:visible:first").focus(); + }, delay); +} + +$(document).ready(function(){ + const current_step = $("#current_step").attr('state'); + + // Show modal based on which step user is + if (Object.keys(USER_STATUSES).includes(current_step)) { + showModal(USER_STATUSES[current_step]); + } +}); \ No newline at end of file diff --git a/ckanext/justicehub_theme/lib/helpers.py b/ckanext/justicehub_theme/lib/helpers.py index 4e28eecc..4bd211f4 100644 --- a/ckanext/justicehub_theme/lib/helpers.py +++ b/ckanext/justicehub_theme/lib/helpers.py @@ -6,9 +6,14 @@ from sqlalchemy import MetaData from sqlalchemy.sql import select +import ckan.lib.dictization.model_dictize as model_dictize + import ckan.logic as logic import ckan.model as model from ckan.common import c +from six import string_types, text_type +from webhelpers.html import tags +import ckan.lib.helpers as h cached_tables = {} @@ -108,3 +113,74 @@ def get_package_visits(pkg): total = res.running_total recent = res.recent_views return {'total' : total, 'recent': recent} + + + +def get_popular_groups(): + + context = {} + data_dict = {'sort': 'package_count desc', + 'all_fields': True, + 'include_dataset_count': True} + + groups = logic.get_action('group_list')(context, data_dict) + return groups[0:12] + + + #context = {'model': model} + + #TODO: short the groups by number of datasets in it + #q = model.Session.query(model.Group) \ + # .filter(model.Group.is_organization == False) \ + # .filter(model.Group.state == 'active') \ + # .limit(12) + + + #groups = q.all() + + #group_list = model_dictize.group_list_dictize(groups, context) + #return group_list + + +def pop_zip_resource(pkg): + '''Finds the zip resource in a package's resources, removes it from the + package and returns it. NB the package doesn't have the zip resource in it + any more. + ''' + zip_res = None + non_zip_resources = [] + for res in pkg.get('resources', []): + if res.get('downloadall_metadata_modified'): + zip_res = res + else: + non_zip_resources.append(res) + pkg['resources'] = non_zip_resources + return zip_res + + + +def show_linked_user(user, maxlength=0, avatar=20): + if not isinstance(user, model.User): + user_name = text_type(user) + user = model.User.get(user_name) + if not user: + return user_name + if user: + name = user.name if model.User.VALID_NAME.match(user.name) else user.id + displayname = user.display_name + + if maxlength and len(user.display_name) > maxlength: + displayname = displayname[:maxlength] + '...' + + return tags.literal(u'{icon} {link}'.format( + icon=h.gravatar( + email_hash=user.email_hash, + size=avatar + ), + link=tags.link_to( + displayname, + ('/user/show/' + name) + ) + )) + + diff --git a/ckanext/justicehub_theme/logic/action/__init__.py b/ckanext/justicehub_theme/logic/action/__init__.py index 249778e4..8e2090b1 100644 --- a/ckanext/justicehub_theme/logic/action/__init__.py +++ b/ckanext/justicehub_theme/logic/action/__init__.py @@ -2,5 +2,7 @@ partner_users_autocomplete, get_package_owner_details, metadata_autocomplete, - resource_metadata_autocomplete + resource_metadata_autocomplete, + package_search, + package_show ) diff --git a/ckanext/justicehub_theme/logic/action/action.py b/ckanext/justicehub_theme/logic/action/action.py index 84adbdd6..74ec1c34 100644 --- a/ckanext/justicehub_theme/logic/action/action.py +++ b/ckanext/justicehub_theme/logic/action/action.py @@ -1,5 +1,4 @@ from ckanext.issues.logic import schema -from six import string_types import ckan.lib.dictization.model_dictize as model_dictize import ckan.model as model @@ -7,6 +6,33 @@ from ckan.logic import validate +import logging +import socket +import json + +from paste.deploy.converters import asbool +from six import string_types, text_type + +import ckan.logic as logic +import ckan.logic.schema +import ckan.plugins as plugins +import ckan.lib.search as search +import ckan.lib.plugins as lib_plugins + +# TODO: Wrong way of doing +from ckan.logic.action.get import _add_tracking_summary_to_resource_dict, _get_or_bust +import ckan.authz as authz + + +_validate = ckan.lib.navl.dictization_functions.validate +NotFound = logic.NotFound +ValidationError = logic.ValidationError +_check_access = logic.check_access +get_action = logic.get_action + +log = logging.getLogger('ckan.logic') + + @p.toolkit.side_effect_free @validate(schema.organization_users_autocomplete_schema) def partner_users_autocomplete(context, data_dict): @@ -107,3 +133,289 @@ def resource_metadata_autocomplete(context, data_dict): matching = [result[0] for result in results] return matching + + +@p.toolkit.side_effect_free +def package_show(context, data_dict): + '''Return the metadata of a dataset (package) and its resources. + + :param id: the id or name of the dataset + :type id: string + :param use_default_schema: use default package schema instead of + a custom schema defined with an IDatasetForm plugin (default: ``False``) + :type use_default_schema: bool + :param include_tracking: add tracking information to dataset and + resources (default: ``False``) + :type include_tracking: bool + :rtype: dictionary + + ''' + print("NEW PACKAGE SHOW") + model = context['model'] + context['session'] = model.Session + name_or_id = data_dict.get("id") or _get_or_bust(data_dict, 'name_or_id') + + pkg = model.Package.get(name_or_id) + + if pkg is None: + raise NotFound + + context['package'] = pkg + + _check_access('package_show', context, data_dict) + + if data_dict.get('use_default_schema', False): + context['schema'] = ckan.logic.schema.default_show_package_schema() + include_tracking = asbool(data_dict.get('include_tracking', False)) + + package_dict = None + use_cache = (context.get('use_cache', True) + and not 'revision_id' in context + and not 'revision_date' in context) + if use_cache: + try: + search_result = search.show(name_or_id) + except (search.SearchError, socket.error): + pass + else: + use_validated_cache = 'schema' not in context + if use_validated_cache and 'validated_data_dict' in search_result: + package_json = search_result['validated_data_dict'] + package_dict = json.loads(package_json) + package_dict_validated = True + else: + package_dict = json.loads(search_result['data_dict']) + package_dict_validated = False + metadata_modified = pkg.metadata_modified.isoformat() + search_metadata_modified = search_result['metadata_modified'] + # solr stores less precice datetime, + # truncate to 22 charactors to get good enough match + if metadata_modified[:22] != search_metadata_modified[:22]: + package_dict = None + + if not package_dict: + package_dict = model_dictize.package_dictize(pkg, context) + package_dict_validated = False + + if include_tracking: + # page-view tracking summary data + package_dict['tracking_summary'] = ( + model.TrackingSummary.get_for_package(package_dict['id'])) + + for resource_dict in package_dict['resources']: + _add_tracking_summary_to_resource_dict(resource_dict, model) + + if context.get('for_view'): + for item in plugins.PluginImplementations(plugins.IPackageController): + package_dict = item.before_view(package_dict) + + for item in plugins.PluginImplementations(plugins.IPackageController): + item.read(pkg) + + for item in plugins.PluginImplementations(plugins.IResourceController): + for resource_dict in package_dict['resources']: + item.before_show(resource_dict) + + if not package_dict_validated: + package_plugin = lib_plugins.lookup_package_plugin( + package_dict['type']) + if 'schema' in context: + schema = context['schema'] + else: + schema = package_plugin.show_package_schema() + if schema and context.get('validate', True): + package_dict, errors = lib_plugins.plugin_validate( + package_plugin, context, package_dict, schema, + 'package_show') + + for item in plugins.PluginImplementations(plugins.IPackageController): + item.after_show(context, package_dict) + + new_dict = {'id': package_dict['creator_user_id']} + user_dict = get_action('user_show')(context, new_dict) + package_dict['creator_name'] = user_dict.get('display_name') + package_dict['creator_username'] = user_dict.get('name') + package_dict['creator_email'] = user_dict.get('email') + if (package_dict.get('extras')): + publisher_contact = next((sub for sub in package_dict['extras'] if sub['key'] == 'publisher_contacts'), None) + package_dict['publisher_name'] = json.loads(publisher_contact.get('value'))[0].get('name') if publisher_contact else "" + return package_dict + + +@p.toolkit.side_effect_free +def package_search(context, data_dict): + # sometimes context['schema'] is None + schema = (context.get('schema') or + logic.schema.default_package_search_schema()) + data_dict, errors = _validate(data_dict, schema, context) + # put the extras back into the data_dict so that the search can + # report needless parameters + data_dict.update(data_dict.get('__extras', {})) + data_dict.pop('__extras', None) + if errors: + raise ValidationError(errors) + + model = context['model'] + session = context['session'] + user = context.get('user') + + _check_access('package_search', context, data_dict) + + # Move ext_ params to extras and remove them from the root of the search + # params, so they don't cause and error + data_dict['extras'] = data_dict.get('extras', {}) + for key in [key for key in data_dict.keys() if key.startswith('ext_')]: + data_dict['extras'][key] = data_dict.pop(key) + + # check if some extension needs to modify the search params + for item in plugins.PluginImplementations(plugins.IPackageController): + data_dict = item.before_search(data_dict) + + # the extension may have decided that it is not necessary to perform + # the query + abort = data_dict.get('abort_search', False) + + if data_dict.get('sort') in (None, 'rank'): + data_dict['sort'] = 'score desc, metadata_modified desc' + + results = [] + if not abort: + if asbool(data_dict.get('use_default_schema')): + data_source = 'data_dict' + else: + data_source = 'validated_data_dict' + data_dict.pop('use_default_schema', None) + + result_fl = data_dict.get('fl') + if not result_fl: + data_dict['fl'] = 'id {0}'.format(data_source) + else: + data_dict['fl'] = ' '.join(result_fl) + + # Remove before these hit solr FIXME: whitelist instead + include_private = asbool(data_dict.pop('include_private', False)) + include_drafts = asbool(data_dict.pop('include_drafts', False)) + data_dict.setdefault('fq', '') + if not include_private: + data_dict['fq'] = '({0}) AND {1}'.format(data_dict['fq'], 'capacity:public') #'capacity:public +' + data_dict['fq'] + if include_drafts: + data_dict['fq'] += ' +state:(active OR draft)' + + # Pop these ones as Solr does not need them + extras = data_dict.pop('extras', None) + + # enforce permission filter based on user + if context.get('ignore_auth') or (user and authz.is_sysadmin(user)): + labels = None + else: + labels = lib_plugins.get_permission_labels( + ).get_user_dataset_labels(context['auth_user_obj']) + + query = search.query_for(model.Package) + state_query = ' +state:(draft OR pending-review OR under-review OR resubmission-required OR rejected OR active)' + if data_dict['fq']: + data_dict['fq'] = '({0}) AND {1}'.format(data_dict['fq'], state_query) + else: + data_dict['fq'] = state_query + query.run(data_dict, permission_labels=labels) + + # Add them back so extensions can use them on after_search + data_dict['extras'] = extras + + if result_fl: + for package in query.results: + if isinstance(package, text_type): + package = {result_fl[0]: package} + if package.get('extras'): + package.update(package['extras'] ) + package.pop('extras') + results.append(package) + else: + for package in query.results: + # get the package object + package_dict = package.get(data_source) + ## use data in search index if there + if package_dict: + # the package_dict still needs translating when being viewed + package_dict = json.loads(package_dict) + if context.get('for_view'): + for item in plugins.PluginImplementations( + plugins.IPackageController): + package_dict = item.before_view(package_dict) + results.append(package_dict) + else: + log.error('No package_dict is coming from solr for package ' + 'id %s', package['id']) + + count = query.count + facets = query.facets + else: + count = 0 + facets = {} + results = [] + + search_results = { + 'count': count, + 'facets': facets, + 'results': results, + 'sort': data_dict['sort'] + } + + # create a lookup table of group name to title for all the groups and + # organizations in the current search's facets. + group_names = [] + for field_name in ('groups', 'organization'): + group_names.extend(facets.get(field_name, {}).keys()) + + groups = (session.query(model.Group.name, model.Group.title) + .filter(model.Group.name.in_(group_names)) + .all() + if group_names else []) + group_titles_by_name = dict(groups) + + # Transform facets into a more useful data structure. + restructured_facets = {} + for key, value in facets.items(): + restructured_facets[key] = { + 'title': key, + 'items': [] + } + for key_, value_ in value.items(): + new_facet_dict = {} + new_facet_dict['name'] = key_ + if key in ('groups', 'organization'): + display_name = group_titles_by_name.get(key_, key_) + display_name = display_name if display_name and display_name.strip() else key_ + new_facet_dict['display_name'] = display_name + elif key == 'license_id': + license = model.Package.get_license_register().get(key_) + if license: + new_facet_dict['display_name'] = license.title + else: + new_facet_dict['display_name'] = key_ + else: + new_facet_dict['display_name'] = key_ + new_facet_dict['count'] = value_ + restructured_facets[key]['items'].append(new_facet_dict) + search_results['search_facets'] = restructured_facets + + # check if some extension needs to modify the search results + for item in plugins.PluginImplementations(plugins.IPackageController): + search_results = item.after_search(search_results, data_dict) + + # After extensions have had a chance to modify the facets, sort them by + # display name. + for facet in search_results['search_facets']: + search_results['search_facets'][facet]['items'] = sorted( + search_results['search_facets'][facet]['items'], + key=lambda facet: facet['display_name'], reverse=True) + + #TODO: move this inside query isntead of adding separately + for package in search_results['results']: + new_dict = {'id': package['creator_user_id']} + user_dict = get_action('user_show')(context, new_dict) + package['creator_name'] = user_dict.get('display_name') + package['creator_username'] = user_dict.get('name') + package['creator_email'] = user_dict.get('email') + + return search_results diff --git a/ckanext/justicehub_theme/plugin.py b/ckanext/justicehub_theme/plugin.py index e8d55cd5..9f8fb8f1 100644 --- a/ckanext/justicehub_theme/plugin.py +++ b/ckanext/justicehub_theme/plugin.py @@ -36,14 +36,18 @@ def get_helpers(self): 'justicehub_theme_parse_json': helpers.parse_json, 'justicehub_theme_get_assignee_user': helpers.get_assignee_user, 'justicehub_theme_issue_vars': helpers.issues_vars, - 'justicehub_theme_is_org_admin': helpers.is_org_admin + 'justicehub_theme_is_org_admin': helpers.is_org_admin, + 'justicehub_theme_get_popular_groups': helpers.get_popular_groups, + 'justicehub_theme_pop_zip_resource': helpers.pop_zip_resource, + 'justicehub_theme_show_linked_user': helpers.show_linked_user } #IActions def get_actions(self): - return dict((name, function) for name, function + temp = dict((name, function) for name, function in jh_action.__dict__.items() if callable(function)) + return temp # IPackageController @@ -58,20 +62,21 @@ def before_view(self, package_dict): u'''Extensions will receive a dictionary with the query parameters, and should return a modified (or not) version of it. ''' - for resource_dict in package_dict['resources']: - resource_dict['downloads'] = helpers.get_resource_downloads(resource_dict) + #for resource_dict in package_dict['resources']: + # resource_dict['downloads'] = helpers.get_resource_downloads(resource_dict) package_dict['tracking_summary'] = ( model.TrackingSummary.get_for_package(package_dict['id'])) - context = {'model': model, 'session': model.Session, - 'user': c.user, 'for_view': True, - 'auth_user_obj': c.userobj} - partner = toolkit.get_action('get_package_owner_details')( - context, - data_dict={'org_id': package_dict['owner_org']} - ) - package_dict['partner'] = partner + # context = {'model': model, 'session': model.Session, + # 'user': c.user, 'for_view': True, + # 'auth_user_obj': c.userobj} + # print(package_dict) + # partner = toolkit.get_action('get_package_owner_details')( + # context, + # data_dict={'org_id': package_dict['owner_org']} + # ) + # package_dict['partner'] = partner return package_dict def after_search(self, search_results, search_params): @@ -99,11 +104,12 @@ def after_delete(self, context, pkg_dict): pass def after_show(self, context, pkg_dict): - partner = toolkit.get_action('get_package_owner_details')( - context, - data_dict={'org_id': pkg_dict['owner_org']} - ) - pkg_dict['partner'] = partner + pass + # partner = toolkit.get_action('get_package_owner_details')( + # context, + # data_dict={'org_id': pkg_dict['owner_org']} + # ) + # pkg_dict['partner'] = partner def before_index(self, pkg_dict): return pkg_dict @@ -119,10 +125,23 @@ def after_map(self, map): map.connect('jhsubscribe', '/subscribe', controller='ckanext.justicehub_theme.controllers:SubscribeController', action='subscribe') + map.connect('jhupload', '/upload', + controller='ckanext.justicehub_theme.controllers:SubscribeController', + action='upload') + map.connect('jhdataset', '/dataset', + controller='ckanext.justicehub_theme.controllers.dataset:PackageNewController', + action='search') + map.connect('jhreaduser', '/user/show/{id}', + controller='ckanext.justicehub_theme.controllers.dataset:UserNewController', + action='read') + return map def before_map(self, map): + map.connect('jhupload', '/upload', + controller='ckanext.justicehub_theme.controllers:SubscribeController', + action='upload') map.connect('jhorg_members', '/organization/members/{id}', controller='ckanext.justicehub_theme.controllers:JHOrgController', action='members') @@ -132,4 +151,9 @@ def before_map(self, map): map.connect('jhsubscribe', '/subscribe', controller='ckanext.justicehub_theme.controllers:SubscribeController', action='subscribe') + map.connect('jhdataset', '/dataset', + controller='ckanext.justicehub_theme.controllers.dataset:PackageNewController', + action='search') + + return map diff --git a/ckanext/justicehub_theme/public/assets/agami_dark.png b/ckanext/justicehub_theme/public/assets/agami_dark.png new file mode 100644 index 00000000..0c979a87 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/agami_dark.png differ diff --git a/ckanext/justicehub_theme/public/assets/agami_light.svg b/ckanext/justicehub_theme/public/assets/agami_light.svg new file mode 100644 index 00000000..928e2be9 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/agami_light.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ckanext/justicehub_theme/public/assets/cdl_light.svg b/ckanext/justicehub_theme/public/assets/cdl_light.svg new file mode 100644 index 00000000..16d2ba86 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/cdl_light.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ckanext/justicehub_theme/public/assets/cdl_primary.png b/ckanext/justicehub_theme/public/assets/cdl_primary.png new file mode 100644 index 00000000..c8146dda Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/cdl_primary.png differ diff --git a/ckanext/justicehub_theme/public/assets/company_1.png b/ckanext/justicehub_theme/public/assets/company_1.png new file mode 100644 index 00000000..c0c43c29 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/company_1.png differ diff --git a/ckanext/justicehub_theme/public/assets/company_2.png b/ckanext/justicehub_theme/public/assets/company_2.png new file mode 100644 index 00000000..e88c6fd1 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/company_2.png differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/P39A.png b/ckanext/justicehub_theme/public/assets/contributors/P39A.png new file mode 100644 index 00000000..9e1b2d49 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/P39A.png differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/amirapu.JPG b/ckanext/justicehub_theme/public/assets/contributors/amirapu.JPG new file mode 100644 index 00000000..25a61c49 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/amirapu.JPG differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/boehm.jpg b/ckanext/justicehub_theme/public/assets/contributors/boehm.jpg new file mode 100644 index 00000000..522b7295 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/boehm.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/chri.png b/ckanext/justicehub_theme/public/assets/contributors/chri.png new file mode 100644 index 00000000..78c36ba7 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/chri.png differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/clpr.svg b/ckanext/justicehub_theme/public/assets/contributors/clpr.svg new file mode 100644 index 00000000..fa7af880 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/contributors/clpr.svg @@ -0,0 +1 @@ +Asset 11 \ No newline at end of file diff --git a/ckanext/justicehub_theme/public/assets/contributors/ddl.png b/ckanext/justicehub_theme/public/assets/contributors/ddl.png new file mode 100644 index 00000000..996a3f8e Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/ddl.png differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/haq.png b/ckanext/justicehub_theme/public/assets/contributors/haq.png new file mode 100644 index 00000000..687b9e4b Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/haq.png differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/idfc.svg b/ckanext/justicehub_theme/public/assets/contributors/idfc.svg new file mode 100644 index 00000000..a74d0cc3 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/contributors/idfc.svg @@ -0,0 +1 @@ +IDFC_Institute_LogoArtboard 1 \ No newline at end of file diff --git a/ckanext/justicehub_theme/public/assets/contributors/iff.png b/ckanext/justicehub_theme/public/assets/contributors/iff.png new file mode 100644 index 00000000..29d85be6 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/iff.png differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/igidr.png b/ckanext/justicehub_theme/public/assets/contributors/igidr.png new file mode 100644 index 00000000..1e11dc00 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/igidr.png differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/indiankanoon.png b/ckanext/justicehub_theme/public/assets/contributors/indiankanoon.png new file mode 100644 index 00000000..5833346a Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/indiankanoon.png differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/madhav.jpg b/ckanext/justicehub_theme/public/assets/contributors/madhav.jpg new file mode 100644 index 00000000..880c22fb Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/madhav.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/nipfp.png b/ckanext/justicehub_theme/public/assets/contributors/nipfp.png new file mode 100644 index 00000000..89e4a936 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/nipfp.png differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/rao.jpg b/ckanext/justicehub_theme/public/assets/contributors/rao.jpg new file mode 100644 index 00000000..330baf55 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/rao.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/studio-nilima.jpg b/ckanext/justicehub_theme/public/assets/contributors/studio-nilima.jpg new file mode 100644 index 00000000..8a1b1f94 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/studio-nilima.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/tata.png b/ckanext/justicehub_theme/public/assets/contributors/tata.png new file mode 100644 index 00000000..c468f571 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/tata.png differ diff --git a/ckanext/justicehub_theme/public/assets/contributors/vidhi.jpg b/ckanext/justicehub_theme/public/assets/contributors/vidhi.jpg new file mode 100644 index 00000000..aaa452d3 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/contributors/vidhi.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/dataset_image.svg b/ckanext/justicehub_theme/public/assets/dataset_image.svg new file mode 100644 index 00000000..2ca11e60 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/dataset_image.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/ckanext/justicehub_theme/public/assets/explore_background.png b/ckanext/justicehub_theme/public/assets/explore_background.png new file mode 100644 index 00000000..f363076a Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/explore_background.png differ diff --git a/ckanext/justicehub_theme/public/assets/feedback.png b/ckanext/justicehub_theme/public/assets/feedback.png new file mode 100644 index 00000000..bbc44c7d Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/feedback.png differ diff --git a/ckanext/justicehub_theme/public/assets/hero_background.png b/ckanext/justicehub_theme/public/assets/hero_background.png new file mode 100644 index 00000000..2c4ac896 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/hero_background.png differ diff --git a/ckanext/justicehub_theme/public/assets/icons/about.svg b/ckanext/justicehub_theme/public/assets/icons/about.svg new file mode 100644 index 00000000..a320a850 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/about.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/authenticity.svg b/ckanext/justicehub_theme/public/assets/icons/authenticity.svg new file mode 100644 index 00000000..09e84f5c --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/authenticity.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/blog.svg b/ckanext/justicehub_theme/public/assets/icons/blog.svg new file mode 100644 index 00000000..ac8b3537 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/blog.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/book_icon.svg b/ckanext/justicehub_theme/public/assets/icons/book_icon.svg new file mode 100644 index 00000000..05a26990 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/book_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/childrights.svg b/ckanext/justicehub_theme/public/assets/icons/childrights.svg new file mode 100644 index 00000000..8444bb04 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/childrights.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/completeness.svg b/ckanext/justicehub_theme/public/assets/icons/completeness.svg new file mode 100644 index 00000000..55326ee3 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/completeness.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/constitution.svg b/ckanext/justicehub_theme/public/assets/icons/constitution.svg new file mode 100644 index 00000000..05c5f06d --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/constitution.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/contact.svg b/ckanext/justicehub_theme/public/assets/icons/contact.svg new file mode 100644 index 00000000..803a5de4 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/contact.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/contribute.svg b/ckanext/justicehub_theme/public/assets/icons/contribute.svg new file mode 100644 index 00000000..7bd69a90 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/contribute.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/corporate.svg b/ckanext/justicehub_theme/public/assets/icons/corporate.svg new file mode 100644 index 00000000..16134936 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/corporate.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/courts.svg b/ckanext/justicehub_theme/public/assets/icons/courts.svg new file mode 100644 index 00000000..5bfb5d5e --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/courts.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/economy.svg b/ckanext/justicehub_theme/public/assets/icons/economy.svg new file mode 100644 index 00000000..eb705477 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/economy.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/education.svg b/ckanext/justicehub_theme/public/assets/icons/education.svg new file mode 100644 index 00000000..68463239 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/education.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/explore.svg b/ckanext/justicehub_theme/public/assets/icons/explore.svg new file mode 100644 index 00000000..13b6abd7 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/explore.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/facebook.svg b/ckanext/justicehub_theme/public/assets/icons/facebook.svg new file mode 100644 index 00000000..a3dff021 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/facebook.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/getintouch.svg b/ckanext/justicehub_theme/public/assets/icons/getintouch.svg new file mode 100644 index 00000000..a4fe6d3b --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/getintouch.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/github.svg b/ckanext/justicehub_theme/public/assets/icons/github.svg new file mode 100644 index 00000000..51c4414b --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/github.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/health.svg b/ckanext/justicehub_theme/public/assets/icons/health.svg new file mode 100644 index 00000000..40fbcb8e --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/health.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/home.svg b/ckanext/justicehub_theme/public/assets/icons/home.svg new file mode 100644 index 00000000..2286b0e8 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/home.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/humanrights.svg b/ckanext/justicehub_theme/public/assets/icons/humanrights.svg new file mode 100644 index 00000000..b390cbe5 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/humanrights.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/judges.png b/ckanext/justicehub_theme/public/assets/icons/judges.png new file mode 100644 index 00000000..8b7237ee Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/icons/judges.png differ diff --git a/ckanext/justicehub_theme/public/assets/icons/judges.svg b/ckanext/justicehub_theme/public/assets/icons/judges.svg new file mode 100644 index 00000000..52365a12 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/judges.svg @@ -0,0 +1 @@ +bryanlowCreated by Blair Adamsfrom the Noun Project \ No newline at end of file diff --git a/ckanext/justicehub_theme/public/assets/icons/judicial-reforms.png b/ckanext/justicehub_theme/public/assets/icons/judicial-reforms.png new file mode 100644 index 00000000..740571fc Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/icons/judicial-reforms.png differ diff --git a/ckanext/justicehub_theme/public/assets/icons/judicial-reforms.svg b/ckanext/justicehub_theme/public/assets/icons/judicial-reforms.svg new file mode 100644 index 00000000..3a67018f --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/judicial-reforms.svg @@ -0,0 +1 @@ +innovation-adjustment- reform- reorganization- improvementCreated by Sumit Saengthongfrom the Noun Project \ No newline at end of file diff --git a/ckanext/justicehub_theme/public/assets/icons/landrights.svg b/ckanext/justicehub_theme/public/assets/icons/landrights.svg new file mode 100644 index 00000000..e484b9f2 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/landrights.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/laws.png b/ckanext/justicehub_theme/public/assets/icons/laws.png new file mode 100644 index 00000000..c19c0f38 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/icons/laws.png differ diff --git a/ckanext/justicehub_theme/public/assets/icons/laws.svg b/ckanext/justicehub_theme/public/assets/icons/laws.svg new file mode 100644 index 00000000..690bbf33 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/laws.svg @@ -0,0 +1 @@ +32Created by Adiyogifrom the Noun Project \ No newline at end of file diff --git a/ckanext/justicehub_theme/public/assets/icons/legalaid.svg b/ckanext/justicehub_theme/public/assets/icons/legalaid.svg new file mode 100644 index 00000000..1f67464c --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/legalaid.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/login.svg b/ckanext/justicehub_theme/public/assets/icons/login.svg new file mode 100644 index 00000000..c28d1838 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/login.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/menu.svg b/ckanext/justicehub_theme/public/assets/icons/menu.svg new file mode 100644 index 00000000..94bf7d22 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/menu.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/migration.svg b/ckanext/justicehub_theme/public/assets/icons/migration.svg new file mode 100644 index 00000000..971bd2f4 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/migration.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/movie_icon.svg b/ckanext/justicehub_theme/public/assets/icons/movie_icon.svg new file mode 100644 index 00000000..91677002 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/movie_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/policing.svg b/ckanext/justicehub_theme/public/assets/icons/policing.svg new file mode 100644 index 00000000..d0d69723 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/policing.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/prison.png b/ckanext/justicehub_theme/public/assets/icons/prison.png new file mode 100644 index 00000000..b83da107 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/icons/prison.png differ diff --git a/ckanext/justicehub_theme/public/assets/icons/prison.svg b/ckanext/justicehub_theme/public/assets/icons/prison.svg new file mode 100644 index 00000000..0836cff7 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/prison.svg @@ -0,0 +1 @@ +Created by Edwin PMfrom the Noun Project \ No newline at end of file diff --git a/ckanext/justicehub_theme/public/assets/icons/proofread.svg b/ckanext/justicehub_theme/public/assets/icons/proofread.svg new file mode 100644 index 00000000..9992b42e --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/proofread.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/resources.svg b/ckanext/justicehub_theme/public/assets/icons/resources.svg new file mode 100644 index 00000000..5abc2f68 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/resources.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/search.svg b/ckanext/justicehub_theme/public/assets/icons/search.svg new file mode 100644 index 00000000..5a81e5e1 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/search.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/terms.svg b/ckanext/justicehub_theme/public/assets/icons/terms.svg new file mode 100644 index 00000000..7495d979 --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/terms.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/ckanext/justicehub_theme/public/assets/icons/twitter.svg b/ckanext/justicehub_theme/public/assets/icons/twitter.svg new file mode 100644 index 00000000..dc77b04d --- /dev/null +++ b/ckanext/justicehub_theme/public/assets/icons/twitter.svg @@ -0,0 +1,3 @@ + + + diff --git a/ckanext/justicehub_theme/public/assets/jh_logo.png b/ckanext/justicehub_theme/public/assets/jh_logo.png new file mode 100644 index 00000000..904ef7a5 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/jh_logo.png differ diff --git a/ckanext/justicehub_theme/public/assets/jh_logo_notext.png b/ckanext/justicehub_theme/public/assets/jh_logo_notext.png new file mode 100644 index 00000000..421e4681 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/jh_logo_notext.png differ diff --git a/ckanext/justicehub_theme/public/assets/jh_logo_white.png b/ckanext/justicehub_theme/public/assets/jh_logo_white.png new file mode 100644 index 00000000..efe81592 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/jh_logo_white.png differ diff --git a/ckanext/justicehub_theme/public/assets/jh_logomark.png b/ckanext/justicehub_theme/public/assets/jh_logomark.png new file mode 100644 index 00000000..421e4681 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/jh_logomark.png differ diff --git a/ckanext/justicehub_theme/public/assets/person_1.png b/ckanext/justicehub_theme/public/assets/person_1.png new file mode 100644 index 00000000..75cd0642 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/person_1.png differ diff --git a/ckanext/justicehub_theme/public/assets/person_2.png b/ckanext/justicehub_theme/public/assets/person_2.png new file mode 100644 index 00000000..d5f7c45b Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/person_2.png differ diff --git a/ckanext/justicehub_theme/public/assets/team/abhinav.png b/ckanext/justicehub_theme/public/assets/team/abhinav.png new file mode 100644 index 00000000..d4c7aa5d Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/abhinav.png differ diff --git a/ckanext/justicehub_theme/public/assets/team/akhil.jpeg b/ckanext/justicehub_theme/public/assets/team/akhil.jpeg new file mode 100644 index 00000000..1a1a6499 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/akhil.jpeg differ diff --git a/ckanext/justicehub_theme/public/assets/team/apoorv.png b/ckanext/justicehub_theme/public/assets/team/apoorv.png new file mode 100644 index 00000000..631c39c5 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/apoorv.png differ diff --git a/ckanext/justicehub_theme/public/assets/team/charlie.jpg b/ckanext/justicehub_theme/public/assets/team/charlie.jpg new file mode 100644 index 00000000..5bcc98c3 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/charlie.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/team/dc.jpg b/ckanext/justicehub_theme/public/assets/team/dc.jpg new file mode 100644 index 00000000..c15f08f1 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/dc.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/team/divya.jpg b/ckanext/justicehub_theme/public/assets/team/divya.jpg new file mode 100644 index 00000000..574a28f2 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/divya.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/team/gaurav.jpg b/ckanext/justicehub_theme/public/assets/team/gaurav.jpg new file mode 100644 index 00000000..7647d883 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/gaurav.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/team/saurabh.jpg b/ckanext/justicehub_theme/public/assets/team/saurabh.jpg new file mode 100644 index 00000000..a31d2aaa Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/saurabh.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/team/saurav.jpeg b/ckanext/justicehub_theme/public/assets/team/saurav.jpeg new file mode 100644 index 00000000..2b6f1761 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/saurav.jpeg differ diff --git a/ckanext/justicehub_theme/public/assets/team/shashank.jpg b/ckanext/justicehub_theme/public/assets/team/shashank.jpg new file mode 100644 index 00000000..3e66549f Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/shashank.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/team/supriya.jpg b/ckanext/justicehub_theme/public/assets/team/supriya.jpg new file mode 100644 index 00000000..daccd4a3 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/supriya.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/team/swati.jpg b/ckanext/justicehub_theme/public/assets/team/swati.jpg new file mode 100644 index 00000000..526934d8 Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/swati.jpg differ diff --git a/ckanext/justicehub_theme/public/assets/team/varun.jpg b/ckanext/justicehub_theme/public/assets/team/varun.jpg new file mode 100644 index 00000000..016a0bcf Binary files /dev/null and b/ckanext/justicehub_theme/public/assets/team/varun.jpg differ diff --git a/ckanext/justicehub_theme/public/bootstrap-multiselect.min.css b/ckanext/justicehub_theme/public/bootstrap-multiselect.min.css new file mode 100644 index 00000000..5a99da0d --- /dev/null +++ b/ckanext/justicehub_theme/public/bootstrap-multiselect.min.css @@ -0,0 +1 @@ +span.multiselect-native-select{position:relative}span.multiselect-native-select select{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px -1px -1px -3px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important;left:50%;top:30px}.multiselect.dropdown-toggle:after{display:none}.multiselect-container{position:absolute;list-style-type:none;margin:0;padding:0}.multiselect-container .multiselect-reset .input-group{width:93%}.multiselect-container .multiselect-filter>.fa-search{z-index:1;padding-left:.75rem}.multiselect-container .multiselect-filter>input.multiselect-search{border:none;border-bottom:1px solid #d3d3d3;padding-left:2rem;margin-left:-1.625rem;border-bottom-right-radius:0;border-bottom-left-radius:0}.multiselect-container .multiselect-filter>input.multiselect-search:focus{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.multiselect-container .multiselect-filter>.multiselect-moz-clear-filter{margin-left:-1.5rem;display:none}.multiselect-container .multiselect-option.multiselect-group-option-indented{padding-left:1.75rem}.multiselect-container .multiselect-all,.multiselect-container .multiselect-group,.multiselect-container .multiselect-option{padding:.25rem .25rem .25rem .75rem}.multiselect-container .multiselect-all.dropdown-item,.multiselect-container .multiselect-all.dropdown-toggle,.multiselect-container .multiselect-group.dropdown-item,.multiselect-container .multiselect-group.dropdown-toggle,.multiselect-container .multiselect-option.dropdown-item,.multiselect-container .multiselect-option.dropdown-toggle{cursor:pointer}.multiselect-container .multiselect-all .form-check-label,.multiselect-container .multiselect-group .form-check-label,.multiselect-container .multiselect-option .form-check-label{cursor:pointer}.multiselect-container .multiselect-all.active:not(.multiselect-active-item-fallback),.multiselect-container .multiselect-all:not(.multiselect-active-item-fallback):active,.multiselect-container .multiselect-group.active:not(.multiselect-active-item-fallback),.multiselect-container .multiselect-group:not(.multiselect-active-item-fallback):active,.multiselect-container .multiselect-option.active:not(.multiselect-active-item-fallback),.multiselect-container .multiselect-option:not(.multiselect-active-item-fallback):active{background-color:#d3d3d3;color:#000}.multiselect-container .multiselect-all .form-check,.multiselect-container .multiselect-group .form-check,.multiselect-container .multiselect-option .form-check{padding:0 5px 0 20px}.multiselect-container .multiselect-all:focus,.multiselect-container .multiselect-group:focus,.multiselect-container .multiselect-option:focus{outline:0}.form-inline .multiselect-container span.form-check{padding:3px 20px 3px 40px}.input-group.input-group-sm>.multiselect-native-select .multiselect{padding:.25rem .5rem;font-size:.875rem;line-height:1.5;padding-right:1.75rem;height:calc(1.5em + .5rem + 2px)}.input-group>.multiselect-native-select{flex:1 1 auto;width:1%}.input-group>.multiselect-native-select>div.btn-group{width:100%}.input-group>.multiselect-native-select:not(:first-child) .multiselect{border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.multiselect-native-select:not(:last-child) .multiselect{border-top-right-radius:0;border-bottom-right-radius:0} \ No newline at end of file diff --git a/ckanext/justicehub_theme/public/common.css b/ckanext/justicehub_theme/public/common.css index 45b765e7..513520e1 100644 --- a/ckanext/justicehub_theme/public/common.css +++ b/ckanext/justicehub_theme/public/common.css @@ -52,7 +52,7 @@ body, #field-giant-search, .partner-links.social-links .fa, .search-form .search-input.search-giant input { - font-size: 20px; + /* font-size: 20px; */ } h1, .col2 p, @@ -398,7 +398,7 @@ img.fa-certificate.fa-lg { height: 28px; } .dropdown-toggle .caret { - width: 10px; + /* width: 10px; */ } .subscribe-error, .subscribe-success { diff --git a/ckanext/justicehub_theme/public/home.js b/ckanext/justicehub_theme/public/home.js new file mode 100644 index 00000000..22adc432 --- /dev/null +++ b/ckanext/justicehub_theme/public/home.js @@ -0,0 +1,100 @@ +(function () { + // Code for adding contributors to the homepage + + const contributors = [ + { name: `Indian Kanoon`, imagePath: '/assets/contributors/indiankanoon.png' }, + { name: `HAQ`, imagePath: '/assets/contributors/haq.png' }, + { name: `Project 39A`, imagePath: '/assets/contributors/P39A.png' }, + { name: `Vidhi`, imagePath: '/assets/contributors/vidhi.jpg' }, + { name: `CHRI`, imagePath: '/assets/contributors/chri.png' }, + { name: `NIPFP`, imagePath: '/assets/contributors/nipfp.png' }, + { name: `CLPR`, imagePath: '/assets/contributors/clpr.svg' }, + { name: `IDFC`, imagePath: '/assets/contributors/idfc.svg' }, + { name: `Tata Trusts`, imagePath: '/assets/contributors/tata.png' }, + { name: `DevDataLab`, imagePath: '/assets/contributors/ddl.png' }, + { name: `Studio Nilima`, imagePath: '/assets/contributors/studio-nilima.jpg' }, + { name: `Internet Freedom Foundation`, imagePath: '/assets/contributors/iff.png' }, + { name: `Madhav S Aney`, type: 'person', imagePath: '/assets/contributors/madhav.jpg' }, + { name: `Manaswini Rao`, type: 'person', imagePath: '/assets/contributors/rao.jpg' }, + { name: `Johannes Boehm`, type: 'person', imagePath: '/assets/contributors/boehm.jpg' }, + { name: `Amrit Amirapu`, type: 'person', imagePath: '/assets/contributors/amirapu.JPG' } + ]; + + function contributorTemplate(contributor) { + return ` +
+
+ ${contributor.name} +
+ ${contributor.type === 'person' ? `

${contributor.name}

` : ``} +
+ `; + } + + const individualContributors = contributors.filter((contributor) => contributor.type === 'person'); + + const orgContributors = contributors.filter((contributor) => !contributor.type); + + const individualContributorsRow = document.querySelector('.contributors-row--individual'); + const orgContributorsRow = document.querySelector('.contributors-row--org'); + + individualContributors.forEach( + (contributor) => + (individualContributorsRow.innerHTML += contributorTemplate(contributor)) + ); + + orgContributors.forEach( + (contributor) => + (orgContributorsRow.innerHTML += contributorTemplate(contributor)) + ); + + const switchToSignIn = document.querySelector('.click-to-login'); + const switchToSignUp = document.querySelector('.click-to-signup'); + const switchToForgot = document.querySelector('.click-to-forgot'); + + switchToSignIn.addEventListener('click', () => { + $('#signUpModal').removeClass('fade').modal('hide'); + $('#signInModal').addClass('fade').modal('show'); + }); + + switchToSignUp.addEventListener('click', () => { + $('#signInModal').removeClass('fade').modal('hide'); + $('#signUpModal').addClass('fade').modal('show'); + }); + + switchToForgot.addEventListener('click', () => { + $('#signInModal').removeClass('fade').modal('hide'); + $('#signUpModal').removeClass('fade').modal('hide'); + $('#forgotPasswordModal').addClass('fade').modal('show'); + }); + + function debounce(func, wait, immediate) { + var timeout; + return function () { + var context = this, + args = arguments; + var later = function () { + timeout = null; + if (!immediate) func.apply(context, args); + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) func.apply(context, args); + }; + } + + const passwordRegex = new RegExp(/^(?=.*?[a-z])(?=.*?[0-9]).{8,}$/); + + const passwordField = document.querySelector('input[type="password"]'); + + const passwordValidator = debounce(function () { + if (!passwordRegex.test(this.value)) { + this.style.boxShadow = 'rgb(255, 0, 0) 0px 0px 1.5px 1px'; + } else { + this.style.boxShadow = 'none'; + } + }, 500); + + passwordField.addEventListener('keydown', passwordValidator); +})(); diff --git a/ckanext/justicehub_theme/public/jh_home_new1.css b/ckanext/justicehub_theme/public/jh_home_new1.css new file mode 100644 index 00000000..81538f1b --- /dev/null +++ b/ckanext/justicehub_theme/public/jh_home_new1.css @@ -0,0 +1,1861 @@ +:root { + --primary-color: #f65940; + --primary-color-dark: #e0462f; + --primary-background-color: #2a242d; +} + +body { + font-family: 'Roboto', sans-serif; + margin: 0; + padding: 0; + font-size: 18px; + background-color: white; +} + +a { + color: var(--primary-color); +} + +a:hover, +a:active { + color: var(--primary-color); +} + +.btn-primary, +.btn-primary:focus, +.btn-primary:active:focus, +.btn-primary:visited { + background-color: var(--primary-color); + color: white; + border-color: var(--primary-color); + transition: all 0.1s ease-in; +} + +.btn-primary:hover { + background-color: var(--primary-color-dark); + border-color: var(--primary-color-dark); +} + +.btn-primary-outline { + background-color: transparent; + color: var(--primary-color-dark); + border-color: var(--primary-color-dark); +} + +.btn-primary-outline:hover { + color: var(--primary-color); + border-color: var(--primary-color); +} + +.navbar { + height: 70px; + margin-bottom: 0; +} + +.navbar-default { + background-color: white; +} + +.navbar-default .navbar-nav > li > a, +.navbar-default .navbar-nav > li > .btn { + font-weight: 500; +} + +.navbar-default .navbar-nav > li > .btn { + margin-left: 15px; +} + +.navbar-default .navbar-nav > li > a { + font-size: 18px; + color: #000000; +} + +.navbar .custom-container { + display: flex; + align-items: center; + height: 100%; + justify-content: space-between; +} + +.mobile-menu { + display: none; +} + +.mobile-login { + display: none; +} + +.navbar-brand { + padding: 0; + display: flex; + justify-content: center; + align-items: center; +} + +.navbar-logo { + width: 150px; + height: auto; +} + +li.dropdown:focus { + background-color: white; +} + +.side-nav { + font-family: 'Montserrat', sans-serif; + height: 100%; + width: 280px; + padding-left: 25px; + margin-left: -280px; + position: fixed; + z-index: 1; + top: 0; + left: 0; + background-color: white; + color: #f65940; + overflow-x: hidden; + transition: 0.5s; + z-index: 999; +} + +.side-nav__header { + border-bottom: 1px solid #c4c4c4; + height: 60px; + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + left: -25px; +} + +.side-nav__brand { + width: 100px; + height: auto; +} + +.side-nav .closebtn { + font-size: 36px; + margin-right: 25px; + color: var(--primary-color); + text-decoration: none; +} + +.side-nav > a { + margin-top: 20px; + margin-bottom: 20px; + text-decoration: none; + font-size: 16px; + font-weight: 500; + color: var(--primary-color); + display: block; + transition: 0.3s; + display: flex; + align-items: center; +} + +.side-nav > a:hover { + color: var(--primary-color-dark); +} + +.side-nav > a img { + margin-right: 8px; +} + +@media (max-height: 450px) { + .side-nav { + padding-top: 15px; + } + .side-nav a { + font-size: 18px; + } + #carousel-testimonials { + text-align: center; + } +} + +.custom-container { + max-width: 1200px; + width: 100%; + margin-left: auto; + margin-right: auto; + padding-right: 16px; + padding-left: 16px; +} + +.modal-content.generic-modal-content { + max-width: 450px; + width: 100%; + box-sizing: border-box; + padding-bottom: 15px; + margin: 0 auto; + top: 90px; + font-family: 'Montserrat', sans-serif; +} + +.modal-header, +.modal-footer { + border: none; +} + +.modal-header .close span { + font-size: 2em; + height: 15px; +} + +.modal-header-info { + display: flex; + flex-direction: column; + align-items: center; + max-width: 400px; + width: 100%; + padding: 0 36px; + box-sizing: border-box; + margin: 0 auto; +} + +.modal-logo { + width: 80px; + height: 80px; +} + +.modal-header-info h4 { + font-size: 18px; + font-weight: 500; + margin-top: 0; +} + +.modal-header-info p { + text-align: center; + color: #6c666f; + font-size: 14px; + line-height: 20px; +} + +.modal-body.generic-modal-body { + max-width: 400px; + width: 100%; + padding-left: 36px; + padding-right: 36px; + padding-bottom: 30px; + box-sizing: border-box; + margin: 0 auto; +} + +.modal-body.generic-modal-body .input-group { + display: flex; + flex-direction: column; + margin-top: 14px; + margin-bottom: 14px; +} + +.modal-body.generic-modal-body .input-group label { + font-size: 12px; +} + +.modal-body.generic-modal-body span { + display: block; + font-size: 10px; + text-align: center; + margin-bottom: 14px; + margin-top: 18px; +} + +.modal-body.generic-modal-body span a { + color: #338ccd; + text-decoration: underline; +} + +.modal-body.generic-modal-body button { + width: 100%; + text-transform: uppercase; + font-size: 14px; + font-weight: 500; +} + +.modal-body.generic-modal-body p { + color: #6c666f; + text-align: center; + margin-top: 28px; + margin-bottom: 28px; +} + +.modal-body.generic-modal-body p a { + text-transform: uppercase; + color: #338ccd; + font-weight: 500; +} + +.toolbar { + display: none; +} + +/* hero section */ + +.hero-section { + background-image: url('./assets/hero_background.png'); + background-size: cover; + background-repeat: no-repeat; + color: white; + position: relative; +} + +.hero-section__overlay { + background-color: #201412; + opacity: 0.8; +} + +.hero-section__content { + margin-top: 120px; + margin-bottom: 360px; +} + +.hero-section__content h2 { + font-size: 48px; + font-weight: 500; + margin-top: 15px; + margin-bottom: 15px; +} + +.hero-section__content p { + font-weight: 500; + line-height: 30px; + margin-top: 25px; + margin-bottom: 25px; +} + +.hero-section__content .btn { + text-transform: uppercase; + font-weight: 500; + margin-right: 15px; + box-sizing: border-box; + padding: 10px 0px; + letter-spacing: 0.5px; + font-weight: 700; +} + +.categories { + position: absolute; + background-color: white; + color: black; + max-width: 1168px; + width: 100%; + top: 100%; + left: 50%; + transform: translate(-50%, -40%); + border-radius: 5px; +} + +.categories h3 { + font-size: 30px; + text-align: center; + margin-top: 30px; + margin-bottom: 30px; +} + +.categories__row { + padding-right: 72px; + padding-left: 72px; +} + +.category-item { + display: flex; + align-items: center; + margin-top: 34px; + margin-bottom: 34px; + cursor: pointer; +} + +.category-item p { + margin-bottom: 0; + margin-left: 12px; + min-height: 60px; +} + +.category-item .icon-container { + height: 90px; + width: 90px; + border-radius: 50%; + border: 1px solid black; + display: flex; + align-items: center; + justify-content: center; +} + +/* datasets section */ + +.datasets-section { + background-color: #2a242d; + padding-top: 480px; + padding-bottom: 20px; + color: white; +} + +.main-search { + max-width: 740px; + width: 100%; + margin-bottom: 120px; + margin-right: auto; + margin-left: auto; +} + +.main-search p { + text-align: center; + font-size: 24px; + font-weight: 500; +} + +/* .main-search .input-group {} */ + +.datasets-section__content img { + width: 340px; + height: auto; +} + +.datasets-section__content h2 { + font-size: 64px; + font-weight: 400; + letter-spacing: 3px; + margin-top: 15px; + margin-bottom: 15px; +} + +.datasets-section__content p { + line-height: 30px; + font-weight: 500; +} + +.dataset-action-row { + margin-top: 50px; +} + +.dataset-action-row a { + display: flex; + align-items: center; +} + +.dataset-action-row a img { + margin-bottom: 0; + margin-right: 8px; +} + +.dataset-action-row a:hover { + text-decoration: none; +} + +.dataset-action-row span { + color: var(--primary-color); + text-transform: uppercase; + font-weight: 700; +} + +.datasets-section__content .dataset-action-row img { + height: 28px; + width: auto; + margin-right: 8px; +} + +#howToUploadVideoContainer .modal-dialog { + width: 80%; + margin: 0; + padding: 0; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +#howToUploadVideoContainer .modal-body { + position: relative; + overflow: hidden; + width: 100%; + padding-top: 56.25%; +} + +#howToUploadVideoContainer .modal-body iframe { + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + width: 100%; + height: 100%; +} + +#howToUploadVideoContainer .modal-header { + position: relative; +} + +#howToUploadVideoContainer .modal-header h4 { + position: absolute; + display: inline-block; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +/* review section */ + +.review-section { + padding-top: 80px; + padding-bottom: 80px; + background-color: white; +} + +.review-section h2 { + color: #6c666f; + font-size: 48px; + font-weight: 500; + padding-left: 28px; + border-left: 3px solid #6c666f; + margin-bottom: 36px; + letter-spacing: 1px; +} + +.review-section__content.row { + margin: auto; + text-align: center; +} + +.review-section__content h4 { + color: #898989; + font-weight: 400; + font-size: 24px; +} + +.review-section__content p { + color: #524b4b; + margin-bottom: 32px; + font-size: 25px; + line-height: 34px; + font-weight: 500; +} + +.review-section__content a { + color: white; + padding: 8px 20px; + font-size: 18px; +} + +.moderator-duty { + display: flex; + align-items: center; + margin-top: 20px; +} + +.moderator-duty span { + margin-left: 18px; +} + +/* contributors section */ + +.contributors-section { + padding-top: 60px; + padding-bottom: 60px; + background-color: #fff9f9; +} + +.contributors-section h3 { + font-size: 30px; + text-align: center; +} + +.contributors-row { + margin-top: 56px; + margin-bottom: 56px; + display: grid; + grid-template-columns: 1fr 1fr 1fr 1fr; + row-gap: 48px; +} + +.contributor-info { + display: flex; + flex-direction: column; + align-items: center; + align-self: center; +} + +.contributor-info div { + height: 120px; + display: flex; + justify-content: center; + align-items: center; +} + +.contributor-info img { + width: 120px; + height: auto; +} + +.contributor-info.person img { + border-radius: 50%; +} + +.contributor-info p { + margin-top: 18px; + font-size: 24px; + font-weight: 500; +} + +.contributors-section p { + font-size: 25px; + text-align: center; +} + +.contributors-section .btn { + display: block; + font-weight: 700; + font-size: 18px; + width: 225px; + height: 50px; + box-sizing: border-box; + letter-spacing: 1px; + text-transform: uppercase; + margin-right: auto; + margin-left: auto; + margin-top: 28px; + display: flex; + align-items: center; + justify-content: center; +} + +/* quality section */ + +.quality-section { + padding-top: 80px; + padding-bottom: 80px; + background-color: #2a242d; + color: white; +} +.quality-section h2 { + font-size: 36px; + font-weight: 500; + line-height: 45px; + margin-top: -20px; + margin-bottom: 60px; + max-width: 490px; + width: 100%; + padding-left: 25px; + border-left: 3px solid var(--primary-color); +} + +.quality-section__content p { + font-weight: 500; + line-height: 30px; +} + +.video-container { + margin-top: -20px; +} + +#carousel-testimonials { + min-height: 360px; +} + +.carousel-inner .item { + height: 100%; +} + +.carousel-inner .item > p { + font-style: italic; +} + +.carousel-inner .item > div { + text-align: right; +} + +.carousel-inner .item div h3 { + color: var(--primary-color); + margin-bottom: 0; +} + +.carousel-inner .item div p { + font-size: 14px; + opacity: 0.75; + margin: 0; +} + +/* footer */ + +footer { + padding-top: 60px; + padding-bottom: 60px; + background-color: black; +} + +footer h3 { + font-weight: 300; + font-size: 18px; + text-transform: uppercase; + color: white; +} + +.subscribe { + color: white; + padding-right: 48px; +} + +.footer__branding { + display: flex; + align-items: center; + margin-bottom: 32px; +} + +.footer__branding__jh { + height: 36px; + width: auto; + padding-right: 24px; + border-right: 1px solid white; +} + +.footer__branding_social { + width: 24px; + height: 24px; + border-radius: 50%; + background-color: var(--primary-color); + color: black; + display: flex; + align-items: center; + justify-content: center; + margin-right: 8px; + margin-left: 8px; + font-weight: 700; + cursor: pointer; +} + +.github { + background-color: black; +} + +.github img { + width: 27px; + height: 27px; +} + +.footer__branding_social:first-of-type { + margin-left: 24px; +} + +.footer__branding_social:hover { + color: black; + text-decoration: none; +} + +.subscribe__form { + margin-left: 0; + margin-right: 0; + margin-top: 18px; +} + +.subscribe__form input { + color: black; + padding: 0; +} + +.subscribe__form button { + margin-left: 10px; + text-transform: uppercase; + font-weight: 500; +} + +.links { + margin-top: -12px; + padding-left: 48px; + padding-right: 48px; + border-right: 1px solid white; + border-left: 1px solid white; +} + +.links-row ul { + padding: 0; +} + +.links-row li { + list-style: none; + margin-top: 10px; + margin-bottom: 10px; +} + +.links-row li a { + color: #f65940; + font-weight: 500; + font-size: 14px; +} + +.created { + color: white; + margin-top: -12px; + padding-left: 48px; +} + +.created p { + font-size: 14px; + margin-top: 112px; + margin-bottom: 0px; +} + +.created a { + color: var(--primary-color); + text-decoration: underline; +} + +.makers-row { + margin-top: 10px; + display: flex; + align-items: center; +} + +.makers-row a { + display: block; + margin-right: 32px; +} + +.makers-row img { + transform: scale(1.4); +} + +.error-message { + color: red !important; +} + +.flash-messages { + top: 0; + right: 0; + position: fixed; + margin: 50px; + z-index: 9999; +} + +.close { + padding-left: 10px; + padding-top: 2px; +} + +@media (max-width: 990px) { + .category-item { + flex-direction: column; + margin-top: 15px; + margin-bottom: 15px; + } + + .category-item p { + margin-top: 10px; + margin-left: 0; + text-align: center; + } + + .datasets-section__content { + text-align: center; + } + .video-container { + margin: 0; + } + + .subscribe { + padding-right: 15px; + } + + .links { + border: none; + padding-left: 15px; + margin-top: 15px; + } + + .created { + padding-left: 15px; + margin-top: 15px; + } + + .created p { + margin-top: 15px; + } +} + +@media (max-width: 768px) { + body { + font-size: 14px; + } + + .navbar { + height: 50px; + margin-bottom: 0; + } + + .navbar-header { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + grid-template-rows: 1fr; + align-items: center; + width: 100%; + } + + .mobile-menu { + display: block; + cursor: pointer; + grid-column-start: 1; + } + + .mobile-login { + display: block; + border: none; + background-color: white; + color: var(--primary-color); + font-weight: 700; + font-weight: 12px; + justify-self: self-end; + } + + .navbar-logo { + width: 120px; + height: auto; + } + + .hero-section__content { + margin-top: 50px; + margin-bottom: 360px; + } + + .hero-section__content h2 { + font-size: 24px; + text-align: center; + font-weight: 700; + } + + .hero-section__content p { + text-align: center; + line-height: 25px; + } + + .hero-section__content .btn { + margin-right: 0; + margin-left: 0; + margin-top: 10px; + margin-bottom: 10px; + } + + .categories { + width: calc(100% - 32px); + margin-right: auto; + margin-left: auto; + top: 115%; + } + + .categories h3 { + font-size: 16px; + color: #6c666f; + margin-top: 25px; + margin-bottom: 25px; + } + + .categories__row { + padding-left: 45px; + padding-right: 45px; + } + + .category-item .icon-container { + height: 50px; + width: 50px; + } + + .category-item .icon-container img { + height: 30px; + width: 30px; + } + + .category-item p { + font-size: 12px; + } + + .main-search { + margin-bottom: 48px; + } + + .main-search > p { + font-size: 14px; + font-weight: 300; + margin-bottom: 18px; + } + + .main-search > p span { + font-weight: 500; + display: block; + } + + .dataset-video-container iframe { + width: 75%; + height: 75%; + } + + .datasets-section { + padding-bottom: 40px; + padding-top: 540px; + } + + .datasets-section__content h2 { + font-size: 24px; + font-weight: 500; + letter-spacing: 0; + } + + .datasets-section__content p { + margin-top: 24px; + margin-bottom: 24px; + } + + .datasets-section__content img { + width: 214px; + height: auto; + margin-top: 24px; + margin-bottom: 24px; + } + + .review-section { + padding-top: 25px; + padding-bottom: 25px; + } + + .review-section h2 { + font-size: 24px; + letter-spacing: 0; + padding: 0; + border: none; + text-align: center; + } + + .review-section__content p { + line-height: 25px; + } + + .moderators__content { + margin-top: 30px; + } + + .moderators__content h4 { + text-transform: uppercase; + font-size: 14px; + letter-spacing: 0.5px; + } + + .contributors-section { + padding-top: 25px; + padding-bottom: 45px; + } + + .contributors-section h3 { + color: #6c666f; + font-size: 24px; + line-height: 30px; + } + + .contributors-section p { + font-size: 14px; + } + + .contributors-section .btn { + width: 100%; + } + + .contributors-row { + grid-template-columns: 1fr 1fr 1fr; + } + + .contributor-info p { + font-size: 1em; + } + + .highlights-info { + margin-top: 32px; + text-align: center; + } + + #carousel-testimonials { + min-height: 340px; + } + + .quality-section h2 { + padding: 0; + border: none; + font-size: 24px; + line-height: 35px; + margin-bottom: 1em; + text-align: center; + } + + .quality-section img { + margin-bottom: 40px; + } + + .quality-section__content p { + margin-top: 24px; + margin-bottom: 24px; + line-height: 25px; + } + + .subscribe__form button { + margin-left: 0; + margin-top: 10px; + font-weight: 700; + letter-spacing: 1px; + } + + .footer__branding__jh { + height: 24px; + width: auto; + } + + .item-addition { + flex-direction: column; + } + + .item-addition > * { + width: 100% !important; + } +} + +/* contact page */ + +.contact-form ~ h1 { + margin-left: -15px; + margin-right: -15px; +} + +.contact-form fieldset legend { + margin-left: -15px; + margin-right: -15px; + border-bottom: none; +} + +.contact-form .form-actions { + display: flex; + align-items: center; + justify-content: space-between; +} + +@media (max-width: 450px) { + .contributors-row { + grid-template-columns: 1fr 1fr; + } +} + +/* dataset upload styles */ + +.btn-primary-text, +.btn-primary-text:link, +.btn-primary-text:visited { + color: var(--primary-color); + font-size: 18px; + background: none; + border: none; + text-transform: uppercase; + text-decoration: none; + font-family: 'Montserrat', 'sans-serif'; + cursor: pointer; + display: flex; + justify-content: center; + align-items: center; + display: inline-block; +} + +.btn-primary-text:hover { + color: var(--primary-color-dark); + background: none; + text-decoration: none; +} + +.hide { + display: none; +} + +.btn-mont { + font-family: 'Montserrat', sans-serif; + font-weight: 500; + font-size: 18px; + text-transform: uppercase; +} + +/* data upload header */ + +.data-upload-header { + background-color: var(--primary-background-color); + padding-top: 36px; + padding-bottom: 80px; +} + +.data-upload-header .custom-container { + padding: 0 16px; +} + +.exit-flow { + display: flex; + justify-content: space-between; + align-items: center; + width: 60px; + color: var(--primary-color); + font-size: 1em; + font-weight: 500; + text-transform: uppercase; + cursor: pointer; +} + +.exit-flow:hover, +.exit-flow:active, +.exit-flow:visited, +.exit-flow:link { + color: var(--primary-color); + text-decoration: none; +} + +.data-upload-header h1 { + color: var(--primary-color); + font-size: 1.5em; + font-weight: 500; + padding-left: 28px; + border-left: 3px solid var(--primary-color); + margin-bottom: 28px; + margin-top: 40px; +} + +.data-upload-header h2 { + color: white; + font-size: 24px; + font-weight: 500; + text-align: center; + max-width: 840px; + width: 100%; + margin-right: auto; + margin-left: auto; + margin-top: 0; + margin-bottom: 2em; +} + +.data-upload-header h2 a { + color: var(--primary-color); + text-decoration: none; +} + +.upload-video-container button { + margin: auto; + font-family: Roboto, 'sans-serif'; +} + +.steps-row { + display: flex; + width: 840px; + justify-content: space-around; + padding: 0; + margin-left: auto; + margin-right: auto; + margin-top: 2em; +} + +.step-indicator { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin: 0 16px; + list-style: none; + cursor: pointer; +} + +.step-indicator__icon-container { + display: flex; + justify-content: center; + align-items: center; + color: #5b575b; + height: 100px; + width: 100px; + font-size: 36px; + border-radius: 100%; + border: 1px solid #5b575b; +} + +.step-indicator p { + display: flex; + justify-content: space-between; + align-items: center; + font-weight: 500; + margin-top: 20px; + margin-bottom: 0; + color: #5b575b; +} + +.step-indicator p svg { + display: none; +} + +.step-indicator.active > * { + color: white; +} + +.step-indicator.active .step-indicator__icon-container { + border: 1px solid white; +} + +.step-indicator.done > * { + color: var(--primary-color); +} + +.step-indicator.done .step-indicator__icon-container { + border: 1px solid var(--primary-color); +} + +.step-indicator.done p svg { + display: block; + margin-left: 4px; +} + +/* data upload sections that have fields*/ + +.data-upload-section { + background-color: #fef9f8; + padding: 48px 28px; +} + +.data-upload-section hr { + border: 0.5px solid #110516; +} + +.data-upload-section__form__field { + margin-bottom: 60px; +} + +.data-upload-section__form__field h3 { + margin-bottom: 6px; + margin-top: 0; +} + +.data-upload-section__form__field > span { + font-family: 'Montserrat', sans-serif; + color: #6c666f; + max-width: 750px; + width: 100%; + display: inline-block; +} + +.data-upload-section__form__field input, +#datasetDescriptionField { + font-family: 'Montserrat', sans-serif; + color: #000; + font-weight: 500; +} + +.data-upload-section__form__field .input--large { + margin-top: 8px; + max-width: 740px; + width: 100%; +} + +.data-upload-section__form__field .input--medium { + max-width: 450px; + width: 100%; + font-family: 'Montserrat', sans-serif; +} + +.data-upload-section__form__field label { + font-family: 'Montserrat', sans-serif; + font-size: 14px; +} + +.file-upload { + width: 100%; + margin-top: 40px; + padding-top: 40px; + border-top: 0.5px solid #110516; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(min(500px, 100%), 1fr)); + grid-gap: 10rem; + align-items: center; + position: relative; +} + +.file-upload:first-of-type { + border-top: none; +} + +.remove-input, +.reset-input { + position: absolute; + padding: 4px; + top: 5px; + right: 0; + width: 20px; + height: 20px; + box-sizing: content-box; + color: var(--primary-color); + cursor: pointer; +} + +.file-upload__name { + display: flex; + justify-content: space-between; +} + +.file-upload__name .name-field { + flex: 1; + align-self: flex-start; + max-width: 360px; + width: 100%; +} + +.file-upload__name .name-field h4 { + margin-top: 0; +} + +.file-upload__name .name-field h4 span { + font-weight: 300; + font-size: 14px; +} + +.upload-box { + width: 112px; + height: 128px; + border: 1px dashed var(--primary-color); + display: flex; + align-items: center; + justify-content: center; + position: relative; +} + +.upload-box svg { + font-size: 48px; + color: var(--primary-color); +} + +.upload-box input { + position: absolute; + width: 100%; + height: 100%; + opacity: 0; + z-index: 99; + cursor: pointer; +} + +.data-upload-section__footer { + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 2em; +} + +.data-upload-section__footer__right { + display: flex; + align-items: center; +} + +.data-upload-section__footer__right > :first-child { + margin-right: 22px; +} + +.item-addition { + display: flex; + flex-wrap: wrap; + max-width: 700px; + width: 100%; + justify-content: space-between; + margin-top: 30px; + padding-top: 20px; + position: relative; +} + +.item-addition--link { + max-width: 800px; +} + +.item-addition__name-field { + width: 32%; +} + +.item-addition__email-field { + width: 32%; +} + +.item-addition__website-field { + width: 32%; +} + +/* #licenseSelect { + +} */ + +.date-of-publication-entry { + display: flex; + justify-content: flex-start; +} + +.date-of-publication-entry > * { + margin-right: 12px; +} + +#pubDate input { + width: 60px; +} + +#pubYear input { + width: 84px; +} + +.time-period-entry { + display: flex; + justify-content: space-between; + max-width: 450px; + width: 100%; +} + +.period { + display: flex; + justify-content: space-between; + align-items: center; + width: 46%; +} + +.period h5 { + font-weight: 300; + color: #6c666f; + font-family: 'Montserrat', sans-serif; +} + +.period input, +.period select { + font-family: 'Montserrat', sans-serif; + font-size: 14px; +} + +.period select { + width: 100%; + padding: 2px 0; +} + +.period__year input { + width: 76px; +} + +.source-section .data-upload-section__form__field span { + font-size: 14px; +} + +/* preview modal */ + +#previewDatasetModal .modal-body { + max-height: 700px; + height: 100%; + overflow-y: scroll; + padding: 0 40px; +} + +#previewDatasetModal .modal-footer { + display: flex; + justify-content: flex-end; +} + +.modal-body__data-section { + border-top: 1px solid #5b575b; + padding-top: 30px; + padding-bottom: 30px; +} + +.modal-body__data-section:first-of-type { + border-top: none; +} + +.modal-body__data-section__header { + display: flex; + justify-content: space-between; + align-items: center; +} + +.modal-body__data-section__header h3 { + margin: 0; + color: #5b575b; +} + +.modal-body__data-section__header .preview-edit { + font-size: 14px; + display: flex; + align-items: center; +} + +.modal-body__data-section__header .preview-edit span { + display: inline-block; + margin-right: 4px; +} + +.modal-body__data-section table { + margin-top: 10px; +} + +.modal-body__data-section table tr td { + padding-top: 10px; + padding-bottom: 10px; +} + +.modal-body__data-section table tr td:first-child { + font-size: 14px; + color: #898989; + width: 160px; +} + +.modal-body__data-section table tr td:last-child { + font-size: 14px; + color: #000000; +} + +.file-summary { + display: flex; + align-items: flex-start; + padding-top: 18px; + padding-bottom: 18px; +} + +.file-summary__icon-container { + margin-right: 8px; + width: 34px; + height: auto; + display: flex; + justify-content: center; + align-items: center; + box-sizing: border-box; +} + +.file-summary__icon-container svg { + width: 100%; + height: 100%; +} + +.file-summary__text h4 { + margin-bottom: 0; + margin-top: 0; + font-weight: 400; + font-size: 18px; +} + +.file-summary__text__description { + margin-top: 18px; +} + +.file-summary__text__description p:first-of-type { + font-size: 14px; + color: #898989; +} + +.file-summary__text__description p:last-of-type { + font-weight: 300; + font-size: 14px; + font-weight: 25px; +} + +#submitDatasetButton { + margin: 0 20px; +} + +/* tags */ + +.tags-container { + max-width: 740px; + width: 100%; + display: flex; + flex-wrap: wrap; + align-items: center; + background-color: white; + margin-top: 7px; + font-family: 'Montserrat', 'sans-serif'; + border: 1px solid #a6a6a6; + box-sizing: border-box; + border-radius: 4px; + padding: 4px 8px; +} + +.tags-container input { + display: inline-block; + height: inherit; + border: none; + box-shadow: none; + padding-left: 0; + border-radius: 0; +} + +.tags-container input:focus { + border: none; + box-shadow: none; + outline: none; +} + +.tags-container > span { + display: inline-block; + background-color: #c4c4c4; + margin-right: 8px; + margin-top: 2px; + margin-bottom: 2px; + padding: 2px 8px; + border-radius: 4px; +} + +.tags-container > span .iconify { + margin-left: 4px; + position: relative; + top: 2px; + cursor: pointer; +} + +/* multi select */ + +.multiselect-container { + overflow-y: scroll; + height: 300px; +} + +.multiselect-container > * { + width: 100%; +} + +.multiselect-native-select .btn-group { + margin-left: 14px; +} + +.multiselect-selected-text { + font-family: 'Montserrat', 'sans-serif'; + font-size: 14px; +} + +.multiselect.dropdown-toggle { + width: 220px; + display: none; +} + +.multiselect-option { + border: none; +} + +.multiselect-option .form-check { + display: flex; + margin: 0; + padding: 4px !important; +} + +/* utils */ + +.loader { + width: 20px; + height: 20px; + margin: 0 24px; + border-radius: 50%; + border: 3px solid #ccc; + border-top: 3px solid var(--primary-color); + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} + +@media (max-width: 768px) { + .data-upload-header { + background-color: #fef9f8; + font-size: 14px; + padding-bottom: 36px; + } + + .data-upload-header h2 { + display: none; + } + + .data-upload-section { + font-size: 14px; + line-height: 24px; + } + + .data-upload-section__footer { + display: flex; + flex-direction: column; + } + + .data-upload-section__footer__right { + display: flex; + flex-direction: column; + width: 100%; + } + + .data-upload-section__footer__right > :first-child { + margin-right: 0; + margin-bottom: 12px; + margin-top: 24px; + } + + .steps-row { + width: 100%; + flex-direction: column; + } + + .step-indicator { + display: block; + text-align: left; + justify-content: center; + margin: 5px 16px; + padding: 10px; + background-color: var(--primary-background-color); + } + + .step-indicator p { + margin-top: 0; + } + + .step-indicator__icon-container { + display: none; + } + + .data-upload-section { + box-sizing: border-box; + background-color: white; + box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25); + /* margin: 0 16px; */ + padding-left: 16px; + padding-right: 16px; + } + + .file-upload { + grid-template-columns: 1fr; + } + + .upload-box { + width: 100%; + height: 50px; + margin-bottom: 20px; + } + + .file-upload__name { + flex-direction: column; + } + + .time-period-entry { + flex-direction: column; + } + + .period { + width: 60%; + } +} + +.fab { + position: fixed; + display: flex; + background-color: white; + justify-content: center; + align-items: center; + right: 2em; + bottom: 4em; + border-radius: 50%; + border: none; + width: 60px; + height: 60px; + z-index: 1; + box-shadow: 2px 3px 8px 2px rgba(0, 0, 0, 0.1); +} + +.feedback-logo { + width: 30px; + height: 30px; +} diff --git a/ckanext/justicehub_theme/public/js/bootstrap-multiselect.min.js b/ckanext/justicehub_theme/public/js/bootstrap-multiselect.min.js new file mode 100644 index 00000000..1bae7b0b --- /dev/null +++ b/ckanext/justicehub_theme/public/js/bootstrap-multiselect.min.js @@ -0,0 +1 @@ +!function(root,factory){"function"==typeof define&&define.amd&&"function"==typeof require&&"function"==typeof require.specified&&require.specified("knockout")?define(["jquery","knockout"],factory):factory(root.jQuery,root.ko)}(this,(function($,ko){"use strict";function forEach(array,callback){for(var index=0;index').after(this.$container),this.options.onInitialized(this.$select,this.$container)}void 0!==ko&&ko.bindingHandlers&&!ko.bindingHandlers.multiselect&&(ko.bindingHandlers.multiselect={after:["options","value","selectedOptions","enable","disable"],init:function(element,valueAccessor,allBindings,viewModel,bindingContext){var $element=$(element),config=ko.toJS(valueAccessor());if($element.multiselect(config),allBindings.has("options")){var options=allBindings.get("options");ko.isObservable(options)&&ko.computed({read:function(){options(),setTimeout((function(){var ms=$element.data("multiselect");ms&&ms.updateOriginalOptions(),$element.multiselect("rebuild")}),1)},disposeWhenNodeIsRemoved:element})}if(allBindings.has("value")){var value=allBindings.get("value");ko.isObservable(value)&&ko.computed({read:function(){value(),setTimeout((function(){$element.multiselect("refresh")}),1)},disposeWhenNodeIsRemoved:element}).extend({rateLimit:100,notifyWhenChangesStop:!0})}if(allBindings.has("selectedOptions")){var selectedOptions=allBindings.get("selectedOptions");ko.isObservable(selectedOptions)&&ko.computed({read:function(){selectedOptions(),setTimeout((function(){$element.multiselect("refresh")}),1)},disposeWhenNodeIsRemoved:element}).extend({rateLimit:100,notifyWhenChangesStop:!0})}var setEnabled=function(enable){setTimeout((function(){enable?$element.multiselect("enable"):$element.multiselect("disable")}))};if(allBindings.has("enable")){var enable=allBindings.get("enable");ko.isObservable(enable)?ko.computed({read:function(){setEnabled(enable())},disposeWhenNodeIsRemoved:element}).extend({rateLimit:100,notifyWhenChangesStop:!0}):setEnabled(enable)}if(allBindings.has("disable")){var disable=allBindings.get("disable");ko.isObservable(disable)?ko.computed({read:function(){setEnabled(!disable())},disposeWhenNodeIsRemoved:element}).extend({rateLimit:100,notifyWhenChangesStop:!0}):setEnabled(!disable)}ko.utils.domNodeDisposal.addDisposeCallback(element,(function(){$element.multiselect("destroy")}))},update:function(element,valueAccessor,allBindings,viewModel,bindingContext){var $element=$(element),config=ko.toJS(valueAccessor());$element.multiselect("setOptions",config),$element.multiselect("rebuild")}}),Multiselect.prototype={defaults:{buttonText:function(selectedOptions,select){if(this.disabledText.length>0&&select.prop("disabled"))return this.disabledText;if(0===selectedOptions.length)return this.nonSelectedText;if(this.allSelectedText&&selectedOptions.length===$("option",$(select)).length&&1!==$("option",$(select)).length&&this.multiple)return this.selectAllNumber?this.allSelectedText+" ("+selectedOptions.length+")":this.allSelectedText;if(0!=this.numberDisplayed&&selectedOptions.length>this.numberDisplayed)return selectedOptions.length+" "+this.nSelectedText;var selected="",delimiter=this.delimiterText;return selectedOptions.each((function(){var label=void 0!==$(this).attr("label")?$(this).attr("label"):$(this).text();selected+=label+delimiter})),selected.substr(0,selected.length-this.delimiterText.length)},buttonTitle:function(options,select){if(0===options.length)return this.nonSelectedText;var selected="",delimiter=this.delimiterText;return options.each((function(){var label=void 0!==$(this).attr("label")?$(this).attr("label"):$(this).text();selected+=label+delimiter})),selected.substr(0,selected.length-this.delimiterText.length)},checkboxName:function(option){return!1},optionLabel:function(element){return $(element).attr("label")||$(element).text()},optionClass:function(element){return $(element).attr("class")||""},onChange:function(option,checked){},onDropdownShow:function(event){},onDropdownHide:function(event){},onDropdownShown:function(event){},onDropdownHidden:function(event){},onSelectAll:function(){},onDeselectAll:function(){},onInitialized:function($select,$container){},onFiltering:function($filter){},enableHTML:!1,buttonClass:"custom-select",inheritClass:!1,buttonWidth:"auto",buttonContainer:'
',dropRight:!1,dropUp:!1,selectedClass:"active",maxHeight:!1,includeSelectAllOption:!1,includeSelectAllIfMoreThan:0,selectAllText:" Select all",selectAllValue:"multiselect-all",selectAllName:!1,selectAllNumber:!0,selectAllJustVisible:!0,enableFiltering:!1,enableCaseInsensitiveFiltering:!1,enableFullValueFiltering:!1,enableClickableOptGroups:!1,enableCollapsibleOptGroups:!1,collapseOptGroupsByDefault:!1,filterPlaceholder:"Search",filterBehavior:"text",includeFilterClearBtn:!0,preventInputChangeEvent:!1,nonSelectedText:"None selected",nSelectedText:"selected",allSelectedText:"All selected",numberDisplayed:3,disableIfEmpty:!1,disabledText:"",delimiterText:", ",includeResetOption:!1,includeResetDivider:!1,resetText:"Reset",indentGroupOptions:!0,templates:{button:'',popupContainer:'',filter:'
',option:'',divider:'',optionGroup:'',resetButton:'
'}},constructor:Multiselect,buildContainer:function(){this.$container=$(this.options.buttonContainer),this.$container.on("show.bs.dropdown",this.options.onDropdownShow),this.$container.on("hide.bs.dropdown",this.options.onDropdownHide),this.$container.on("shown.bs.dropdown",this.options.onDropdownShown),this.$container.on("hidden.bs.dropdown",this.options.onDropdownHidden)},buildButton:function(){this.$button=$(this.options.templates.button).addClass(this.options.buttonClass),this.$select.attr("class")&&this.options.inheritClass&&this.$button.addClass(this.$select.attr("class")),this.$select.prop("disabled")?this.disable():this.enable(),this.options.buttonWidth&&"auto"!==this.options.buttonWidth&&(this.$button.css({width:"100%",overflow:"hidden","text-overflow":"ellipsis"}),this.$container.css({width:this.options.buttonWidth}));var tabindex=this.$select.attr("tabindex");tabindex&&this.$button.attr("tabindex",tabindex),this.$container.prepend(this.$button)},buildDropdown:function(){this.$popupContainer=$(this.options.templates.popupContainer),this.options.dropRight?this.$container.addClass("dropright"):this.options.dropUp&&this.$container.addClass("dropup"),this.options.maxHeight&&this.$popupContainer.css({"max-height":this.options.maxHeight+"px","overflow-y":"auto","overflow-x":"hidden"}),this.$popupContainer.on("touchstart click",(function(e){e.stopPropagation()})),this.$container.append(this.$popupContainer)},buildDropdownOptions:function(){this.$select.children().each($.proxy((function(index,element){var $element=$(element),tag=$element.prop("tagName").toLowerCase();$element.prop("value")!==this.options.selectAllValue&&("optgroup"===tag?this.createOptgroup(element):"option"===tag&&("divider"===$element.data("role")?this.createDivider():this.createOptionValue(element,!1)))}),this)),$(this.$popupContainer).off("change",'> *:not(.multiselect-group) input[type="checkbox"], > *:not(.multiselect-group) input[type="radio"]'),$(this.$popupContainer).on("change",'> *:not(.multiselect-group) input[type="checkbox"], > *:not(.multiselect-group) input[type="radio"]',$.proxy((function(event){var $target=$(event.target),checked=$target.prop("checked")||!1,isSelectAllOption=$target.val()===this.options.selectAllValue;this.options.selectedClass&&(checked?$target.closest(".multiselect-option").addClass(this.options.selectedClass):$target.closest(".multiselect-option").removeClass(this.options.selectedClass));var value=$target.val(),$option=this.getOptionByValue(value),$optionsNotThis=$("option",this.$select).not($option),$checkboxesNotThis=$("input",this.$container).not($target);if(isSelectAllOption?checked?this.selectAll(this.options.selectAllJustVisible,!0):this.deselectAll(this.options.selectAllJustVisible,!0):(checked?($option.prop("selected",!0),this.options.multiple?$option.prop("selected",!0):(this.options.selectedClass&&$($checkboxesNotThis).closest(".dropdown-item").removeClass(this.options.selectedClass),$($checkboxesNotThis).prop("checked",!1),$optionsNotThis.prop("selected",!1),this.$button.click()),"active"===this.options.selectedClass&&$optionsNotThis.closest(".dropdown-item").css("outline","")):$option.prop("selected",!1),this.options.onChange($option,checked),this.updateSelectAll(),this.options.enableClickableOptGroups&&this.options.multiple&&this.updateOptGroups()),this.$select.change(),this.updateButtonText(),this.options.preventInputChangeEvent)return!1}),this)),$(".multiselect-option",this.$popupContainer).off("mousedown"),$(".multiselect-option",this.$popupContainer).on("mousedown",(function(e){if(e.shiftKey)return!1})),$(this.$popupContainer).off("touchstart click",".multiselect-option, .multiselect-all, .multiselect-group"),$(this.$popupContainer).on("touchstart click",".multiselect-option, .multiselect-all, .multiselect-group",$.proxy((function(event){event.stopPropagation();var $target=$(event.target),$input;if(event.shiftKey&&this.options.multiple){$target.is("input")||(event.preventDefault(),($target=$target.closest(".multiselect-option").find("input")).prop("checked",!$target.prop("checked")));var checked=$target.prop("checked")||!1;if(null!==this.lastToggledInput&&this.lastToggledInput!==$target){var from=this.$popupContainer.find(".multiselect-option:visible").index($target.closest(".multiselect-option")),to=this.$popupContainer.find(".multiselect-option:visible").index(this.lastToggledInput.closest(".multiselect-option"));if(from>to){var tmp=to;to=from,from=tmp}++to;var range=this.$popupContainer.find(".multiselect-option:not(.multiselect-filter-hidden)").slice(from,to).find("input");range.prop("checked",checked),this.options.selectedClass&&range.closest(".multiselect-option").toggleClass(this.options.selectedClass,checked);for(var i=0,j=range.length;i0)$checkbox.prop("checked",!$checkbox.prop("checked")),$checkbox.change();else if(this.options.enableClickableOptGroups&&this.options.multiple&&!$target.hasClass("caret-container")){var groupItem=$target;groupItem.hasClass("multiselect-group")||(groupItem=$target.closest(".multiselect-group")),($checkbox=groupItem.find(".form-check-input")).length>0&&($checkbox.prop("checked",!$checkbox.prop("checked")),$checkbox.change())}event.preventDefault()}$target.closest(".multiselect-option").find("input[type='checkbox'], input[type='radio']").length>0?this.lastToggledInput=$target:this.lastToggledInput=null,$target.blur()}),this)),this.$container.off("keydown.multiselect").on("keydown.multiselect",$.proxy((function(event){if(!$("input.multiselect-search",this.$container).is(":focus"))if(9===event.keyCode&&this.$container.hasClass("show"))this.$button.click();else{var $items=$(this.$container).find(".multiselect-option:not(.disabled), .multiselect-group:not(.disabled), .multiselect-all").filter(":visible");if(!$items.length)return;var index=$items.index($items.filter(":focus")),$current=$items.eq(index);if(32===event.keyCode){var $checkbox=$current.find("input");$checkbox.prop("checked",!$checkbox.prop("checked")),$checkbox.change(),event.preventDefault()}13===event.keyCode&&setTimeout((function(){$current.focus()}),0)}}),this)),this.options.enableClickableOptGroups&&this.options.multiple&&($(".multiselect-group input",this.$popupContainer).off("change"),$(".multiselect-group input",this.$popupContainer).on("change",$.proxy((function(event){event.stopPropagation();var $target,checked=$(event.target).prop("checked")||!1,$item=$(event.target).closest(".dropdown-item"),$group,$inputs=$item.nextUntil(".multiselect-group").not(".multiselect-filter-hidden").not(".disabled").find("input"),$options=[];this.options.selectedClass&&(checked?$item.addClass(this.options.selectedClass):$item.removeClass(this.options.selectedClass)),$.each($inputs,$.proxy((function(index,input){var $input=$(input),value=$input.val(),$option=this.getOptionByValue(value);checked?($input.prop("checked",!0),$input.closest(".dropdown-item").addClass(this.options.selectedClass),$option.prop("selected",!0)):($input.prop("checked",!1),$input.closest(".dropdown-item").removeClass(this.options.selectedClass),$option.prop("selected",!1)),$options.push(this.getOptionByValue(value))}),this)),this.options.onChange($options,checked),this.$select.change(),this.updateButtonText(),this.updateSelectAll()}),this))),this.options.enableCollapsibleOptGroups&&this.options.multiple&&($(".multiselect-group .caret-container",this.$popupContainer).off("click"),$(".multiselect-group .caret-container",this.$popupContainer).on("click",$.proxy((function(event){var $group,$inputs=$(event.target).closest(".multiselect-group").nextUntil(".multiselect-group").not(".multiselect-filter-hidden"),visible=!0;$inputs.each((function(){visible=visible&&!$(this).hasClass("multiselect-collapsible-hidden")})),visible?$inputs.hide().addClass("multiselect-collapsible-hidden"):$inputs.show().removeClass("multiselect-collapsible-hidden")}),this)))},createCheckbox:function($item,label,name,value,title,inputType){var $wrapper=$("");if($wrapper.addClass("form-check"),this.options.enableHTML&&$(label).length>0)$wrapper.append($(label));else{var $checkboxLabel=$('`; + return tagElement; + } + + function insertTag(tagsContainerElement, tagName) { + tagsContainerElement.insertBefore(generateTagElement(tagName), tagsContainerElement.querySelector('input')); + } + + function addTag(event, property) { + if (event.code === 'Comma' && event.target.value.length >= 3) { + // remove the comma at the end + const tagName = event.target.value.substring(0, event.target.value.length - 1); + // add tag to the dataset + dataset.addItemToListProperty(property, tagName); + // add tag to DOM + insertTag(event.target.parentElement, tagName); + event.target.value = ''; + } + } + + function removeTag(event, property, parentElement) { + if (!event.target.matches('svg')) { + return; + } + // remove tag from the dataset + const updatedTagsList = dataset[property].filter((tag) => tag !== event.target.dataset.tag); + dataset.updateProperty(property, updatedTagsList); + // remove tag from DOM + const tagToBeDeleted = event.target.parentElement; + parentElement.removeChild(tagToBeDeleted); + } + + const keywordsContainer = document.getElementById('keywordsContainer'); + const sourcesContainer = document.getElementById('sourcesContainer'); + keywordsContainer.addEventListener('click', (event) => removeTag(event, 'keywords', keywordsContainer)); + sourcesContainer.addEventListener('click', (event) => removeTag(event, 'sources', sourcesContainer)); + + const keywordsInput = document.getElementById('keywordsInput'); + const sourcesInput = document.getElementById('sourcesInput'); + keywordsInput.addEventListener('keyup', (event) => addTag(event, 'keywords')); + + keywordsInput.addEventListener('paste', (event) => { + event.preventDefault(); + const pastedText = (event.clipboardData || window.clipboardData).getData('text'); + const tagsListFromPastedText = pastedText.split(',').map((text) => text.trim()); + dataset.updateProperty('keywords', dataset.keywords.concat(tagsListFromPastedText)); + tagsListFromPastedText.forEach((tag) => { + insertTag(event.target.parentElement, tag); + }); + }); + + sourcesInput.addEventListener('keyup', (event) => addTag(event, 'sources')); + + // functions for getting all values and updating dataset object + + function getValueFromInputSelector(inputSelector, element = document) { + return element.querySelector(inputSelector).value; + } + + function getRadioValue(name) { + let value; + const allRadioOptions = document.querySelectorAll(`input[name="${name}"]`); + allRadioOptions.forEach((option) => { + if (option.checked) { + value = option.value; + return; + } + }); + return value; + } + + function getFileDetailsFromFileUploadElement(fileUploadElement) { + const uploadedFile = fileUploadElement.querySelector('input[type="file"]').files + ? fileUploadElement.querySelector('input[type="file"]').files[0] + : null; + + const fileFormat = fileUploadElement.dataset.format; + + return { + file: uploadedFile, + fileName: getValueFromInputSelector('.name-field input', fileUploadElement), + fileDescription: getValueFromInputSelector('.file-upload__description textarea', fileUploadElement), + fileId: fileUploadElement.id, + fileFormat: fileFormat + }; + } + + function getReferenceLinksFromReferenceElement(referenceElement) { + return { + link: getValueFromInputSelector('.item-addition__link-field input', referenceElement), + title: getValueFromInputSelector('.item-addition__title-field input', referenceElement) + }; + } + + function getAuthorDetailsFromAuthorAdditionElement(authorElement) { + return { + authorName: getValueFromInputSelector('.item-addition__name-field input', authorElement), + authorEmail: getValueFromInputSelector('.item-addition__email-field input', authorElement), + authorWebsite: getValueFromInputSelector('.item-addition__website-field input', authorElement) + }; + } + + function getTimePeriodDetailsFromSelector(timePeriodSelector) { + return { + month: getValueFromInputSelector(`${timePeriodSelector} .months-select`), + year: getValueFromInputSelector(`${timePeriodSelector} .year-input`) + }; + } + + // save as draft + const saveAsDraftButtons = document.querySelectorAll('.draft-button'); + saveAsDraftButtons.forEach((button) => { + button.addEventListener('click', () => { + if (!getValueFromInputSelector('#datasetNameField').length) { + return; + } + const loader = document.querySelector('.loader'); + if (loader) { + loader.style.display = 'none'; + } + + button.style.display = 'none'; + button.insertAdjacentHTML('afterend', `
`); + updateDatasetWithValuesFromFilesSection(); + updateDatasetWithValuesFromOwnershipSection(); + updateDatasetWithValuesFromRelevancySection(); + updateDatasetWithReferences(); + postDatasetRequest('draft'); + }); + }); + + const previewButton = document.querySelector('#previewButton'); + + function generateFilePreviewHTML(file) { + let fileIcon = ''; + + if (isEditMode()) { + fileIcon = getFileUploadBoxPropertyByFileType(file.fileFormat.toLowerCase(), 'icon'); + } else if (file.file.type.indexOf('csv') > -1) { + fileIcon = getFileUploadBoxPropertyByFileType('csv', 'icon'); + } else if (file.file.type.indexOf('spreadsheetml') > -1) { + fileIcon = getFileUploadBoxPropertyByFileType('xlsx', 'icon'); + } else if (file.file.type.indexOf('pdf') > -1) { + fileIcon = getFileUploadBoxPropertyByFileType('pdf', 'icon'); + } else { + fileIcon = getFileUploadBoxPropertyByFileType('unknown', 'icon'); + } + + return ` +
+
+ +
+
+

${file.fileName}

+
+

Description:

+

${file.fileDescription}

+
+
+
+
+ `; + } + + function generateDataRelevancyPreviewTableHTML(dataset) { + return ` + + Region(s) covered: + ${ + Array.isArray(dataset.region) + ? dataset.region.map((region) => ` ${region}`) + : `No regions selected` + } + + + Date of Publication: + ${dataset.date} ${dataset.month} ${dataset.year} + + + Time period covered: + ${ + dataset.timePeriod.from.year && dataset.timePeriod.to.year + ? `${dataset.timePeriod.from.month} ${dataset.timePeriod.from.year} - ${dataset.timePeriod.to.month} ${dataset.timePeriod.to.year}` + : 'From and To years are not entered' + } + + + Language: + ${dataset.language ? dataset.language : 'No language added'} + + `; + } + + function generateSourcePreviewTableHTML(dataset) { + return ` + + Keywords: + ${ + dataset.keywords.length ? dataset.keywords.join(', ') : `No keywords entered` + } + + + Data Source(s): + ${ + dataset.sources.length ? dataset.sources.join(', ') : `No sources entered` + } + + + Reference Links: + + ${dataset.referenceLinks.map((reference) => ` ${reference.title} - ${reference.link}`)} + + + `; + } + + function generateOwnershipPreviewTableHTML(dataset) { + return ` + + Licensing permissions: + ${ + dataset.license.licenseDescription + ? dataset.license.licenseDescription + : `No license selected` + } + + + Viewing Permissions: + ${ + dataset.viewPermission ? dataset.viewPermission : `No permission selected` + } + + + Primary Author(s): + + ${ + dataset.publisher.authors[0].authorName + ? dataset.publisher.authors.map( + (author) => ` ${author.authorName} - ${author.authorEmail} - ${author.authorWebsite}` + ) + : `No publishers entered` + } + + +`; + } + + previewButton.addEventListener('click', () => { + updateDatasetWithReferences(); + const filesListPreviewSection = document.querySelector('#filesListOnPreview'); + + if (areMandatoryFieldsEmpty()) { + submitDatasetButton.disabled = true; + } else { + submitDatasetButton.disabled = false; + } + + submitDatasetButton.style.display = 'block'; + const loader = document.querySelector('.loader'); + if (loader) { + loader.style.display = 'none'; + } + + filesListPreviewSection.innerHTML = ''; + if (!isEditMode()) { + dataset.files.forEach((file) => { + filesListPreviewSection.insertAdjacentHTML('beforeend', generateFilePreviewHTML(file)); + }); + } else { + const updatedFiles = resourcesByType.updated.map((resourceId) => document.getElementById(resourceId)); + + updatedFiles.forEach((fileUploadElement) => + filesListPreviewSection.insertAdjacentHTML( + 'beforeend', + generateFilePreviewHTML(getFileDetailsFromFileUploadElement(fileUploadElement)) + ) + ); + + const addedFiles = resourcesByType.added.map((resourceId) => document.getElementById(resourceId)); + + addedFiles.forEach((fileUploadElement) => + filesListPreviewSection.insertAdjacentHTML( + 'beforeend', + generateFilePreviewHTML(getFileDetailsFromFileUploadElement(fileUploadElement)) + ) + ); + + const untouchedFiles = receivedResources + .filter( + (resource) => resourcesByType.updated.indexOf(resource.id) < 0 && resourcesByType.deleted.indexOf(resource.id) + ) + .map((resource) => document.getElementById(resource.id)); + + if (untouchedFiles) { + untouchedFiles.forEach((fileUploadElement) => + filesListPreviewSection.insertAdjacentHTML( + 'beforeend', + generateFilePreviewHTML(getFileDetailsFromFileUploadElement(fileUploadElement)) + ) + ); + } + } + + document.querySelector('#dataRelevancyPreviewTable').innerHTML = generateDataRelevancyPreviewTableHTML(dataset); + document.querySelector('#ownershipPreviewTable').innerHTML = generateOwnershipPreviewTableHTML(dataset); + document.querySelector('#sourcePreviewTable').innerHTML = generateSourcePreviewTableHTML(dataset); + const titleContainer = document.querySelector('#datasetNameOnPreviewModal'); + titleContainer.innerHTML = dataset.name ? dataset.name : 'No title entered'; + const descContainer = document.querySelector('#datasetDescOnPreviewModal'); + descContainer.innerHTML = dataset.description ? dataset.description : ''; + + console.log(dataset); + }); + + // preview modal + + const editSectionButtons = document.querySelectorAll('.preview-edit'); + editSectionButtons.forEach((button) => + button.addEventListener('click', () => { + dataUploadSteps.setActiveStepByName(button.dataset.section, updateActiveSectionDOM); + }) + ); + + const submitDatasetButton = document.getElementById('submitDatasetButton'); + submitDatasetButton.addEventListener('click', () => { + submitDatasetButton.style.display = 'none'; + submitDatasetButton.insertAdjacentHTML('afterend', `
`); + postDatasetRequest(); + }); + + function areMandatoryFieldsEmpty() { + return ( + !dataset.name || + !dataset.publisher.authors[0].authorName || + !dataset.keywords.length || + !dataset.sources.length || + !dataset.timePeriod.from.year || + !dataset.timePeriod.to.year || + !dataset.language || + !dataset.license.licenseName + ); + } + + // don't check when it is draft + + // api calls + + function generateFormDataForPostingMetaData(state) { + let metaData = new FormData(); + if (isEditMode()) { + metaData.append('pkg_name', datasetIdName); + } + metaData.append('title', dataset.name); + metaData.append('notes', dataset.description); + metaData.append('license_id', dataset.license.licenseName); + metaData.append('private', dataset.viewPermission === 'Anyone' ? false : true); + metaData.append('publisher_type', dataset.publisher.type); + metaData.append('publication_date', `${dataset.date}/${dataset.month}/${dataset.year}`); + metaData.append('start_month', `${dataset.timePeriod.from.year}-${dataset.timePeriod.from.month}`); + metaData.append('end_month', `${dataset.timePeriod.to.year}-${dataset.timePeriod.to.month}`); + metaData.append('region', [dataset.region]); + dataset.publisher.authors.forEach((author, index) => { + metaData.append(`publisher_contacts-${index + 1}-name`, author.authorName); + metaData.append(`publisher_contacts-${index + 1}-email`, author.authorEmail); + metaData.append(`publisher_contacts-${index + 1}-website`, author.authorWebsite); + }); + dataset.referenceLinks.forEach((referenceLink, index) => { + metaData.append(`links-${index + 1}-link`, referenceLink.link); + metaData.append(`links-${index + 1}-title`, referenceLink.title); + }); + metaData.append('language', dataset.language); + metaData.append('tag_string', dataset.keywords.join(',')); + metaData.append('source', dataset.sources.join(',')); + metaData.append('dataset_state', state); + + return metaData; + } + + function postAllFilesSync(packageName, filesList) { + console.log(errorInfo.error); + console.log(filesList); + if (filesList.length === 0 && !errorInfo.error) { + if (window.global_state === 'draft') { + window.location = `/message/success?message= Dataset saved as draft successfully&dataset=${packageName}`; + } else if (isEditMode()) { + window.location = `/message/success?message= Dataset updated successfully&dataset=${packageName}`; + } else { + window.location = `/message/success?message= Dataset created successfully&dataset=${packageName}`; + } + return; + } + + if (filesList.length === 0 && errorInfo.error) { + submitDatasetButton.style.display = 'block'; + const loader = document.querySelector('.loader'); + if (loader) { + loader.style.display = 'none'; + } + return; + } + + const filesData = new FormData(); + filesData.append('upload', filesList[0].file); + filesData.append('name', filesList[0].fileName); + filesData.append('description', filesList[0].fileDescription); + + fetch(`${BASE_URL}/api/dataset/${packageName}/resource/new`, { + method: 'POST', + credentials: 'same-origin', + body: filesData + }) + .then((response) => { + console.log(response.ok); + if (!response.ok) { + errorInfo.updateErrorMessage(`Could not upload ${filesList[0].fileName}`); + const failedFileSummary = document.getElementById(`${filesList[0].fileId}`); + failedFileSummary.querySelector('file-error').style.display = 'block'; + failedFileSummary.querySelector('file-error').innerHTML = 'This file could not be uploaded'; + } + postAllFilesSync(packageName, filesList.slice(1)); + }) + .catch((error) => { + errorInfo.updateErrorMessage(error.message); + postAllFilesSync(packageName, filesList.slice(1)); + }); + } + + // function to delete a single resource + function deleteAllResources(resourceList, packageName) { + if (!resourceList.length) { + updateResources(resourcesByType.updated, packageName); + } else { + const resourceToBeDeleted = resourceList[0]; + + fetch(`${BASE_URL}/api/dataset/${packageName}/resource/${resourceToBeDeleted}/delete`, { + method: 'POST' + }) + .then((response) => { + if (!response.ok) { + errorInfo.updateErrorMessage(`Could not delete ${resourceToBeDeleted}`); + } + deleteAllResources(resourceList.slice(1)); + }) + .catch((error) => { + errorInfo.updateErrorMessage(error.message); + console.log(error.message); + }); + } + } + + function updateResources(resourcesList, packageName) { + if (!resourcesList.length) { + const filesList = resourcesByType.added.map((resourceId) => + getFileDetailsFromFileUploadElement(document.getElementById(resourceId)) + ); + postAllFilesSync(packageName, filesList); + } else { + const resource = getFileDetailsFromFileUploadElement(document.getElementById(resourcesList[0])); + + const fileData = new FormData(); + if (resource.file) { + fileData.append('upload', resource.file); + } + fileData.append('name', resource.fileName); + fileData.append('description', resource.fileDescription); + + fetch(`${BASE_URL}/api/dataset/${packageName}/resource/${resourcesList[0]}/edit`, { + method: 'POST', + credentials: 'same-origin', + body: fileData + }) + .then((response) => { + if (!response.ok) { + errorInfo.updateErrorMessage(`Could not update ${resource.fileName}`); + } + updateResources(resourcesList.slice(1)); + }) + .catch((error) => { + errorInfo.updateErrorMessage(error.message); + console.log(error.message); + }); + } + } + + // function to update a single resource + + function updateAllResources(packageName = datasetIdName) { + console.log(packageName); + console.log(datasetIdName); + deleteAllResources(resourcesByType.deleted, packageName); + } + + function postDatasetRequest(state = 'active') { + window.global_state = state; + errorInfo.updateErrorMessage(''); + + const modalBody = document.querySelector('#previewDatasetModal .modal-body'); + const existingErrorMessageElement = modalBody.querySelector('.dataset-fail'); + if (existingErrorMessageElement) { + existingErrorMessageElement.remove(); + } + + // if (state === 'active' && areMandatoryFieldsEmpty()) { + // modalBody.insertAdjacentHTML( + // 'afterbegin', + // `

Some fields are empty. Please populate them.

` + // ); + // return; + // } + + if (state === 'draft' && !dataset.name) { + document.getElementById('datasetNameField').setAttribute('placeholder', 'Enter a name for the dataset'); + document.getElementById('datasetNameField').style.border = '1px solid red'; + dataUploadSteps.setActiveStep(1, updateActiveSectionDOM); + setTimeout(() => { + document.getElementById('datasetNameField').style.border = '1px solid #ccc'; + }, 2000); + return; + } + + if (isEditMode()) { + console.log('sending update request'); + fetch(`${BASE_URL}/api/dataset/new`, { + method: 'POST', + credentials: 'same-origin', + body: generateFormDataForPostingMetaData(state) + }) + .then((response) => { + if (!response.ok) { + errorInfo.updateErrorMessage('Could not edit dataset'); + modalBody.insertAdjacentHTML( + 'afterbegin', + `

${error.message} - Couldn't update dataset. Please try again.

` + ); + + submitDatasetButton.style.display = 'block'; + + if (state == 'draft') { + saveAsDraftButtons.forEach((button) => { + button.addEventListener('click', () => { + button.style.display = 'block'; + }); + }); + } + const loader = document.querySelector('.loader'); + if (loader) { + loader.style.display = 'none'; + } + return; + } + return response.json(); + }) + .then((data) => { + updateAllResources(data.pkg_name); + }) + .catch((error) => { + console.log(error.message); + }); + } else { + fetch(`${BASE_URL}/api/dataset/new`, { + method: 'POST', + credentials: 'same-origin', + body: generateFormDataForPostingMetaData(state) + }) + .then((response) => response.json()) + .then((data) => { + if (!data.success) { + errorInfo.updateErrorMessage('Could not upload dataset'); + modalBody.insertAdjacentHTML( + 'afterbegin', + `

${error.message} - Couldn't upload dataset. Please try again.

` + ); + + submitDatasetButton.style.display = 'block'; + + if (state == 'draft') { + saveAsDraftButtons.forEach((button) => { + button.addEventListener('click', () => { + button.style.display = 'block'; + }); + }); + } + const loader = document.querySelector('.loader'); + if (loader) { + loader.style.display = 'none'; + } + return; + } + const filesList = resourcesByType.added.map((resourceId) => + getFileDetailsFromFileUploadElement(document.getElementById(resourceId)) + ); + postAllFilesSync(data.pkg_name, filesList); + }) + .catch((error) => { + console.log(error.message); + errorInfo.updateErrorMessage(error.message); + modalBody.insertAdjacentHTML( + 'afterbegin', + `

${error.message} - Couldn't upload dataset. Please try again.

` + ); + + submitDatasetButton.style.display = 'block'; + + if (state == 'draft') { + saveAsDraftButtons.forEach((button) => { + button.addEventListener('click', () => { + button.style.display = 'block'; + }); + }); + } + const loader = document.querySelector('.loader'); + if (loader) { + loader.style.display = 'none'; + } + return; + }); + } + } + + document.addEventListener('DOMContentLoaded', () => { + if (isEditMode()) { + const datasetName = splitURL[splitURL.length - 2]; + fetch(`${BASE_URL}/api/dataset/${datasetName}`, { + method: 'GET', + credentials: 'same-origin' + }) + .then((response) => response.json()) + .then((data) => fillFieldsWithData(data)) + .catch((error) => console.log(error.message)); + } + }); + + function fillFieldsWithData(data) { + console.log(data); + + datasetIdName = data.name; + + const fileUploadSections = document.querySelectorAll('.file-upload'); + fileUploadSections.forEach((section) => { + section.parentElement.removeChild(section); + }); + + // file section + document.getElementById('datasetNameField').value = data.title; + document.getElementById('datasetDescriptionField').innerHTML = data.notes; + receivedResources = data.resources; + receivedResourcesIds = receivedResources.map((resource) => resource.id); + receivedResources.forEach((resource) => { + fileUploadContainer.insertAdjacentHTML( + 'beforeend', + generateFileUploadField(resource.id, resource.name, resource.description.replace('\n', '\r\n'), resource.format) + ); + const uploadBox = document.getElementById(resource.id).querySelector('.upload-box'); + updateFileInputBackground(uploadBox, resource.format.toLowerCase()); + }); + + // ownership section + document.getElementById('licenseSelect').value = data.license_id; + document.querySelector(`input[name="view-permissions"]`).value = data.public === 'false' ? 'Only me' : 'Anyone'; + document.querySelector(`input[name="primary-publisher"]`).value = data.publisher_type; + + const publisherAdditionInputs = document.querySelectorAll('.item-addition--author'); + publisherAdditionInputs.forEach((input) => { + input.parentElement.removeChild(input); + }); + + data.publisher_contacts.forEach((publisher) => { + authorAdditionForm.insertAdjacentHTML( + 'beforeend', + generateAuthorField( + data.publisher_type === 'individual' ? 'Author' : 'Organization', + publisher.name, + publisher.email ? publisher.email : '', + publisher.website ? publisher.website : '' + ) + ); + }); + + // relevancy section + const [fromYear, fromMonth] = data.start_month.split('-'); + const [toYear, toMonth] = data.end_month.split('-'); + const [pubDate, pubMonth, pubYear] = data.publication_date ? data.publication_date.split('/') : ['', '', '']; + const regions = data.region.split(','); + + if (regions[0] === 'All India') { + const allIndiaInput = document.getElementById('allIndia'); + allIndiaInput.checked = true; + } else { + const partialIndiaInput = document.getElementById('partialIndia'); + partialIndiaInput.checked = true; + const nativeMultiSelect = document.querySelector('span.multiselect-native-select'); + const multiSelectToggle = document.querySelector('.multiselect.dropdown-toggle'); + nativeMultiSelect.style.display = 'inline-block'; + multiSelectToggle.style.display = 'inline-block'; + populateStates(regions); + } + + document.getElementById('fromYear').value = fromYear; + document.getElementById('toYear').value = toYear; + document.getElementById('fromMonth').value = fromMonth ? fromMonth : '--'; + document.getElementById('toMonth').value = toMonth ? toMonth : '--'; + + document.getElementById('pubDateInput').value = pubDate; + document.getElementById('pubMonthInput').value = pubMonth ? pubMonth : '--'; + document.getElementById('pubYearInput').value = pubYear; + + if (data.language === 'English' || data.language === 'Hindi') { + document.querySelector(`input[name="language-options"]`).value = data.language; + } else { + document.querySelector(`input[name="language-options"]`).value = 'other'; + document.getElementById('otherLanguageInput').style.display = 'inline-block'; + document.getElementById('otherLanguageInput').value = data.language; + } + + // sources section + + data.tags.forEach((tag) => { + insertTag(keywordsInput.parentElement, tag.display_name); + dataset.addItemToListProperty('keywords', tag.display_name); + }); + data.source.forEach((s) => { + insertTag(sourcesInput.parentElement, s); + dataset.addItemToListProperty('sources', s); + }); + + const referenceInputs = document.querySelectorAll('.item-addition--reference'); + + referenceInputs.forEach((input) => { + input.parentElement.removeChild(input); + }); + + const referenceLinks = data.links ? data.links : []; + + referenceLinks.forEach((link) => { + const referenceAdditionForm = document.querySelector('.data-upload-section__form__field--references'); + referenceAdditionForm.insertAdjacentHTML( + 'beforeend', + generateReferenceField(Math.random(), link.title, link.link) + ); + }); + } +})(); diff --git a/ckanext/justicehub_theme/public/justicehub_theme.css b/ckanext/justicehub_theme/public/justicehub_theme.css index 36233348..bd049689 100644 --- a/ckanext/justicehub_theme/public/justicehub_theme.css +++ b/ckanext/justicehub_theme/public/justicehub_theme.css @@ -154,8 +154,8 @@ a.morelink:visited { [class^="btn btn-"], .res-actions a, .content_action a { - border-radius: 30px; - padding: 5px 25px; + /* border-radius: 30px; + padding: 5px 25px; */ color: #ffffff; } .content_action a { diff --git a/ckanext/justicehub_theme/templates/base.html b/ckanext/justicehub_theme/templates/base.html index b1114329..779366ca 100644 --- a/ckanext/justicehub_theme/templates/base.html +++ b/ckanext/justicehub_theme/templates/base.html @@ -1,20 +1,49 @@ {% ckan_extends %} +{% block meta %} + {{ super() }} + + + + + + + + + + + + + + + + + + + +{% endblock %} + {% block meta_viewport %} {% endblock %} {% block styles %} {{ super() }} - - + {# + #} + + + + + + {% endblock %} {%- block scripts %} @@ -22,3 +51,8 @@ {% resource 'ckanext_issues/autocomplete-action-api.js' %} {% resource 'justicehub_theme/justicehub_theme.js' %} {% endblock -%} + + +{# + +#} diff --git a/ckanext/justicehub_theme/templates/dataupload/index.html b/ckanext/justicehub_theme/templates/dataupload/index.html new file mode 100644 index 00000000..23641d93 --- /dev/null +++ b/ckanext/justicehub_theme/templates/dataupload/index.html @@ -0,0 +1,540 @@ + + + + + + + + + + + + Data Upload Flow + + + {% include "header.html" %} +
+
+ Exit +

Upload Data

+

+ Follow our simple 4 step process to ensure that others can understand the context and reliability of the + files. + Click here to watch the video guide. +

+ + + +
+ +
+
    +
  • +
    + +
    +

    Add Files

    +
  • +
  • +
    + +
    +

    Ownership

    +
  • +
  • +
    + +
    +

    Data Relevancy

    +
  • +
  • +
    + +
    +

    Source of Data

    +
  • +
+
+
+
+
+
+

What is this data about?

+ eg: Death Penalties in Karnataka from Years 2000-2010 + +
+
+

Describe this dataset

+ Dataset descriptions improve the searchbility of datasets on the Justice Hub as well as other search + engines like Google, etc + + +
+
+

Upload one or many related files

+ You can upload a single file or a collection of files on a single subject. We accept all file formats like + data (csv & xlsx), data dictionary, methodology or reports (pdf). Each file has to be under 100 MB. Please + get in touch with tech@justicehub.in to upload files larger than + that. + +
+ +
+
+ + +
+
+

Name of the file (Upload a file to edit the name)

+ +
+
+
+

Description

+ +
+
+ +
+ +
+
+ + +
+
+

Name of the file (Upload a file to edit the name)

+ +
+
+
+

Description

+ +
+
+
+ Add more +
+ +
+
+ +
+
+
+

Select Licensing Permission

+ +
+
+

Set Viewing Permissions

+
+ +
+
+ +
+
+
+

Who is the Primary Publisher or Author of the file(s)?

+
+ +
+
+ +
+ +
+
+
Author's name
+ +
+ +
+
Website of Author (optional)
+ +
+
+
+ Add more +
+ +
+
+
+
+
+

Which region does this data cover?

+
+ +
+
+ + +
+
+ + +
+
+ +
+

Date of Publication (optional)

+
+
+
Date
+ +
+
+
Month
+ +
+
+
Year
+ +
+
+
+ +
+

Which time period does this data cover?

+
+
+
+
Month (optional)
+ +
+
+
From year
+ +
+
+
+
+
Month (optional)
+ +
+
+
To year
+ +
+
+
+
+ +
+

Which language is the data in?

+
+ +
+
+ +
+
+ + +
+
+
+
+ +
+
+
+
+

Enter keywords to help people find this data:

+ Use comma(,) to separate keywords - each keyword should at least have 3 characters +
+ +
+
+ +
+

Select the sources you got the data from:

+ Use comma(,) to separate sources +
+ +
+
+ +
+

Reference Links (optional):

+ +
+ +
+
Give your link a title
+ +
+
+
+
+ Add more +
+ + + + {{ h.snippet('widget/auth/datasetSuccess.html', id="datasetUploadSuccessModal") }} +
+ + + + + + + diff --git a/ckanext/justicehub_theme/templates/email/base.html b/ckanext/justicehub_theme/templates/email/base.html new file mode 100644 index 00000000..4ba08cfe --- /dev/null +++ b/ckanext/justicehub_theme/templates/email/base.html @@ -0,0 +1,24 @@ + + + + + +

+ +

+
+ + Hello {{ name }}

+ Thank you for registering an account on the Justice Hub.

+ Please click on this link to validate your e-mail Id. Post this step, you will be able to contribute datasets on the Justice Hub

+ For any queries, kindly reach out at info@justicehub.in

+ We look forward to collaborate with you.

+ Regards,
+ The JusticeHub Team +
+ + diff --git a/ckanext/justicehub_theme/templates/email/forgot_password.html b/ckanext/justicehub_theme/templates/email/forgot_password.html new file mode 100644 index 00000000..8d4582a9 --- /dev/null +++ b/ckanext/justicehub_theme/templates/email/forgot_password.html @@ -0,0 +1,8 @@ +

Dear {{ user_fullname }},

+ +

Password reset form for JusticeHub

+

Please click on this link below to reset before {{ expiration_in_hours }} hours:

+ +

Link

+ +

Thank you

diff --git a/ckanext/justicehub_theme/templates/footer.html b/ckanext/justicehub_theme/templates/footer.html index 88a6c1e2..91a7ce9a 100644 --- a/ckanext/justicehub_theme/templates/footer.html +++ b/ckanext/justicehub_theme/templates/footer.html @@ -1,4 +1,67 @@ - #} diff --git a/ckanext/justicehub_theme/templates/group/edit_base.html b/ckanext/justicehub_theme/templates/group/edit_base.html new file mode 100644 index 00000000..e9c4a188 --- /dev/null +++ b/ckanext/justicehub_theme/templates/group/edit_base.html @@ -0,0 +1,10 @@ +{% ckan_extends %} + + +{% block pre_primary %} + {% block content_action %} + {% link_for _('View'), controller='group', action='read', id=c.group_dict.name, class_='btn btn-default', icon='eye', named_route=group_type + '_read' %} + {% endblock %} +{% endblock %} + + diff --git a/ckanext/justicehub_theme/templates/group/read_base.html b/ckanext/justicehub_theme/templates/group/read_base.html new file mode 100644 index 00000000..2eede609 --- /dev/null +++ b/ckanext/justicehub_theme/templates/group/read_base.html @@ -0,0 +1,9 @@ +{% ckan_extends %} + + +{% block pre_primary %} + {% block content_action %} + {% link_for _('Manage'), controller='group', action='edit', id=c.group_dict.name, class_='btn btn-default', icon='wrench', named_route=group_type + '_edit' %} + {% endblock %} +{% endblock %} + diff --git a/ckanext/justicehub_theme/templates/header.html b/ckanext/justicehub_theme/templates/header.html index 1a068366..7ed15b10 100644 --- a/ckanext/justicehub_theme/templates/header.html +++ b/ckanext/justicehub_theme/templates/header.html @@ -1,69 +1,196 @@ -{% ckan_extends %} +{% block header_wrapper %} {% if data %} {% set step = data.current_step %} {% set error_message = data.message %} {% if +step %} + +{% endif %} {% else %} {% set error_message = false %} {% endif %} +
+ +
+
+ + × +
+ + Join / Login + Home + Explore Data + Contribute Data + Resources + About + Contact +
+ + + +{% endblock %} {# {% ckan_extends %} {% block header_site_navigation %} + +{% endblock %} {% block header_site_search %} {% endblock %} #} diff --git a/ckanext/justicehub_theme/templates/home/about.html b/ckanext/justicehub_theme/templates/home/about.html index 316d2cb3..1d5d2954 100644 --- a/ckanext/justicehub_theme/templates/home/about.html +++ b/ckanext/justicehub_theme/templates/home/about.html @@ -1,15 +1,55 @@ {% ckan_extends %} - {% block about %} -
-
- {% if g.site_about %} - {{ h.render_markdown(g.site_about) }} - {% else %} -

{{ _('About') }}

- {% snippet 'home/snippets/about_text.html' %} - {% endif %} - {% endblock %} -
+{% resource 'justicehub_theme/otherstyles/about.css' %} +
+
+

About Justice Hub

+

Open data will enable everyone to see and solve justice problems using data.

+ +

+ JusticeHub empowers communities for data-driven justice by making legal and justice data open, accessible and + actionable. +

+ +

+ By becoming a shared and open resource for discovering and publishing justice data and related information, + JusticeHub aims to increase the access to and interoperability of data. JusticeHub aims to advance the open data + movement in India by investing in and increasing the capacity of a wide range of actors to use and work with open + data to serve justice. +

+
+
+

Background

+

Justice Hub was born out of the Agami Data for Justice Challenge in June 2019. The Challenge sought to curate a collaborative entrepreneurial effort that increases and evolves the use of data. Inputs from a wide range of changemakers, led us to see the opportunity to collaborate on each other’s datasets.

+ +

+ The Challenge invited applicants to create a data hub and create new datasets, and after a rigorous selection process CivicDataLab was selected as the winner to create the Justice Hub. +

+
+
+

Co-creators

+ +
+
+

Team Members

+
+ +
+
+
+

Advisors

+

Bishaka Datta - Point of View

+

Donald Lobo - Chintu Gudiya Foundation | Tech4Dev

+

Madan Lokur - Former Judge, Supreme Court of India and Judge, Supreme Court of Fiji

+

Rahul Matthan - Partner, Trilegal

+

Samar Halarnkar - Founder, Article 14

+ {% resource 'justicehub_theme/otherstyles/about.js' %} + {% endblock %}
diff --git a/ckanext/justicehub_theme/templates/home/layout4.html b/ckanext/justicehub_theme/templates/home/layout4.html index ae2c49c3..95cffb67 100644 --- a/ckanext/justicehub_theme/templates/home/layout4.html +++ b/ckanext/justicehub_theme/templates/home/layout4.html @@ -1,3 +1,243 @@ +{% set groups = h.justicehub_theme_get_popular_groups() %} + + + + + + JusticeHub + + + +
+
+
+
+
+
+

Legal & Justice Data

+

An open source platform for data related to the Indian legal and justice system. Crowdsourced from a community of law + and data researchers, practitioners and enthusiasts.

+ +
+
+
+
+
+

Explore Popular Categories

+
+ {% for group in groups %} +
+
+ +
+

{{ group.display_name }}

+
+ {% endfor %} +
+
+
+
+
+ + +
+
+
+
+ +
+ +
+

+ Keep abreast with the latest datasets, collaborative opportunities, stories and more! +

+ Join us on Substack +
+
+
+
+ +
+
+
+
+ file formats +
+
+

Datasets

+

+ A dataset is a collection of files grouped together to give a complete understanding of a specific topic. + They can contain different files, like reports, raw data in the form of csv or excel sheets, a data + dictionary (which describes the contents in the files) & more. +

+

+ You can find datasets as well as stand-alone files on the platform. For more info on what truly makes a + dataset, click the links below. +

+
+ +
+ Read more +
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+ +
+
+

Top Data Contributors in the Community

+
+
+

Can’t find what you are looking for?

+ Let us know! +
+
+ + + + + +
+ + + + + + +{#
@@ -5,6 +245,15 @@ {% snippet 'home/snippets/search.html' %} {% endblock %}
+ +
+ {% for group in groups %} + {% snippet "group/snippets/group_item.html", group=group, position=loop.index %} + {% endfor %} +
+ + +
@@ -52,3 +301,5 @@
+#} + diff --git a/ckanext/justicehub_theme/templates/package/read_base (copy)-1.html b/ckanext/justicehub_theme/templates/package/read_base (copy)-1.html new file mode 100644 index 00000000..3c9bab69 --- /dev/null +++ b/ckanext/justicehub_theme/templates/package/read_base (copy)-1.html @@ -0,0 +1,147 @@ +{% extends "package/base.html" %} + +{% set organization=c.group_dict %} + +{% block subtitle %}{{ h.dataset_display_name(pkg) }} - {{ super() }}{% endblock %} + +{% block head_extras -%} + {{ super() }} + {% set description = h.markdown_extract(pkg.notes, extract_length=200)|forceescape %} + + +{% endblock -%} + +{% block wrapper_class %} + no-nav +{% endblock %} + +{% block page_header %} +
+ +

{{ h.dataset_display_name(pkg) }}

+ {% if self.content_action() | trim %} +
+ {% block content_action %} + {% if h.check_access('package_update', {'id':pkg.id }) %} + {% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn btn-default', icon='wrench' %} + {% endif %} + {% endblock %} +
+ {% endif %} +
+{% endblock %} + + +{% block primary_content_inner %} + {% block package_revision_info %} + {% if c.revision_date %} +
+

+ {% set timestamp = h.render_datetime(c.revision_date, with_hours=True) %} + {% set url = h.url_for(controller='package', action='read', id=pkg.name) %} + + {% trans timestamp=timestamp, url=url %}This is an old revision of this dataset, as edited at {{ timestamp }}. It may differ significantly from the current revision.{% endtrans %} +

+
+ {% endif %} + {% endblock %} +{% endblock %} + + + +{% block main_primary %} + +{% block pre_primary %} +
+
+
+

Project Name Comes Here

+

Project Description is a formally written declaration of the project and its idea and context to explain the goals and objectives to be reached, the business need and problem to be addressed, potentials pitfalls and challenges, approaches and execution methods, resource estimates, people and organizations involved, and

+
+
+ {% for tag in pkg.tags %} +
{{ tag.display_name }}
+ {% endfor %} +
+
+
200
DOWNLOADS
+
342
VIEWS
+
+
+
+ {{h.get_translated(pkg.organization, 'title') or pkg.organization.name}} + {{ pkg.organization.name }} + {{ c.group_dict.display_name }} +
+
+{% endblock %} + + + +
+{% block secondary %} + +{% endblock %} + + + +{% block primary %} +
+ {% block primary_content %} + {{ super() }} + {% endblock %} +
+{% endblock %} +
+ + +
bottom content
+ +{% endblock %} + + + + + + +{# +{% block content_primary_nav %} + {{ h.build_nav_icon('dataset_read', _('Dataset'), id=pkg.name) }} + {{ h.build_nav_icon('dataset_groups', _('Groups'), id=pkg.name) }} + {{ h.build_nav_icon('dataset_activity', _('Activity Stream'), id=pkg.name) }} +{% endblock %} +#} + +{# +{% block secondary_content %} + + {% block secondary_help_content %}{% endblock %} + + {% block package_info %} + {% snippet 'package/snippets/info.html', pkg=pkg %} + {% endblock %} + + {% block package_organization %} + {% if pkg.organization %} + {% set org = h.get_organization(pkg.organization.name) %} + {% snippet "snippets/organization.html", organization=org, has_context_title=true %} + {% endif %} + {% endblock %} + + {% block package_social %} + {% snippet "snippets/social.html" %} + {% endblock %} + + {% block package_license %} + {% snippet "snippets/license.html", pkg_dict=pkg %} + {% endblock %} + +{% endblock %} +#} diff --git a/ckanext/justicehub_theme/templates/package/read_base (copy).html b/ckanext/justicehub_theme/templates/package/read_base (copy).html new file mode 100644 index 00000000..7f4c151e --- /dev/null +++ b/ckanext/justicehub_theme/templates/package/read_base (copy).html @@ -0,0 +1,248 @@ +{% ckan_extends %} + +{% set organization=c.group_dict %} + +{% block wrapper_class %} + no-nav +{% endblock %} + +{% block pre_primary %} +
+
+
+
+

{{h.dataset_display_name(pkg)}} + {% if pkg.private %} + + {% endif %} + {% if pkg.verified %} + Verified + {% endif %} +

+
+ {{ _('Maintained by ') }} + {{ pkg.maintainer }} + +
+ +
+
{{h.render_markdown(h.get_translated(pkg, 'notes'))}}
+
+
+
+
+ {% for tag in pkg.tags %} + + {% endfor %} +
+
+
+
+ + +
+ +
+
+ {# + {% set downloads = h.justicehub_theme_get_package_avg_downloads(pkg) %} + {{ downloads }}{% if downloads %}{{ _('+') }}{% endif %} + {{ _('Downloads') }} + #} + + + {% set views = pkg.tracking_summary.total %} + {{ views }}{% if views %}{{ _('+') }}{% endif %} + {{ _('Views') }} + + + + {{ _('Updated ') }}{{ h.time_ago_from_timestamp(pkg.last_updated) }} + +
+
+ + + + +
+
+ + {% if self.content_action() | trim %} +
+ {% block content_action %} + {% if h.check_access('package_update', {'id':pkg.id }) %} + {% link_for _('EDIT'), controller='package', action='edit', id=pkg.name, class_='btn btn-default' %} + {% endif %} + {% endblock %} +
+ {% endif %} +
+{% endblock %} + +
+ {% block secondary %} + + {% endblock %} + + {% block primary %} +
+ {% block primary_content %} + {{ super() }} + {% endblock %} +
+ {% endblock %} +
+ +{% block page_header %} + +{% endblock %} +{% block primary_content_inner %} +
+
+ {% block package_resources %} +

+ {{ _('FILES') }} +

+ {% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %} + {% endblock %} +
+ +
+ {% block indicator_additional_info %} + {% snippet "scheming/package/snippets/additional_info.html", pkg_dict=pkg %} + {% endblock %} +
+ + + +
+ {% snippet "issues/dataset.html", pkg=pkg %} +
+ + {#
+ {% snippet "package/snippets/group_list.html", pkg_dict=pkg, pkg=pkg, id=pkg.name %} +
#} +
+{% endblock %} diff --git a/ckanext/justicehub_theme/templates/package/read_base.html b/ckanext/justicehub_theme/templates/package/read_base.html index 070eef18..2613bb3c 100644 --- a/ckanext/justicehub_theme/templates/package/read_base.html +++ b/ckanext/justicehub_theme/templates/package/read_base.html @@ -3,234 +3,255 @@ {% set organization=c.group_dict %} {% block wrapper_class %} - no-nav + no-nav dataset-page {% endblock %} + {% block pre_primary %} -
-
-
-
-

{{h.dataset_display_name(pkg)}} - {% if pkg.private %} - - {% endif %} - {% if pkg.verified %} - Verified - {% endif %} -

-
- {{ _('Maintained by ') }} - {{ pkg.maintainer }} - -
- -
-
{{h.render_markdown(h.get_translated(pkg, 'notes'))}}
-
-
-
-
- {% for tag in pkg.tags %} - - {% endfor %} -
-
-
-
+{% resource 'justicehub_theme/dataset/dataset.css' %} +{% endblock %} -
- + +{% block meta %} + + + {% block meta_generator %}{% endblock %} + {% block meta_viewport %}{% endblock %} + + + + + + + + + + + + + + + + + + + +{% endblock %} + + +{% block secondary %} + {% endblock %} -
- {% block secondary %} - - {% endblock %} - {% block primary %} -
- {% block primary_content %} - {{ super() }} - {% endblock %} -
- {% endblock %} -
+{% block primary %} +
+ {% block primary_content %} + {#{{ super() }}#} +
+
+
+

{{h.dataset_display_name(pkg)}}

+ {% if h.check_access('package_update', {'id':pkg.id }) %} + Edit dataset + {% endif %} +
+ +

{{ ('Uploaded: ')}} {{ h.time_ago_from_timestamp(pkg.metadata_created) }}; Last updated: {{ h.time_ago_from_timestamp(pkg.metadata_modified) }} + {% if pkg['publication_date'] %} + {% set split_date = pkg.publication_date.split('/') %} + {%- if pkg.publication_date| length > 3 -%} + ; Date of Publication: + {% for item in split_date%} + {%- if item|length > 0 and item != split_date[-1] -%} + {{item}}{{('-')}} + {%- elif item|length > 0 and item == split_date[-1] -%} + {{item}} + {%- endif -%} + {% endfor %} + {% endif %} + {% endif %} +

+
+

+ {% if pkg['region'] %} + {% set regions = pkg.region.split(',') %} + {% if regions| length > 1 %} + {% for region in regions %} + {% if region == regions[regions| length - 1]%} + {{ region }} + {% else %} + {{ region }}{{(',')}} + {% endif %} + {% endfor %} + {% else %} + {{pkg.region}} + {% endif %} + {% endif %} +

+

+ {% if pkg['start_month'] %} + {% set start_period = pkg.start_month.split('-') %} + {% set end_period = pkg.end_month.split('-') %} + {{ start_period[1]}} {{ start_period[0]}}{{(' - ')}}{{ end_period[1]}} {{ end_period[0]}} + {% endif %} +

+

{{ pkg.language }}

+
+

{{ pkg.license_title }}

+

{{ pkg.notes }}

-{% block page_header %} - -{% endblock %} -{% block primary_content_inner %} -
-
- {% block package_resources %} -

- {{ _('FILES') }} -

- {% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %} - {% endblock %} -
+ {#
+ {% block package_resources %} + {% if pkg.resources %} +
-
- {% block indicator_additional_info %} - {% snippet "scheming/package/snippets/additional_info.html", pkg_dict=pkg %} - {% endblock %} -
+ {% set zip_res = h.justicehub_theme_pop_zip_resource(pkg) %} + {% if zip_res %} + + {% else %} + + {% endif %} + {{ _('Download all') }} + - +
+ {% endif %} + {% endblock %} +
#} -
- {% snippet "issues/dataset.html", pkg=pkg %}
+ + {% set resources = pkg.resources or [] %} + {% for res in resources %} +
+
+ + {{ h.get_translated(res, 'format') }} + +
+

{{ h.resource_display_name(res) | truncate(50) }}

+

{{ res.description }}

+
+
+ +
+ {% endfor %}
+ {% if c.userobj.sysadmin %} +
+ {% block page_header %} + + {% endblock %} +
+ {% if self.page_primary_action() | trim %} +
+ {% block page_primary_action %}{% endblock %} +
+ {% endif %} + {% block primary_content_inner %} + {% endblock %} +
+
+ {% endif %} + {% endblock %} +
{% endblock %} + + diff --git a/ckanext/justicehub_theme/templates/package/resource_read copy.html b/ckanext/justicehub_theme/templates/package/resource_read copy.html new file mode 100644 index 00000000..88304c1f --- /dev/null +++ b/ckanext/justicehub_theme/templates/package/resource_read copy.html @@ -0,0 +1,132 @@ +{% ckan_extends %} + +{% block resource_inner %} +
+ + {% block resource_content %} + +
+
+ {% block resource_read_title %} +

{{ h.resource_display_name(res) | truncate(50) }}

+ {% endblock %} + +
+ {{ _('Updated') }} + {{ h.time_ago_from_timestamp(res.last_modified) or h.time_ago_from_timestamp(res.created) or _('unknown') }} +
+ + + +
+ {% if res.description %} + {{ h.render_markdown(res.description) }} + {% endif %} + {% if not res.description and c.package.notes %} +

{{ _('From the dataset abstract') }}

+
+ {{ h.markdown_extract(h.get_translated(c.package, 'notes')) }} +

+ {% trans dataset=c.package.title, url=h.url_for(controller='package', action='read', id=c.package['name']) %} + Source: {{ dataset }} + {% endtrans %} +

+
+ {% endif %} +
+ + {% block resource_read_url %} + {% if res.url and h.is_url(res.url) %} +

+ {{ _('URL:') }}
+ {{ res.url | truncate(100) }} +

+ {% elif res.url %} +

+ {{ _('URL:') }}
+ {{ res.url | truncate(100) }} +

+ {% endif %} + {% endblock %} + + {% if res.variable_measured %} +
+ {{ _('Resource captures: ') }} + {{ res.variable_measured }} +
+ {% endif %} + +
+ +
+
+
+ {% block resource_actions %} + + {% endblock %} +
+
+ {% snippet "snippets/social.html" %} +
+
+ {% endblock %} + + {% if res.format == 'CSV' %} + {% block data_preview %} + {{ super() }} + {% endblock %} + {% endif %} +{% endblock %} + +{% block primary_content %} +{% endblock %} + +{% block secondary_content %} +{% endblock %} diff --git a/ckanext/justicehub_theme/templates/package/resource_read.html b/ckanext/justicehub_theme/templates/package/resource_read.html index 88304c1f..fc60e5c3 100644 --- a/ckanext/justicehub_theme/templates/package/resource_read.html +++ b/ckanext/justicehub_theme/templates/package/resource_read.html @@ -1,128 +1,120 @@ {% ckan_extends %} +{% block wrapper_class %} + no-nav dataset-page +{% endblock %} + {% block resource_inner %} -
+{% resource 'justicehub_theme/dataset/dataset.css' %} +{% resource 'justicehub_theme/dataset/resource.css' %} +
{% block resource_content %} -
-
- {% block resource_read_title %} -

{{ h.resource_display_name(res) | truncate(50) }}

- {% endblock %} - -
- {{ _('Updated') }} - {{ h.time_ago_from_timestamp(res.last_modified) or h.time_ago_from_timestamp(res.created) or _('unknown') }} + + +
+ {#{{ super() }}#} +
+
+

View all files in "{{pkg.title}}"

+

{{ h.resource_display_name(res) | truncate(50) }}

+

{{ ('Updated: ')}} {{h.time_ago_from_timestamp(res.last_modified) or _('unknown') }} | {{ res.format }}

+ {% if res.format == 'CSV' or res.format == 'PDF' %} + {% block data_preview %} + {% block resource_view %} + {% block resource_view_content %} + {{ super() }} + {% endblock %} + {% endblock %} {% endblock %} -
- - {% endif %} - {% endblock %} - - {% endblock %} -
-
- {% snippet "snippets/social.html" %} + {% else %} +

This file cannot be previewed. Please download it.

+ {% endif %} +

{{ res.description }}

+ + +
{% endblock %} - - {% if res.format == 'CSV' %} - {% block data_preview %} - {{ super() }} - {% endblock %} - {% endif %} +
{% endblock %} {% block primary_content %} diff --git a/ckanext/justicehub_theme/templates/package/search.html b/ckanext/justicehub_theme/templates/package/search.html index 2a867910..cec7c3bb 100644 --- a/ckanext/justicehub_theme/templates/package/search.html +++ b/ckanext/justicehub_theme/templates/package/search.html @@ -1,47 +1,90 @@ -{% ckan_extends %} - - -{% block pre_primary %} - - {% block page_primary_action %} - {% if h.check_access('package_create') %} -
- {{ h.snippet ('snippets/add_dataset.html', dataset_type=dataset_type) }} +{% ckan_extends %} {% resource 'justicehub_theme/exploredatasets/search.css' %} {% set groups = +h.justicehub_theme_get_popular_groups() %} {% block pre_primary %} {% block page_primary_action %} {% if +h.check_access('package_create') %} {% endif %} +
+
+
+

Find the data you are looking for

+
+
+

+ With uploads from professionals and organisations in the field of legal and justice, you have a whole + repository of data at your fingertips. Use the filter panel to find data specific to your needs. Use the + popular keywords option below, or the search bar if you know exactly what you want to find. +

+
+

Popular Categories

+
+ {% for group in groups %} + {{ group.display_name }} + {% endfor %} +
+
+
- {% endif %} - {% endblock %} + {% block search_input %} +
+ +
+

Click here to read the guidelines for writing effective queries

+ {% endblock %} +
+
+ {# {{ h.snippet ('snippets/add_dataset.html', dataset_type=dataset_type) }} #} +
+{% endblock %} - {% block form %} - {% set facets = { - 'fields': c.fields_grouped, - 'search': c.search_facets, - 'titles': c.facet_titles, - 'translated_fields': c.translated_fields, - 'remove_field': c.remove_field } - %} - {% set sorting = [ - (_('Relevance'), 'score desc, metadata_modified desc'), - (_('Name (A-Z)'), 'title_string asc'), - (_('Name (Z-A)'), 'title_string desc'), - (_('Last Modified'), 'metadata_modified desc'), - (_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false) ] - %} - {% snippet 'snippets/search_form.html', form_id='dataset-search-form', type=dataset_type, query=c.q, sorting=sorting, sorting_selected=c.sort_by_selected, count=c.page.item_count, placeholder=_('Search ' + dataset_type + 's') + '...', facets=facets, show_empty=request.params, error=c.query_error, fields=c.fields %} - {% endblock %} +
+ {% block form %} {% set facets = { 'fields': c.fields_grouped, 'search': c.search_facets, 'titles': c.facet_titles, + 'translated_fields': c.translated_fields, 'remove_field': c.remove_field } %} {% set sorting = [ (_('Relevance'), + 'score desc, metadata_modified desc'), (_('Name (A-Z)'), 'title_string asc'), (_('Name (Z-A)'), 'title_string desc'), + (_('Last Modified'), 'metadata_modified desc'), (_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, + false) ] %} {% snippet 'snippets/search_form.html', form_id='dataset-search-form', type=dataset_type, query=c.q, + sorting=sorting, sorting_selected=c.sort_by_selected, count=c.page.item_count, placeholder=_('Search ' + dataset_type + + 's') + '...', facets=facets, show_empty=request.params, error=c.query_error, fields=c.fields %} {% endblock %} +
{% endblock %} -{% block primary_content %} -
+{% block primary %} +
+ {% block primary_content %}
- {% block package_search_results_list %} - {{ h.snippet('snippets/package_list.html', packages=c.page.items) }} - {% endblock %} + {% block package_search_results_list %} {{ h.snippet('snippets/package_list.html', packages=c.page.items) }} {% + endblock %}
+ {% block page_pagination %} {{ c.page.pager(q=c.q) }} {% endblock %} + {% endblock %} +
+{% endblock %} - {% block page_pagination %} - {{ c.page.pager(q=c.q) }} - {% endblock %} -
- +{% block secondary %} + +{% resource 'justicehub_theme/exploredatasets/search.js' %} {% endblock %} diff --git a/ckanext/justicehub_theme/templates/package/snippets/group_list.html b/ckanext/justicehub_theme/templates/package/snippets/group_list.html new file mode 100644 index 00000000..64c0e6da --- /dev/null +++ b/ckanext/justicehub_theme/templates/package/snippets/group_list.html @@ -0,0 +1,25 @@ +{% import 'macros/form.html' as form %} + +{% block primary_content_inner %} +

{{ _('Groups') }}

+ + {% if c.group_dropdown %} +
+ + +
+ {% endif %} + + {% if c.pkg_dict.groups %} +
+ {% snippet 'group/snippets/group_list.html', groups=c.pkg_dict.groups %} +
+ {% else %} +

{{ _('There are no groups associated with this dataset') }}

+ {% endif %} + +{% endblock %} diff --git a/ckanext/justicehub_theme/templates/package/snippets/tags.html b/ckanext/justicehub_theme/templates/package/snippets/tags.html new file mode 100644 index 00000000..8d296d62 --- /dev/null +++ b/ckanext/justicehub_theme/templates/package/snippets/tags.html @@ -0,0 +1,5 @@ +{% if tags %} +
+ {% snippet 'snippets/tag_list.html', tags=tags, _class='tag-list well' %} +
+{% endif %} diff --git a/ckanext/justicehub_theme/templates/page.html b/ckanext/justicehub_theme/templates/page.html new file mode 100644 index 00000000..f77934af --- /dev/null +++ b/ckanext/justicehub_theme/templates/page.html @@ -0,0 +1,141 @@ +{% extends "base.html" %} + +{%- block page -%} + + {% block skip %} + + {% 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 message in h.flash.pop_messages() | list %} +
+ {{ h.literal(message) }} +
+ {% endfor %} + {% endblock %} +
+ {% endblock %} + + {#{% block toolbar %} +
+ {% block breadcrumb %} + {% if self.breadcrumb_content() | trim %} + + {% endif %} + {% endblock %} +
+ {% 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 %} + {% resource 'base/main' %} + {% resource 'base/ckan' %} + {% if g.tracking_enabled %} + {% resource 'base/tracking.js' %} + {% endif %} + {{ super() }} +{% endblock -%} diff --git a/ckanext/justicehub_theme/templates/snippets/facet_list.html b/ckanext/justicehub_theme/templates/snippets/facet_list.html index ff61735d..90f5e7cf 100644 --- a/ckanext/justicehub_theme/templates/snippets/facet_list.html +++ b/ckanext/justicehub_theme/templates/snippets/facet_list.html @@ -1,6 +1,8 @@ {% ckan_extends %} + {% block facet_list_heading %} +{% resource 'justicehub_theme/exploredatasets/filter_box.css' %}

{% set title = title or h.get_facet_title(name) %} {{ title | upper }} @@ -8,6 +10,7 @@

{% endblock %} {% block facet_list_items %} +{% resource 'justicehub_theme/exploredatasets/filter_box.css' %} {% with items = items or h.get_facet_items_dict(name) %} {% if items %}