diff --git a/app/assets/javascripts/init.js b/app/assets/javascripts/init.js index b4d8e4f..5310bc6 100644 --- a/app/assets/javascripts/init.js +++ b/app/assets/javascripts/init.js @@ -1,7 +1,7 @@ $(document).ready(function(){ $.ajax({ - url: '/api/v1/sites/current.json', + url: '/api/v1/sites/current', success: function(response){ Verlag.pages = new Verlag.Collection.Pages(response.pages); // Verlag.folders = new Verlag.Collection.Folders(response.folders); @@ -22,21 +22,7 @@ $(document).ready(function(){ Verlag.router.navigate(href, { trigger: true }); }); - // Modal Events - $('#overlay').live('click', function(e){ - if(e.target.id == 'overlay'){ - e.preventDefault(); - Verlag.closeModal(); - } - }); - - // Modal Events - $('a.close').live('click', function(e){ - e.preventDefault(); - Verlag.closeModal(); - }); - - // Key Master + // Key Bindings $('body').on('keypress', function(e){ if(e.keyCode == '115' && e.metaKey == true){ e.preventDefault(); diff --git a/app/assets/javascripts/lib/router.js b/app/assets/javascripts/lib/router.js index 3a09f5b..3bac5c0 100644 --- a/app/assets/javascripts/lib/router.js +++ b/app/assets/javascripts/lib/router.js @@ -85,7 +85,7 @@ Verlag.Router = Backbone.Router.extend({ this.cleanup(Verlag.sidebar); this.cleanup(Verlag.editor); - Verlag.editor = new Verlag.View.Settings(); + Verlag.editor = new Verlag.View.SiteSettings(); }, // Shared diff --git a/app/assets/javascripts/views/assets/show.js b/app/assets/javascripts/views/assets/show.js index d7bf112..a701dc5 100644 --- a/app/assets/javascripts/views/assets/show.js +++ b/app/assets/javascripts/views/assets/show.js @@ -31,7 +31,7 @@ Verlag.View.Asset = Backbone.View.extend({ asset: function(){ var attr = asset.toJSON(); attr.is_image = asset.isImage(); - attr.image_path = '/images/' + asset.id + '/' + asset.get('file_name'); + attr.image_path = '/images/' + asset.id + '/' + asset.get('file_name') + '?w=240&h=180&c=t&g=North';; attr.admin_path = asset.adminPath(); return attr; } diff --git a/app/assets/javascripts/views/pages/edit.js b/app/assets/javascripts/views/pages/edit.js index b8a5d25..b2548d6 100644 --- a/app/assets/javascripts/views/pages/edit.js +++ b/app/assets/javascripts/views/pages/edit.js @@ -19,7 +19,6 @@ Verlag.View.EditPage = Backbone.View.extend({ var self = this; this.page = Verlag.pages.get(options.id) || new Verlag.Model.Page({ id: options.id }); - this.page.on('change', this.render); this.page.fetch({ success: function(page, response){ self.render(); @@ -69,8 +68,17 @@ Verlag.View.EditPage = Backbone.View.extend({ page.save({ parts: parts },{ - success: function(){ - Verlag.notify('Page saved') + success: function(model, response){ + console.log(response) + if(!response.errors){ + Verlag.notify('Page saved') + } else { + alert('hey') + } + }, + error: function(reponse){ + console.log(response); + alert('error') } }); diff --git a/app/assets/javascripts/views/settings/index.js b/app/assets/javascripts/views/settings/index.js index 8a29f7d..330f0e8 100644 --- a/app/assets/javascripts/views/settings/index.js +++ b/app/assets/javascripts/views/settings/index.js @@ -1,4 +1,4 @@ -Verlag.View.Settings = Backbone.View.extend({ +Verlag.View.SiteSettings = Backbone.View.extend({ el: '#editor', tagName: 'div', diff --git a/app/assets/javascripts/views/shared/settings.js b/app/assets/javascripts/views/shared/settings.js index 2f24d63..1bbe025 100644 --- a/app/assets/javascripts/views/shared/settings.js +++ b/app/assets/javascripts/views/shared/settings.js @@ -35,12 +35,16 @@ Verlag.View.Settings = Backbone.View.extend({ }); this.model.save(attr, { - success: function(){ - Verlag.notify('Page saved'); - // TODO make this automatic - Verlag.editor.render(); - - $('.modal').modal('hide'); + success: function(model, response){ + if(!response.errors){ + Verlag.notify('Saved') + // TODO make this automatic + Verlag.editor.render(); + $('.modal').modal('hide'); + } else { + alert('error') + console.log(response.errors); + } } }); } diff --git a/app/assets/templates/assets/edit.mustache b/app/assets/templates/assets/edit.mustache index 52c4fbd..09f9e85 100644 --- a/app/assets/templates/assets/edit.mustache +++ b/app/assets/templates/assets/edit.mustache @@ -7,8 +7,8 @@ {{#asset}} {{# is_image }} -
- {{title}} +
+ {{ title }}
{{/ is_image }} {{^ is_image }} diff --git a/app/assets/templates/pages/edit.mustache b/app/assets/templates/pages/edit.mustache index ed222ce..6deb1a5 100644 --- a/app/assets/templates/pages/edit.mustache +++ b/app/assets/templates/pages/edit.mustache @@ -6,6 +6,8 @@ {{# page }}

{{ title }}

Settings + Add Child + Remove
{{# parts }} diff --git a/app/routes/api/v1/rest_controller.rb b/app/routes/api/v1/rest_controller.rb index ba54a26..1c99359 100644 --- a/app/routes/api/v1/rest_controller.rb +++ b/app/routes/api/v1/rest_controller.rb @@ -81,7 +81,7 @@ def klass if resource.update_attributes(attributes) resource.to_json else - { :errors => resource.errors }.to_json + { errors: resource.errors }.to_json end end diff --git a/public/assets/application-6bbfab6989ba9fe317cd5b9b9562c916.js.gz b/public/assets/application-6bbfab6989ba9fe317cd5b9b9562c916.js.gz deleted file mode 100644 index dfc69f6..0000000 Binary files a/public/assets/application-6bbfab6989ba9fe317cd5b9b9562c916.js.gz and /dev/null differ diff --git a/public/assets/application-761fcce21e7b7b70af2fa83a7568fe96.css.gz b/public/assets/application-761fcce21e7b7b70af2fa83a7568fe96.css.gz index 2eb6222..c901e59 100644 Binary files a/public/assets/application-761fcce21e7b7b70af2fa83a7568fe96.css.gz and b/public/assets/application-761fcce21e7b7b70af2fa83a7568fe96.css.gz differ diff --git a/public/assets/application-6bbfab6989ba9fe317cd5b9b9562c916.js b/public/assets/application-a38aea7d1071edea0dd1eacb699d9185.js similarity index 98% rename from public/assets/application-6bbfab6989ba9fe317cd5b9b9562c916.js rename to public/assets/application-a38aea7d1071edea0dd1eacb699d9185.js index 65a3450..09c093c 100644 --- a/public/assets/application-6bbfab6989ba9fe317cd5b9b9562c916.js +++ b/public/assets/application-a38aea7d1071edea0dd1eacb699d9185.js @@ -707,7 +707,7 @@ var Hogan = {}; })(typeof exports !== 'undefined' ? exports : Hogan); this.HoganTemplates || (this.HoganTemplates = {}); - this.HoganTemplates["assets/edit"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ×");t.b("\n" + i);t.b("

Modal header

");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);if(t.s(t.f("asset",c,p,1),c,p,0,177,1830,"{{ }}")){t.rs(c,p,function(c,p,t){t.b("\n" + i);if(t.s(t.f("is_image",c,p,1),c,p,0,198,337,"{{ }}")){t.rs(c,p,function(c,p,t){t.b("
");t.b("\n" + i);t.b(" \"");t.b(t.v(t.f("title",c,p,0)));t.b("\"");t.b("\n" + i);t.b("
");t.b("\n" + i);});c.pop();}if(!t.s(t.f("is_image",c,p,1),c,p,1,0,0,"")){t.b("
");t.b("\n" + i);t.b("

");t.b(t.v(t.f("ext",c,p,0)));t.b("

");t.b("\n" + i);t.b("

");t.b("\n" + i);t.b(" Download: ");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("file_name",c,p,0)));t.b("");t.b("\n" + i);t.b("

");t.b("\n" + i);t.b("
");t.b("\n" + i);};t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" Path: /images/");t.b(t.v(t.f("id",c,p,0)));t.b("/");t.b(t.v(t.f("file_name",c,p,0)));t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" Cancel");t.b("\n" + i);t.b(" or");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n" + i);});c.pop();}t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" Cancel");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n");t.b("\n");return t.fl(); },partials: {}, subs: { }}, "", Hogan, {}); + this.HoganTemplates["assets/edit"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ×");t.b("\n" + i);t.b("

Modal header

");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);if(t.s(t.f("asset",c,p,1),c,p,0,177,1822,"{{ }}")){t.rs(c,p,function(c,p,t){t.b("\n" + i);if(t.s(t.f("is_image",c,p,1),c,p,0,198,329,"{{ }}")){t.rs(c,p,function(c,p,t){t.b("
");t.b("\n" + i);t.b(" \"");t.b(t.v(t.f("title",c,p,0)));t.b("\"");t.b("\n" + i);t.b("
");t.b("\n" + i);});c.pop();}if(!t.s(t.f("is_image",c,p,1),c,p,1,0,0,"")){t.b("
");t.b("\n" + i);t.b("

");t.b(t.v(t.f("ext",c,p,0)));t.b("

");t.b("\n" + i);t.b("

");t.b("\n" + i);t.b(" Download: ");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("file_name",c,p,0)));t.b("");t.b("\n" + i);t.b("

");t.b("\n" + i);t.b("
");t.b("\n" + i);};t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" Path: /images/");t.b(t.v(t.f("id",c,p,0)));t.b("/");t.b(t.v(t.f("file_name",c,p,0)));t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" Cancel");t.b("\n" + i);t.b(" or");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n" + i);});c.pop();}t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" Cancel");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n");t.b("\n");return t.fl(); },partials: {}, subs: { }}, "", Hogan, {}); this.HoganTemplates || (this.HoganTemplates = {}); this.HoganTemplates["assets/form"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("
");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n" + i);t.b("

Upload Assets

");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
0
");t.b("\n" + i);t.b("
0
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" Cancel ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n");return t.fl(); },partials: {}, subs: { }}, "", Hogan, {}); this.HoganTemplates || (this.HoganTemplates = {}); @@ -729,7 +729,7 @@ var Hogan = {}; this.HoganTemplates || (this.HoganTemplates = {}); this.HoganTemplates["page_types/new"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");if(t.s(t.f("model",c,p,1),c,p,0,12,551,"{{ }}")){t.rs(c,p,function(c,p,t){t.b("

New Page

");t.b("\n");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);});c.pop();}return t.fl(); },partials: {}, subs: { }}, "", Hogan, {}); this.HoganTemplates || (this.HoganTemplates = {}); - this.HoganTemplates["pages/edit"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n");t.b("\n" + i);t.b("
");t.b("\n" + i);if(t.s(t.f("page",c,p,1),c,p,0,67,338,"{{ }}")){t.rs(c,p,function(c,p,t){t.b("

");t.b(t.v(t.f("title",c,p,0)));t.b("

");t.b("\n" + i);t.b(" Settings");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);if(t.s(t.f("parts",c,p,1),c,p,0,200,314,"{{ }}")){t.rs(c,p,function(c,p,t){t.b("

");t.b(t.v(t.f("name",c,p,0)));t.b("

");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("render",c,p,0)));t.b("\n" + i);t.b("
");t.b("\n" + i);});c.pop();}t.b("
");t.b("\n" + i);});c.pop();}t.b("
");t.b("\n");t.b("\n");return t.fl(); },partials: {}, subs: { }}, "", Hogan, {}); + this.HoganTemplates["pages/edit"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n");t.b("\n" + i);t.b("
");t.b("\n" + i);if(t.s(t.f("page",c,p,1),c,p,0,67,420,"{{ }}")){t.rs(c,p,function(c,p,t){t.b("

");t.b(t.v(t.f("title",c,p,0)));t.b("

");t.b("\n" + i);t.b(" Settings");t.b("\n" + i);t.b(" Add Child");t.b("\n" + i);t.b(" Remove");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);if(t.s(t.f("parts",c,p,1),c,p,0,282,396,"{{ }}")){t.rs(c,p,function(c,p,t){t.b("

");t.b(t.v(t.f("name",c,p,0)));t.b("

");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("render",c,p,0)));t.b("\n" + i);t.b("
");t.b("\n" + i);});c.pop();}t.b("
");t.b("\n" + i);});c.pop();}t.b("
");t.b("\n");t.b("\n");return t.fl(); },partials: {}, subs: { }}, "", Hogan, {}); this.HoganTemplates || (this.HoganTemplates = {}); this.HoganTemplates["pages/form"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n");return t.fl(); },partials: {}, subs: { }}, "", Hogan, {}); this.HoganTemplates || (this.HoganTemplates = {}); @@ -5383,7 +5383,7 @@ Verlag.View.Asset = Backbone.View.extend({ asset: function(){ var attr = asset.toJSON(); attr.is_image = asset.isImage(); - attr.image_path = '/images/' + asset.id + '/' + asset.get('file_name'); + attr.image_path = '/images/' + asset.id + '/' + asset.get('file_name') + '?w=240&h=180&c=t&g=North';; attr.admin_path = asset.adminPath(); return attr; } @@ -5684,7 +5684,6 @@ Verlag.View.EditPage = Backbone.View.extend({ var self = this; this.page = Verlag.pages.get(options.id) || new Verlag.Model.Page({ id: options.id }); - this.page.on('change', this.render); this.page.fetch({ success: function(page, response){ self.render(); @@ -5734,8 +5733,17 @@ Verlag.View.EditPage = Backbone.View.extend({ page.save({ parts: parts },{ - success: function(){ - Verlag.notify('Page saved') + success: function(model, response){ + console.log(response) + if(!response.errors){ + Verlag.notify('Page saved') + } else { + alert('hey') + } + }, + error: function(reponse){ + console.log(response); + alert('error') } }); @@ -5873,7 +5881,7 @@ Verlag.View.PagePreview = Backbone.View.extend({ } }); -Verlag.View.Settings = Backbone.View.extend({ +Verlag.View.SiteSettings = Backbone.View.extend({ el: '#editor', tagName: 'div', @@ -6101,12 +6109,16 @@ Verlag.View.Settings = Backbone.View.extend({ }); this.model.save(attr, { - success: function(){ - Verlag.notify('Page saved'); - // TODO make this automatic - Verlag.editor.render(); - - $('.modal').modal('hide'); + success: function(model, response){ + if(!response.errors){ + Verlag.notify('Saved') + // TODO make this automatic + Verlag.editor.render(); + $('.modal').modal('hide'); + } else { + alert('error') + console.log(response.errors); + } } }); } @@ -6410,7 +6422,7 @@ Verlag.Router = Backbone.Router.extend({ this.cleanup(Verlag.sidebar); this.cleanup(Verlag.editor); - Verlag.editor = new Verlag.View.Settings(); + Verlag.editor = new Verlag.View.SiteSettings(); }, // Shared @@ -6427,7 +6439,7 @@ Verlag.Router = Backbone.Router.extend({ $(document).ready(function(){ $.ajax({ - url: '/api/v1/sites/current.json', + url: '/api/v1/sites/current', success: function(response){ Verlag.pages = new Verlag.Collection.Pages(response.pages); // Verlag.folders = new Verlag.Collection.Folders(response.folders); @@ -6448,21 +6460,7 @@ $(document).ready(function(){ Verlag.router.navigate(href, { trigger: true }); }); - // Modal Events - $('#overlay').live('click', function(e){ - if(e.target.id == 'overlay'){ - e.preventDefault(); - Verlag.closeModal(); - } - }); - - // Modal Events - $('a.close').live('click', function(e){ - e.preventDefault(); - Verlag.closeModal(); - }); - - // Key Master + // Key Bindings $('body').on('keypress', function(e){ if(e.keyCode == '115' && e.metaKey == true){ e.preventDefault(); diff --git a/public/assets/application-a38aea7d1071edea0dd1eacb699d9185.js.gz b/public/assets/application-a38aea7d1071edea0dd1eacb699d9185.js.gz new file mode 100644 index 0000000..59484af Binary files /dev/null and b/public/assets/application-a38aea7d1071edea0dd1eacb699d9185.js.gz differ diff --git a/public/assets/vendor/jquery-1.7.1.min-059437ee05223d02d6aed0a8d81644ee.js.gz b/public/assets/vendor/jquery-1.7.1.min-059437ee05223d02d6aed0a8d81644ee.js.gz index 6200853..a56c2d3 100644 Binary files a/public/assets/vendor/jquery-1.7.1.min-059437ee05223d02d6aed0a8d81644ee.js.gz and b/public/assets/vendor/jquery-1.7.1.min-059437ee05223d02d6aed0a8d81644ee.js.gz differ diff --git a/public/assets/vendor/keymaster.min-50fd21755c3c7fc6069493d1b13a28f2.js.gz b/public/assets/vendor/keymaster.min-50fd21755c3c7fc6069493d1b13a28f2.js.gz index d622e78..79809e2 100644 Binary files a/public/assets/vendor/keymaster.min-50fd21755c3c7fc6069493d1b13a28f2.js.gz and b/public/assets/vendor/keymaster.min-50fd21755c3c7fc6069493d1b13a28f2.js.gz differ diff --git a/public/assets/vendor/modernizr.custom.00537-feab8a287162003bae2251e986c68fb7.js.gz b/public/assets/vendor/modernizr.custom.00537-feab8a287162003bae2251e986c68fb7.js.gz index 3eec613..5e8cc8c 100644 Binary files a/public/assets/vendor/modernizr.custom.00537-feab8a287162003bae2251e986c68fb7.js.gz and b/public/assets/vendor/modernizr.custom.00537-feab8a287162003bae2251e986c68fb7.js.gz differ