Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted coffeescript files into JS #575

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// Any JavaScript file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
Expand Down
3 changes: 0 additions & 3 deletions app/javascript/src/attachments.coffee

This file was deleted.

2 changes: 2 additions & 0 deletions app/javascript/src/attachments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
3 changes: 0 additions & 3 deletions app/javascript/src/blackouts.coffee

This file was deleted.

2 changes: 2 additions & 0 deletions app/javascript/src/blackouts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
3 changes: 0 additions & 3 deletions app/javascript/src/comments.coffee

This file was deleted.

2 changes: 2 additions & 0 deletions app/javascript/src/comments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
3 changes: 0 additions & 3 deletions app/javascript/src/email_forms.coffee

This file was deleted.

2 changes: 2 additions & 0 deletions app/javascript/src/email_forms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
95 changes: 0 additions & 95 deletions app/javascript/src/emails.coffee

This file was deleted.

118 changes: 118 additions & 0 deletions app/javascript/src/emails.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
window.setupAjaxLoader = function () {
return $.ajaxSetup({
beforeSend: function () {
return $("#loader").show();
},
complete: function () {
return $("#loader").hide();
},
success: function () {},
});
};

window.hideOptionsMenu = function (menu) {
menu.removeClass("visible");
return menu.parent().children(".email-options-link").removeClass("invisible");
};

$(function () {
$(".hidden-header-toggle").click(function () {
if ($(this).data("clicked") === "no") {
$(this).data("clicked", "yes");
$(this).text("Hide Extra Headers");
$(this).parent().parent().find(".hidden-header").css("display", "block");
} else {
$(this).data("clicked", "no");
$(this).text("Show Hidden Headers");
$(this).parent().parent().find(".hidden-header").css("display", "none");
}
return window.hideOptionsMenu($(this).parent());
});
$(".email-contents-quote-mode").click(function () {
var contents;
contents = $(this).parent().parent().parent().find(".the-content");
contents.data("quote-mode", $(this).data("quote-mode"));
contents.html(
window.simpleFormat(contents.data($(this).data("quote-mode"))),
);
$(this)
.parent()
.children(".email-contents-quote-mode")
.removeClass("active");
$(this).addClass("active");
return window.hideOptionsMenu($(this).parent());
});
$(".email-options-link").click(function () {
$(this).addClass("invisible");
return $(this).parent().children(".email-options").addClass("visible");
});
$(".close-options").click(function () {
return window.hideOptionsMenu($(this).parent());
});
$(".email-unread-toggle").click(function () {
var link;
if ($(this).data("clicked") === "no") {
$(this).text("Mark Read");
$(this).data("clicked", "yes");
window.setupAjaxLoader();
$.ajax({
url: $(this).data("url"),
type: "put",
data: "email[unread]=1",
});
} else {
link = $(this);
window.setupAjaxLoader();
$.ajax({
url: $(this).data("url"),
type: "put",
data: "email[unread]=0",
success: function () {
link.text("Mark Unread");
return link.data("clicked", "no");
},
});
}
return window.hideOptionsMenu($(this).parent());
});
$(".email-reply-link").click(function () {
window.setupAjaxLoader();
return $.ajax({
url: window.reply_email_path,
data: "id=" + $(this).data("email-id"),
dataType: "script",
success: "success",
});
});
$(".email-new-event-link").click(function () {
window.setupAjaxLoader();
return $.ajax({
url: window.new_event_email_path,
data: "id=" + $(this).data("email-id"),
dataType: "script",
success: "success",
});
});
$(".email-existing-event-link").click(function () {
window.setupAjaxLoader();
return $.ajax({
url: window.existing_event_email_path,
data: "id=" + $(this).data("email-id"),
dataType: "script",
success: "success",
});
});
return $(".email-unfile-link").click(function () {
window.setupAjaxLoader();
return $.ajax({
url: $(this).data("url"),
type: "put",
data: "email[event_id]=nil",
success: function () {
return window.location.reload(true);
},
});
});
});
27 changes: 0 additions & 27 deletions app/javascript/src/equipment_profile.coffee

This file was deleted.

41 changes: 41 additions & 0 deletions app/javascript/src/equipment_profile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
$(function () {
$("#equipment-profile-list").masonry({
itemSelector: ".equipment-profile-category",
columnWidth: ".equipment-profile-category",
percentPosition: true,
});
$("#equipment-profile-calendar").fullCalendar({
events:
"/equipment_profile/" +
$("#equipment-profile-calendar").data("id") +
".json",
left: "title",
center: "",
right: "today prev,next",
});
$("#equipment_profile_category").change(function () {
return $("#equipment_profile_subcategory").html(
$("#equipment_profile_category option:selected").data("subcategories"),
);
});
$(".edit_equipment_profile_category").click(function () {
$("#equipment_profile_category").replaceWith(
$("#equipment_profile_category").data("text"),
);
if ($("#equipment_profile_subcategory").data("did") !== true) {
$("#equipment_profile_subcategory").replaceWith(
$("#equipment_profile_subcategory").data("text"),
);
}
$(".edit_equipment_profile_category").remove();
return $(".edit_equipment_profile_subcategory").remove();
});
return $(".edit_equipment_profile_subcategory").click(function () {
$("#equipment_profile_subcategory").replaceWith(
$("#equipment_profile_subcategory").data("text"),
);
return $(".edit_equipment_profile_subcategory").remove();
});
});
Loading