estimancy/projestimate

View on GitHub
app/views/views_widgets/edit.js.erb

Summary

Maintainability
Test Coverage
$("#notifications").html("");
$(".modal-body-inner").html("<%= j render(:partial => "views_widgets/form") %>");

$("#myModalLabel").css('font-size', 'larger');
$("#myModalLabel").html('<%= "#{@views_widget.view.name} : #{I18n.t(:edit_widget, value: @views_widget.name)}" %>');

$("#edit_component").modal({
    keyboard: false,
    backdrop: "static",
    backdrop: false
});

$("#views_widget_icon_class").change(function(){
    if ($(this).val() !== ""){
        $("#view_icon_class_image").removeClass();
        $("#view_icon_class_image").addClass( $(this).val());
        $("#view_icon_class_image").addClass( "icon-large blue" );
    }
    else{
        $("#view_icon_class_image").removeClass();
    }
    return false;
});

$("#views_widget_module_project_id").change(function() {
    if ($(this).val() !== ""){
        return $.ajax({
            url: "/update_widget_module_project_data",
            method: "GET",
            data: "module_project_id=" + $(this).val()
        });
    }
});

$("#notifications").html("<%= j(render "layouts/notifications") %>");