Skip to content

Commit

Permalink
Merge pull request #83 from agoravoting/go-v9
Browse files Browse the repository at this point in the history
Go v9
  • Loading branch information
Findeton authored Nov 24, 2017
2 parents 8c89b23 + b9d5198 commit 23206f4
Show file tree
Hide file tree
Showing 14 changed files with 1,502 additions and 1,429 deletions.
23 changes: 12 additions & 11 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'use strict';

var pkg = require('./package.json');
var AV_CONFIG_VERSION = '103111.8';
var AV_CONFIG_VERSION = '103111.9';

//Using exclusion patterns slows down Grunt significantly
//instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**'
Expand Down Expand Up @@ -195,10 +195,10 @@ module.exports = function (grunt) {
options: {
remove: ['script[data-remove!="false"]','link[data-remove!="false"]'],
append: [
{selector:'body',html:'<!--[if lte IE 8]><script src="/libcompat-v103111.8.js"></script><![endif]--><!--[if gte IE 9]><script src="/libnocompat-v103111.8.js"></script><![endif]--><!--[if !IE]><!--><script src="/libnocompat-v103111.8.js"></script><!--<![endif]-->'},
{selector:'body',html:'<!--[if lte IE 8]><script src="/libcompat-v103111.9.js"></script><![endif]--><!--[if gte IE 9]><script src="/libnocompat-v103111.9.js"></script><![endif]--><!--[if !IE]><!--><script src="/libnocompat-v103111.9.js"></script><!--<![endif]-->'},
{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 -->'},
{selector:'body',html:'<script src="/appCommon-v103111.8.js"></script>'},
{selector:'body',html:'<script src="/avPlugins-v103111.8.js"></script>'},
{selector:'body',html:'<script src="/appCommon-v103111.9.js"></script>'},
{selector:'body',html:'<script src="/avPlugins-v103111.9.js"></script>'},
{selector:'head',html:'<link rel="stylesheet" id="theme" href="/themes/default/app.min.css">'}
]
},
Expand Down Expand Up @@ -228,9 +228,9 @@ module.exports = function (grunt) {
'temp/libnocompat.js': ['<%= dom_munger.data.libnocompatjs %>'],
'temp/lib.js': ['<%= dom_munger.data.libjs %>'],
'temp/app.js': ['<%= dom_munger.data.appjs %>','<%= ngtemplates.main.dest %>'],
'dist/avConfig-v103111.8.js': ['avConfig.js'],
'dist/avThemes-v103111.8.js': ['avThemes.js'],
'dist/avPlugins-v103111.8.js': ['plugins/**/*.js']
'dist/avConfig-v103111.9.js': ['avConfig.js'],
'dist/avThemes-v103111.9.js': ['avThemes.js'],
'dist/avPlugins-v103111.9.js': ['plugins/**/*.js']
}
}
},
Expand Down Expand Up @@ -262,10 +262,10 @@ module.exports = function (grunt) {
beautify: true
},
files: {
'dist/appCommon-v103111.8.js': 'temp/app.js',
'dist/libCommon-v103111.8.js': 'temp/lib.js',
'dist/libnocompat-v103111.8.js': 'temp/libnocompat.js',
'dist/libcompat-v103111.8.js': 'temp/libcompat.js',
'dist/appCommon-v103111.9.js': 'temp/app.js',
'dist/libCommon-v103111.9.js': 'temp/lib.js',
'dist/libnocompat-v103111.9.js': 'temp/libnocompat.js',
'dist/libcompat-v103111.9.js': 'temp/libcompat.js',
'dist/avWidgets.js': 'avWidgets.js',

"dist/locales/moment/es.js": "bower_components/moment/lang/es.js",
Expand Down Expand Up @@ -348,6 +348,7 @@ module.exports = function (grunt) {
grunt.registerTask('build',['check_config', 'jshint','clean:before','less','autoprefixer','dom_munger','ngtemplates','cssmin','concat','merge-json','ngAnnotate','uglify','copy','htmlmin','imagemin','clean:after']);
grunt.registerTask('serve', ['dom_munger:read','jshint','connect', 'watch']);
grunt.registerTask('test',['dom_munger:read','karma:all_tests']);
grunt.registerTask('default',[]);

grunt.event.on('watch', function(action, filepath) {
//https://github.com/gruntjs/grunt-contrib-watch/issues/156
Expand Down
2 changes: 1 addition & 1 deletion avConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* in this same file, which you might want to edit and tune if needed.
*/

var AV_CONFIG_VERSION = '103111.8';
var AV_CONFIG_VERSION = '103111.9';

var avConfigData = {
// the base url path for ajax requests, for example for sending ballots or
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "avCommon",
"version" : "103111.8",
"version" : "103111.9",
"main": "index.html",
"ignore": [
"tests",
Expand Down
56 changes: 34 additions & 22 deletions dist/appCommon-v103111.8.js → dist/appCommon-v103111.9.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
};
return data;
}
return void 0 === userid ? $http.get(backendUrl + "user/", {}) : $http.get(backendUrl + "user/%d" % userid, {});
return "undefined" == typeof userid ? $http.get(backendUrl + "user/", {}) : $http.get(backendUrl + "user/%d" % userid, {});
}, authmethod.ping = function() {
if (!authmethod.isLoggedIn()) {
var data = {
Expand Down Expand Up @@ -117,7 +117,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
}) : $http.get(backendUrl + "auth-event/" + id + "/census/");
}, authmethod.getRegisterFields = function(viewEventData) {
var fields = _.filter(angular.copy(viewEventData.extra_fields), function(item) {
return !0 !== item.required_when_registered;
return !0 === item.required_when_registered ? !1 : !0;
});
fields || (fields = []);
var found = !1;
Expand Down Expand Up @@ -259,7 +259,9 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
} ]), angular.module("avRegistration").directive("avLogin", [ "Authmethod", "StateDataService", "$parse", "$state", "$location", "$cookies", "$i18next", "$window", "$timeout", "ConfigService", "Patterns", function(Authmethod, StateDataService, $parse, $state, $location, $cookies, $i18next, $window, $timeout, ConfigService, Patterns) {
function link(scope, element, attrs) {
function isValidTel(inputName) {
return !!document.getElementById(inputName) && angular.element(document.getElementById(inputName)).intlTelInput("isValidNumber");
if (!document.getElementById(inputName)) return !1;
var telInput = angular.element(document.getElementById(inputName));
return telInput.intlTelInput("isValidNumber");
}
function isValidEmail(email) {
var pattern = Patterns.get("email");
Expand Down Expand Up @@ -342,10 +344,10 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
el.disabled = !0), scope.telIndex = index + 1, scope.telField = el) : "tlf" === el.type && "sms-otp" === scope.method && (null !== scope.email && -1 === scope.email.indexOf("@") && (el.value = scope.email,
el.disabled = !0, scope.currentFormStep = 1), scope.telIndex = index + 1, scope.telField = el),
el;
});
_.filter(fields, function(el) {
}), filled_fields = _.filter(fields, function(el) {
return null !== el.value;
}).length === scope.login_fields.length && scope.loginUser(!0);
});
filled_fields.length === scope.login_fields.length && scope.loginUser(!0);
}, scope.view = function(id) {
Authmethod.viewEvent(id).success(function(data) {
"ok" === data.status ? scope.apply(data.events) : (scope.status = "Not found", document.querySelector(".input-error").style.display = "block");
Expand Down Expand Up @@ -493,9 +495,10 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
function link(scope, element, attrs) {
scope.dni_re = /^[XYZ]?\d{7,8}[A-Z]$/, scope.validateDni = function(str) {
str || (str = ""), str = str.toUpperCase().replace(/\s/, "");
var prefix = str.charAt(0), index = "XYZ".indexOf(prefix);
return index > -1 && (index, str = str.substr(1), "Y" === prefix ? str = "1" + str : "Z" === prefix && (str = "2" + str)),
"TRWAGMYFPDXBNJZSQVHLCKE".charAt(parseInt(str, 10) % 23) === str.charAt(str.length - 1);
var prefix = str.charAt(0), index = "XYZ".indexOf(prefix), niePrefix = 0;
index > -1 && (niePrefix = index, str = str.substr(1), "Y" === prefix ? str = "1" + str : "Z" === prefix && (str = "2" + str));
var dni_letters = "TRWAGMYFPDXBNJZSQVHLCKE", letter = dni_letters.charAt(parseInt(str, 10) % 23);
return letter === str.charAt(str.length - 1);
};
}
return {
Expand Down Expand Up @@ -552,7 +555,9 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
var validateTel = function() {
scope.$evalAsync(function() {
var intlNumber = telInput.intlTelInput("getNumber");
intlNumber && (scope.field.value = intlNumber), !telInput.intlTelInput("isValidNumber") && $("#input" + scope.index).val().replace("[ \t\n]", "").length > 0 ? (telInput.toggleClass("error", !0),
intlNumber && (scope.field.value = intlNumber);
var isValid = telInput.intlTelInput("isValidNumber");
!isValid && $("#input" + scope.index).val().replace("[ \n]", "").length > 0 ? (telInput.toggleClass("error", !0),
scope.isValidNumber = !1) : (telInput.toggleClass("error", !1), scope.isValidNumber = !0);
});
};
Expand Down Expand Up @@ -639,7 +644,8 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
plugins.signals.fire(signalName, data);
}, plugins.hook = function(hookname, data) {
for (var i = 0; i < plugins.hooks.length; i++) {
if (!(0, plugins.hooks[i])(hookname, data)) return !1;
var h = plugins.hooks[i], ret = h(hookname, data);
if (!ret) return !1;
}
return !0;
}, plugins;
Expand Down Expand Up @@ -797,10 +803,12 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
};
} ]), angular.module("avUi").directive("avCollapsing", [ "$window", "$timeout", function($window, $timeout) {
function collapseEl(instance, el) {
return instance.collapseSelector ? select(instance, el, instance.collapseSelector) : angular.element(el);
var val = null;
return val = instance.collapseSelector ? select(instance, el, instance.collapseSelector) : angular.element(el);
}
function select(instance, el, selector) {
return instance.parentSelector ? el.closest(instance.parentSelector).find(selector) : angular.element(selector);
var val;
return val = instance.parentSelector ? el.closest(instance.parentSelector).find(selector) : angular.element(selector);
}
var checkCollapse = function(instance, el, options) {
var maxHeight = select(instance, el, instance.maxHeightSelector).css("max-height"), height = angular.element(el)[0].scrollHeight;
Expand Down Expand Up @@ -897,7 +905,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
}
if (void 0 === format && (format = "str"), 0 === total_votes) return print(0);
var base = question.totals.valid_votes + question.totals.null_votes + question.totals.blank_votes;
return void 0 !== over && null !== over || (over = question.answer_total_votes_percentage),
return (void 0 === over || null === over) && (over = question.answer_total_votes_percentage),
"over-valid-votes" === over || "over-total-valid-votes" === over ? base = question.totals.valid_votes : "over-total-valid-points" === over && void 0 !== question.totals.valid_points && (base = question.totals.valid_points),
print(100 * total_votes / base);
};
Expand All @@ -917,9 +925,11 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
angular.isUndefined(d.errorData) && (d.errorData = {});
var ret = _.every(d.checks, function(item) {
var itemMin, itemMax, max, min, pass = !0;
if ("is-int" === item.check) (pass = angular.isNumber(d.data[item.key], item.postfix)) || error(item.check, {
if ("is-int" === item.check) pass = angular.isNumber(d.data[item.key], item.postfix),
pass || error(item.check, {
key: item.key
}, item.postfix); else if ("is-array" === item.check) (pass = angular.isArray(d.data[item.key], item.postfix)) || error(item.check, {
}, item.postfix); else if ("is-array" === item.check) pass = angular.isArray(d.data[item.key], item.postfix),
pass || error(item.check, {
key: item.key
}, item.postfix); else if ("lambda" === item.check) {
if (!item.validator(d.data[item.key])) {
Expand All @@ -930,7 +940,8 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
_.isObject(item.append) && _.isString(item.append.key) && !_.isUndefined(item.append.value) && (errorData[item.append.key] = evalValue(item.append.value, item)),
error(item.check, errorData, item.postfix);
}
} else if ("is-string-if-defined" === item.check) (pass = angular.isUndefined(d.data[item.key]) || angular.isString(d.data[item.key], item.postfix)) || error(item.check, {
} else if ("is-string-if-defined" === item.check) pass = angular.isUndefined(d.data[item.key]) || angular.isString(d.data[item.key], item.postfix),
pass || error(item.check, {
key: item.key
}, item.postfix); else if ("array-length-if-defined" === item.check) {
if (angular.isDefined(d.data[item.key]) && (itemMin = evalValue(item.min, d.data),
Expand All @@ -948,7 +959,8 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
};
error("array-length-max", itemErrorData0, item.postfix);
}
} else if ("is-string" === item.check) (pass = angular.isString(d.data[item.key], item.postfix)) || error(item.check, {
} else if ("is-string" === item.check) pass = angular.isString(d.data[item.key], item.postfix),
pass || error(item.check, {
key: item.key
}, item.postfix); else if ("array-length" === item.check) {
if (itemMin = evalValue(item.min, d.data), itemMax = evalValue(item.max, d.data),
Expand Down Expand Up @@ -1028,7 +1040,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
});
});
}
return !(!pass && "chain" === d.data.groupType);
return pass || "chain" !== d.data.groupType ? !0 : !1;
});
return ret;
}
Expand All @@ -1038,9 +1050,9 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
angular.isNumber(fixedDigits) && fixedDigits >= 0 && (number = number.toFixed(parseInt(fixedDigits)));
var number_str = (number + "").replace(".", ","), ret = "", commaPos = number_str.length;
-1 !== number_str.indexOf(",") && (commaPos = number_str.indexOf(","));
for (var i = 0; i < commaPos; i++) {
for (var i = 0; commaPos > i; i++) {
var reverse = commaPos - i;
reverse % 3 == 0 && reverse > 0 && i > 0 && (ret += "."), ret += number_str[i];
reverse % 3 === 0 && reverse > 0 && i > 0 && (ret += "."), ret += number_str[i];
}
return ret + number_str.substr(commaPos, number_str.length);
};
Expand Down Expand Up @@ -1191,6 +1203,6 @@ angular.module("jm.i18next").config([ "$i18nextProvider", "ConfigServiceProvider
$templateCache.put("avUi/documentation-directive/documentation-directive.html", '<div><h2 class="text-center text-av-secondary" ng-i18next="avDocumentation.documentation.title"></h2><p ng-i18next="avDocumentation.documentation.first_line"></p><ul class="docu-ul"><li ng-if="!!documentation.faq"><a href="{{documentation.faq}}" target="_blank" ng-i18next="avDocumentation.documentation.faq"></a></li><li ng-if="!!documentation.overview"><a href="{{documentation.overview}}" target="_blank" ng-i18next="avDocumentation.documentation.overview"></a></li><li><a href="{{auths_url}}" target="_blank" ng-i18next="avDocumentation.documentation.authorities"></a></li><li ng-if="!!documentation.technical"><a href="{{documentation.technical}}" target="_blank" ng-i18next="avDocumentation.documentation.technical"></a></li><li ng-if="!!documentation.security_contact"><a href="{{documentation.security_contact}}" target="_blank" ng-i18next="avDocumentation.documentation.security_contact"></a></li></ul><div class="documentation-html-include" av-plugin-html ng-bind-html="documentation_html_include"></div></div>'),
$templateCache.put("avUi/foot-directive/foot-directive.html", '<div class="commonfoot"><div class="social" style="text-align: center"><span class="powered-by pull-left" ng-i18next="[html:i18next]({url: organization.orgUrl, name: organization.orgName})avCommon.poweredBy"></span> <a href="{{social.facebook}}" target="_blank" ng-if="!!social.facebook"><i class="fa fa-fw fa-lg fa-facebook"></i></a> <a href="{{social.twitter}}" target="_blank" ng-if="!!social.twitter"><i class="fa fa-fw fa-lg fa-twitter"></i></a> <a href="{{social.googleplus}}" target="_blank" ng-if="!!social.googleplus"><i class="fa fa-fw fa-lg fa-google-plus"></i></a> <a href="{{social.youtube}}" target="_blank" ng-if="!!social.youtube"><i class="fa fa-fw fa-lg fa-youtube-play"></i></a> <a href="{{social.github}}" target="_blank" ng-if="!!social.github"><i class="fa fa-fw fa-lg fa-github"></i></a></div></div>'),
$templateCache.put("avUi/simple-error-directive/simple-error-directive.html", '<div class="av-simple-error-title" ng-transclude></div>'),
$templateCache.put("test/test_booth_widget.html", '<!DOCTYPE html><html><head><title>Test frame</title><meta charset="UTF-8"></head><script>function getCastHmac(auth_data, callback) {\n callback("khmac:///sha-256;5e25a9af28a33d94b8c2c0edbc83d6d87355e45b93021c35a103821557ec7dc5/voter-1110-1dee0c135afeae29e208550e7258dab7b64fb008bc606fc326d41946ab8e773f:1415185712");\n }<\/script><body style="overflow-y: hidden; overflow-x: hidden; padding: 0; margin: 0"><div style="width: 100%; display: block; position: absolute; top: 0; bottom: 0; scroll: none; padding: 0; margin: 0"><a class="agoravoting-voting-booth" href="http://agora.dev/#/election/1110/vote" data-authorization-funcname="getCastHmac">Votar con Agora Voting</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="http://agora.dev/avWidgets.min.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","agoravoting-widgets-js");<\/script></div></body></html>'),
$templateCache.put("test/test_booth_widget.html", '<!DOCTYPE html><html><head><title>Test frame</title><meta charset="UTF-8"></head><script>function getCastHmac(auth_data, callback) {\n callback("khmac:///sha-256;5e25a9af28a33d94b8c2c0edbc83d6d87355e45b93021c35a103821557ec7dc5/voter-1110-1dee0c135afeae29e208550e7258dab7b64fb008bc606fc326d41946ab8e773f:1415185712");\n }</script><body style="overflow-y: hidden; overflow-x: hidden; padding: 0; margin: 0"><div style="width: 100%; display: block; position: absolute; top: 0; bottom: 0; scroll: none; padding: 0; margin: 0"><a class="agoravoting-voting-booth" href="http://agora.dev/#/election/1110/vote" data-authorization-funcname="getCastHmac">Votar con Agora Voting</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="http://agora.dev/avWidgets.min.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","agoravoting-widgets-js");</script></div></body></html>'),
$templateCache.put("test/unit_test_e2e.html", '<div dynamic="html" id="dynamic-result"></div>');
} ]);
2 changes: 1 addition & 1 deletion dist/avConfig-v103111.8.js → dist/avConfig-v103111.9.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* in this same file, which you might want to edit and tune if needed.
*/

var AV_CONFIG_VERSION = '103111.8';
var AV_CONFIG_VERSION = '103111.9';

var avConfigData = {
// the base url path for ajax requests, for example for sending ballots or
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dist/avWidgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var link = links[i], href = link.getAttribute("href");
void 0 !== callback && callback(link, i, className);
var iframe = createElement("iframe", {
class: className + "-iframe",
"class": className + "-iframe",
src: href,
style: "border: 0; width: 100%; height: 100%",
seamless: ""
Expand Down
Loading

0 comments on commit 23206f4

Please sign in to comment.