Remove unnecessary return statements
These statements were automatically added by CoffeeScript. I'm only removing the obvious cases; there might be more cases where the `return` statement isn't necessary.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.AdvancedSearch = {
|
||||
@@ -7,15 +6,15 @@
|
||||
},
|
||||
toggle_form: function(event) {
|
||||
event.preventDefault();
|
||||
return $("#js-advanced-search").slideToggle();
|
||||
$("#js-advanced-search").slideToggle();
|
||||
},
|
||||
toggle_date_options: function() {
|
||||
if ($("#js-advanced-search-date-min").val() === "custom") {
|
||||
$("#js-custom-date").show();
|
||||
return $(".js-calendar").datepicker("option", "disabled", false);
|
||||
$(".js-calendar").datepicker("option", "disabled", false);
|
||||
} else {
|
||||
$("#js-custom-date").hide();
|
||||
return $(".js-calendar").datepicker("option", "disabled", true);
|
||||
$(".js-calendar").datepicker("option", "disabled", true);
|
||||
}
|
||||
},
|
||||
init_calendar: function() {
|
||||
@@ -25,7 +24,7 @@
|
||||
maxDate: "+0d"
|
||||
});
|
||||
$(".js-calendar-full").datepicker();
|
||||
return $.datepicker.setDefaults($.datepicker.regional[locale]);
|
||||
$.datepicker.setDefaults($.datepicker.regional[locale]);
|
||||
},
|
||||
initialize: function() {
|
||||
App.AdvancedSearch.init_calendar();
|
||||
@@ -35,12 +34,12 @@
|
||||
}
|
||||
$("#js-advanced-search-title").on({
|
||||
click: function(event) {
|
||||
return App.AdvancedSearch.toggle_form(event);
|
||||
App.AdvancedSearch.toggle_form(event);
|
||||
}
|
||||
});
|
||||
return $("#js-advanced-search-date-min").on({
|
||||
$("#js-advanced-search-date-min").on({
|
||||
change: function() {
|
||||
return App.AdvancedSearch.toggle_date_options();
|
||||
App.AdvancedSearch.toggle_date_options();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.AllowParticipation = {
|
||||
initialize: function() {
|
||||
return $(document).on({
|
||||
$(document).on({
|
||||
"mouseenter focus": function() {
|
||||
$(this).find(".js-participation-not-allowed").show();
|
||||
return $(this).find(".js-participation-allowed").hide();
|
||||
$(this).find(".js-participation-allowed").hide();
|
||||
},
|
||||
mouseleave: function() {
|
||||
$(this).find(".js-participation-not-allowed").hide();
|
||||
return $(this).find(".js-participation-allowed").show();
|
||||
$(this).find(".js-participation-allowed").show();
|
||||
}
|
||||
}, ".js-participation");
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Answers = {
|
||||
initializeAnswers: function(answers) {
|
||||
return $(answers).on("cocoon:after-insert", function(e, new_answer) {
|
||||
$(answers).on("cocoon:after-insert", function(e, new_answer) {
|
||||
var given_order;
|
||||
given_order = App.Answers.maxGivenOrder(answers) + 1;
|
||||
return $(new_answer).find("[name$='[given_order]']").val(given_order);
|
||||
$(new_answer).find("[name$='[given_order]']").val(given_order);
|
||||
});
|
||||
},
|
||||
maxGivenOrder: function(answers) {
|
||||
@@ -15,17 +14,17 @@
|
||||
$(answers).find("[name$='[given_order]']").each(function(index, answer) {
|
||||
var value;
|
||||
value = parseFloat($(answer).val());
|
||||
return max_order = value > max_order ? value : max_order;
|
||||
max_order = value > max_order ? value : max_order;
|
||||
});
|
||||
return max_order;
|
||||
},
|
||||
nestedAnswers: function() {
|
||||
return $(".js-answers").each(function(index, answers) {
|
||||
return App.Answers.initializeAnswers(answers);
|
||||
$(".js-answers").each(function(index, answers) {
|
||||
App.Answers.initializeAnswers(answers);
|
||||
});
|
||||
},
|
||||
initialize: function() {
|
||||
return App.Answers.nestedAnswers();
|
||||
App.Answers.nestedAnswers();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Banners = {
|
||||
initialize: function() {
|
||||
$("[data-js-banner-title]").on({
|
||||
change: function() {
|
||||
return $("#js-banner-title").html($(this).val());
|
||||
$("#js-banner-title").html($(this).val());
|
||||
}
|
||||
});
|
||||
$("[data-js-banner-description]").on({
|
||||
change: function() {
|
||||
return $("#js-banner-description").html($(this).val());
|
||||
$("#js-banner-description").html($(this).val());
|
||||
}
|
||||
});
|
||||
$("[name='banner[background_color]']").on({
|
||||
change: function() {
|
||||
return $("#js-banner-background").css("background-color", $(this).val());
|
||||
$("#js-banner-background").css("background-color", $(this).val());
|
||||
}
|
||||
});
|
||||
return $("[name='banner[font_color]']").on({
|
||||
$("[name='banner[font_color]']").on({
|
||||
change: function() {
|
||||
$("#js-banner-title").css("color", $(this).val());
|
||||
return $("#js-banner-description").css("color", $(this).val());
|
||||
$("#js-banner-description").css("color", $(this).val());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.BudgetEditAssociations = {
|
||||
set_text: function(response) {
|
||||
$(".js-budget-show-administrators-list").text(response["administrators"]);
|
||||
$(".js-budget-show-valuators-list").text(response["valuators"]);
|
||||
return $(".js-budget-show-trackers-list").text(response["trackers"]);
|
||||
$(".js-budget-show-trackers-list").text(response["trackers"]);
|
||||
},
|
||||
initialize: function() {
|
||||
$(".js-budget-list-checkbox-user").on({
|
||||
@@ -21,18 +20,18 @@
|
||||
valuators: valuator_count,
|
||||
trackers: tracker_count
|
||||
};
|
||||
return $.get(url, params, function(response) {
|
||||
return App.BudgetEditAssociations.set_text(response, "json");
|
||||
$.get(url, params, function(response) {
|
||||
App.BudgetEditAssociations.set_text(response, "json");
|
||||
});
|
||||
}
|
||||
});
|
||||
return $(".js-budget-show-users-list").on({
|
||||
$(".js-budget-show-users-list").on({
|
||||
click: function() {
|
||||
var div_id;
|
||||
div_id = $(this).data().toggle;
|
||||
return $(".js-budget-users-list").each(function() {
|
||||
$(".js-budget-users-list").each(function() {
|
||||
if (this.id !== div_id && !$(this).hasClass("is-hidden")) {
|
||||
return $(this).addClass("is-hidden");
|
||||
$(this).addClass("is-hidden");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.CheckAllNone = {
|
||||
@@ -6,12 +5,12 @@
|
||||
$("[data-check-all]").on("click", function() {
|
||||
var target_name;
|
||||
target_name = $(this).data("check-all");
|
||||
return $("[name='" + target_name + "']").prop("checked", true);
|
||||
$("[name='" + target_name + "']").prop("checked", true);
|
||||
});
|
||||
return $("[data-check-none]").on("click", function() {
|
||||
$("[data-check-none]").on("click", function() {
|
||||
var target_name;
|
||||
target_name = $(this).data("check-none");
|
||||
return $("[name='" + target_name + "']").prop("checked", false);
|
||||
$("[name='" + target_name + "']").prop("checked", false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.CheckboxToggle = {
|
||||
initialize: function() {
|
||||
return $("[data-checkbox-toggle]").on("change", function() {
|
||||
$("[data-checkbox-toggle]").on("change", function() {
|
||||
var $target;
|
||||
$target = $($(this).data("checkbox-toggle"));
|
||||
|
||||
if ($(this).is(":checked")) {
|
||||
return $target.show();
|
||||
$target.show();
|
||||
} else {
|
||||
return $target.hide();
|
||||
$target.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.ColumnsSelector = {
|
||||
@@ -11,13 +10,13 @@
|
||||
App.Cookies.saveCookie($("#js-columns-selector").data("cookie"), c_value, 30);
|
||||
}
|
||||
columns = c_value.split(",");
|
||||
return columns.forEach(function(column) {
|
||||
columns.forEach(function(column) {
|
||||
$("[data-field=" + column + "]").removeClass("hidden");
|
||||
return $("#column_selector_" + column).prop("checked", true);
|
||||
$("#column_selector_" + column).prop("checked", true);
|
||||
});
|
||||
},
|
||||
initChecks: function() {
|
||||
return $(".column-selecteable th[data-field]").each(function() {
|
||||
$(".column-selecteable th[data-field]").each(function() {
|
||||
var field, input, item, label, text;
|
||||
field = $(this).data("field");
|
||||
text = $(this).text().trim();
|
||||
@@ -31,20 +30,20 @@
|
||||
label.prop("for", "column_selector_" + field);
|
||||
label.text(text);
|
||||
item.removeClass("hidden");
|
||||
return $("#js-columns-selector-wrapper").append(item);
|
||||
$("#js-columns-selector-wrapper").append(item);
|
||||
});
|
||||
},
|
||||
toggleOptions: function(event) {
|
||||
event.preventDefault();
|
||||
$("#js-columns-selector").toggleClass("hollow");
|
||||
return $("#js-columns-selector-wrapper").toggleClass("hidden");
|
||||
$("#js-columns-selector-wrapper").toggleClass("hidden");
|
||||
},
|
||||
hideAll: function() {
|
||||
$("[data-field]").addClass("hidden");
|
||||
return $(".column-selector-item input").prop("checked", false);
|
||||
$(".column-selector-item input").prop("checked", false);
|
||||
},
|
||||
toggleColumn: function(event) {
|
||||
return App.ColumnsSelector.displayColumn($(event.target).data("column"));
|
||||
App.ColumnsSelector.displayColumn($(event.target).data("column"));
|
||||
},
|
||||
displayColumn: function(column) {
|
||||
var value;
|
||||
@@ -54,7 +53,7 @@
|
||||
$("[data-field=" + column + "]").addClass("hidden");
|
||||
}
|
||||
value = App.ColumnsSelector.updateItem(column);
|
||||
return App.Cookies.saveCookie($("#js-columns-selector").data("cookie"), value, 30);
|
||||
App.Cookies.saveCookie($("#js-columns-selector").data("cookie"), value, 30);
|
||||
},
|
||||
updateItem: function(value) {
|
||||
var index, values;
|
||||
@@ -75,12 +74,12 @@
|
||||
App.ColumnsSelector.initColums();
|
||||
$("#js-columns-selector").on({
|
||||
click: function(event) {
|
||||
return App.ColumnsSelector.toggleOptions(event);
|
||||
App.ColumnsSelector.toggleOptions(event);
|
||||
}
|
||||
});
|
||||
return $(".column-selector-item input").on({
|
||||
$(".column-selector-item input").on({
|
||||
click: function(event) {
|
||||
return App.ColumnsSelector.toggleColumn(event);
|
||||
App.ColumnsSelector.toggleColumn(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,65 +1,64 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Comments = {
|
||||
add_comment: function(parent_id, response_html) {
|
||||
$(response_html).insertAfter($("#js-comment-form-" + parent_id));
|
||||
return this.update_comments_count();
|
||||
this.update_comments_count();
|
||||
},
|
||||
add_reply: function(parent_id, response_html) {
|
||||
if ($("#" + parent_id + " .comment-children").length === 0) {
|
||||
$("#" + parent_id).append("<li><ul id='" + parent_id + "_children' class='no-bullet comment-children'></ul></li>");
|
||||
}
|
||||
$("#" + parent_id + " .comment-children:first").prepend($(response_html));
|
||||
return this.update_comments_count();
|
||||
this.update_comments_count();
|
||||
},
|
||||
update_comments_count: function() {
|
||||
return $(".js-comments-count").each(function() {
|
||||
$(".js-comments-count").each(function() {
|
||||
var new_val;
|
||||
new_val = $(this).text().trim().replace(/\d+/, function(match) {
|
||||
return parseInt(match, 10) + 1;
|
||||
});
|
||||
return $(this).text(new_val);
|
||||
$(this).text(new_val);
|
||||
});
|
||||
},
|
||||
display_error: function(field_with_errors, error_html) {
|
||||
return $(error_html).insertAfter($("" + field_with_errors));
|
||||
$(error_html).insertAfter($("" + field_with_errors));
|
||||
},
|
||||
reset_and_hide_form: function(id) {
|
||||
var form_container, input;
|
||||
form_container = $("#js-comment-form-" + id);
|
||||
input = form_container.find("form textarea");
|
||||
input.val("");
|
||||
return form_container.hide();
|
||||
form_container.hide();
|
||||
},
|
||||
reset_form: function(id) {
|
||||
var input;
|
||||
input = $("#js-comment-form-" + id + " form textarea");
|
||||
return input.val("");
|
||||
input.val("");
|
||||
},
|
||||
toggle_form: function(id) {
|
||||
return $("#js-comment-form-" + id).toggle();
|
||||
$("#js-comment-form-" + id).toggle();
|
||||
},
|
||||
toggle_arrow: function(id) {
|
||||
var arrow;
|
||||
arrow = "span#" + id + "_arrow";
|
||||
if ($(arrow).hasClass("icon-arrow-right")) {
|
||||
return $(arrow).removeClass("icon-arrow-right").addClass("icon-arrow-down");
|
||||
$(arrow).removeClass("icon-arrow-right").addClass("icon-arrow-down");
|
||||
} else {
|
||||
return $(arrow).removeClass("icon-arrow-down").addClass("icon-arrow-right");
|
||||
$(arrow).removeClass("icon-arrow-down").addClass("icon-arrow-right");
|
||||
}
|
||||
},
|
||||
initialize: function() {
|
||||
$("body .js-add-comment-link").each(function() {
|
||||
if ($(this).data("initialized") !== "yes") {
|
||||
return $(this).on("click", function() {
|
||||
$(this).on("click", function() {
|
||||
App.Comments.toggle_form($(this).data().id);
|
||||
return false;
|
||||
}).data("initialized", "yes");
|
||||
}
|
||||
});
|
||||
return $("body .js-toggle-children").each(function() {
|
||||
return $(this).on("click", function() {
|
||||
$("body .js-toggle-children").each(function() {
|
||||
$(this).on("click", function() {
|
||||
var children_container_id;
|
||||
children_container_id = ($(this).data().id) + "_children";
|
||||
$("#" + children_container_id).toggle("slow");
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Documentable = {
|
||||
initialize: function() {
|
||||
$(".js-document-attachment").each(function() {
|
||||
return App.Documentable.initializeDirectUploadInput(this);
|
||||
App.Documentable.initializeDirectUploadInput(this);
|
||||
});
|
||||
$("#nested-documents").on("cocoon:after-remove", function() {
|
||||
return App.Documentable.unlockUploads();
|
||||
App.Documentable.unlockUploads();
|
||||
});
|
||||
return $("#nested-documents").on("cocoon:after-insert", function(e, nested_document) {
|
||||
$("#nested-documents").on("cocoon:after-insert", function(e, nested_document) {
|
||||
var input;
|
||||
input = $(nested_document).find(".js-document-attachment");
|
||||
input["lockUpload"] = $(nested_document).closest("#nested-documents").find(".document:visible").length >= $("#nested-documents").data("max-documents-allowed");
|
||||
App.Documentable.initializeDirectUploadInput(input);
|
||||
if (input["lockUpload"]) {
|
||||
return App.Documentable.lockUploads();
|
||||
App.Documentable.lockUploads();
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -23,7 +22,7 @@
|
||||
var inputData;
|
||||
inputData = this.buildData([], input);
|
||||
this.initializeRemoveCachedDocumentLink(input, inputData);
|
||||
return $(input).fileupload({
|
||||
$(input).fileupload({
|
||||
paramName: "attachment",
|
||||
formData: null,
|
||||
add: function(e, data) {
|
||||
@@ -31,11 +30,11 @@
|
||||
upload_data = App.Documentable.buildData(data, e.target);
|
||||
App.Documentable.clearProgressBar(upload_data);
|
||||
App.Documentable.setProgressBar(upload_data, "uploading");
|
||||
return upload_data.submit();
|
||||
upload_data.submit();
|
||||
},
|
||||
change: function(e, data) {
|
||||
return data.files.forEach(function(file) {
|
||||
return App.Documentable.setFilename(inputData, file.name);
|
||||
data.files.forEach(function(file) {
|
||||
App.Documentable.setFilename(inputData, file.name);
|
||||
});
|
||||
},
|
||||
fail: function(e, data) {
|
||||
@@ -46,7 +45,7 @@
|
||||
App.Documentable.setInputErrors(data);
|
||||
$(data.destroyAttachmentLinkContainer).find("a.delete:not(.remove-nested)").remove();
|
||||
$(data.addAttachmentLabel).addClass("error");
|
||||
return $(data.addAttachmentLabel).show();
|
||||
$(data.addAttachmentLabel).show();
|
||||
},
|
||||
done: function(e, data) {
|
||||
var destroyAttachmentLink;
|
||||
@@ -63,10 +62,10 @@
|
||||
$(destroyAttachmentLink).on("click", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return App.Documentable.doDeleteCachedAttachmentRequest(this.href, data);
|
||||
App.Documentable.doDeleteCachedAttachmentRequest(this.href, data);
|
||||
});
|
||||
if (input["lockUpload"]) {
|
||||
return App.Documentable.showNotice();
|
||||
App.Documentable.showNotice();
|
||||
}
|
||||
},
|
||||
progress: function(e, data) {
|
||||
@@ -93,43 +92,43 @@
|
||||
},
|
||||
clearFilename: function(data) {
|
||||
$(data.fileNameContainer).text("");
|
||||
return $(data.fileNameContainer).hide();
|
||||
$(data.fileNameContainer).hide();
|
||||
},
|
||||
clearInputErrors: function(data) {
|
||||
return $(data.errorContainer).find("small.error").remove();
|
||||
$(data.errorContainer).find("small.error").remove();
|
||||
},
|
||||
clearProgressBar: function(data) {
|
||||
return $(data.progressBar).find(".loading-bar").removeClass("complete errors uploading").css("width", "0px");
|
||||
$(data.progressBar).find(".loading-bar").removeClass("complete errors uploading").css("width", "0px");
|
||||
},
|
||||
setFilename: function(data, file_name) {
|
||||
$(data.fileNameContainer).text(file_name);
|
||||
return $(data.fileNameContainer).show();
|
||||
$(data.fileNameContainer).show();
|
||||
},
|
||||
setProgressBar: function(data, klass) {
|
||||
return $(data.progressBar).find(".loading-bar").addClass(klass);
|
||||
$(data.progressBar).find(".loading-bar").addClass(klass);
|
||||
},
|
||||
setTitleFromFile: function(data, title) {
|
||||
if ($(data.titleField).val() === "") {
|
||||
return $(data.titleField).val(title);
|
||||
$(data.titleField).val(title);
|
||||
}
|
||||
},
|
||||
setInputErrors: function(data) {
|
||||
var errors;
|
||||
errors = "<small class='error'>" + data.jqXHR.responseJSON.errors + "</small>";
|
||||
return $(data.errorContainer).append(errors);
|
||||
$(data.errorContainer).append(errors);
|
||||
},
|
||||
lockUploads: function() {
|
||||
return $("#new_document_link").addClass("hide");
|
||||
$("#new_document_link").addClass("hide");
|
||||
},
|
||||
unlockUploads: function() {
|
||||
$("#max-documents-notice").addClass("hide");
|
||||
return $("#new_document_link").removeClass("hide");
|
||||
$("#new_document_link").removeClass("hide");
|
||||
},
|
||||
showNotice: function() {
|
||||
return $("#max-documents-notice").removeClass("hide");
|
||||
$("#max-documents-notice").removeClass("hide");
|
||||
},
|
||||
doDeleteCachedAttachmentRequest: function(url, data) {
|
||||
return $.ajax({
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
@@ -146,9 +145,9 @@
|
||||
$(data.wrapper).find(".attachment-actions").addClass("small-12").removeClass("small-6 float-right");
|
||||
$(data.wrapper).find(".attachment-actions .action-remove").addClass("small-3").removeClass("small-12");
|
||||
if ($(data.input).data("nested-document") === true) {
|
||||
return $(data.wrapper).remove();
|
||||
$(data.wrapper).remove();
|
||||
} else {
|
||||
return $(data.wrapper).find("a.remove-cached-attachment").remove();
|
||||
$(data.wrapper).find("a.remove-cached-attachment").remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -157,14 +156,14 @@
|
||||
var remove_document_link, wrapper;
|
||||
wrapper = $(input).closest(".direct-upload");
|
||||
remove_document_link = $(wrapper).find("a.remove-cached-attachment");
|
||||
return $(remove_document_link).on("click", function(e) {
|
||||
$(remove_document_link).on("click", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return App.Documentable.doDeleteCachedAttachmentRequest(this.href, data);
|
||||
App.Documentable.doDeleteCachedAttachmentRequest(this.href, data);
|
||||
});
|
||||
},
|
||||
removeDocument: function(id) {
|
||||
return $("#" + id).remove();
|
||||
$("#" + id).remove();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.EmbedVideo = {
|
||||
initialize: function() {
|
||||
return $("#js-embedded-video").each(function() {
|
||||
$("#js-embedded-video").each(function() {
|
||||
var code;
|
||||
code = $(this).data("video-code");
|
||||
return $("#js-embedded-video").html(code);
|
||||
$("#js-embedded-video").html(code);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.FixedBar = {
|
||||
initialize: function() {
|
||||
return $("[data-fixed-bar]").each(function() {
|
||||
$("[data-fixed-bar]").each(function() {
|
||||
var $this, fixedBarTopPosition;
|
||||
$this = $(this);
|
||||
fixedBarTopPosition = $this.offset().top;
|
||||
return $(window).on("scroll", function() {
|
||||
$(window).on("scroll", function() {
|
||||
if ($(window).scrollTop() > fixedBarTopPosition) {
|
||||
$this.addClass("is-fixed");
|
||||
return $("#check-ballot").css({
|
||||
"display": "inline-block"
|
||||
});
|
||||
$("#check-ballot").css({ "display": "inline-block" });
|
||||
} else {
|
||||
$this.removeClass("is-fixed");
|
||||
return $("#check-ballot").hide();
|
||||
$("#check-ballot").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Flaggable = {
|
||||
update: function(resource_id, button) {
|
||||
return $("#" + resource_id + " .js-flag-actions").html(button).foundation();
|
||||
$("#" + resource_id + " .js-flag-actions").html(button).foundation();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Followable = {
|
||||
update: function(followable_id, button, notice) {
|
||||
$("#" + followable_id + " .js-follow").html(button);
|
||||
if ($("[data-alert]").length > 0) {
|
||||
return $("[data-alert]").replaceWith(notice);
|
||||
$("[data-alert]").replaceWith(notice);
|
||||
} else {
|
||||
return $("body").append(notice);
|
||||
$("body").append(notice);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Forms = {
|
||||
disableEnter: function() {
|
||||
return $("form.js-enter-disabled").on("keyup keypress", function(event) {
|
||||
$("form.js-enter-disabled").on("keyup keypress", function(event) {
|
||||
if (event.which === 13) {
|
||||
return event.preventDefault();
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
},
|
||||
submitOnChange: function() {
|
||||
return $(".js-submit-on-change").unbind("change").on("change", function() {
|
||||
$(".js-submit-on-change").unbind("change").on("change", function() {
|
||||
$(this).closest("form").submit();
|
||||
return false;
|
||||
});
|
||||
},
|
||||
toggleLink: function() {
|
||||
return $(".js-toggle-link").unbind("click").on("click", function() {
|
||||
$(".js-toggle-link").unbind("click").on("click", function() {
|
||||
var toggle_txt;
|
||||
$($(this).data("toggle-selector")).toggle("down");
|
||||
if ($(this).data("toggle-text") !== void 0) {
|
||||
@@ -35,10 +34,10 @@
|
||||
inputs = $(progress_bar + ", " + processes + ", " + banners);
|
||||
inputs.on({
|
||||
input: function() {
|
||||
return $("[name='" + this.name + "']").val($(this).val());
|
||||
$("[name='" + this.name + "']").val($(this).val());
|
||||
}
|
||||
});
|
||||
return inputs.trigger("input");
|
||||
inputs.trigger("input");
|
||||
},
|
||||
hideOrShowFieldsAfterSelection: function() {
|
||||
$("[name='progress_bar[kind]']").on({
|
||||
@@ -48,21 +47,21 @@
|
||||
title_field = $(".translatable-fields[data-locale=" + locale + "]");
|
||||
if (this.value === "primary") {
|
||||
title_field.hide();
|
||||
return $(".globalize-languages").hide();
|
||||
$(".globalize-languages").hide();
|
||||
} else {
|
||||
title_field.show();
|
||||
return $(".globalize-languages").show();
|
||||
$(".globalize-languages").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
return $("[name='progress_bar[kind]']").change();
|
||||
$("[name='progress_bar[kind]']").change();
|
||||
},
|
||||
initialize: function() {
|
||||
App.Forms.disableEnter();
|
||||
App.Forms.submitOnChange();
|
||||
App.Forms.toggleLink();
|
||||
App.Forms.synchronizeInputs();
|
||||
return App.Forms.hideOrShowFieldsAfterSelection();
|
||||
App.Forms.hideOrShowFieldsAfterSelection();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.FoundationExtras = {
|
||||
clearSticky: function() {
|
||||
if ($("[data-sticky]").length) {
|
||||
return $("[data-sticky]").foundation("destroy");
|
||||
$("[data-sticky]").foundation("destroy");
|
||||
}
|
||||
},
|
||||
mobile_ui_init: function() {
|
||||
return $(window).trigger("load.zf.sticky");
|
||||
$(window).trigger("load.zf.sticky");
|
||||
},
|
||||
desktop_ui_init: function() {
|
||||
return $(window).trigger("init.zf.sticky");
|
||||
$(window).trigger("init.zf.sticky");
|
||||
},
|
||||
initialize: function() {
|
||||
$(document).foundation();
|
||||
$(window).trigger("resize");
|
||||
$(document).on("page:before-unload", this.clearSticky);
|
||||
window.addEventListener("popstate", this.clearSticky, false);
|
||||
return $(function() {
|
||||
$(function() {
|
||||
if ($(window).width() < 620) {
|
||||
return App.FoundationExtras.mobile_ui_init();
|
||||
App.FoundationExtras.mobile_ui_init();
|
||||
} else {
|
||||
return App.FoundationExtras.desktop_ui_init();
|
||||
App.FoundationExtras.desktop_ui_init();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Globalize = {
|
||||
@@ -8,18 +7,18 @@
|
||||
display_locale: function(locale) {
|
||||
App.Globalize.enable_locale(locale);
|
||||
App.Globalize.add_language(locale);
|
||||
return $(".js-add-language option:selected").removeAttr("selected");
|
||||
$(".js-add-language option:selected").removeAttr("selected");
|
||||
},
|
||||
display_translations: function(locale) {
|
||||
$(".js-select-language option[value=" + locale + "]").prop("selected", true);
|
||||
return $(".js-globalize-attribute").each(function() {
|
||||
$(".js-globalize-attribute").each(function() {
|
||||
if ($(this).data("locale") === locale) {
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
$(".js-delete-language").hide();
|
||||
return $(".js-delete-" + locale).show();
|
||||
$(".js-delete-" + locale).show();
|
||||
});
|
||||
},
|
||||
add_language: function(locale) {
|
||||
@@ -29,13 +28,13 @@
|
||||
option = new Option(language_option.text(), language_option.val());
|
||||
$(".js-select-language").append(option);
|
||||
}
|
||||
return $(".js-select-language option[value=" + locale + "]").prop("selected", true);
|
||||
$(".js-select-language option[value=" + locale + "]").prop("selected", true);
|
||||
},
|
||||
remove_language: function(locale) {
|
||||
var next;
|
||||
$(".js-globalize-attribute[data-locale=" + locale + "]").each(function() {
|
||||
$(this).val("").hide();
|
||||
return App.Globalize.resetEditor(this);
|
||||
App.Globalize.resetEditor(this);
|
||||
});
|
||||
$(".js-select-language option[value=" + locale + "]").remove();
|
||||
next = $(".js-select-language option:not([value=''])").first();
|
||||
@@ -43,21 +42,21 @@
|
||||
App.Globalize.disable_locale(locale);
|
||||
App.Globalize.update_description();
|
||||
if ($(".js-select-language option").length === 1) {
|
||||
return $(".js-select-language option").prop("selected", true);
|
||||
$(".js-select-language option").prop("selected", true);
|
||||
}
|
||||
},
|
||||
resetEditor: function(element) {
|
||||
if (CKEDITOR.instances[$(element).attr("id")]) {
|
||||
return CKEDITOR.instances[$(element).attr("id")].setData("");
|
||||
CKEDITOR.instances[$(element).attr("id")].setData("");
|
||||
}
|
||||
},
|
||||
enable_locale: function(locale) {
|
||||
App.Globalize.destroy_locale_field(locale).val(false);
|
||||
return App.Globalize.site_customization_enable_locale_field(locale).val(1);
|
||||
App.Globalize.site_customization_enable_locale_field(locale).val(1);
|
||||
},
|
||||
disable_locale: function(locale) {
|
||||
App.Globalize.destroy_locale_field(locale).val(true);
|
||||
return App.Globalize.site_customization_enable_locale_field(locale).val(0);
|
||||
App.Globalize.site_customization_enable_locale_field(locale).val(0);
|
||||
},
|
||||
enabled_locales: function() {
|
||||
return $.map($(".js-select-language:first option:not([value=''])"), function(element) {
|
||||
@@ -73,14 +72,14 @@
|
||||
refresh_visible_translations: function() {
|
||||
var locale;
|
||||
locale = $(".js-select-language").val();
|
||||
return App.Globalize.display_translations(locale);
|
||||
App.Globalize.display_translations(locale);
|
||||
},
|
||||
update_description: function() {
|
||||
var count, description;
|
||||
count = App.Globalize.enabled_locales().length;
|
||||
description = App.Globalize.language_description(count);
|
||||
$(".js-languages-description").html(description);
|
||||
return $(".js-languages-count").text(count);
|
||||
$(".js-languages-count").text(count);
|
||||
},
|
||||
language_description: function(count) {
|
||||
switch (count) {
|
||||
@@ -98,19 +97,19 @@
|
||||
locale = $(this).val();
|
||||
App.Globalize.display_translations(locale);
|
||||
App.Globalize.display_locale(locale);
|
||||
return App.Globalize.update_description();
|
||||
App.Globalize.update_description();
|
||||
});
|
||||
$(".js-select-language").on("change", function() {
|
||||
return App.Globalize.display_translations($(this).val());
|
||||
App.Globalize.display_translations($(this).val());
|
||||
});
|
||||
$(".js-delete-language").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
App.Globalize.remove_language($(this).data("locale"));
|
||||
return $(this).hide();
|
||||
$(this).hide();
|
||||
});
|
||||
return $(".js-add-fields-container").on("cocoon:after-insert", function() {
|
||||
return App.Globalize.enabled_locales().forEach(function(locale) {
|
||||
return App.Globalize.enable_locale(locale);
|
||||
$(".js-add-fields-container").on("cocoon:after-insert", function() {
|
||||
App.Globalize.enabled_locales().forEach(function(locale) {
|
||||
App.Globalize.enable_locale(locale);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.IeAlert = {
|
||||
@@ -8,11 +7,11 @@
|
||||
path: "/",
|
||||
expires: 365
|
||||
});
|
||||
return $(".ie-callout").remove();
|
||||
$(".ie-callout").remove();
|
||||
},
|
||||
initialize: function() {
|
||||
return $(".ie-callout-close-js").on("click", function(event) {
|
||||
return App.IeAlert.set_cookie_and_hide(event);
|
||||
$(".ie-callout-close-js").on("click", function(event) {
|
||||
App.IeAlert.set_cookie_and_hide(event);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Imageable = {
|
||||
initialize: function() {
|
||||
$(".js-image-attachment").each(function() {
|
||||
return App.Imageable.initializeDirectUploadInput(this);
|
||||
App.Imageable.initializeDirectUploadInput(this);
|
||||
});
|
||||
$("#nested-image").on("cocoon:after-remove", function() {
|
||||
return $("#new_image_link").removeClass("hide");
|
||||
$("#new_image_link").removeClass("hide");
|
||||
});
|
||||
$("#nested-image").on("cocoon:before-insert", function() {
|
||||
return $(".js-image-attachment").closest(".image").remove();
|
||||
$(".js-image-attachment").closest(".image").remove();
|
||||
});
|
||||
return $("#nested-image").on("cocoon:after-insert", function(e, nested_image) {
|
||||
$("#nested-image").on("cocoon:after-insert", function(e, nested_image) {
|
||||
var input;
|
||||
$("#new_image_link").addClass("hide");
|
||||
input = $(nested_image).find(".js-image-attachment");
|
||||
return App.Imageable.initializeDirectUploadInput(input);
|
||||
App.Imageable.initializeDirectUploadInput(input);
|
||||
});
|
||||
},
|
||||
initializeDirectUploadInput: function(input) {
|
||||
var inputData;
|
||||
inputData = this.buildData([], input);
|
||||
this.initializeRemoveCachedImageLink(input, inputData);
|
||||
return $(input).fileupload({
|
||||
$(input).fileupload({
|
||||
paramName: "attachment",
|
||||
formData: null,
|
||||
add: function(e, data) {
|
||||
@@ -31,11 +30,11 @@
|
||||
upload_data = App.Imageable.buildData(data, e.target);
|
||||
App.Imageable.clearProgressBar(upload_data);
|
||||
App.Imageable.setProgressBar(upload_data, "uploading");
|
||||
return upload_data.submit();
|
||||
upload_data.submit();
|
||||
},
|
||||
change: function(e, data) {
|
||||
return data.files.forEach(function(file) {
|
||||
return App.Imageable.setFilename(inputData, file.name);
|
||||
data.files.forEach(function(file) {
|
||||
App.Imageable.setFilename(inputData, file.name);
|
||||
});
|
||||
},
|
||||
fail: function(e, data) {
|
||||
@@ -47,7 +46,7 @@
|
||||
App.Imageable.clearPreview(data);
|
||||
$(data.destroyAttachmentLinkContainer).find("a.delete:not(.remove-nested)").remove();
|
||||
$(data.addAttachmentLabel).addClass("error");
|
||||
return $(data.addAttachmentLabel).show();
|
||||
$(data.addAttachmentLabel).show();
|
||||
},
|
||||
done: function(e, data) {
|
||||
var destroyAttachmentLink;
|
||||
@@ -62,10 +61,10 @@
|
||||
App.Imageable.setPreview(data);
|
||||
destroyAttachmentLink = $(data.result.destroy_link);
|
||||
$(data.destroyAttachmentLinkContainer).html(destroyAttachmentLink);
|
||||
return $(destroyAttachmentLink).on("click", function(e) {
|
||||
$(destroyAttachmentLink).on("click", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return App.Imageable.doDeleteCachedAttachmentRequest(this.href, data);
|
||||
App.Imageable.doDeleteCachedAttachmentRequest(this.href, data);
|
||||
});
|
||||
},
|
||||
progress: function(e, data) {
|
||||
@@ -93,46 +92,46 @@
|
||||
},
|
||||
clearFilename: function(data) {
|
||||
$(data.fileNameContainer).text("");
|
||||
return $(data.fileNameContainer).hide();
|
||||
$(data.fileNameContainer).hide();
|
||||
},
|
||||
clearInputErrors: function(data) {
|
||||
return $(data.errorContainer).find("small.error").remove();
|
||||
$(data.errorContainer).find("small.error").remove();
|
||||
},
|
||||
clearProgressBar: function(data) {
|
||||
return $(data.progressBar).find(".loading-bar").removeClass("complete errors uploading").css("width", "0px");
|
||||
$(data.progressBar).find(".loading-bar").removeClass("complete errors uploading").css("width", "0px");
|
||||
},
|
||||
clearPreview: function(data) {
|
||||
return $(data.wrapper).find(".image-preview").remove();
|
||||
$(data.wrapper).find(".image-preview").remove();
|
||||
},
|
||||
setFilename: function(data, file_name) {
|
||||
$(data.fileNameContainer).text(file_name);
|
||||
return $(data.fileNameContainer).show();
|
||||
$(data.fileNameContainer).show();
|
||||
},
|
||||
setProgressBar: function(data, klass) {
|
||||
return $(data.progressBar).find(".loading-bar").addClass(klass);
|
||||
$(data.progressBar).find(".loading-bar").addClass(klass);
|
||||
},
|
||||
setTitleFromFile: function(data, title) {
|
||||
if ($(data.titleField).val() === "") {
|
||||
return $(data.titleField).val(title);
|
||||
$(data.titleField).val(title);
|
||||
}
|
||||
},
|
||||
setInputErrors: function(data) {
|
||||
var errors;
|
||||
errors = "<small class='error'>" + data.jqXHR.responseJSON.errors + "</small>";
|
||||
return $(data.errorContainer).append(errors);
|
||||
$(data.errorContainer).append(errors);
|
||||
},
|
||||
setPreview: function(data) {
|
||||
var image_preview;
|
||||
image_preview = "<div class='small-12 column text-center image-preview'><figure><img src='" + data.result.attachment_url + "' class='cached-image'></figure></div>";
|
||||
if ($(data.preview).length > 0) {
|
||||
return $(data.preview).replaceWith(image_preview);
|
||||
$(data.preview).replaceWith(image_preview);
|
||||
} else {
|
||||
$(image_preview).insertBefore($(data.wrapper).find(".attachment-actions"));
|
||||
return data.preview = $(data.wrapper).find(".image-preview");
|
||||
data.preview = $(data.wrapper).find(".image-preview");
|
||||
}
|
||||
},
|
||||
doDeleteCachedAttachmentRequest: function(url, data) {
|
||||
return $.ajax({
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
@@ -150,9 +149,9 @@
|
||||
$(data.wrapper).find(".attachment-actions").addClass("small-12").removeClass("small-6 float-right");
|
||||
$(data.wrapper).find(".attachment-actions .action-remove").addClass("small-3").removeClass("small-12");
|
||||
if ($(data.input).data("nested-image") === true) {
|
||||
return $(data.wrapper).remove();
|
||||
$(data.wrapper).remove();
|
||||
} else {
|
||||
return $(data.wrapper).find("a.remove-cached-attachment").remove();
|
||||
$(data.wrapper).find("a.remove-cached-attachment").remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -161,15 +160,15 @@
|
||||
var remove_image_link, wrapper;
|
||||
wrapper = $(input).closest(".direct-upload");
|
||||
remove_image_link = $(wrapper).find("a.remove-cached-attachment");
|
||||
return $(remove_image_link).on("click", function(e) {
|
||||
$(remove_image_link).on("click", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return App.Imageable.doDeleteCachedAttachmentRequest(this.href, data);
|
||||
App.Imageable.doDeleteCachedAttachmentRequest(this.href, data);
|
||||
});
|
||||
},
|
||||
removeImage: function(id) {
|
||||
$("#" + id).remove();
|
||||
return $("#new_image_link").removeClass("hide");
|
||||
$("#new_image_link").removeClass("hide");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.InvestmentReportAlert = {
|
||||
initialize: function() {
|
||||
return $("#js-investment-report-alert").on("click", function() {
|
||||
$("#js-investment-report-alert").on("click", function() {
|
||||
if (this.checked && $("#budget_investment_feasibility_unfeasible").is(":checked")) {
|
||||
return confirm(this.dataset.alert + "\n" + this.dataset.notFeasibleAlert);
|
||||
} else if (this.checked) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Legislation = {
|
||||
@@ -6,13 +5,13 @@
|
||||
$("form#new_legislation_answer input.button").hide();
|
||||
$("form#new_legislation_answer input[type=radio]").on({
|
||||
click: function() {
|
||||
return $("form#new_legislation_answer").submit();
|
||||
$("form#new_legislation_answer").submit();
|
||||
}
|
||||
});
|
||||
$("form#draft_version_go_to_version input.button").hide();
|
||||
return $("form#draft_version_go_to_version select").on({
|
||||
$("form#draft_version_go_to_version select").on({
|
||||
change: function() {
|
||||
return $("form#draft_version_go_to_version").submit();
|
||||
$("form#draft_version_go_to_version").submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.LegislationAdmin = {
|
||||
@@ -9,17 +8,17 @@
|
||||
checkbox = $(this);
|
||||
parent = $(this).parents(".row:eq(0)");
|
||||
date_selector = $(this).data("disable-date");
|
||||
return parent.find("input[type='text'][id^='" + date_selector + "']").each(function() {
|
||||
parent.find("input[type='text'][id^='" + date_selector + "']").each(function() {
|
||||
if (checkbox.is(":checked")) {
|
||||
return $(this).removeAttr("disabled");
|
||||
$(this).removeAttr("disabled");
|
||||
} else {
|
||||
return $(this).val("");
|
||||
$(this).val("");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return $("#nested_question_options").on("cocoon:after-insert", function() {
|
||||
return App.Globalize.refresh_visible_translations();
|
||||
$("#nested_question_options").on("cocoon:after-insert", function() {
|
||||
App.Globalize.refresh_visible_translations();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.LegislationAllegations = {
|
||||
toggle_comments: function() {
|
||||
if (!App.LegislationAnnotatable.isMobile()) {
|
||||
$(".draft-allegation").toggleClass("comments-on");
|
||||
return $("#comments-box").html("").hide();
|
||||
$("#comments-box").html("").hide();
|
||||
}
|
||||
},
|
||||
show_comments: function() {
|
||||
if (!App.LegislationAnnotatable.isMobile()) {
|
||||
return $(".draft-allegation").addClass("comments-on");
|
||||
$(".draft-allegation").addClass("comments-on");
|
||||
}
|
||||
},
|
||||
initialize: function() {
|
||||
@@ -19,15 +18,15 @@
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (!App.LegislationAnnotatable.isMobile()) {
|
||||
return App.LegislationAllegations.toggle_comments();
|
||||
App.LegislationAllegations.toggle_comments();
|
||||
}
|
||||
}
|
||||
});
|
||||
return $(".js-toggle-allegations").on({
|
||||
$(".js-toggle-allegations").on({
|
||||
click: function() {
|
||||
if (!App.LegislationAnnotatable.isMobile()) {
|
||||
if ($(this).find(".draft-panel .panel-title:visible").length === 0) {
|
||||
return App.LegislationAllegations.toggle_comments();
|
||||
App.LegislationAllegations.toggle_comments();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.LegislationAnnotatable = {
|
||||
@@ -41,7 +40,7 @@
|
||||
if (App.LegislationAnnotatable.isMobile()) {
|
||||
return;
|
||||
}
|
||||
return $.ajax({
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: event.annotation_url + "/annotations/" + event.annotation_id + "/comments",
|
||||
dataType: "script"
|
||||
@@ -73,8 +72,8 @@
|
||||
annotation_url: target.closest(".legislation-annotatable").data("legislation-annotatable-base-url"),
|
||||
offset: target.offset()["top"]
|
||||
});
|
||||
return parents_ids.each(function(i, pid) {
|
||||
return $.event.trigger({
|
||||
parents_ids.each(function(i, pid) {
|
||||
$.event.trigger({
|
||||
type: "renderLegislationAnnotation",
|
||||
annotation_id: pid,
|
||||
annotation_url: target.closest(".legislation-annotatable").data("legislation-annotatable-base-url")
|
||||
@@ -95,7 +94,7 @@
|
||||
App.LegislationAllegations.show_comments();
|
||||
$("#comments-box").show();
|
||||
annotation_url = $("[data-legislation-annotatable-base-url]").data("legislation-annotatable-base-url");
|
||||
return $.ajax({
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: annotation_url + "/annotations/new",
|
||||
dataType: "script"
|
||||
@@ -122,7 +121,6 @@
|
||||
$(e.target).find("label").addClass("error");
|
||||
$("<small class='error'>" + data.responseJSON[0] + "</small>").insertAfter($(e.target).find("textarea"));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}).bind(this));
|
||||
@@ -181,7 +179,7 @@
|
||||
var ann_weight, el;
|
||||
ann_weight = App.LegislationAnnotatable.propotionalWeight(annotation.weight, max_weight);
|
||||
el = $("span[data-annotation-id='" + annotation.id + "']");
|
||||
return el.addClass("weight-" + ann_weight);
|
||||
el.addClass("weight-" + ann_weight);
|
||||
});
|
||||
clearInterval(checkExist);
|
||||
}
|
||||
@@ -200,7 +198,7 @@
|
||||
App.LegislationAnnotatable.remove_highlight();
|
||||
});
|
||||
current_user_id = $("html").data("current-user-id");
|
||||
return $(".legislation-annotatable").each(function() {
|
||||
$(".legislation-annotatable").each(function() {
|
||||
var ann_id, base_url;
|
||||
ann_id = $(this).data("legislation-draft-version-id");
|
||||
base_url = $(this).data("legislation-annotatable-base-url");
|
||||
@@ -209,7 +207,7 @@
|
||||
beforeAnnotationCreated: function(ann) {
|
||||
ann["legislation_draft_version_id"] = ann_id;
|
||||
ann.permissions = ann.permissions || {};
|
||||
return ann.permissions.admin = [];
|
||||
ann.permissions.admin = [];
|
||||
}
|
||||
};
|
||||
}).include(annotator.ui.main, {
|
||||
@@ -222,9 +220,9 @@
|
||||
search: "/annotations/search"
|
||||
}
|
||||
});
|
||||
return App.LegislationAnnotatable.app.start().then(function() {
|
||||
App.LegislationAnnotatable.app.start().then(function() {
|
||||
App.LegislationAnnotatable.app.ident.identity = current_user_id;
|
||||
return App.LegislationAnnotatable.app.annotations.load({
|
||||
App.LegislationAnnotatable.app.annotations.load({
|
||||
legislation_draft_version_id: ann_id
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.LocationChanger = {
|
||||
initialize: function() {
|
||||
return $(".js-location-changer").on("change", function() {
|
||||
return window.location.assign($(this).val());
|
||||
$(".js-location-changer").on("change", function() {
|
||||
window.location.assign($(this).val());
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Managers = {
|
||||
@@ -15,17 +14,17 @@
|
||||
return chars.join("");
|
||||
},
|
||||
togglePassword: function(type) {
|
||||
return $("#user_password").prop("type", type);
|
||||
$("#user_password").prop("type", type);
|
||||
},
|
||||
initialize: function() {
|
||||
$(".generate-random-value").on("click", function() {
|
||||
return $("#user_password").val(App.Managers.generatePassword());
|
||||
$("#user_password").val(App.Managers.generatePassword());
|
||||
});
|
||||
return $(".show-password").on("click", function() {
|
||||
$(".show-password").on("click", function() {
|
||||
if ($("#user_password").is("input[type='password']")) {
|
||||
return App.Managers.togglePassword("text");
|
||||
App.Managers.togglePassword("text");
|
||||
} else {
|
||||
return App.Managers.togglePassword("password");
|
||||
App.Managers.togglePassword("password");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Map = {
|
||||
initialize: function() {
|
||||
$("*[data-map]").each(function() {
|
||||
return App.Map.initializeMap(this);
|
||||
App.Map.initializeMap(this);
|
||||
});
|
||||
return $(".js-toggle-map").on({
|
||||
$(".js-toggle-map").on({
|
||||
click: function() {
|
||||
return App.Map.toggleMap();
|
||||
App.Map.toggleMap();
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -76,11 +75,11 @@
|
||||
};
|
||||
openMarkerPopup = function(e) {
|
||||
marker = e.target;
|
||||
return $.ajax("/investments/" + marker.options["id"] + "/json_data", {
|
||||
$.ajax("/investments/" + marker.options["id"] + "/json_data", {
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
return e.target.bindPopup(getPopupContent(data)).openPopup();
|
||||
e.target.bindPopup(getPopupContent(data)).openPopup();
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -101,25 +100,25 @@
|
||||
map.on("click", moveOrPlaceMarker);
|
||||
}
|
||||
if (addMarkerInvestments) {
|
||||
return addMarkerInvestments.forEach(function(coordinates) {
|
||||
addMarkerInvestments.forEach(function(coordinates) {
|
||||
if (App.Map.validCoordinates(coordinates)) {
|
||||
marker = createMarker(coordinates.lat, coordinates.long);
|
||||
marker.options["id"] = coordinates.investment_id;
|
||||
return marker.on("click", openMarkerPopup);
|
||||
marker.on("click", openMarkerPopup);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
toggleMap: function() {
|
||||
$(".map").toggle();
|
||||
return $(".js-location-map-remove-marker").toggle();
|
||||
$(".js-location-map-remove-marker").toggle();
|
||||
},
|
||||
cleanInvestmentCoordinates: function(element) {
|
||||
var clean_markers, markers;
|
||||
markers = $(element).attr("data-marker-investments-coordinates");
|
||||
if (markers != null) {
|
||||
clean_markers = markers.replace(/-?(\*+)/g, null);
|
||||
return $(element).attr("data-marker-investments-coordinates", clean_markers);
|
||||
$(element).attr("data-marker-investments-coordinates", clean_markers);
|
||||
}
|
||||
},
|
||||
validCoordinates: function(coordinates) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.MarkdownEditor = {
|
||||
@@ -6,7 +5,7 @@
|
||||
var result, textarea_content;
|
||||
textarea_content = App.MarkdownEditor.find_textarea(element).val();
|
||||
result = md.render(textarea_content);
|
||||
return element.find(".markdown-preview").html(result);
|
||||
element.find(".markdown-preview").html(result);
|
||||
},
|
||||
// Multi-locale (translatable) form fields work by hiding inputs of locales
|
||||
// which are not "active".
|
||||
@@ -14,7 +13,7 @@
|
||||
return editor.find("textarea");
|
||||
},
|
||||
initialize: function() {
|
||||
return $(".markdown-editor").each(function() {
|
||||
$(".markdown-editor").each(function() {
|
||||
var editor, md;
|
||||
md = window.markdownit({
|
||||
html: true,
|
||||
@@ -27,9 +26,9 @@
|
||||
$(".legislation-draft-versions-edit .warning").show();
|
||||
});
|
||||
editor.find("textarea").on("scroll", function() {
|
||||
return editor.find(".markdown-preview").scrollTop($(this).scrollTop());
|
||||
editor.find(".markdown-preview").scrollTop($(this).scrollTop());
|
||||
});
|
||||
return editor.find(".fullscreen-toggle").on("click", function() {
|
||||
editor.find(".fullscreen-toggle").on("click", function() {
|
||||
var span;
|
||||
editor.toggleClass("fullscreen");
|
||||
$(".fullscreen-container").toggleClass("medium-8", "medium-12");
|
||||
@@ -41,9 +40,9 @@
|
||||
}
|
||||
if (editor.hasClass("fullscreen")) {
|
||||
App.MarkdownEditor.find_textarea(editor).height($(window).height() - 100);
|
||||
return App.MarkdownEditor.refresh_preview(editor, md);
|
||||
App.MarkdownEditor.refresh_preview(editor, md);
|
||||
} else {
|
||||
return App.MarkdownEditor.find_textarea(editor).height("10em");
|
||||
App.MarkdownEditor.find_textarea(editor).height("10em");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.ModalDownload = {
|
||||
enableButton: function() {
|
||||
$("#js-download-modal-submit").attr("disabled", false);
|
||||
return $("#js-download-modal-submit").removeClass("disabled");
|
||||
$("#js-download-modal-submit").removeClass("disabled");
|
||||
},
|
||||
initialize: function() {
|
||||
return $("#js-download-modal-submit").on("click", function() {
|
||||
return setTimeout(App.ModalDownload.enableButton, 2000);
|
||||
$("#js-download-modal-submit").on("click", function() {
|
||||
setTimeout(App.ModalDownload.enableButton, 2000);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.ModeratorBudgetInvestments = {
|
||||
add_class_faded: function(id) {
|
||||
$("#" + id).addClass("faded");
|
||||
return $("#comments").addClass("faded");
|
||||
$("#comments").addClass("faded");
|
||||
},
|
||||
hide_moderator_actions: function(id) {
|
||||
return $("#" + id + " .js-moderator-investment-actions:first").hide();
|
||||
$("#" + id + " .js-moderator-investment-actions:first").hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.ModeratorComments = {
|
||||
add_class_faded: function(id) {
|
||||
return $("#" + id + " .comment-body:first").addClass("faded");
|
||||
$("#" + id + " .comment-body:first").addClass("faded");
|
||||
},
|
||||
hide_moderator_actions: function(id) {
|
||||
return $("#" + id + " .js-moderator-comment-actions").hide();
|
||||
$("#" + id + " .js-moderator-comment-actions").hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.ModeratorDebates = {
|
||||
add_class_faded: function(id) {
|
||||
$("#" + id).addClass("faded");
|
||||
return $("#comments").addClass("faded");
|
||||
$("#comments").addClass("faded");
|
||||
},
|
||||
hide_moderator_actions: function(id) {
|
||||
return $("#" + id + " .js-moderator-debate-actions:first").hide();
|
||||
$("#" + id + " .js-moderator-debate-actions:first").hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.ModeratorProposalNotifications = {
|
||||
add_class_faded: function(id) {
|
||||
return $("#" + id).addClass("faded");
|
||||
$("#" + id).addClass("faded");
|
||||
},
|
||||
hide_moderator_actions: function(id) {
|
||||
return $("#" + id + " .js-moderator-proposal-notifications-actions:first").hide();
|
||||
$("#" + id + " .js-moderator-proposal-notifications-actions:first").hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.ModeratorProposals = {
|
||||
add_class_faded: function(id) {
|
||||
$("#" + id).addClass("faded");
|
||||
return $("#comments").addClass("faded");
|
||||
$("#comments").addClass("faded");
|
||||
},
|
||||
hide_moderator_actions: function(id) {
|
||||
return $("#" + id + " .js-moderator-proposals-actions:first").hide();
|
||||
$("#" + id + " .js-moderator-proposals-actions:first").hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Polls = {
|
||||
@@ -12,11 +11,11 @@
|
||||
return strings.join("").substring(0, 64);
|
||||
},
|
||||
replaceToken: function(token) {
|
||||
return $(".js-question-answer").each(function() {
|
||||
$(".js-question-answer").each(function() {
|
||||
var token_param;
|
||||
token_param = this.search.slice(-6);
|
||||
if (token_param === "token=") {
|
||||
return this.href = this.href + token;
|
||||
this.href = this.href + token;
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -24,20 +23,21 @@
|
||||
var token;
|
||||
token = App.Polls.generateToken();
|
||||
App.Polls.replaceToken(token);
|
||||
return $(".zoom-link").on("click", function(event) {
|
||||
$(".zoom-link").on("click", function(event) {
|
||||
var answer;
|
||||
answer = $(event.target).closest("div.answer");
|
||||
|
||||
if ($(answer).hasClass("medium-6")) {
|
||||
$(answer).removeClass("medium-6");
|
||||
$(answer).addClass("answer-divider");
|
||||
if (!$(answer).hasClass("first")) {
|
||||
return $(answer).insertBefore($(answer).prev("div.answer"));
|
||||
$(answer).insertBefore($(answer).prev("div.answer"));
|
||||
}
|
||||
} else {
|
||||
$(answer).addClass("medium-6");
|
||||
$(answer).removeClass("answer-divider");
|
||||
if (!$(answer).hasClass("first")) {
|
||||
return $(answer).insertAfter($(answer).next("div.answer"));
|
||||
$(answer).insertAfter($(answer).next("div.answer"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.PollsAdmin = {
|
||||
initialize: function() {
|
||||
return $("select[class='js-poll-shifts']").on({
|
||||
$("select[class='js-poll-shifts']").on({
|
||||
change: function() {
|
||||
switch ($(this).val()) {
|
||||
case "vote_collection":
|
||||
@@ -12,7 +11,7 @@
|
||||
break;
|
||||
case "recount_scrutiny":
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").show();
|
||||
return $("select[class='js-shift-vote-collection-dates']").hide();
|
||||
$("select[class='js-shift-vote-collection-dates']").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.PreventDoubleSubmission = {
|
||||
disable_buttons: function(buttons) {
|
||||
return setTimeout(function() {
|
||||
return buttons.each(function() {
|
||||
setTimeout(function() {
|
||||
buttons.each(function() {
|
||||
var button, loading, ref;
|
||||
button = $(this);
|
||||
if (!button.hasClass("disabled")) {
|
||||
loading = (ref = button.data("loading")) != null ? ref : "...";
|
||||
button.addClass("disabled").attr("disabled", "disabled");
|
||||
button.data("text", button.val());
|
||||
return button.val(loading);
|
||||
button.val(loading);
|
||||
}
|
||||
});
|
||||
}, 1);
|
||||
},
|
||||
reset_buttons: function(buttons) {
|
||||
return buttons.each(function() {
|
||||
buttons.each(function() {
|
||||
var button, button_text;
|
||||
button = $(this);
|
||||
if (button.hasClass("disabled")) {
|
||||
@@ -25,23 +24,23 @@
|
||||
button.removeClass("disabled").attr("disabled", null);
|
||||
if (button_text) {
|
||||
button.val(button_text);
|
||||
return button.data("text", null);
|
||||
button.data("text", null);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
initialize: function() {
|
||||
return $("form").on("submit", function(event) {
|
||||
$("form").on("submit", function(event) {
|
||||
var buttons;
|
||||
if (!(event.target.id === "new_officing_voter" || event.target.id === "admin_download_emails")) {
|
||||
buttons = $(this).find(":button, :submit");
|
||||
return App.PreventDoubleSubmission.disable_buttons(buttons);
|
||||
App.PreventDoubleSubmission.disable_buttons(buttons);
|
||||
}
|
||||
}).on("ajax:success", function(event) {
|
||||
var buttons;
|
||||
if (!(event.target.id === "new_officing_voter" || event.target.id === "admin_download_emails")) {
|
||||
buttons = $(this).find(":button, :submit");
|
||||
return App.PreventDoubleSubmission.reset_buttons(buttons);
|
||||
App.PreventDoubleSubmission.reset_buttons(buttons);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Questions = {
|
||||
nestedQuestions: function() {
|
||||
return $(".js-questions").on("cocoon:after-insert", function(e, new_question) {
|
||||
return App.Answers.initializeAnswers($(new_question).find(".js-answers"));
|
||||
$(".js-questions").on("cocoon:after-insert", function(e, new_question) {
|
||||
App.Answers.initializeAnswers($(new_question).find(".js-answers"));
|
||||
});
|
||||
},
|
||||
initialize: function() {
|
||||
return App.Questions.nestedQuestions();
|
||||
App.Questions.nestedQuestions();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.RegistrationForm = {
|
||||
@@ -6,26 +5,26 @@
|
||||
var clearUsernameMessage, showUsernameMessage, usernameInput, validateUsername;
|
||||
usernameInput = $("form#new_user[action=\"/users\"] input#user_username");
|
||||
clearUsernameMessage = function() {
|
||||
return $("small").remove();
|
||||
$("small").remove();
|
||||
};
|
||||
showUsernameMessage = function(response) {
|
||||
var klass;
|
||||
klass = response.available ? "no-error" : "error";
|
||||
return usernameInput.after($("<small class=\"" + klass + "\" style=\"margin-top: -16px;\">" + response.message + "</small>"));
|
||||
usernameInput.after($("<small class=\"" + klass + "\" style=\"margin-top: -16px;\">" + response.message + "</small>"));
|
||||
};
|
||||
validateUsername = function(username) {
|
||||
var request;
|
||||
request = $.get("/user/registrations/check_username?username=" + username);
|
||||
return request.done(function(response) {
|
||||
return showUsernameMessage(response);
|
||||
request.done(function(response) {
|
||||
showUsernameMessage(response);
|
||||
});
|
||||
};
|
||||
return usernameInput.on("focusout", function() {
|
||||
usernameInput.on("focusout", function() {
|
||||
var username;
|
||||
clearUsernameMessage();
|
||||
username = usernameInput.val();
|
||||
if (username !== "") {
|
||||
return validateUsername(username);
|
||||
validateUsername(username);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.SendAdminNotificationAlert = {
|
||||
initialize: function() {
|
||||
return $("#js-send-admin_notification-alert").on("click", function() {
|
||||
$("#js-send-admin_notification-alert").on("click", function() {
|
||||
return confirm(this.dataset.alert);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.SendNewsletterAlert = {
|
||||
initialize: function() {
|
||||
return $("#js-send-newsletter-alert").on("click", function() {
|
||||
$("#js-send-newsletter-alert").on("click", function() {
|
||||
return confirm(this.dataset.alert);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Settings = {
|
||||
initialize: function() {
|
||||
return $("#settings-tabs").on("change.zf.tabs", function() {
|
||||
$("#settings-tabs").on("change.zf.tabs", function() {
|
||||
var map_container;
|
||||
if ($("#tab-map-configuration:visible").length) {
|
||||
map_container = L.DomUtil.get("admin-map");
|
||||
if (map_container !== null) {
|
||||
map_container._leaflet_id = null;
|
||||
}
|
||||
return App.Map.initialize();
|
||||
App.Map.initialize();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.SocialShare = {
|
||||
initialize: function() {
|
||||
return $(".social-share-button a").each(function() {
|
||||
return $(this).append("<span class='show-for-sr'>" + ($(this).data("site")) + "</span>");
|
||||
$(".social-share-button a").each(function() {
|
||||
$(this).append("<span class='show-for-sr'>" + ($(this).data("site")) + "</span>");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Sortable = {
|
||||
@@ -9,7 +8,7 @@
|
||||
new_order = $(this).sortable("toArray", {
|
||||
attribute: "data-answer-id"
|
||||
});
|
||||
return $.ajax({
|
||||
$.ajax({
|
||||
url: $(".sortable").data("js-url"),
|
||||
data: {
|
||||
ordered_list: new_order
|
||||
@@ -18,13 +17,13 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
return $(".sortable-priotirized-votation").sortable({
|
||||
$(".sortable-priotirized-votation").sortable({
|
||||
update: function() {
|
||||
var new_order;
|
||||
new_order = $(this).sortable("toArray", {
|
||||
attribute: "data-answer-id"
|
||||
});
|
||||
return $.ajax({
|
||||
$.ajax({
|
||||
url: $(this).data("js-url"),
|
||||
data: {
|
||||
ordered_list: new_order
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
// Helper for generate C3.js graphs
|
||||
@@ -24,13 +23,13 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
return c3.generate(conf);
|
||||
c3.generate(conf);
|
||||
};
|
||||
|
||||
App.Stats = {
|
||||
initialize: function() {
|
||||
return $("[data-graph]").each(function() {
|
||||
return buildGraph(this);
|
||||
$("[data-graph]").each(function() {
|
||||
buildGraph(this);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Suggest = {
|
||||
initialize: function() {
|
||||
return $("[data-js-suggest-result]").each(function() {
|
||||
$("[data-js-suggest-result]").each(function() {
|
||||
var $this, callback, timer;
|
||||
$this = $(this);
|
||||
callback = function() {
|
||||
return $.ajax({
|
||||
$.ajax({
|
||||
url: $this.data("js-url"),
|
||||
data: {
|
||||
search: $this.val()
|
||||
@@ -17,20 +16,21 @@
|
||||
success: function(stHtml) {
|
||||
var js_suggest_selector, locale;
|
||||
js_suggest_selector = $this.data("js-suggest");
|
||||
|
||||
if (js_suggest_selector.startsWith(".")) {
|
||||
locale = $this.closest(".translatable-fields").data("locale");
|
||||
js_suggest_selector += "[data-locale=" + locale + "]";
|
||||
}
|
||||
return $(js_suggest_selector).html(stHtml);
|
||||
$(js_suggest_selector).html(stHtml);
|
||||
}
|
||||
});
|
||||
};
|
||||
timer = null;
|
||||
$this.on("keyup", function() {
|
||||
window.clearTimeout(timer);
|
||||
return timer = window.setTimeout(callback, 1000);
|
||||
timer = window.setTimeout(callback, 1000);
|
||||
});
|
||||
return $this.on("change", callback);
|
||||
$this.on("change", callback);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.TableSortable = {
|
||||
@@ -18,7 +17,7 @@
|
||||
};
|
||||
},
|
||||
initialize: function() {
|
||||
return $("table.sortable th").click(function() {
|
||||
$("table.sortable th").click(function() {
|
||||
var rows, table;
|
||||
table = $(this).parents("table").eq(0);
|
||||
rows = table.find("tbody tr").toArray().sort(App.TableSortable.comparer($(this).index()));
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.TagAutocomplete = {
|
||||
@@ -9,9 +8,9 @@
|
||||
return App.TagAutocomplete.split(term).pop();
|
||||
},
|
||||
init_autocomplete: function() {
|
||||
return $(".tag-autocomplete").autocomplete({
|
||||
$(".tag-autocomplete").autocomplete({
|
||||
source: function(request, response) {
|
||||
return $.ajax({
|
||||
$.ajax({
|
||||
url: $(".tag-autocomplete").data("js-url"),
|
||||
data: {
|
||||
search: App.TagAutocomplete.extractLast(request.term)
|
||||
@@ -42,7 +41,7 @@
|
||||
});
|
||||
},
|
||||
initialize: function() {
|
||||
return App.TagAutocomplete.init_autocomplete();
|
||||
App.TagAutocomplete.init_autocomplete();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Tags = {
|
||||
initialize: function() {
|
||||
var $tag_input;
|
||||
$tag_input = $("input.js-tag-list");
|
||||
return $("body .js-add-tag-link").each(function() {
|
||||
$("body .js-add-tag-link").each(function() {
|
||||
if ($(this).data("initialized") !== "yes") {
|
||||
return $(this).on("click", function() {
|
||||
$(this).on("click", function() {
|
||||
var current_tags, name;
|
||||
name = "\"" + ($(this).text()) + "\"";
|
||||
current_tags = $tag_input.val().split(",").filter(Boolean);
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.TreeNavigator = {
|
||||
setNodes: function(nodes) {
|
||||
return nodes.children("ul").each(function() {
|
||||
nodes.children("ul").each(function() {
|
||||
var link;
|
||||
link = $(this).prev("a");
|
||||
$('<span class="open"></span>').insertBefore(link);
|
||||
return App.TreeNavigator.setNodes($(this).children());
|
||||
App.TreeNavigator.setNodes($(this).children());
|
||||
});
|
||||
},
|
||||
initialize: function() {
|
||||
@@ -24,18 +23,18 @@
|
||||
click: function() {
|
||||
if ($(this).hasClass("open")) {
|
||||
$(this).removeClass("open").addClass("closed");
|
||||
return $(this).siblings("ul").hide();
|
||||
$(this).siblings("ul").hide();
|
||||
} else if ($(this).hasClass("closed")) {
|
||||
$(this).removeClass("closed").addClass("open");
|
||||
return $(this).siblings("ul").show();
|
||||
$(this).siblings("ul").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
anchor = $(location).attr("hash");
|
||||
if (anchor) {
|
||||
return elem.find("a[href='" + anchor + "']").parents("ul").each(function() {
|
||||
elem.find("a[href='" + anchor + "']").parents("ul").each(function() {
|
||||
$(this).show();
|
||||
return $(this).siblings("span").removeClass("closed").addClass("open");
|
||||
$(this).siblings("span").removeClass("closed").addClass("open");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Users = {
|
||||
initialize: function() {
|
||||
return $(".initialjs-avatar").initial();
|
||||
$(".initialjs-avatar").initial();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.ValuationBudgetInvestmentForm = {
|
||||
showFeasibleFields: function() {
|
||||
$("#valuation_budget_investment_edit_form #unfeasible_fields").hide("down");
|
||||
return $("#valuation_budget_investment_edit_form #feasible_fields").show();
|
||||
$("#valuation_budget_investment_edit_form #feasible_fields").show();
|
||||
},
|
||||
showNotFeasibleFields: function() {
|
||||
$("#valuation_budget_investment_edit_form #feasible_fields").hide("down");
|
||||
return $("#valuation_budget_investment_edit_form #unfeasible_fields").show();
|
||||
$("#valuation_budget_investment_edit_form #unfeasible_fields").show();
|
||||
},
|
||||
showAllFields: function() {
|
||||
$("#valuation_budget_investment_edit_form #feasible_fields").show("down");
|
||||
return $("#valuation_budget_investment_edit_form #unfeasible_fields").show("down");
|
||||
$("#valuation_budget_investment_edit_form #unfeasible_fields").show("down");
|
||||
},
|
||||
showFeasibilityFields: function() {
|
||||
var feasibility;
|
||||
feasibility = $("#valuation_budget_investment_edit_form input[type=radio][name='budget_investment[feasibility]']:checked").val();
|
||||
if (feasibility === "feasible") {
|
||||
return App.ValuationBudgetInvestmentForm.showFeasibleFields();
|
||||
App.ValuationBudgetInvestmentForm.showFeasibleFields();
|
||||
} else if (feasibility === "unfeasible") {
|
||||
return App.ValuationBudgetInvestmentForm.showNotFeasibleFields();
|
||||
App.ValuationBudgetInvestmentForm.showNotFeasibleFields();
|
||||
}
|
||||
},
|
||||
showFeasibilityFieldsOnChange: function() {
|
||||
return $("#valuation_budget_investment_edit_form input[type=radio][name='budget_investment[feasibility]']").change(function() {
|
||||
$("#valuation_budget_investment_edit_form input[type=radio][name='budget_investment[feasibility]']").change(function() {
|
||||
App.ValuationBudgetInvestmentForm.showAllFields();
|
||||
return App.ValuationBudgetInvestmentForm.showFeasibilityFields();
|
||||
App.ValuationBudgetInvestmentForm.showFeasibilityFields();
|
||||
});
|
||||
},
|
||||
initialize: function() {
|
||||
App.ValuationBudgetInvestmentForm.showFeasibilityFields();
|
||||
return App.ValuationBudgetInvestmentForm.showFeasibilityFieldsOnChange();
|
||||
App.ValuationBudgetInvestmentForm.showFeasibilityFieldsOnChange();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,57 +1,44 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Votations = {
|
||||
checkMaxVotes: function() {
|
||||
if ($("#votation_type_enum_type").val() === "0") {
|
||||
$(".js-max_votes").hide();
|
||||
return $("#max_votes").attr({
|
||||
disabled: true
|
||||
});
|
||||
$("#max_votes").attr({ disabled: true });
|
||||
} else {
|
||||
$(".js-max_votes").show();
|
||||
return $("#max_votes").attr({
|
||||
disabled: false
|
||||
});
|
||||
$("#max_votes").attr({ disabled: false });
|
||||
}
|
||||
},
|
||||
checkPrioritization: function() {
|
||||
if ($("#votation_type_enum_type").val() === "2") {
|
||||
$(".js-prioritization_type").show();
|
||||
return $("#prioritization_type").attr({
|
||||
disabled: false
|
||||
});
|
||||
$("#prioritization_type").attr({ disabled: false });
|
||||
} else {
|
||||
$(".js-prioritization_type").hide();
|
||||
return $("#prioritization_type").attr({
|
||||
disabled: true
|
||||
});
|
||||
$("#prioritization_type").attr({ disabled: true });
|
||||
}
|
||||
},
|
||||
checkMaxGroups: function() {
|
||||
if ($("#votation_type_enum_type").val() === "7" || $("#votation_type_enum_type").val() === "8") {
|
||||
$(".js-max_group_votes").show();
|
||||
return $("#max_groups_answers").attr({
|
||||
disabled: false
|
||||
});
|
||||
$("#max_groups_answers").attr({ disabled: false });
|
||||
} else {
|
||||
$(".js-max_group_votes").hide();
|
||||
return $("#max_groups_answers").attr({
|
||||
disabled: true
|
||||
});
|
||||
$("#max_groups_answers").attr({ disabled: true });
|
||||
}
|
||||
},
|
||||
setTraduction: function(response) {
|
||||
return $(".js-description_text").text(response["traduction"]);
|
||||
$(".js-description_text").text(response["traduction"]);
|
||||
},
|
||||
updateChecks: function() {
|
||||
App.Votations.checkMaxVotes();
|
||||
App.Votations.checkPrioritization();
|
||||
return App.Votations.checkMaxGroups();
|
||||
App.Votations.checkMaxGroups();
|
||||
},
|
||||
initialize: function() {
|
||||
App.Votations.updateChecks();
|
||||
return $("#votation_type_enum_type").on({
|
||||
$("#votation_type_enum_type").on({
|
||||
change: function() {
|
||||
var params, url;
|
||||
App.Votations.updateChecks();
|
||||
@@ -59,8 +46,8 @@
|
||||
params = {
|
||||
enum_type: $("#votation_type_enum_type").val()
|
||||
};
|
||||
return $.get(url, params, function(response) {
|
||||
return App.Votations.setTraduction(response, "json");
|
||||
$.get(url, params, function(response) {
|
||||
App.Votations.setTraduction(response, "json");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Votes = {
|
||||
hoverize: function(votes) {
|
||||
return $(document).on({
|
||||
$(document).on({
|
||||
"mouseenter focus": function() {
|
||||
$("div.participation-not-allowed", this).show();
|
||||
return $("div.participation-allowed", this).hide();
|
||||
$("div.participation-allowed", this).hide();
|
||||
},
|
||||
mouseleave: function() {
|
||||
$("div.participation-not-allowed", this).hide();
|
||||
return $("div.participation-allowed", this).show();
|
||||
$("div.participation-allowed", this).show();
|
||||
}
|
||||
}, votes);
|
||||
},
|
||||
@@ -18,7 +17,7 @@
|
||||
App.Votes.hoverize("div.votes");
|
||||
App.Votes.hoverize("div.supports");
|
||||
App.Votes.hoverize("div.debate-questions");
|
||||
return App.Votes.hoverize("div.comment-footer");
|
||||
App.Votes.hoverize("div.comment-footer");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.WatchFormChanges = {
|
||||
@@ -25,8 +24,8 @@
|
||||
return;
|
||||
}
|
||||
$(document).off("page:before-change").on("page:before-change", App.WatchFormChanges.checkChanges);
|
||||
return App.WatchFormChanges.forms().each(function() {
|
||||
return $(this).data("watchChanges", $(this).serialize());
|
||||
App.WatchFormChanges.forms().each(function() {
|
||||
$(this).data("watchChanges", $(this).serialize());
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user