diff --git a/services/web/public/coffee/ide/settings/services/settings.coffee b/services/web/public/coffee/ide/settings/services/settings.coffee index 4e6bbcea3d..0c4b52dd89 100644 --- a/services/web/public/coffee/ide/settings/services/settings.coffee +++ b/services/web/public/coffee/ide/settings/services/settings.coffee @@ -1,19 +1,37 @@ define [ "base" ], (App) -> - App.factory "settings", ["ide", (ide) -> + App.factory "settings", ["ide", "event_tracking", (ide, event_tracking) -> return { saveSettings: (data) -> + for key in Object.keys(data) + changedSetting = key + changedSettingVal = data[key] + event_tracking.send "setting-changed", { changedSetting, changedSettingVal } + data._csrf = window.csrfToken ide.$http.post "/user/settings", data + saveProjectSettings: (data) -> + for key in Object.keys(data) + changedSetting = key + changedSettingVal = data[key] + event_tracking.send "project-setting-changed", { changedSetting, changedSettingVal} + data._csrf = window.csrfToken ide.$http.post "/project/#{ide.project_id}/settings", data + saveProjectAdminSettings: (data) -> + for key in Object.keys(data) + changedSetting = key + changedSettingVal = data[key] + event_tracking.send "project-admin-setting-changed", { changedSetting, changedSettingVal } + data._csrf = window.csrfToken ide.$http.post "/project/#{ide.project_id}/settings/admin", data + } ] \ No newline at end of file