Skip to content
This repository was archived by the owner on Dec 21, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions static/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,25 @@ function isPublishedSpan (isPublished) {
return span;
};

function projectCodeButtonSpan (project) {
var span = document.createElement('span');
var tooltip = 'See Code';

span.classList.add('project-code-button');
span.innerHTML = '<a style="color: inherit;" ' +
'target="_blank" rel="noopener noreferrer" ' +
'href="' +
projectURL(
project.username,
project.projectname,
getUrlParameter('devVersion') !== null) +
'&editMode&noRun">' +
'<i class="fas fa-lambda' +
'" aria-hidden="true"></i></a>';
span.title = localizer.localize(tooltip);
return span;
};

function projectURL (author, project, devVersion) {
return (devVersion ? snapDevURL : snapURL) +
'#present:Username=' + encodeURIComponent(author) +
Expand Down
6 changes: 5 additions & 1 deletion static/js/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ function itemDiv (item, itemType, ownerUsernamePath, nameField,
if (extraFields) {
Object.keys(extraFields).forEach(function (fieldName) {
var attribute = extraFields[fieldName];
var item_access = 'item';
if (attribute) {
item_access += '.' + attribute;
}
div.appendChild(
window[fieldName + 'Span'](eval('item.' + attribute))
window[fieldName + 'Span'](eval(item_access))
);
});
}
Expand Down
5 changes: 5 additions & 0 deletions static/style/classes.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ pre.in-place {
background: url('../img/octagon.png');
}

/* img filler because we don't have octagon in FA free edition */
.fa-lambda:before {
content: '\03BB'; /* Unicode for Lambda */
}

/* Hide Discourse's meta info on images */
.lightbox > .meta {
display: none;
Expand Down
4 changes: 3 additions & 1 deletion static/style/project.css
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ img.collection-thumbnail {
}

.collection.small span.is-public,
.project.small span.is-public {
.project.small span.is-public,
.collection.small span.is-published,
.project.small span.is-published {
margin-right: 0.5em;
}

Expand Down
1 change: 1 addition & 0 deletions templates/collection.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
extraFields: {
isPublic: 'ispublic',
isPublished: 'ispublished',
projectCodeButton: '',
author: 'username'
},
withCollectionControls: true
Expand Down
1 change: 1 addition & 0 deletions templates/examples.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
extraFields: {
isPublic: 'ispublic',
isPublished: 'ispublished',
projectCodeButton: '',
author: 'username'
}
}
Expand Down
1 change: 1 addition & 0 deletions templates/my_collections.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
extraFields: {
isPublic: 'shared',
isPublished: 'published',
projectCodeButton: '',
author: 'username'
}
}
Expand Down
3 changes: 2 additions & 1 deletion templates/my_projects.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
gridSize: 5,
extraFields: {
isPublic: 'ispublic',
isPublished: 'ispublished'
isPublished: 'ispublished',
projectCodeButton: ''
}
}
)
Expand Down
1 change: 1 addition & 0 deletions templates/project_collections.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
extraFields: {
isPublic: 'shared',
isPublished: 'published',
projectCodeButton: '',
author: 'username'
}
}
Expand Down
1 change: 1 addition & 0 deletions templates/project_remixes.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
extraFields: {
isPublic: 'ispublic',
isPublished: 'ispublished',
projectCodeButton: '',
author: 'username'
}
}
Expand Down
2 changes: 2 additions & 0 deletions templates/search.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
extraFields: {
isPublic: 'ispublic',
isPublished: 'ispublished',
projectCodeButton: '',
author: 'username'
}
}
Expand Down Expand Up @@ -74,6 +75,7 @@
extraFields: {
isPublic: 'shared',
isPublished: 'published',
projectCodeButton: '',
author: 'username'
}
}
Expand Down
1 change: 1 addition & 0 deletions templates/welcome.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ if (username) {
extraFields: {
isPublic: 'ispublic',
isPublished: 'ispublished',
projectCodeButton: '',
author: 'username'
}
}
Expand Down