Files
old-ribica/back-office/app/views/layouts/application.html.erb
2015-02-01 05:21:18 +01:00

47 lines
1.3 KiB
Plaintext

<!DOCTYPE html>
<html>
<head>
<title>Ribica Back Office</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= cloudinary_js_config %>
<%= csrf_meta_tags %>
</head>
<body>
<div>
<%= link_to "Items", items_path %>
<%= link_to "Sections", sections_path %>
<%= link_to "Units", units_path %>
<%= link_to "Media Types", media_types_path %>
</div>
<%= yield %>
<script type="text/javascript" >
function runJsonEditor(id_of_editor_place, id_of_hidden_field, id_of_save_button, id_of_click_to_edit) {
$("#" + id_of_click_to_edit).hide();
$("#" + id_of_save_button).show();
// create the editor
var container = $("#" + id_of_editor_place).get(0);
var editor = new JSONEditor(container);
var value = $("#" + id_of_hidden_field).val();
if(value !== undefined && value !== "") {
editor.set(JSON.parse(value));
}
$("#" + id_of_save_button).click(function(e) {
var field = $("#" + id_of_hidden_field);
var json = editor.get();
field.val(JSON.stringify(json));
alert("JSON Edited. Save the record now !");
});
}
</script>
</body>
</html>