promethee 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d615539201ed702b072e8759debef564b7b8981068fa650b672c12c393bd1c82
4
- data.tar.gz: 61afe497a197687435124bbf7cd19a894ed8db353d2a73dda701e1f7e0f3f847
3
+ metadata.gz: 5e202e7ffd817f5a07854497c59ade42067f7e3ad1a44fb3d55e7a8f5b89f221
4
+ data.tar.gz: 84f0d2f18ab92b60a294131826607817bfba7175e445dd17517cf2102db6914a
5
5
  SHA512:
6
- metadata.gz: e29fb2e45cbc23eac0e068ff7bcb54cd0dd535abae2e913d3a5ea3eca49c30d6002094de6165354d5914008e4bb173c25988f3866f204b69f3080ac1b84670bb
7
- data.tar.gz: 5686ecc9dcd36ffde59f8746e69511e437c545e86c6214ca494f8b7ccb20682f02f7cf1e82910f9765dd988bee4c4afaef0d603222f22c5f1fe2aaf626db1dac
6
+ metadata.gz: 71138249e1f16f4d9bafc0b097db1349e6dc3d193f42001775afb2c6beccd87a19b0862f3b4e453189a1066f13b8c3783e603220b9c1a48de990cd15b38fdc66
7
+ data.tar.gz: 0c1019c2ca28bae6f8f667d740fc372e76f6f0c9da8c74cb0af89b3fced4c3bed39dbab8fe73ec604c4f2be60cd26739c47cbda393c6a71e600e83ad5ac1a032
@@ -3,5 +3,5 @@
3
3
  //= require ng-file-upload/dist/ng-file-upload
4
4
  //= require angular-bootstrap-colorpicker/js/bootstrap-colorpicker-module
5
5
  //= require @fancyapps/fancybox/dist/jquery.fancybox.min
6
+ //= require jquery-warn-before-unload/jquery.warnBeforeUnload
6
7
  //= require promethee/fancybox
7
- //= require promethee/unload
@@ -130,13 +130,13 @@ promethee.controller('PrometheeController', ['$scope', 'summernoteConfig', 'pres
130
130
  }
131
131
 
132
132
  $scope.submit = function() {
133
- document.body.classList.remove("promethee-page-locked");
133
+ window.warnBeforeUnload.unlock();
134
134
  $('#promethee').closest('form').submit();
135
135
  };
136
136
 
137
137
  $scope.$watch('promethee.data', function(new_val, old_val) {
138
138
  if (old_val != new_val) {
139
- document.body.classList.add("promethee-page-locked");
139
+ window.warnBeforeUnload.lock();
140
140
  }
141
141
  }, true);
142
142
 
@@ -53,7 +53,7 @@ promethee_masters_multiple = Promethee::Data::MastersMultiple.new master_data, o
53
53
  $scope.masters.set(<%= promethee_masters_multiple.to_json.html_safe %>);
54
54
  $scope.$watch('data', function(new_val, old_val) {
55
55
  if (old_val != new_val) {
56
- document.body.classList.add("promethee-page-locked");
56
+ window.warnBeforeUnload.lock();
57
57
  }
58
58
  }, true);
59
59
  }]);
@@ -1,5 +1,5 @@
1
1
  module Promethee
2
2
  module Rails
3
- VERSION = '1.7.0'
3
+ VERSION = '1.7.1'
4
4
  end
5
5
  end
@@ -1,38 +1,18 @@
1
1
  {
2
- "_from": "@fancyapps/fancybox",
3
- "_id": "@fancyapps/fancybox@3.3.5",
4
- "_inBundle": false,
5
- "_integrity": "sha512-/sO9o/zeQhWN1OMRlVOWpElN56Ww/aSNks5a7PZ7JKM6I5jeih6CxaCeeOp8jgJXVfElbWOO2KTAMT/7tICNcQ==",
6
- "_location": "/@fancyapps/fancybox",
7
- "_phantomChildren": {},
8
- "_requested": {
9
- "type": "tag",
10
- "registry": true,
11
- "raw": "@fancyapps/fancybox",
12
- "name": "@fancyapps/fancybox",
13
- "escapedName": "@fancyapps%2ffancybox",
14
- "scope": "@fancyapps",
15
- "rawSpec": "",
16
- "saveSpec": null,
17
- "fetchSpec": "latest"
18
- },
19
- "_requiredBy": [
20
- "#USER",
21
- "/"
22
- ],
23
- "_resolved": "https://registry.npmjs.org/@fancyapps/fancybox/-/fancybox-3.3.5.tgz",
24
- "_shasum": "e0bead520450ff0af51d353a17ac6bf864ba0f49",
25
- "_spec": "@fancyapps/fancybox",
26
- "_where": "/Users/sebastiengaya/Dev/2_LPR/promethee",
27
- "author": {
28
- "name": "fancyApps"
2
+ "name": "@fancyapps/fancybox",
3
+ "description": "Touch enabled, responsive and fully customizable jQuery lightbox script",
4
+ "version": "3.3.5",
5
+ "homepage": "http://fancyapps.com/fancybox/",
6
+ "main": "./dist/jquery.fancybox.js",
7
+ "author": "fancyApps",
8
+ "license": "GPL-3.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/fancyapps/fancybox.git"
29
12
  },
30
- "bugs": {
31
- "url": "https://github.com/fancyapps/fancybox/issues"
13
+ "peerDependencies": {
14
+ "jquery": ">=1.9.0"
32
15
  },
33
- "bundleDependencies": false,
34
- "deprecated": false,
35
- "description": "Touch enabled, responsive and fully customizable jQuery lightbox script",
36
16
  "devDependencies": {
37
17
  "del": "^2.2.2",
38
18
  "gulp": "^3.9.1",
@@ -50,31 +30,14 @@
50
30
  "gulp-util": "^3.0.8",
51
31
  "jshint": "^2.9.4"
52
32
  },
33
+ "keywords": ["touch", "responsive", "lightbox", "fancybox", "gallery", "jQuery", "plugin"],
34
+ "bugs": {
35
+ "url": "https://github.com/fancyapps/fancybox/issues"
36
+ },
53
37
  "directories": {
54
38
  "doc": "docs"
55
39
  },
56
- "homepage": "http://fancyapps.com/fancybox/",
57
- "keywords": [
58
- "touch",
59
- "responsive",
60
- "lightbox",
61
- "fancybox",
62
- "gallery",
63
- "jQuery",
64
- "plugin"
65
- ],
66
- "license": "GPL-3.0",
67
- "main": "./dist/jquery.fancybox.js",
68
- "name": "@fancyapps/fancybox",
69
- "peerDependencies": {
70
- "jquery": ">=1.9.0"
71
- },
72
- "repository": {
73
- "type": "git",
74
- "url": "git+https://github.com/fancyapps/fancybox.git"
75
- },
76
40
  "scripts": {
77
41
  "test": "echo \"Error: no test specified\" && exit 1"
78
- },
79
- "version": "3.3.5"
42
+ }
80
43
  }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Les Poupées Russes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,15 @@
1
+ # jQuery Warn Before Unload
2
+
3
+ Prevents a page from unloading directly when something was changed in any input or text area. Asks whether you are sure or not.
4
+
5
+ ## Getting started
6
+
7
+ Add with yarn or npm:
8
+ ```
9
+ yarn add jquery-warn-before-unload
10
+ ```
11
+
12
+ Then include javascript, for example like that (in a rails project):
13
+ ```
14
+ //= require jquery-warn-before-unload/jquery.warnBeforeUnload
15
+ ```
@@ -0,0 +1,81 @@
1
+ /*global window, $ */
2
+ window.warnBeforeUnload = {
3
+
4
+ className: 'warn-before-unload',
5
+
6
+ ignored: {
7
+ classes: ['do-not-warn-before-unload', 'filter'],
8
+ types: ['search']
9
+ },
10
+
11
+ message: 'You have entered new data on this page. If you navigate away from this page without first saving your data, the changes will be lost.',
12
+
13
+ init: function () {
14
+ 'use strict';
15
+ this.watchUnload();
16
+ this.watchInputs();
17
+ this.watchSubmits();
18
+ },
19
+
20
+ watchUnload: function () {
21
+ 'use strict';
22
+ var that = this;
23
+ window.addEventListener('beforeunload', function (event) {
24
+ if ($('body').hasClass(that.className)) {
25
+ event.returnValue = that.message;
26
+ return that.message;
27
+ }
28
+ });
29
+ },
30
+
31
+ watchInputs: function () {
32
+ 'use strict';
33
+ var that = this;
34
+ $(':input, textarea').bind('change', function () {
35
+ if (that.shouldLock(this)) {
36
+ that.lock();
37
+ }
38
+ });
39
+ },
40
+
41
+ watchSubmits: function () {
42
+ 'use strict';
43
+ var that = this;
44
+ $('form').on('submit', function () {
45
+ that.unlock();
46
+ });
47
+ },
48
+
49
+ shouldLock: function (object) {
50
+ 'use strict';
51
+ var that = this;
52
+ var shouldLock = true;
53
+ that.ignored.classes.forEach(function (item) {
54
+ if ($(object).hasClass(item)) {
55
+ shouldLock = false;
56
+ }
57
+ });
58
+ that.ignored.types.forEach(function (item) {
59
+ if ($(object).attr('type') === item) {
60
+ shouldLock = false;
61
+ }
62
+ });
63
+ return shouldLock;
64
+ },
65
+
66
+ lock: function () {
67
+ 'use strict';
68
+ $('body').addClass(this.className);
69
+ },
70
+
71
+ unlock: function () {
72
+ 'use strict';
73
+ $('body').removeClass(this.className);
74
+ }
75
+
76
+ };
77
+
78
+ $(function () {
79
+ 'use strict';
80
+ window.warnBeforeUnload.init();
81
+ });
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "jquery-warn-before-unload",
3
+ "version": "1.0.4",
4
+ "description": "Warns before leaving a modified page.",
5
+ "main": "jquery.warnBeforeUnload.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/lespoupeesrusses/jquery-warn-before-unload.git"
12
+ },
13
+ "author": {
14
+ "name": "Pierre-André Boissinot",
15
+ "email": "paboissinot@lespoupees.paris"
16
+ },
17
+ "contributors": [
18
+ {
19
+ "name": "Arnaud Levy",
20
+ "email": "alevy@lespoupees.paris"
21
+ }
22
+ ],
23
+ "license": "MIT",
24
+ "bugs": {
25
+ "url": "https://github.com/lespoupeesrusses/jquery-warn-before-unload/issues"
26
+ },
27
+ "homepage": "https://github.com/lespoupeesrusses/jquery-warn-before-unload#readme"
28
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promethee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Gaya
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2018-07-31 00:00:00.000000000 Z
17
+ date: 2018-08-01 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails
@@ -178,7 +178,6 @@ files:
178
178
  - app/assets/images/logo-promethee-vertical.svg
179
179
  - app/assets/javascripts/promethee.js
180
180
  - app/assets/javascripts/promethee/fancybox.js
181
- - app/assets/javascripts/promethee/unload.js
182
181
  - app/assets/stylesheets/promethee-edit.sass
183
182
  - app/assets/stylesheets/promethee-edit/_move.sass
184
183
  - app/assets/stylesheets/promethee-edit/_preview.sass
@@ -455,6 +454,10 @@ files:
455
454
  - node_modules/fancybox/package.json
456
455
  - node_modules/fancybox/sprite.psd
457
456
  - node_modules/fancybox/test.js
457
+ - node_modules/jquery-warn-before-unload/LICENSE
458
+ - node_modules/jquery-warn-before-unload/README.md
459
+ - node_modules/jquery-warn-before-unload/jquery.warnBeforeUnload.js
460
+ - node_modules/jquery-warn-before-unload/package.json
458
461
  - node_modules/ng-file-upload/LICENSE
459
462
  - node_modules/ng-file-upload/README.md
460
463
  - node_modules/ng-file-upload/dist/FileAPI.flash.swf
@@ -1,11 +0,0 @@
1
- /*global window */
2
- window.addEventListener("beforeunload", function (event) {
3
- "use strict";
4
- var message,
5
- shouldLock = document.body.className.match(/\bpromethee-page-locked\b/);
6
- if (shouldLock) {
7
- message = "You have modified this page. If you quit without saving, your changes will be lost.";
8
- event.returnValue = message;
9
- return message;
10
- }
11
- });