From 509c172009a63241349cae3f828db9751bc9e054 Mon Sep 17 00:00:00 2001 From: ochan1 Date: Tue, 16 Nov 2021 02:33:52 -0800 Subject: [PATCH 1/6] Add See Code button among the proj icons --- static/js/base.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/static/js/base.js b/static/js/base.js index ce86c33..ea288f1 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -157,6 +157,23 @@ 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 = ''; + span.title = localizer.localize(tooltip); + return span; +}; + function projectURL (author, project, devVersion) { return (devVersion ? snapDevURL : snapURL) + '#present:Username=' + encodeURIComponent(author) + From 06a9f82ed1df182360312e5815ccaa494c6189b6 Mon Sep 17 00:00:00 2001 From: ochan1 Date: Tue, 16 Nov 2021 02:34:10 -0800 Subject: [PATCH 2/6] Use item itself if no attribute specified --- static/js/project.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/js/project.js b/static/js/project.js index 4e9ca0a..13f48e9 100644 --- a/static/js/project.js +++ b/static/js/project.js @@ -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)) ); }); } From 7ab0e5a5261822b1ea091926aeacedb14fef81e9 Mon Sep 17 00:00:00 2001 From: ochan1 Date: Tue, 16 Nov 2021 02:34:30 -0800 Subject: [PATCH 3/6] Padding between published and see code icons --- static/style/project.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/style/project.css b/static/style/project.css index 76cd65a..bf995d3 100644 --- a/static/style/project.css +++ b/static/style/project.css @@ -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; } From eea44c332ff578f970b2ba2369c7912a3936bc2f Mon Sep 17 00:00:00 2001 From: ochan1 Date: Tue, 16 Nov 2021 02:35:33 -0800 Subject: [PATCH 4/6] Add See Project Code button to project grid elems --- templates/collection.tmp | 1 + templates/examples.tmp | 1 + templates/my_projects.tmp | 3 ++- templates/project_remixes.tmp | 1 + templates/search.tmp | 1 + templates/welcome.tmp | 1 + 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/collection.tmp b/templates/collection.tmp index 21aadaf..244780b 100644 --- a/templates/collection.tmp +++ b/templates/collection.tmp @@ -88,6 +88,7 @@ extraFields: { isPublic: 'ispublic', isPublished: 'ispublished', + projectCodeButton: '', author: 'username' }, withCollectionControls: true diff --git a/templates/examples.tmp b/templates/examples.tmp index 7095033..6adb2c8 100644 --- a/templates/examples.tmp +++ b/templates/examples.tmp @@ -32,6 +32,7 @@ extraFields: { isPublic: 'ispublic', isPublished: 'ispublished', + projectCodeButton: '', author: 'username' } } diff --git a/templates/my_projects.tmp b/templates/my_projects.tmp index 847eb2b..fb75fc1 100644 --- a/templates/my_projects.tmp +++ b/templates/my_projects.tmp @@ -29,7 +29,8 @@ gridSize: 5, extraFields: { isPublic: 'ispublic', - isPublished: 'ispublished' + isPublished: 'ispublished', + projectCodeButton: '' } } ) diff --git a/templates/project_remixes.tmp b/templates/project_remixes.tmp index 62d026d..6981682 100644 --- a/templates/project_remixes.tmp +++ b/templates/project_remixes.tmp @@ -27,6 +27,7 @@ extraFields: { isPublic: 'ispublic', isPublished: 'ispublished', + projectCodeButton: '', author: 'username' } } diff --git a/templates/search.tmp b/templates/search.tmp index 8770976..09503a6 100644 --- a/templates/search.tmp +++ b/templates/search.tmp @@ -35,6 +35,7 @@ extraFields: { isPublic: 'ispublic', isPublished: 'ispublished', + projectCodeButton: '', author: 'username' } } diff --git a/templates/welcome.tmp b/templates/welcome.tmp index 5fee200..2a86496 100644 --- a/templates/welcome.tmp +++ b/templates/welcome.tmp @@ -53,6 +53,7 @@ if (username) { extraFields: { isPublic: 'ispublic', isPublished: 'ispublished', + projectCodeButton: '', author: 'username' } } From 73c1cc80a805968c5922200879d3f610a06d6407 Mon Sep 17 00:00:00 2001 From: ochan1 Date: Tue, 16 Nov 2021 02:42:11 -0800 Subject: [PATCH 5/6] More See Project Code button to project grid elems --- templates/my_collections.tmp | 1 + templates/project_collections.tmp | 1 + templates/search.tmp | 1 + 3 files changed, 3 insertions(+) diff --git a/templates/my_collections.tmp b/templates/my_collections.tmp index e69905f..00d3570 100644 --- a/templates/my_collections.tmp +++ b/templates/my_collections.tmp @@ -34,6 +34,7 @@ extraFields: { isPublic: 'shared', isPublished: 'published', + projectCodeButton: '', author: 'username' } } diff --git a/templates/project_collections.tmp b/templates/project_collections.tmp index 9071e97..cc26d02 100644 --- a/templates/project_collections.tmp +++ b/templates/project_collections.tmp @@ -29,6 +29,7 @@ extraFields: { isPublic: 'shared', isPublished: 'published', + projectCodeButton: '', author: 'username' } } diff --git a/templates/search.tmp b/templates/search.tmp index 09503a6..3c2134c 100644 --- a/templates/search.tmp +++ b/templates/search.tmp @@ -75,6 +75,7 @@ extraFields: { isPublic: 'shared', isPublished: 'published', + projectCodeButton: '', author: 'username' } } From 89f279cab44809ab9a0ad3da934ce091ab0799b6 Mon Sep 17 00:00:00 2001 From: ochan1 Date: Sat, 20 Nov 2021 16:48:59 -0800 Subject: [PATCH 6/6] Add unicode lambda for See Code icon --- static/js/base.js | 10 ++++++---- static/style/classes.css | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/static/js/base.js b/static/js/base.js index ea288f1..42cbe4d 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -162,14 +162,16 @@ function projectCodeButtonSpan (project) { var tooltip = 'See Code'; span.classList.add('project-code-button'); - span.innerHTML = ''; + '&editMode&noRun">' + + ''; span.title = localizer.localize(tooltip); return span; }; diff --git a/static/style/classes.css b/static/style/classes.css index 0eeb28d..38522a2 100644 --- a/static/style/classes.css +++ b/static/style/classes.css @@ -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;