Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Commit

Permalink
moving buttons around
Browse files Browse the repository at this point in the history
  • Loading branch information
kbingman committed Jul 17, 2012
1 parent 3fe5479 commit 0024c74
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 61 deletions.
18 changes: 2 additions & 16 deletions 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);
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/lib/router.js
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/views/assets/show.js
Expand Up @@ -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;
}
Expand Down
14 changes: 11 additions & 3 deletions app/assets/javascripts/views/pages/edit.js
Expand Up @@ -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();
Expand Down Expand Up @@ -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')
}
});

Expand Down
2 changes: 1 addition & 1 deletion 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',
Expand Down
16 changes: 10 additions & 6 deletions app/assets/javascripts/views/shared/settings.js
Expand Up @@ -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);
}
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions app/assets/templates/assets/edit.mustache
Expand Up @@ -7,8 +7,8 @@
{{#asset}}

{{# is_image }}
<div class="image-display" id="image-display-{{id}}">
<img src="/images/{{id}}/{{file_name}}" alt="{{title}}" />
<div class="image-display" id="image-display-{{ id }}">
<img src="{{ image_path }}" alt="{{ title }}" />
</div>
{{/ is_image }}
{{^ is_image }}
Expand Down
2 changes: 2 additions & 0 deletions app/assets/templates/pages/edit.mustache
Expand Up @@ -6,6 +6,8 @@
{{# page }}
<h1 id="page-title-{{id}}">{{ title }}</h1>
<a class="btn js-settings">Settings</a>
<a class="btn js-new-child">Add Child</a>
<a class="btn js-remove">Remove</a>

<div class="content">
{{# parts }}
Expand Down
2 changes: 1 addition & 1 deletion app/routes/api/v1/rest_controller.rb
Expand Up @@ -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

Expand Down
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 0024c74

Please sign in to comment.