summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/DocumentModal.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-06-10 19:46:53 -0400
committerJulie Lala <jules@okfoc.us>2014-06-10 19:46:53 -0400
commit4e4b5b5668835097f335efaf55dfe837eec7dc3c (patch)
tree5cd6cb12a203c5dd7c8cf9f62b9cd9235e52513c /public/assets/javascripts/ui/DocumentModal.js
parent3074488306e041718dec221ff9142748e2e68916 (diff)
parentb231af3e38b8f066f18031fd69b0fdb30a5e244a (diff)
Merge branch 'master' of github.com:okfocus/vvalls
Diffstat (limited to 'public/assets/javascripts/ui/DocumentModal.js')
-rw-r--r--public/assets/javascripts/ui/DocumentModal.js49
1 files changed, 0 insertions, 49 deletions
diff --git a/public/assets/javascripts/ui/DocumentModal.js b/public/assets/javascripts/ui/DocumentModal.js
deleted file mode 100644
index 6f16169..0000000
--- a/public/assets/javascripts/ui/DocumentModal.js
+++ /dev/null
@@ -1,49 +0,0 @@
-
-var DocumentModal = ModalFormView.extend({
- el: ".mediaDrawer.editDocument",
- createAction: "/api/docs/new",
- updateAction: "/api/docs/edit",
- destroyAction: "/api/docs/destroy",
-
- load: function(name, isNew){
- this.reset()
-
- if (isNew || name === "new") {
- name = sanitize(name)
- if (name !== "new") {
- this.$("[name='new_name']").val( name.replace(/\s+/g,"-") )
- this.$("[name='displayName']").val( capitalize(name.replace(/-/g," ")) )
- }
- this.action = this.createAction
- return this.show()
- }
-
- this.action = this.updateAction
-
- $.get("/api/docs", { name: name }, $.proxy(function(data){
- if (data.isNew) {
- this.action = this.createAction
- }
-
- for (var i in data) {
- this.$("[name='" + i + "']").val(data[i])
- }
- this.$("[name='new_name']").val(name)
-
- this.show()
- }, this))
- },
-
- success: function(res){
- window.location.pathname = "/about/" + res.name
- },
-
- destroy: function(name, cb){
- $.ajax({
- type: "delete",
- url: this.destroyAction,
- data: { name: name, _csrf: $("[name=_csrf]").val() }
- }).complete(cb || function(){})
- },
-
-})