forked from Appsilon/shiny.router
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
168 lines (130 loc) · 5.23 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
---
always_allow_html: yes
params:
website_url: http://appsilon.com
logo_url: https://cdn.rawgit.com/Appsilon/website-cdn/gh-pages/logo-white.png
repo_name: shiny.router
repo_url: https://github.com/Appsilon/shiny.router
chagelog_url: https://github.com/Appsilon/shiny.router/blob/master/CHANGELOG.md
escape_script: FALSE
---
<link href="http://fonts.googleapis.com/css?family=Lato:300,700,300italic|Inconsolata" rel="stylesheet" type="text/css">
<link href='docs/style.css' rel='stylesheet' type='text/css'>
shiny.router
===========
<div class="subheader">
A minimalistic router for your [Shiny](https://shiny.rstudio.com/) apps.
<br>
[](https://travis-ci.org/Appsilon/shiny.router)
[](https://codecov.io/gh/Appsilon/shiny.router)
</div>
<div class="section level2">
Now it's possible to recreate a state of your app, by providing a specific URL, like:
```
make_router(
route("<your_app_url>/main", mainPageShinyUI),
route("<your_app_url>/other", otherPageShinyUI)
)
```
<!--
TODO We would like to have a nice graphic explaning routing mechanism
-->
Basic tutorial article is available on [Appsilon Data Science blog](http://blog.appsilon.com/rstats/2016/12/08/shiny.router.html).
<p style="text-align: center; font-size: x-large;">
<a href="http://demo.appsilon.com/shiny.router/">Live demo</a>
</p>
</div>
Source code {.darkslide}
-----------
This library source code can be found on [Appsilon Data Science's](http://appsilon.com) Github:
<br>
[https://github.com/Appsilon/shiny.router](https://github.com/Appsilon/shiny.router)
```{r, echo = F, results = 'asis'}
if (params$type == "web") {
cat(paste0('<script>
document.write(\'<div class="logo"><a href="', params$website_url, '"><img alt="Appsilon Data Science" src="', params$logo_url, '"/></a></div>\')
</script>
'))
}
```
How to install?
---------------
It's possible to install this library through CRAN
```
install.packages("shiny.router")
```
The most recent version you can get from this repo using [devtools](https://github.com/hadley/devtools).
```
devtools::install_github("Appsilon/shiny.router")
```
To install [previous version](https://github.com/Appsilon/shiny.router/blob/master/CHANGELOG.md) you can run:
```
devtools::install_github("Appsilon/shiny.router", ref = "0.1.0")
```
Example {.firebrick}
-------
Visit [examples](https://github.com/Appsilon/shiny.router/tree/master/examples) directory for some complete samples.
Here's the basic usage:
```
router <- make_router(
route("/", root_page),
route("/other", other_page)
)
ui <- shinyUI(semanticPage(
title = "Router demo",
router_ui()
))
server <- shinyServer(function(input, output) {
router(input, output)
})
shinyApp(ui, server)
```
How to contribute?
-----------------
If you want to contribute to this project please submit a regular PR, once you're done with new feature or bug fix.<br>
**Changes in documentation**
Both repository **README.md** file and an official documentation page are generated with Rmarkdown, so if there is a need to update them, please modify accordingly a **README.Rmd** file and use [readmebuilder](https://github.com/Appsilon/readmebuilder) package to render the new README.
In most cases a simple call of:
```r
readmebuilder::build_readme()
```
Troubleshooting {.darkorange}
-----------------
We used the latest versions of dependencies for this library, so please update your R environment before installation.
However, if you encounter any problems, try the following:
1. Up-to-date R language environment
2. Installing specific dependent libraries versions
* magrittr
```
install.packages("magrittr", version='1.5')
```
* shiny
```
install.packages("shiny", version='0.14.2.9001')
```
3. Missing semanticui dependency - one of our examples uses one of our others libraries, so please install it as well, when running that example.
Repository: [semanticui](https://github.com/Appsilon/semanticui)
Future enhacements
------------------
* URL params handling
* CRAN release
* consider utilising https://shiny.rstudio.com/articles/client-data.html instead of Page.js
Appsilon Data Science {.footer}
=====================
```{r, echo = F, results='asis'}
if (params$type == "web") {
cat(paste0('<script>
document.write(\'<div class="logo"><a href="', params$website_url, '"><img alt="Appsilon Data Science" src="', params$logo_url, '" /></a></div><div class="subheader"> We Provide End-to-End Data Science Solutions </div> \');
</script>
'))
}
```
Get in touch [[email protected]]([email protected])
```{r, echo = F, results='asis'}
if (params$type == "web") {
cat(paste0('<script>
document.write(\'<a href="', params$repo_url, '"><img style="position: absolute; margin: 0; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>\');
</script>
'))
}
```