diff --git a/CHANGELOG.md b/CHANGELOG.md index ccf6eba1..8d883b16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2.1.2] - Unreleased + +### Changed + +### Added +- Add in option to wrap long calendar events to multiple lines using `wrapEvents` configuration option. + +### Updated +- Added missing keys to Polish translation. +- Added missing key to German translation. ## [2.1.1] - 2017-04-01 diff --git a/Gruntfile.js b/Gruntfile.js index 06fed2d5..8d069c82 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -6,12 +6,20 @@ module.exports = function(grunt) { options: { configFile: ".eslintrc.json" }, - target: ["js/*.js", "modules/default/*.js", "modules/default/*/*.js", - "serveronly/*.js", "*.js", "tests/*/*.js", "!modules/default/alert/notificationFx.js", - "!modules/default/alert/modernizr.custom.js", "!modules/default/alert/classie.js", + target: [ + "js/*.js", + "modules/default/*.js", + "modules/default/*/*.js", + "serveronly/*.js", + "*.js", + "tests/**/*.js", + "!modules/default/alert/notificationFx.js", + "!modules/default/alert/modernizr.custom.js", + "!modules/default/alert/classie.js", "config/*", - "translations/translations.js", "vendor/vendor.js" - + "translations/translations.js", + "vendor/vendor.js", + "modules/node_modules/node_helper/index.js" ] }, stylelint: { @@ -19,14 +27,26 @@ module.exports = function(grunt) { options: { configFile: ".stylelintrc" }, - src: ["css/main.css", "modules/default/calendar/calendar.css", "modules/default/clock/clock_styles.css", "modules/default/currentweather/currentweather.css", "modules/default/weatherforcast/weatherforcast.css"] + src: [ + "css/main.css", + "modules/default/calendar/calendar.css", + "modules/default/clock/clock_styles.css", + "modules/default/currentweather/currentweather.css", + "modules/default/weatherforcast/weatherforcast.css" + ] } }, jsonlint: { main: { - src: ["package.json", ".eslintrc.json", ".stylelintrc", "translations/*.json", - "modules/default/*/translations/*.json", "installers/pm2_MagicMirror.json", - "vendor/package.js"], + src: [ + "package.json", + ".eslintrc.json", + ".stylelintrc", + "translations/*.json", + "modules/default/*/translations/*.json", + "installers/pm2_MagicMirror.json", + "vendor/package.js" + ], options: { reporter: "jshint" } @@ -58,11 +78,20 @@ module.exports = function(grunt) { "MD038": false } }, - src: ["README.md", "CHANGELOG.md", "LICENSE.md", "modules/README.md", "modules/default/**/*.md", "!modules/default/calendar/vendor/ical.js/readme.md"] + src: [ + "README.md", + "CHANGELOG.md", + "LICENSE.md", + "modules/README.md", + "modules/default/**/*.md", + "!modules/default/calendar/vendor/ical.js/readme.md" + ] } }, yamllint: { - all: [".travis.yml"] + all: [ + ".travis.yml" + ] } }); grunt.loadNpmTasks("grunt-eslint"); diff --git a/config/config.js.sample b/config/config.js.sample index 53677cfa..9b8787bb 100644 --- a/config/config.js.sample +++ b/config/config.js.sample @@ -6,7 +6,11 @@ var config = { port: 8080, - ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses. + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses + // or add a specific IPv4 of 192.168.1.5 : + // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], + // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : + // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"], language: "en", timeFormat: 24, diff --git a/installers/raspberry.sh b/installers/raspberry.sh index 2df89a5f..a76c1a9e 100644 --- a/installers/raspberry.sh +++ b/installers/raspberry.sh @@ -65,7 +65,7 @@ if command_exists node; then fi else - echo -e "\e[92mNo Node.js upgrade nessecery.\e[0m" + echo -e "\e[92mNo Node.js upgrade necessary.\e[0m" fi else diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index 470560ba..003c13e1 100644 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -31,6 +31,7 @@ The following properties can be configured: | `displaySymbol` | Display a symbol in front of an entry.

**Possible values:** `true` or `false`
**Default value:** `true` | `defaultSymbol` | The default symbol.

**Possible values:** See [Font Awsome](http://fontawesome.io/icons/) website.
**Default value:** `calendar` | `maxTitleLength` | The maximum title length.

**Possible values:** `10` - `50`
**Default value:** `25` +| `wrapEvents` | Wrap event titles to multiple lines. Breaks lines at the length defined by `maxTitleLength`.

**Possible values:** `true` or `false`
**Default value:** `false` | `fetchInterval` | How often does the content needs to be fetched? (Milliseconds)

**Possible values:** `1000` - `86400000`
**Default value:** `300000` (5 minutes) | `animationSpeed` | Speed of the update animation. (Milliseconds)

**Possible values:**`0` - `5000`
**Default value:** `2000` (2 seconds) | `fade` | Fade the future events to black. (Gradient)

**Possible values:** `true` or `false`
**Default value:** `true` diff --git a/modules/default/calendar/calendar.css b/modules/default/calendar/calendar.css index 26b1e93d..6bc5762d 100644 --- a/modules/default/calendar/calendar.css +++ b/modules/default/calendar/calendar.css @@ -2,6 +2,7 @@ padding-left: 0; padding-right: 10px; font-size: 80%; + vertical-align: top; } .calendar .symbol span { @@ -19,4 +20,5 @@ .calendar .time { padding-left: 30px; text-align: right; + vertical-align: top; } diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 12ce290f..fa77c94a 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -18,6 +18,7 @@ Module.register("calendar", { displayRepeatingCountTitle: false, defaultRepeatingCountTitle: "", maxTitleLength: 25, + wrapEvents: false, // wrap events to multiple lines breaking at maxTitleLength fetchInterval: 5 * 60 * 1000, // Update every 5 minutes. animationSpeed: 2000, fade: true, @@ -414,15 +415,38 @@ Module.register("calendar", { * * argument string string - The string to shorten. * argument maxLength number - The max length of the string. + * argument wrapEvents - Wrap the text after the line has reached maxLength * * return string - The shortened string. */ - shorten: function (string, maxLength) { - if (string.length > maxLength) { - return string.slice(0, maxLength) + "…"; - } + shorten: function (string, maxLength, wrapEvents) { + if (wrapEvents) { + var temp = ""; + var currentLine = ""; + var words = string.split(" "); - return string; + for (var i = 0; i < words.length; i++) { + var word = words[i]; + if (currentLine.length + word.length < 25 - 1) { // max - 1 to account for a space + currentLine += (word + " "); + } else { + if (currentLine.length > 0) { + temp += (currentLine + "
" + word + " "); + } else { + temp += (word + "
"); + } + currentLine = ""; + } + } + + return temp + currentLine; + } else { + if (string.length > maxLength) { + return string.slice(0, maxLength) + "…"; + } else { + return string; + } + } }, /* capFirst(string) @@ -437,7 +461,7 @@ Module.register("calendar", { /* titleTransform(title) * Transforms the title of an event for usage. * Replaces parts of the text as defined in config.titleReplace. - * Shortens title based on config.maxTitleLength + * Shortens title based on config.maxTitleLength and config.wrapEvents * * argument title string - The title to transform. * @@ -456,7 +480,7 @@ Module.register("calendar", { title = title.replace(needle, replacement); } - title = this.shorten(title, this.config.maxTitleLength); + title = this.shorten(title, this.config.maxTitleLength, this.config.wrapEvents); return title; }, diff --git a/modules/node_modules/node_helper/index.js b/modules/node_modules/node_helper/index.js index 8d0372bd..37c3e2cb 100644 --- a/modules/node_modules/node_helper/index.js +++ b/modules/node_modules/node_helper/index.js @@ -20,7 +20,7 @@ NodeHelper = Class.extend({ }, start: function() { - console.log("Staring module helper: " + this.name); + console.log("Starting module helper: " + this.name); }, /* socketNotificationReceived(notification, payload) @@ -45,7 +45,7 @@ NodeHelper = Class.extend({ /* setPath(path) * Set the module path. * - * argument name string - Module name. + * argument path string - Module path. */ setPath: function(path) { this.path = path; @@ -98,9 +98,10 @@ NodeHelper = Class.extend({ // register catch all. socket.on("*", function(notification, payload) { - if (notification !== "*") - //console.log('received message in namespace: ' + namespace); - self.socketNotificationReceived(notification, payload); + if (notification !== "*") { + //console.log('received message in namespace: ' + namespace); + self.socketNotificationReceived(notification, payload); + } }); }); diff --git a/package.json b/package.json index a190f12d..3f1bde8d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "magicmirror", - "version": "2.1.1", + "version": "2.1.2-dev", "description": "The open source modular smart mirror platform.", "main": "js/electron.js", "scripts": { diff --git a/tests/configs/modules/compliments/compliments_parts_day.js b/tests/configs/modules/compliments/compliments_parts_day.js index 8d47fe22..b4443567 100644 --- a/tests/configs/modules/compliments/compliments_parts_day.js +++ b/tests/configs/modules/compliments/compliments_parts_day.js @@ -1,4 +1,4 @@ -/* Magic Mirror Test config for default compliments +/* Magic Mirror Test config for default compliments * * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com * MIT Licensed. diff --git a/tests/configs/modules/positions.js b/tests/configs/modules/positions.js index 7d0188c2..60e6dd04 100644 --- a/tests/configs/modules/positions.js +++ b/tests/configs/modules/positions.js @@ -24,8 +24,8 @@ var config = { // Using exotic content. This is why dont accept go to JSON configuration file (function() { var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third", - "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", - "bottom_bar", "fullscreen_above", "fullscreen_below"]; + "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", + "bottom_bar", "fullscreen_above", "fullscreen_below"]; var modules = Array(); for (idx in positions) { modules.push({ diff --git a/tests/unit/global_vars/root_path_spec.js b/tests/unit/global_vars/root_path_spec.js index 197ee6a7..ef7ce3e9 100644 --- a/tests/unit/global_vars/root_path_spec.js +++ b/tests/unit/global_vars/root_path_spec.js @@ -63,8 +63,8 @@ describe("'global.root_path' set in js/app.js", function() { }); it("should expect the global.version equals package.json file", function() { - version_package = JSON.parse(fs.readFileSync("package.json", "utf8")).version; - expect(this.sandbox.global.version).to.equal(version_package); + versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version; + expect(this.sandbox.global.version).to.equal(versionPackage); }); }); diff --git a/translations/de.json b/translations/de.json index eb67d41a..2723bf86 100644 --- a/translations/de.json +++ b/translations/de.json @@ -7,6 +7,8 @@ "RUNNING": "noch", "EMPTY": "Keine Termine.", + "WEEK": "Woche", + "N": "N", "NNE": "NNO", "NE": "NO", diff --git a/translations/pl.json b/translations/pl.json index 0c79835f..1d30e395 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -3,9 +3,12 @@ "TODAY": "Dziś", "TOMORROW": "Jutro", + "DAYAFTERTOMORROW": "Pojutrze", "RUNNING": "Koniec za", "EMPTY": "Brak wydarzeń.", + "WEEK": "Tydzień", + "N": "N", "NNE": "NNE", "NE": "NE",