Project

General

Profile

« Previous | Next » 

Revision df886c98

Added by Ohad Levy over 12 years ago

  • ID df886c98f48ce50b0dfe87a2a24ddd92dce1fb13

Feature #1184 - allow to save array based settings

this also moves the setting page to use inline edit

View differences:

public/javascripts/application.js
}
// Settings edit
function edit_setting(name, url) {
var html = $('<div></div>').appendTo('body').load(url + " #content");
html.dialog({
modal: true,
title: "Editing " + name,
width: 700,
height: 250,
close: function(event, ui) {},
buttons: [
{
text: "OK",
click: function() {
$("form").submit();
$( this ).dialog( "close" );
},
},{
text: "Cancel",
click: function() {
$( this ).dialog( "close" );
}
}
]
});
return false;
}
function get_pie_chart(div, url) {
if($("#"+div)[0] == undefined)
{
......
$(document).ready(function() {
var common_settings = {
method : 'PUT',
cancel : 'Cancel',
submit : 'Save',
indicator : "<img src='../images/spinner.gif' />",
tooltip : 'Click to edit..',
placeholder : 'Click to edit..',
submitdata : {authenticity_token: AUTH_TOKEN, format : "json"},
onedit : function(data) { $(this).removeClass("editable"); },
callback : function(value, settings) { $(this).addClass("editable"); },
onsuccess : function(data) {
var parsed = $.parseJSON(data);
$(this).html(parsed[$(this).attr('name').split("[")[0]][$(this).attr('data-field')]);
......
var settings = {
type : 'text',
name : $(this).attr('name'),
width: '100%',
};
$(this).editable($(this).attr('data-url'), $.extend(common_settings, settings));
});

Also available in: Unified diff