Skip to content

Commit

Permalink
Replace "licence" with "license"
Browse files Browse the repository at this point in the history
Replaces the spelling "licence" with "license" for improved maintainability.
  • Loading branch information
ItIsJordan committed Feb 27, 2024
1 parent 569ed49 commit 8849f79
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions hepdata/modules/records/assets/js/hepdata_resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ HEPDATA.hepdata_resources = (function () {

// Render the licence header text if required
resource_item.append("span").text(function(d) {
return d['data_license'] && d['data_license'].url ? "Licence: " : "";
return d['data_license'] && d['data_license'].url ? "license: " : "";
});

// Manage rendering of the data license value
// Uses url, description and name from data_licence for anchor url, title, and text respectively
// Uses url, description and name from data_license for anchor url, title, and text respectively
resource_item.append("a")
.attr('href', function(d) {
return d['data_license'] ? d['data_license'].url : null;
Expand All @@ -61,7 +61,7 @@ HEPDATA.hepdata_resources = (function () {
.text(function(d) {
return d['data_license'] ? d['data_license'].name : null;
})
.attr("class", "licence-url");
.attr("class", "license-url");

resource_item.append("p")
.attr('display', function(d){
Expand Down
4 changes: 2 additions & 2 deletions hepdata/modules/records/assets/js/hepdata_tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ HEPDATA.table_renderer = {
// Handle rendering of a licence if it exists
if(table_data.table_license) {
// Set up anchor with url, text, and title/tooltip
var licence_url = $("<a>")
var license_url = $("<a>")
.text(table_data.table_license.name)
.attr("href", table_data.table_license.url)
.attr('title', table_data.table_license.description)
// Add the anchor to the section, and show it
$("#table_data_license_url").append(licence_url);
$("#table_data_license_url").append(license_url);
$("#table_data_license").removeClass("hidden");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ <h4>
<p><a href="{{ ctx.resource.file_location }}">{{ ctx.resource.file_location }}</a></p>
{% elif ctx.display_type == 'code' %}

{% if ctx.data_licence %}
<div id="resource-data-licence">
Licence: <a href="{{ ctx.data_licence.url }}" title="{{ ctx.data_licence.description }}">{{ ctx.data_licence.name }}</a>
{% if ctx.data_license %}
<div id="resource-data-license">
Licence: <a href="{{ ctx.data_license.url }}" title="{{ ctx.data_license.description }}">{{ ctx.data_license.name }}</a>
</div>
{% endif %}

Expand Down
10 changes: 5 additions & 5 deletions hepdata/modules/records/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ def file_size_check(file_location, load_all):
size_check["status"] = size_check["size"] <= SIZE_LOAD_CHECK_THRESHOLD
return size_check

def generate_licence_data_by_id(licence_id):
def generate_license_data_by_id(license_id):
"""
Generates a dictionary from a Licence class selected by
Generates a dictionary from a license class selected by
its ID from the database.
:param licence_id:
:return dict: Returns the licence_data dictionary, or None
:param license_id:
:return dict: Returns the license_data dictionary, or None
"""
license_data = License.query.filter_by(id=licence_id).first()
license_data = License.query.filter_by(id=license_id).first()
if license_data:
# Generate and return the dictionary
return {
Expand Down
8 changes: 4 additions & 4 deletions hepdata/modules/records/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from hepdata.modules.submission.models import HEPSubmission, DataSubmission, \
DataResource, DataReview, Message, Question
from hepdata.modules.records.utils.common import get_record_by_id, \
default_time, IMAGE_TYPES, decode_string, file_size_check, generate_licence_data_by_id
default_time, IMAGE_TYPES, decode_string, file_size_check, generate_license_data_by_id
from hepdata.modules.records.utils.data_processing_utils import \
generate_table_structure, process_ctx
from hepdata.modules.records.utils.submission import create_data_review, \
Expand Down Expand Up @@ -338,7 +338,7 @@ def get_table_details(recid, data_recid, version, load_all=1):
table_contents["name"] = datasub_record.name
table_contents["title"] = datasub_record.description
table_contents["keywords"] = datasub_record.keywords
table_contents["table_license"] = generate_licence_data_by_id(data_record.file_license)
table_contents["table_license"] = generate_license_data_by_id(data_record.file_license)
table_contents["related_tables"] = get_table_data_list(datasub_record, "related")
table_contents["related_to_this"] = get_table_data_list(datasub_record, "related_to_this")
table_contents["doi"] = datasub_record.doi
Expand Down Expand Up @@ -684,7 +684,7 @@ def process_resource(reference):

_reference_data = {'id': reference.id, 'file_type': reference.file_type,
'file_description': reference.file_description,
'data_license' : generate_licence_data_by_id(reference.file_license),
'data_license' : generate_license_data_by_id(reference.file_license),
'location': _location, 'doi': reference.doi}

if reference.file_type.lower() in IMAGE_TYPES:
Expand Down Expand Up @@ -776,7 +776,7 @@ def get_resource(resource_id):
if filesize:
ctx['filesize'] = '%.2f'%((filesize / 1024) / 1024) # Set filesize if exists
ctx['ADDITIONAL_SIZE_LOAD_CHECK_THRESHOLD'] = '%.2f'%((ADDITIONAL_SIZE_LOAD_CHECK_THRESHOLD / 1024) / 1024)
ctx['data_licence'] = generate_licence_data_by_id(resource_obj.file_license)
ctx['data_license'] = generate_license_data_by_id(resource_obj.file_license)
return render_template('hepdata_records/related_record.html', ctx=ctx)

else:
Expand Down
2 changes: 1 addition & 1 deletion hepdata/modules/theme/assets/scss/record.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,6 @@ g.node {

}

.licence-url {
.license-url {
color: lightblue;
}

0 comments on commit 8849f79

Please sign in to comment.