summaryrefslogtreecommitdiffstats
path: root/apps/files_versioning/js/settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_versioning/js/settings.js')
-rw-r--r--apps/files_versioning/js/settings.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/files_versioning/js/settings.js b/apps/files_versioning/js/settings.js
new file mode 100644
index 00000000000..8dd13bac033
--- /dev/null
+++ b/apps/files_versioning/js/settings.js
@@ -0,0 +1,25 @@
+$(document).ready(function(){
+ $('#file_versioning_head').chosen();
+
+ $.getJSON(OC.filePath('files_versioning', 'ajax', 'gethead.php'), function(jsondata, status) {
+
+ if (jsondata.head == 'HEAD') {
+ // Most recent commit, do nothing
+ } else {
+ $("#file_versioning_head").val(jsondata.head);
+ // Trigger the chosen update call
+ // See http://harvesthq.github.com/chosen/
+ $("#file_versioning_head").trigger("liszt:updated");
+ }
+ });
+
+ $('#file_versioning_head').change(function() {
+
+ var data = $(this).serialize();
+ $.post( OC.filePath('files_versioning', 'ajax', 'sethead.php'), data, function(data){
+ if(data == 'error'){
+ console.log('Saving new HEAD failed');
+ }
+ });
+ });
+});