Revert "added support for changing by a certain amount of pages"

This reverts commit f4fc53fa19.

Update issue templates
This commit is contained in:
Edward Shen 2018-05-08 15:34:36 -04:00
parent 14d4913a87
commit edc1e08e65
No known key found for this signature in database
GPG key ID: 4E887A42793D0433
4 changed files with 57 additions and 14 deletions

34
.github/ISSUE_TEMPLATE/Bug_report.md vendored Normal file
View file

@ -0,0 +1,34 @@
---
name: Bug report
about: Thanks for helping us out!
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem. If you believe you have aptly described your issue in words, feel free to ignore this section.
**Please fill out the following information;**
- Node version: [This can be obtained by running `node --version`]
- Have you updated to the latest MagicMirror core? [yes/no]
- Please post the relevant part of your config file here:
```json
(Paste the part of the config file here)
```
- Please post any errors you see about MMM-Pages in the console (Hit F12 > Console when the Magic Mirror window is focused), or write **None** if there aren't any:
```
```
**Additional context**
Add any other context about the problem here.

View file

@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -55,12 +55,11 @@ Module.register('MMM-pages', {
* @param {number} payload the page to change to * @param {number} payload the page to change to
*/ */
notificationReceived: function(notification, payload) { notificationReceived: function(notification, payload) {
const isValidPayload = typeof payload === 'number';
switch (notification) { switch (notification) {
case 'PAGE_CHANGED': case 'PAGE_CHANGED':
Log.log(`${this.name} recieved a notification` Log.log(`${this.name} recieved a notification`
+ `to change to page ${payload} of type ${typeof payload}`); + `to change to page ${payload} of type ${typeof payload}`);
if (isValidPayload) { if (typeof payload === 'number') {
this.curPage = payload; this.curPage = payload;
} else { } else {
Log.error('Was asked to change to an invalid number!'); Log.error('Was asked to change to an invalid number!');
@ -71,18 +70,12 @@ Module.register('MMM-pages', {
break; break;
case 'PAGE_INCREMENT': case 'PAGE_INCREMENT':
Log.log(`${this.name} recieved a notification to increment pages!`); Log.log(`${this.name} recieved a notification to increment pages!`);
this.curPage = this.mod( this.curPage = this.mod(this.curPage + 1, this.config.modules.length);
this.curPage + (isValidPayload) ? payload : 1,
this.config.modules.length
);
this.updatePages(true); this.updatePages(true);
break; break;
case 'PAGE_DECREMENT': case 'PAGE_DECREMENT':
Log.log(`${this.name} recieved a notification to decrement pages!`); Log.log(`${this.name} recieved a notification to decrement pages!`);
this.curPage = this.mod( this.curPage = this.mod(this.curPage - 1, this.config.modules.length);
this.curPage - (isValidPayload) ? payload : 1,
this.config.modules.length
);
this.updatePages(true); this.updatePages(true);
break; break;
case 'DOM_OBJECTS_CREATED': case 'DOM_OBJECTS_CREATED':

View file

@ -76,10 +76,9 @@ this.sendNotification("PAGE_CHANGED", 2);
``` ```
This would cause the module to change show that you are on page 3. This would cause the module to change show that you are on page 3.
Sending a `PAGE_INCREMENT` or `PAGE_DECREMENT` without any parameters will You can also just send `PAGE_INCREMENT` or `PAGE_DECREMENT` without any payloads
increase or decrease the page by one. Attaching a valid payload to the (or with, but it will be ignored) to have the module change the displayed page
aforementioned notifications will increase or decrease the pages by that amount. by one.
Remember that this module **strictly checks** for a number.
This module keeps internal track of how many pages you have, defined by your This module keeps internal track of how many pages you have, defined by your
config in the config file. There is no way to dynamically change the pages you config in the config file. There is no way to dynamically change the pages you