Skip to content

Commit

Permalink
continued
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel Nitzschner committed Jan 16, 2012
1 parent 225b56e commit 512317c
Show file tree
Hide file tree
Showing 26 changed files with 125 additions and 213 deletions.
2 changes: 1 addition & 1 deletion app/models/album.php
Expand Up @@ -26,7 +26,7 @@ class Album extends AppModel {
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'order' => 'order',
'limit' => '',
'offset' => '',
'finderQuery' => '',
Expand Down
2 changes: 1 addition & 1 deletion app/models/photo.php
Expand Up @@ -14,7 +14,7 @@ class Photo extends AppModel {
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'order' => 'order',
'limit' => '',
'offset' => '',
'finderQuery' => '',
Expand Down
Expand Up @@ -26,7 +26,7 @@ class AlbumEditView extends Spine.Controller
id = el.val()
album = Album.find(id)
album.updateSelection [album.id]
Spine.trigger('album:activate', album)
Spine.trigger('album:activate')

change: (item, mode) ->
console.log 'Album::change'
Expand Down Expand Up @@ -67,15 +67,9 @@ class AlbumEditView extends Spine.Controller
Spine.trigger('expose:sublistSelection', Gallery.record)

saveOnEnter: (e) =>
console.log e.keyCode
console.log document.activeElement
console.log 'inner'
@save @editEl if(e.keyCode == 13)
if (e.keyCode == 9)
console.log 'stopping propagation'
e.stopPropagation()
# e.preventDefault()


click: (e) ->
e.stopPropagation()
Expand Down
Expand Up @@ -37,7 +37,7 @@ AlbumEditView = (function() {
id = el.val();
album = Album.find(id);
album.updateSelection([album.id]);
return Spine.trigger('album:activate', album);
return Spine.trigger('album:activate');
};
AlbumEditView.prototype.change = function(item, mode) {
var firstID;
Expand Down Expand Up @@ -92,14 +92,10 @@ AlbumEditView = (function() {
}
};
AlbumEditView.prototype.saveOnEnter = function(e) {
console.log(e.keyCode);
console.log(document.activeElement);
console.log('inner');
if (e.keyCode === 13) {
this.save(this.editEl);
}
if (e.keyCode === 9) {
console.log('stopping propagation');
return e.stopPropagation();
}
};
Expand Down
19 changes: 6 additions & 13 deletions app/webroot/js/spine/app/director/controllers/albums_list.coffee
Expand Up @@ -40,25 +40,18 @@ class AlbumsList extends Spine.Controller

Spine.trigger('expose:sublistSelection', Gallery.record)

activate: (album) ->
activate: ->

alb = Album.record
gal = Gallery.record

selection = Gallery.selectionList()
if selection.length is 1
newActive = Album.find(selection[0]) if Album.exists(selection[0])
first = Album.find(selection[0]) if Album.exists(selection[0])

if !newActive?.destroyed
@current = newActive
Album.current(newActive)
if !first?.destroyed
@current = first
Album.current(first)
else
Album.current(album)

sameAlbum = Album.record?.eql?(alb) and !!alb
Album.current()

Spine.trigger('change:selectedAlbum', Album.record) unless sameAlbum
# Spine.trigger('change:selectedPhoto', Photo.record)
@exposeSelection()

render: (items) ->
Expand Down
20 changes: 7 additions & 13 deletions app/webroot/js/spine/app/director/controllers/albums_list.js
Expand Up @@ -59,25 +59,19 @@ AlbumsList = (function() {
}
return Spine.trigger('expose:sublistSelection', Gallery.record);
};
AlbumsList.prototype.activate = function(album) {
var alb, gal, newActive, sameAlbum, selection, _ref;
alb = Album.record;
gal = Gallery.record;
AlbumsList.prototype.activate = function() {
var first, selection;
selection = Gallery.selectionList();
if (selection.length === 1) {
if (Album.exists(selection[0])) {
newActive = Album.find(selection[0]);
first = Album.find(selection[0]);
}
if (!(newActive != null ? newActive.destroyed : void 0)) {
this.current = newActive;
Album.current(newActive);
if (!(first != null ? first.destroyed : void 0)) {
this.current = first;
Album.current(first);
}
} else {
Album.current(album);
}
sameAlbum = ((_ref = Album.record) != null ? typeof _ref.eql === "function" ? _ref.eql(alb) : void 0 : void 0) && !!alb;
if (!sameAlbum) {
Spine.trigger('change:selectedAlbum', Album.record);
Album.current();
}
return this.exposeSelection();
};
Expand Down
Expand Up @@ -104,7 +104,7 @@ class AlbumsView extends Spine.Controller
album.save()
Gallery.updateSelection [album.id]
Album.trigger('create:join', Gallery.record, album) if Gallery.record
Spine.trigger('change:selectedAlbum', album)
Album.current(album)
@show()
@change album
@openPanel('album', App.showView.btnAlbum)
Expand Down Expand Up @@ -174,12 +174,4 @@ class AlbumsView extends Spine.Controller

target.save()

addFile: (e) ->
console.log 'add.file'
# e.preventDefault()

email: ->
return if ( !@current.email )
window.location = "mailto:" + @current.email

module?.exports = AlbumsView
11 changes: 1 addition & 10 deletions app/webroot/js/spine/app/director/controllers/albums_view.js
Expand Up @@ -115,7 +115,7 @@ AlbumsView = (function() {
if (Gallery.record) {
Album.trigger('create:join', Gallery.record, album);
}
Spine.trigger('change:selectedAlbum', album);
Album.current(album);
this.show();
this.change(album);
return this.openPanel('album', App.showView.btnAlbum);
Expand Down Expand Up @@ -215,15 +215,6 @@ AlbumsView = (function() {
}
return target.save();
};
AlbumsView.prototype.addFile = function(e) {
return console.log('add.file');
};
AlbumsView.prototype.email = function() {
if (!this.current.email) {
return;
}
return window.location = "mailto:" + this.current.email;
};
return AlbumsView;
})();
if (typeof module !== "undefined" && module !== null) {
Expand Down
Expand Up @@ -23,9 +23,9 @@ class GalleriesList extends Spine.Controller
@el

select: (item) =>
@exposeSelection(item)
Gallery.current item
Spine.trigger('change:toolbarOne', ['Gallery'])
Spine.trigger('gallery:activate', item)
Spine.trigger('gallery:activate')

exposeSelection: (item) ->
console.log 'GalleryList::exposeSelection'
Expand Down
Expand Up @@ -32,9 +32,9 @@ GalleriesList = (function() {
return this.el;
};
GalleriesList.prototype.select = function(item) {
this.exposeSelection(item);
Gallery.current(item);
Spine.trigger('change:toolbarOne', ['Gallery']);
return Spine.trigger('gallery:activate', item);
return Spine.trigger('gallery:activate');
};
GalleriesList.prototype.exposeSelection = function(item) {
var el;
Expand Down
18 changes: 7 additions & 11 deletions app/webroot/js/spine/app/director/controllers/photos_list.coffee
Expand Up @@ -29,8 +29,9 @@ class PhotosList extends Spine.Controller
select: (item, e) ->
console.log 'PhotosList::select'
@current = item
Photo.current(item)
@activate()
Spine.trigger('change:selectedPhoto', item)
# Spine.trigger('change:selectedPhoto', item)

render: (items, mode='html') ->
console.log 'PhotosList::render'
Expand Down Expand Up @@ -107,7 +108,7 @@ class PhotosList extends Spine.Controller
'backgroundPosition': 'center, center'
'backgroundSize': '100%'

activate: (photo) ->
activate: ->
@exposeSelection()

exposeSelection: ->
Expand All @@ -124,21 +125,16 @@ class PhotosList extends Spine.Controller

activate: ->

pho = Photo.record

selection = Album.selectionList()
if selection.length is 1
newActive = Photo.find(selection[0]) if Photo.exists(selection[0])
first = Photo.find(selection[0]) if Photo.exists(selection[0])

if !newActive?.destroyed
@current = newActive
Photo.current(newActive)
if !first?.destroyed
@current = first
Photo.current(first)
else
Photo.current()

samePhoto = Photo.record?.eql?(pho) and !!pho

Spine.trigger('change:selectedPhoto', Photo.record)
@exposeSelection()

click: (e) ->
Expand Down
19 changes: 8 additions & 11 deletions app/webroot/js/spine/app/director/controllers/photos_list.js
Expand Up @@ -44,8 +44,8 @@ PhotosList = (function() {
PhotosList.prototype.select = function(item, e) {
console.log('PhotosList::select');
this.current = item;
this.activate();
return Spine.trigger('change:selectedPhoto', item);
Photo.current(item);
return this.activate();
};
PhotosList.prototype.render = function(items, mode) {
if (mode == null) {
Expand Down Expand Up @@ -151,7 +151,7 @@ PhotosList = (function() {
'backgroundSize': '100%'
});
};
PhotosList.prototype.activate = function(photo) {
PhotosList.prototype.activate = function() {
return this.exposeSelection();
};
PhotosList.prototype.exposeSelection = function() {
Expand All @@ -171,22 +171,19 @@ PhotosList = (function() {
return Photo.current(current);
};
PhotosList.prototype.activate = function() {
var newActive, pho, samePhoto, selection, _ref;
pho = Photo.record;
var first, selection;
selection = Album.selectionList();
if (selection.length === 1) {
if (Photo.exists(selection[0])) {
newActive = Photo.find(selection[0]);
first = Photo.find(selection[0]);
}
if (!(newActive != null ? newActive.destroyed : void 0)) {
this.current = newActive;
Photo.current(newActive);
if (!(first != null ? first.destroyed : void 0)) {
this.current = first;
Photo.current(first);
}
} else {
Photo.current();
}
samePhoto = ((_ref = Photo.record) != null ? typeof _ref.eql === "function" ? _ref.eql(pho) : void 0 : void 0) && !!pho;
Spine.trigger('change:selectedPhoto', Photo.record);
return this.exposeSelection();
};
PhotosList.prototype.click = function(e) {
Expand Down
Expand Up @@ -107,6 +107,8 @@ class PhotosView extends Spine.Controller
photo = Photo.find(ap.photo_id)
@render [photo], 'append'

next: (album) ->
album.last()

destroy: (e) ->
console.log 'PhotosView::destroy'
Expand Down Expand Up @@ -143,8 +145,7 @@ class PhotosView extends Spine.Controller
show: ->
return if @isActive()
Album.activeRecord = Album.record
# Spine.trigger('change:selectedAlbum', Album.record, true)
Spine.trigger('gallery:activate', Gallery.record)
Spine.trigger('gallery:activate')
Spine.trigger('change:toolbarOne', ['Photos'], App.showView.initSlider)
Spine.trigger('change:canvas', @)
@renderHeader()
Expand Down
5 changes: 4 additions & 1 deletion app/webroot/js/spine/app/director/controllers/photos_view.js
Expand Up @@ -121,6 +121,9 @@ PhotosView = (function() {
return this.render([photo], 'append');
}
};
PhotosView.prototype.next = function(album) {
return album.last();
};
PhotosView.prototype.destroy = function(e) {
var album, ap, aps, list, photo, photos, _i, _j, _k, _len, _len2, _len3, _results;
console.log('PhotosView::destroy');
Expand Down Expand Up @@ -162,7 +165,7 @@ PhotosView = (function() {
return;
}
Album.activeRecord = Album.record;
Spine.trigger('gallery:activate', Gallery.record);
Spine.trigger('gallery:activate');
Spine.trigger('change:toolbarOne', ['Photos'], App.showView.initSlider);
Spine.trigger('change:canvas', this);
return this.renderHeader();
Expand Down
12 changes: 2 additions & 10 deletions app/webroot/js/spine/app/director/controllers/show.coffee
Expand Up @@ -51,9 +51,6 @@ class ShowView extends Spine.Controller
"click .optUpload" : "toggleUpload"
'dblclick .draghandle' : 'toggleDraghandle'
'click .items' : "deselect"
# 'fileuploadprogress' : "uploadProgress"
# 'fileuploaddone' : "uploadDone"
# 'slide #slider' : 'sliderSlide'
'slidestop #slider' : 'sliderStop'
'slidestart #slider' : 'sliderStart'

Expand Down Expand Up @@ -211,7 +208,6 @@ class ShowView extends Spine.Controller

editGallery: (e) ->
Spine.trigger('edit:gallery')
#@focusFirstInput App.galleryEditView.el

editAlbum: (e) ->
Spine.trigger('edit:album')
Expand Down Expand Up @@ -322,19 +318,15 @@ class ShowView extends Spine.Controller
Spine.Model['Album'].emptySelection()
Photo.current()
Spine.trigger('photo:activate')
Spine.trigger('change:selectedPhoto', item)
when 'Gallery'
Spine.Model['Gallery'].emptySelection()
# Album.current()
Photo.current()
# Spine.trigger('album:exposeSelection')
Spine.trigger('album:activate', false)
else
# Gallery.current()
# Spine.trigger('gallery:exposeSelection')
Gallery.current()
Spine.trigger('gallery:activate', false)

@changeToolbarOne() #unless locked
@changeToolbarOne()
@current.items.deselect()

uploadProgress: (e, coll) ->
Expand Down
2 changes: 1 addition & 1 deletion app/webroot/js/spine/app/director/controllers/show.js
Expand Up @@ -366,14 +366,14 @@ ShowView = (function() {
Spine.Model['Album'].emptySelection();
Photo.current();
Spine.trigger('photo:activate');
Spine.trigger('change:selectedPhoto', item);
break;
case 'Gallery':
Spine.Model['Gallery'].emptySelection();
Photo.current();
Spine.trigger('album:activate', false);
break;
default:
Gallery.current();
Spine.trigger('gallery:activate', false);
}
this.changeToolbarOne();
Expand Down

0 comments on commit 512317c

Please sign in to comment.