Skip to content
Merged
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
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import(jaspBase)
export(addOne)
export(processData)
export(processTable)
export(parabola)
export(parabola)
export(interfaceExample)
48 changes: 48 additions & 0 deletions R/examples.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
interfaceExample <- function(jaspResults, dataset, options) {
# Just show the options as they are understood the R backend
jaspResults[["explanation"]] <- createJaspHtml(title = "User inputs, returned as html",
text = sprintf("Here we show, for pedagogical purposes, the user inputs as they are understood by the R backend."))

jaspResults[["logicals"]] <- createJaspHtml(
title = "Logical controls",
text = sprintf("The tick mark is set to: %s
The radio buttons are set to: %s",
as.character(options$my_tick_mark), # These variables are defined in .inst/qml/Interface.qml
as.character(options$radio_buttons)) # Notice we have to be careful with the data type
)

jaspResults[["others"]] <- createJaspHtml(
title = "Other controls",
text = sprintf("The chosen dropdown element is: %s
The slider value is: %s",
as.character(options$my_dropdown),
as.character(options$my_slider))
)

jaspResults[["keyboard"]] <- createJaspHtml(
title = "Keyboard controls",
text = sprintf("The integer is set to: %s
The double is set to: %s
The percentage is set to: %s
The confidence interval is set to: %s
The text box is set to: <i>%s</i>",
as.character(options$my_integer),
as.character(options$my_double),
as.character(options$my_percent),
as.character(options$my_ci),
options$my_text) # No data-type conversion needed for text
)

jaspResults[["developers"]] <- createJaspHtml(
title = "Note for developers",
text = sprintf("Potential developers will find it useful to inspect the following files:
<ul>
<li><a href='https://github.com/jasp-stats/jaspModuleTemplate/blob/master/inst/qml/Interface.qml'>./inst/qml/Interface.qml</a>: builds the menu on the left panel</li>
<li><a href='https://github.com/jasp-stats/jaspModuleTemplate/blob/master/R/examples.R'>./R/examples.R</a>: builds the output screen you are looking at</li>
<li><a href='https://github.com/jasp-stats/jaspModuleTemplate/blob/master/inst/Description.qml'>./inst/Description.qml</a>: adds access to the current submodule to the module icon on the ribbon above</li>
</ul>")
)

return()
}

addOne <- function(jaspResults, dataset, options) {
result <- as.character(options$my_number + 1) # options$my_number comes from the menu created by inst/qml/integer.qml

Expand Down
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
# jaspModuleTemplate

This template repository is a starting point for developing a new module for JASP.
It contains the necessary files and structure, plus a numbers of examples to get started.
This template repository contains example functionality, which makes it an excellent starting point for developing a new JASP module.
It contains the necessary files and structure, plus a numbers of examples to get started and to understand JASP's internals.

## How to use this repository

Fork this template repository to your own GitHub account to start developing your module.
You can then clone the repository to your local machine and start developing your module.
1. Fork this template repository to your own GitHub account
2. Clone it to your machine
3. Open JASP and add it as a development module

The repository contains example functionality.
Feel free to reuse and adapt the examples to your needs.
### For newcomers

It is very illuminating to take a look at our examples **and** at the files that generate them.

For instance, the image below shows the different menus for the _"Using the interface"_ analysis, together with the files that generate them:

![](inst/img/JASP.png)

### For contributors

Feel free to reuse and adapt to your needs.
Feel also free to remove the ones you don't need.

## Contributing back new module to JASP
Expand Down
29 changes: 21 additions & 8 deletions inst/Description.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ Description
preloadData: true
requiresData: true

GroupTitle
{
title: qsTr("Basic interactivity")
}

Analysis
{
title: qsTr("Using the interface") // Title for window
menu: qsTr("Using the interface") // Title for ribbon
func: "interfaceExample" // Function to be called
qml: "Interface.qml" // Design input window
requiresData: false // Allow to run even without data
}

Analysis
{
title: qsTr("Loading data")
menu: qsTr("Loading data")
func: "processData"
qml: "Data.qml"
}

GroupTitle
{
Expand All @@ -30,14 +51,6 @@ Description
requiresData: false // Allow to run even without data
}

Analysis
{
title: qsTr("Load data")
menu: qsTr("Load data")
func: "processData"
qml: "Data.qml"
}

Analysis
{
title: qsTr("Tabular results")
Expand Down
Binary file added inst/img/JASP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading