Skip to content

Commit

Permalink
add blockly help buttons for missing sections and release dependant h…
Browse files Browse the repository at this point in the history
…elpURL (openhab#2035)

fixes openhab#2014
adds the help button for uom

---------

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
  • Loading branch information
stefan-hoehn committed Sep 23, 2023
1 parent 994d286 commit 276f311
Showing 1 changed file with 30 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
</category>

<category name="Loops" colour="%{BKY_LOOPS_HUE}">
<button
helpUrl="configuration/blockly/rules-blockly-standard-ext.html#loops"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="controls_repeat_ext">
<value name="TIMES">
<shadow type="math_number">
Expand Down Expand Up @@ -45,6 +49,10 @@
</category>

<category name="Math" colour="%{BKY_MATH_HUE}">
<button
helpUrl="configuration/blockly/rules-blockly-standard-ext.html#math"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="math_number">
<field name="NUM">123</field>
</block>
Expand Down Expand Up @@ -166,6 +174,10 @@
</category>

<category name="Text" colour="%{BKY_TEXTS_HUE}">
<button
helpUrl="configuration/blockly/rules-blockly-standard-ext.html#text"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="text" />
<block type="text_join">
<mutation items="0" />
Expand Down Expand Up @@ -251,7 +263,7 @@

<category name="Lists" colour="%{BKY_LISTS_HUE}">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-standard-ext.html#lists"
helpUrl="configuration/blockly/rules-blockly-standard-ext.html#lists"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="lists_create_with">
Expand Down Expand Up @@ -317,7 +329,7 @@

<category name="Color" colour="%{BKY_COLOUR_HUE}">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-standard-ext.html#colors"
helpUrl="configuration/blockly/rules-blockly-standard-ext.html#colors"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="colour_picker" />
Expand Down Expand Up @@ -368,7 +380,7 @@
<category name="openHAB" colour="0" :expanded="$f7.device.desktop">
<category name="Items &amp; Things">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-items-things.html"
helpUrl="configuration/blockly/rules-blockly-items-things.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_getitem_state">
Expand Down Expand Up @@ -466,7 +478,7 @@

<category name="Timers &amp; Delays">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-timers-and-delays.html"
helpUrl="configuration/blockly/rules-blockly-timers-and-delays.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_sleep" />
Expand Down Expand Up @@ -539,7 +551,7 @@

<category name="Voice &amp; Multimedia">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-voice-and-multimedia.html"
helpUrl="configuration/blockly/rules-blockly-voice-and-multimedia.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_playmedia_sink">
Expand Down Expand Up @@ -598,6 +610,10 @@
</block>
</category>
<category name="Units of Measurement" v-if="isGraalJs">
<button
helpUrl="configuration/blockly/rules-blockly-uom.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_quantity">
<value name="quantity">
<shadow type="text">
Expand Down Expand Up @@ -646,7 +662,7 @@
</category>
<category name="Dates &amp; Times">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-date-handling.html"
helpUrl="configuration/blockly/rules-blockly-date-handling.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_zdt_now" />
Expand Down Expand Up @@ -767,7 +783,7 @@

<category name="Ephemeris">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-ephemeris.html"
helpUrl="configuration/blockly/rules-blockly-ephemeris.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_ephemeris_check">
Expand All @@ -791,7 +807,7 @@

<category name="Notifications">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-notifications.html"
helpUrl="configuration/blockly/rules-blockly-notifications.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_sendNotification">
Expand Down Expand Up @@ -837,7 +853,7 @@

<category name="Persistence">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-persistence.html"
helpUrl="configuration/blockly/rules-blockly-persistence.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_zdt_plusminus">
Expand Down Expand Up @@ -908,7 +924,7 @@

<category name="Value Storage">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-value-storage.html"
helpUrl="configuration/blockly/rules-blockly-value-storage.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_store_value">
Expand Down Expand Up @@ -941,7 +957,7 @@

<category name="Run &amp; Process">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-run-and-process.html"
helpUrl="configuration/blockly/rules-blockly-run-and-process.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_callscriptfile">
Expand Down Expand Up @@ -991,7 +1007,7 @@

<category name="Logging &amp; Output">
<button
helpUrl="https://www.openhab.org/docs/configuration/blockly/rules-blockly-logging.html"
helpUrl="configuration/blockly/rules-blockly-logging.html"
text="Help"
callbackKey="ohBlocklyHelp" />
<block type="oh_log">
Expand Down Expand Up @@ -1199,8 +1215,9 @@ export default {
Blockly.Xml.domToWorkspace(xml, this.workspace)
this.workspace.addChangeListener(this.onChange)
this.workspace.helpurlPrefix = (this.$store.state.runtimeInfo.buildString === 'Release Build') ? 'next' : 'www'
this.workspace.registerButtonCallback('ohBlocklyHelp', function (button) {
window.open(button.info.helpurl, '_blank')
window.open(`https://${button.targetWorkspace.helpurlPrefix}.openhab.org/docs/${button.info.helpurl}`, '_blank')
})
Blockly.Workspace.prototype.refresh = function () {
const xml = Blockly.Xml.workspaceToDom(this)
Expand Down

0 comments on commit 276f311

Please sign in to comment.