Skip to content

Commit

Permalink
add optional link to github repo of bundle module (DISPLAY_GITHUB_LINK)
Browse files Browse the repository at this point in the history
put some template links in a common file
  • Loading branch information
Neradoc committed Oct 22, 2022
1 parent c366216 commit 56e3dd5
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 11 deletions.
Binary file added assets/images/GitHub-Mark-120px-plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/GitHub-Mark-32px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/GitHub-Mark-64px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/GitHub-Mark-Light-120px-plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/GitHub-Mark-Light-32px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/GitHub-Mark-Light-64px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion assets/main/board_page.css
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,17 @@ commands group.unrolled .icon-right {
text-align: center;
font-weight: normal;
}
#circup_page table .name { width: 100%; }
#circup_page table .name {
width: 100%;
}
#circup_page table .name .repo_link {
margin-left: 8px;
}
#circup_page table .name .repo_link img {
height: 18px;
opacity: 0.5;
vertical-align: bottom;
}
#circup_page table .board_version { white-space: nowrap; }
#circup_page table .bundle_version { white-space: nowrap; }
#circup_page table .status_icon {
Expand Down Expand Up @@ -449,6 +459,16 @@ commands group.unrolled .icon-right {
padding: 2px 4px;
}
#bundle_list .liste p.hide { display: none; }
#bundle_list .liste p .repo_link {
margin-left: 8px;
}
#bundle_list .liste p .repo_link img {
height: 16px;
vertical-align: bottom;
opacity: 0.5;
/* filter: var(--svg-glow); */
}

.pair0 {
background: var(--color-pair0);
}
Expand Down
13 changes: 11 additions & 2 deletions assets/main/board_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SPDX-FileCopyrightText: Copyright (c) 2022 Neradoc, https://neradoc.me
SPDX-License-Identifier: MIT
*/

import { BUNDLE_ACCESS, OPEN_IN_BROWSER } from "../../config.js"
import { BUNDLE_ACCESS, OPEN_IN_BROWSER, DISPLAY_GITHUB_LINK } from "../../config.js"
import * as common from "../main/common.js"
import * as tools from "../lib/tools.js"
import { setup_directory, refresh_list } from "../main/list_directory.js"
Expand Down Expand Up @@ -267,12 +267,21 @@ async function run_update_process(imports) {
var module = common.library_bundle.get_module(dependency)
var file_name = module.name + (module.package ? "" : ".mpy")
var icon = module.package ? "📁" : "📄"
var new_line = $("#circup_row_template").clone(); // clone the template
if(DISPLAY_GITHUB_LINK && module.repo) {
var github = $("#template-icons .repo_link").clone()
github.prop("href", module.repo)
github.on("click", tools.open_outside_sync)
github.show()
}
var new_line = $("#circup_row_template").clone() // clone the template
new_line.prop("id", "")
new_line.find(".upload button").on("click", upload_button_call)
new_line.find(".upload button").val(dependency)
new_line.find(".icon").html(icon)
new_line.find(".name").html(dependency)
if(DISPLAY_GITHUB_LINK && module.repo) {
new_line.find(".name").append(github)
}
new_line.find(".bundle_version").html(module.version)
new_line.find(".board_version").html("...")
if (imports.includes(dependency)) {
Expand Down
23 changes: 15 additions & 8 deletions assets/main/bundler_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ SPDX-FileCopyrightText: Copyright (c) 2022 Neradoc, https://neradoc.me
SPDX-License-Identifier: MIT
*/

import { DEBUG } from "../lib/tools.js"
import { DISPLAY_GITHUB_LINK } from "../../config.js"
import * as tools from "../lib/tools.js"
import * as jq from "../extlib/jquery.min.js"

export var modules_list = []
Expand Down Expand Up @@ -150,14 +151,20 @@ async function fill_modules_list() {
keys.forEach((module_name, pair) => {
var nd1 = circup.all_the_modules[module_name].dependencies.length
var nd2 = circup.all_the_modules[module_name].external_dependencies.length
var repo = circup.all_the_modules[module_name].repo
var num_deps = ""
if(DEBUG) { num_deps = `(${nd1+nd2})`; }
$("#bundle_modules").append(
`<p>
<input class="checkbox" type="checkbox"/>
<span class="module">${module_name}</span> ${num_deps}
</p>`
)
if(tools.DEBUG) { num_deps = `(${nd1+nd2})`; }
var line_to_add = $(`<p>
<input class="checkbox" type="checkbox"/>
<span class="module">${module_name}</span> ${num_deps}
</p>`)
if(DISPLAY_GITHUB_LINK && repo) {
var github = $("#template-icons .repo_link").clone()
github.prop("href", repo)
github.on("click", tools.open_outside_sync)
line_to_add.find(".module").append(github)
}
$("#bundle_modules").append(line_to_add)
})
filter_the_modules()
}
Expand Down
8 changes: 8 additions & 0 deletions assets/main/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ SPDX-License-Identifier: MIT
--caret-color: white;
--color-editor-zebra: rgba(50, 50, 50, 0.2);
}
.light-mode { display: none; }
}
@media (prefers-color-scheme: light) {
.dark-mode { display: none; }
}

body {
Expand Down Expand Up @@ -85,3 +89,7 @@ button, input {
border-radius: 4px;
padding: 2px 4px;
}

#template-icons {
display: none;
}
13 changes: 13 additions & 0 deletions assets/svg/external-link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export var WORKFLOW_USERNAME = "" // can only be empty for now
export var WORKFLOW_PASSWORD = "passw0rd" // default, overriden by the password field
export var DEBUG_DEFAULT = null // override the "default" param or set to null
export var OPEN_IN_BROWSER = false // open links to web workflow files/serial in browser
export var DISPLAY_GITHUB_LINK = true // show link to github repositories
1 change: 1 addition & 0 deletions html/board-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ <h1 id="top_title">
<div id="blanket"></div>
<div id="password_dialog" class="include" data-src="dialog-password"></div>
<div id="files_progress_dialog" class="include" data-src="dialog-files-progress"></div>
<div id="common_templates" class="include" data-src="common-templates"></div>
</body>
</html>
13 changes: 13 additions & 0 deletions html/common-templates.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--
SPDX-FileCopyrightText: Copyright (c) 2022 Neradoc, https://neradoc.me
SPDX-License-Identifier: MIT
-->
<div id="template-icons">
<a href="" class="repo_link" title="Go to library repository"
><img class="dark-mode"
src="assets/images/GitHub-Mark-Light-64px.png"
/><img class="light-mode"
src="assets/images/GitHub-Mark-64px.png"
/></a>
<a href="" class="external_link" title=""><img src="assets/svg/external-link.svg" /></a>
</div>

0 comments on commit 56e3dd5

Please sign in to comment.