Skip to content

Commit 057fec1

Browse files
authored
Merge pull request #32 from agoravoting/master
update next
2 parents b70f345 + 9f8b300 commit 057fec1

28 files changed

+918
-801
lines changed

Gruntfile.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
var pkg = require('./package.json');
22-
var AV_CONFIG_VERSION = '3.3.0';
22+
var AV_CONFIG_VERSION = '3.4.0';
2323

2424
//Using exclusion patterns slows down Grunt significantly
2525
//instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**'
@@ -192,10 +192,10 @@ module.exports = function (grunt) {
192192
options: {
193193
remove: ['script[data-remove!="false"]','link[data-remove!="false"]'],
194194
append: [
195-
{selector:'body',html:'<!--[if lte IE 8]><script src="/libcompat-v3.0.1.js"></script><![endif]--><!--[if gte IE 9]><script src="/libnocompat-v3.0.1.js"></script><![endif]--><!--[if !IE]><!--><script src="/libnocompat-v3.0.1.js"></script><!--<![endif]-->'},
195+
{selector:'body',html:'<!--[if lte IE 8]><script src="/libcompat-v3.4.0.js"></script><![endif]--><!--[if gte IE 9]><script src="/libnocompat-v3.4.0.js"></script><![endif]--><!--[if !IE]><!--><script src="/libnocompat-v3.4.0.js"></script><!--<![endif]-->'},
196196
{selector:'body',html:'<!--All the source code of this program under copyright. Take a look at the license details at https://github.com/agoravoting/agora-core-view/blob/master/README.md -->'},
197-
{selector:'body',html:'<script src="/appCommon-v3.0.1.js"></script>'},
198-
{selector:'body',html:'<script src="/avPlugins-v3.0.1.js"></script>'},
197+
{selector:'body',html:'<script src="/appCommon-v3.4.0.js"></script>'},
198+
{selector:'body',html:'<script src="/avPlugins-v3.4.0.js"></script>'},
199199
{selector:'head',html:'<link rel="stylesheet" id="theme" href="/themes/default/app.min.css">'}
200200
]
201201
},
@@ -225,9 +225,9 @@ module.exports = function (grunt) {
225225
'temp/libnocompat.js': ['<%= dom_munger.data.libnocompatjs %>'],
226226
'temp/lib.js': ['<%= dom_munger.data.libjs %>'],
227227
'temp/app.js': ['<%= dom_munger.data.appjs %>','<%= ngtemplates.main.dest %>'],
228-
'dist/avConfig-v3.0.1.js': ['avConfig.js'],
229-
'dist/avThemes-v3.0.1.js': ['avThemes.js'],
230-
'dist/avPlugins-v3.0.1.js': ['plugins/**/*.js']
228+
'dist/avConfig-v3.4.0.js': ['avConfig.js'],
229+
'dist/avThemes-v3.4.0.js': ['avThemes.js'],
230+
'dist/avPlugins-v3.4.0.js': ['plugins/**/*.js']
231231
}
232232
}
233233
},
@@ -259,10 +259,10 @@ module.exports = function (grunt) {
259259
beautify: true
260260
},
261261
files: {
262-
'dist/appCommon-v3.0.1.js': 'temp/app.js',
263-
'dist/libCommon-v3.0.1.js': 'temp/lib.js',
264-
'dist/libnocompat-v3.0.1.js': 'temp/libnocompat.js',
265-
'dist/libcompat-v3.0.1.js': 'temp/libcompat.js',
262+
'dist/appCommon-v3.4.0.js': 'temp/app.js',
263+
'dist/libCommon-v3.4.0.js': 'temp/lib.js',
264+
'dist/libnocompat-v3.4.0.js': 'temp/libnocompat.js',
265+
'dist/libcompat-v3.4.0.js': 'temp/libcompat.js',
266266
'dist/avWidgets.js': 'avWidgets.js',
267267

268268
"dist/locales/moment/es.js": "bower_components/moment/lang/es.js",

avConfig.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* in this same file, which you might want to edit and tune if needed.
2121
*/
2222

23-
var AV_CONFIG_VERSION = '3.3.0';
23+
var AV_CONFIG_VERSION = '3.4.0';
2424

2525
var avConfigData = {
2626
// the base url path for ajax requests, for example for sending ballots or

avRegistration/auth-method-service.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,28 @@ angular.module('avRegistration')
138138

139139
authmethod.getRegisterFields = function (viewEventData) {
140140
var fields = angular.copy(viewEventData.extra_fields);
141+
141142
if (!fields) { fields = []; }
142-
if (viewEventData.auth_method === "sms") {
143+
var found = false;
144+
_.each(fields, function(field) {
145+
if (viewEventData.auth_method === "sms" && field.name === 'tlf') {
146+
if (field.type === 'text') {
147+
field.type = 'tlf';
148+
}
149+
found = true;
150+
} else if (viewEventData.auth_method === "email" && field.name === 'email') {
151+
found = true;
152+
}
153+
});
154+
155+
if (viewEventData.auth_method === "sms" && !found) {
143156
fields.push({
144157
"name": "tlf",
145158
"type": "tlf",
146159
"required": true,
147160
"required_on_authentication": true
148161
});
149-
} else if (viewEventData.auth_method === "email") {
162+
} else if (viewEventData.auth_method === "email" && !found) {
150163
fields.push({
151164
"name": "email",
152165
"type": "email",

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "avCommon",
3-
"version": "3.3.0",
3+
"version" : "3.4.0",
44
"main": "index.html",
55
"ignore": [
66
"tests",

dist/appCommon-v3.0.1.js renamed to dist/appCommon-v3.4.0.js

+25-20
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,32 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
7979
}) : $http.get(backendUrl + "auth-event/" + id + "/census/");
8080
}, authmethod.getRegisterFields = function(viewEventData) {
8181
var fields = angular.copy(viewEventData.extra_fields);
82-
fields || (fields = []), "sms" === viewEventData.auth_method ? fields.push({
83-
name: "tlf",
84-
type: "tlf",
85-
required: !0,
86-
required_on_authentication: !0
87-
}) : "email" === viewEventData.auth_method ? fields.push({
82+
fields || (fields = []);
83+
var found = !1;
84+
_.each(fields, function(field) {
85+
"sms" === viewEventData.auth_method && "tlf" === field.name ? ("text" === field.type && (field.type = "tlf"),
86+
found = !0) : "email" === viewEventData.auth_method && "email" === field.name && (found = !0);
87+
}), "sms" !== viewEventData.auth_method || found ? "email" !== viewEventData.auth_method || found ? "user-and-password" === viewEventData.auth_method && (fields.push({
8888
name: "email",
8989
type: "email",
9090
required: !0,
9191
required_on_authentication: !0
92-
}) : "user-and-password" === viewEventData.auth_method && (fields.push({
92+
}), fields.push({
93+
name: "password",
94+
type: "password",
95+
required: !0,
96+
required_on_authentication: !0
97+
})) : fields.push({
9398
name: "email",
9499
type: "email",
95100
required: !0,
96101
required_on_authentication: !0
97-
}), fields.push({
98-
name: "password",
99-
type: "password",
102+
}) : fields.push({
103+
name: "tlf",
104+
type: "tlf",
100105
required: !0,
101106
required_on_authentication: !0
102-
}));
107+
});
103108
for (var i = 0; i < fields.length; i++) if ("captcha" === fields[i].type) {
104109
var captcha = fields.splice(i, 1);
105110
fields.push(captcha[0]);
@@ -108,7 +113,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
108113
return fields;
109114
}, authmethod.getLoginFields = function(viewEventData) {
110115
var fields = authmethod.getRegisterFields(viewEventData);
111-
"sms" !== viewEventData.auth_method && "email" !== viewEventData.auth_method || fields.push({
116+
("sms" === viewEventData.auth_method || "email" === viewEventData.auth_method) && fields.push({
112117
name: "code",
113118
type: "code",
114119
required: !0,
@@ -175,7 +180,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
175180
attrs.code && attrs.code.length > 0 && (scope.code = attrs.code), scope.email = null,
176181
attrs.email && attrs.email.length > 0 && (scope.email = attrs.email), scope.isAdmin = !1,
177182
autheventid === adminId && (scope.isAdmin = !0), scope.resendAuthCode = function(field) {
178-
if (!scope.sendingData && "sms" === scope.method && scope.telIndex !== -1 && !scope.form["input" + scope.telIndex].$invalid) {
183+
if (!scope.sendingData && "sms" === scope.method && -1 !== scope.telIndex && !scope.form["input" + scope.telIndex].$invalid) {
179184
field.value = "";
180185
var data = {};
181186
data.tlf = scope.telField.value, scope.sendingData = !0, Authmethod.resendAuthCode(data, autheventid).success(function(rcvData) {
@@ -218,7 +223,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
218223
return scope.stateData[el.name] ? (el.value = scope.stateData[el.name], el.disabled = !0) : (el.value = null,
219224
el.disabled = !1), "email" === el.type && null !== scope.email ? (el.value = scope.email,
220225
el.disabled = !0) : "code" === el.type && null !== scope.code ? (el.value = scope.code.trim().replace(/ |\n|\t|-|_/g, "").toUpperCase(),
221-
el.disabled = !0) : "tlf" === el.type && "sms" === scope.method && (null !== scope.email && scope.email.indexOf("@") === -1 && (el.value = scope.email,
226+
el.disabled = !0) : "tlf" === el.type && "sms" === scope.method && (null !== scope.email && -1 === scope.email.indexOf("@") && (el.value = scope.email,
222227
el.disabled = !0), scope.telIndex = index + 1, scope.telField = el), el;
223228
}), filled_fields = _.filter(fields, function(el) {
224229
return null !== el.value;
@@ -649,7 +654,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
649654
}
650655
var checkCollapse = function(instance, el, options) {
651656
var maxHeight = select(instance, el, instance.maxHeightSelector).css("max-height"), height = angular.element(el)[0].scrollHeight;
652-
if (maxHeight.indexOf("px") === -1) return void console.log("invalid non-pixels max-height for " + instance.maxHeightSelector);
657+
if (-1 === maxHeight.indexOf("px")) return void console.log("invalid non-pixels max-height for " + instance.maxHeightSelector);
653658
if (maxHeight = parseInt(maxHeight.replace("px", "")), height > maxHeight) {
654659
if (instance.isCollapsed) return;
655660
instance.isCollapsed = !0, collapseEl(instance, el).addClass("collapsed"), select(instance, el, instance.toggleSelector).removeClass("hidden in");
@@ -742,7 +747,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
742747
}
743748
if (void 0 === format && (format = "str"), 0 === total_votes) return print(0);
744749
var base = question.totals.valid_votes + question.totals.null_votes + question.totals.blank_votes;
745-
return void 0 !== over && null !== over || (over = question.answer_total_votes_percentage),
750+
return (void 0 === over || null === over) && (over = question.answer_total_votes_percentage),
746751
"over-valid-votes" === over && (base = question.totals.valid_votes), print(100 * total_votes / base);
747752
};
748753
}), angular.module("avUi").service("CheckerService", function() {
@@ -842,7 +847,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
842847
prefix: sumStrs(d.prefix, item.prefix)
843848
});
844849
}), !0));
845-
return !(!pass && "chain" === d.data.groupType);
850+
return pass || "chain" !== d.data.groupType ? !0 : !1;
846851
});
847852
return ret;
848853
}
@@ -851,8 +856,8 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
851856
return function(number, fixedDigits) {
852857
angular.isNumber(fixedDigits) && fixedDigits >= 0 && (number = number.toFixed(parseInt(fixedDigits)));
853858
var number_str = (number + "").replace(".", ","), ret = "", commaPos = number_str.length;
854-
number_str.indexOf(",") !== -1 && (commaPos = number_str.indexOf(","));
855-
for (var i = 0; i < commaPos; i++) {
859+
-1 !== number_str.indexOf(",") && (commaPos = number_str.indexOf(","));
860+
for (var i = 0; commaPos > i; i++) {
856861
var reverse = commaPos - i;
857862
reverse % 3 === 0 && reverse > 0 && i > 0 && (ret += "."), ret += number_str[i];
858863
}
@@ -862,7 +867,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
862867
return function(originString, searchString) {
863868
if (!angular.isString(originString) || !angular.isString(searchString)) return !1;
864869
var lastIndex = originString.indexOf(searchString);
865-
return lastIndex !== -1 && lastIndex === originString.length - searchString.length;
870+
return -1 !== lastIndex && lastIndex === originString.length - searchString.length;
866871
};
867872
}), angular.module("avUi").service("StateDataService", [ "$state", function($state) {
868873
var data = {};

dist/avConfig-v3.0.1.js renamed to dist/avConfig-v3.4.0.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* in this same file, which you might want to edit and tune if needed.
2121
*/
2222

23-
var AV_CONFIG_VERSION = '3.3.0';
23+
var AV_CONFIG_VERSION = '3.4.0';
2424

2525
var avConfigData = {
2626
// the base url path for ajax requests, for example for sending ballots or
File renamed without changes.
File renamed without changes.

dist/avWidgets.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
var link = links[i], href = link.getAttribute("href");
1010
void 0 !== callback && callback(link, i, className);
1111
var iframe = createElement("iframe", {
12-
class: className + "-iframe",
12+
"class": className + "-iframe",
1313
src: href,
1414
style: "border: 0; width: 100%; height: 100%",
1515
seamless: ""

dist/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<!DOCTYPE html><html id="ng-app" ng-app="agora-gui-common"><head><title>Agora Voting</title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><base href="/"><meta charset="utf-8"><link rel="stylesheet" id="theme" href="/themes/default/app.min.css"></head><body><!-- Livereload script for development only (stripped during dist build) --><!-- IE8 bind workaround (needed for less) --><!-- JS from Bower Components --><!-- Add New Bower Component JS Above --><!-- JS from Vendor Components --><!-- Add New Vendor Component JS Above --><!-- Configuration file JS --><!-- Themes JS --><!-- Main App JS --><!-- registration --><!-- ui --><!-- for security, we do not include the dynamic directive in the app,
2-
so in the compiled app e2e tests are not expected work. --><!-- IE10 viewport hack for Surface/desktop Windows 8 bug --><!-- IE9 console workaround --><!-- Add New Component JS Above --><div id="no-js">Page is taking some time to load, wait a moment please. If it takes too long, please check that you have javascript activated, try with another browser or contact us.</div><div id="unsupported-browser">For security reasons, your browser is unsupported. Please use a newer web browser (if you are using Internet Explorer, use version 9 or newer).</div><div><!-- Shown while loading --><div id="angular-preloading" class="avb-start-loading"></div><!-- Main content --><div id="content"><!-- This is where angular injects its content --><div ui-view=""></div></div></div><!--[if lte IE 8]><script src="/libcompat-v3.0.1.js"></script><![endif]--><!--[if gte IE 9]><script src="/libnocompat-v3.0.1.js"></script><![endif]--><!--[if !IE]><!--><script src="/libnocompat-v3.0.1.js"></script><!--<![endif]--><!--All the source code of this program under copyright. Take a look at the license details at https://github.com/agoravoting/agora-core-view/blob/master/README.md --><script src="/appCommon-v3.0.1.js"></script><script src="/avPlugins-v3.0.1.js"></script></body></html>
2+
so in the compiled app e2e tests are not expected work. --><!-- IE10 viewport hack for Surface/desktop Windows 8 bug --><!-- IE9 console workaround --><!-- Add New Component JS Above --><div id="no-js">Page is taking some time to load, wait a moment please. If it takes too long, please check that you have javascript activated, try with another browser or contact us.</div><div id="unsupported-browser">For security reasons, your browser is unsupported. Please use a newer web browser (if you are using Internet Explorer, use version 9 or newer).</div><div><!-- Shown while loading --><div id="angular-preloading" class="avb-start-loading"></div><!-- Main content --><div id="content"><!-- This is where angular injects its content --><div ui-view=""></div></div></div><!--[if lte IE 8]><script src="/libcompat-v3.4.0.js"></script><![endif]--><!--[if gte IE 9]><script src="/libnocompat-v3.4.0.js"></script><![endif]--><!--[if !IE]><!--><script src="/libnocompat-v3.4.0.js"></script><!--<![endif]--><!--All the source code of this program under copyright. Take a look at the license details at https://github.com/agoravoting/agora-core-view/blob/master/README.md --><script src="/appCommon-v3.4.0.js"></script><script src="/avPlugins-v3.4.0.js"></script></body></html>

0 commit comments

Comments
 (0)