mix-rails-albums 0.12.1 → 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/app/assets/javascripts/admix/photos.js.erb +4 -17
  2. data/app/assets/javascripts/{albums.js → application.js} +0 -0
  3. data/app/assets/javascripts/backbone/application.js.coffee +12 -0
  4. data/app/assets/javascripts/backbone/models/photo.js.coffee +39 -0
  5. data/app/assets/javascripts/backbone/routers/photos_router.js.coffee +36 -0
  6. data/app/assets/javascripts/backbone/templates/photos/edit.jst.ejs +20 -0
  7. data/app/assets/javascripts/backbone/templates/photos/index.jst.ejs +15 -0
  8. data/app/assets/javascripts/backbone/templates/photos/modal.hamlc.erb +14 -0
  9. data/app/assets/javascripts/backbone/templates/photos/new.jst.ejs +20 -0
  10. data/app/assets/javascripts/backbone/templates/photos/photo.jst.ejs +6 -0
  11. data/app/assets/javascripts/backbone/templates/photos/show.jst.ejs +12 -0
  12. data/app/assets/javascripts/backbone/templates/photos/thumbnail.hamlc.erb +16 -0
  13. data/app/assets/javascripts/backbone/templates/photos/upload_index.hamlc.erb +1 -0
  14. data/app/assets/javascripts/backbone/views/photos/edit_view.js.coffee +24 -0
  15. data/app/assets/javascripts/backbone/views/photos/index_view.js.coffee +20 -0
  16. data/app/assets/javascripts/backbone/views/photos/new_view.js.coffee +37 -0
  17. data/app/assets/javascripts/backbone/views/photos/photo_view.js.coffee +19 -0
  18. data/app/assets/javascripts/backbone/views/photos/show_view.js.coffee +8 -0
  19. data/app/assets/javascripts/backbone/views/photos/thumbnail_view.js.coffee +30 -0
  20. data/app/assets/javascripts/backbone/views/photos/upload_index_view.js.coffee +22 -0
  21. data/app/assets/javascripts/collections/filelist.js +1 -0
  22. data/app/assets/javascripts/models/fileitem.js +3 -0
  23. data/app/assets/javascripts/photos/upload.js.coffee.erb +9 -0
  24. data/app/assets/javascripts/routers/photo_router.js.coffee.erb +7 -0
  25. data/app/assets/javascripts/templates/photo_modal_edit.hamlc.erb +14 -0
  26. data/app/assets/javascripts/templates/photo_view.hamlc.erb +1 -1
  27. data/app/assets/javascripts/views/filelistview.js +2 -0
  28. data/app/assets/javascripts/views/fileview.js +6 -1
  29. data/app/assets/javascripts/views/photo_modal_view.js.coffee +25 -0
  30. data/app/models/photo.rb +2 -2
  31. data/app/views/admix/photos/_upload.html.haml +2 -2
  32. data/config/routes.rb +5 -1
  33. data/lib/mix-rails-albums.rb +1 -1
  34. data/lib/mix-rails-albums/version.rb +1 -1
  35. metadata +72 -52
  36. data/app/assets/javascripts/colorbox/jquery.colorbox-min.js +0 -4
  37. data/app/assets/javascripts/photo_uploader.coffee +0 -2
@@ -1,6 +1,4 @@
1
1
  //= require hamlcoffee
2
- //= require ../photo_uploader
3
- //
4
2
  //= require_tree ../models
5
3
  //= require_tree ../collections
6
4
  //= require_tree ../views
@@ -9,25 +7,14 @@
9
7
 
10
8
  <% url = Rails.application.routes.url_helpers %>
11
9
 
12
- var oldSet = Backbone.Model.prototype.set;
13
- _.extend(Backbone.Model.prototype, {
14
- set: function(attrs, options) {
15
- if ('_id' in attrs) { this.id = attrs._id; }
16
- oldSet.apply(this, [attrs, options]);
17
- return this;
18
- }
19
- });
10
+ new PhotoRouter();
20
11
 
12
+ jQuery(function() {
21
13
 
22
- jQuery(function(){
23
-
24
- var fileZip, fileZipView;
25
-
26
-
14
+ var fileZip, fileZipView, fileListView;
27
15
  var fileList = new FileList();
28
16
  fileList.url = $("#files").data('url');
29
- var fileListView;
30
-
17
+
31
18
  jQuery("#uploader").change(function(el) {
32
19
 
33
20
  var files = el.currentTarget.files;
@@ -0,0 +1,12 @@
1
+ #= require hamlcoffee
2
+ #= require_self
3
+ #= require_tree ./templates
4
+ #= require_tree ./models
5
+ #= require_tree ./views
6
+ #= require_tree ./routers
7
+
8
+ window.Application =
9
+ Models: {}
10
+ Collections: {}
11
+ Routers: {}
12
+ Views: {}
@@ -0,0 +1,39 @@
1
+ class Application.Models.Photo extends Backbone.Model
2
+ paramRoot: 'photo'
3
+ idAttribute: '_id'
4
+ defaults:
5
+ image: null
6
+ description: null
7
+ progress: 0
8
+
9
+ initialize: ->
10
+ @on 'add', @onAdd, @
11
+
12
+ onAdd: ->
13
+ xhr = new XMLHttpRequest()
14
+ xhr.open "POST", @url
15
+ datas = new FormData()
16
+ datas.append "image", @get("image")
17
+ xhr.upload.addEventListener "progress", (e) =>
18
+ if e.lengthComputable
19
+ currentState = (e.loaded / e.total) * 100
20
+ @set progress: currentState
21
+
22
+ xhr.onreadystatechange = (e) =>
23
+ if e.currentTarget.readyState is 4
24
+ @set progress: 100
25
+ @trigger "uploadCompleted"
26
+ if xhr.responseText
27
+ responseObject = JSON.parse(xhr.responseText)
28
+ @set responseObject
29
+ else
30
+ console.log "Não foi possível enviar o arquivo"
31
+
32
+
33
+ # Start send the file.
34
+ xhr.send datas
35
+
36
+ class Application.Collections.PhotosCollection extends Backbone.Collection
37
+ model: Application.Models.Photo
38
+ url: '/photos'
39
+
@@ -0,0 +1,36 @@
1
+ class Application.Routers.PhotosRouter extends Backbone.Router
2
+ initialize: (options) ->
3
+ @photos = new Application.Collections.PhotosCollection()
4
+ @photos.reset options.photos
5
+
6
+ routes:
7
+ "new" : "newPhoto"
8
+ "index" : "index"
9
+ "upload_index" : "upload_index"
10
+ ":id/edit" : "edit"
11
+ ":id" : "show"
12
+ ".*" : "index"
13
+
14
+ newPhoto: ->
15
+ @view = new Application.Views.Photos.NewView(collection: @photos)
16
+ $("#photos").html(@view.render().el)
17
+
18
+ index: ->
19
+ @view = new Application.Views.Photos.IndexView(photos: @photos)
20
+ $("#photos").html(@view.render().el)
21
+
22
+ upload_index: ->
23
+ @view = new Application.Views.Photos.UploadIndexView(photos: @photos)
24
+ $("#photos").html(@view.render().el)
25
+
26
+ show: (id) ->
27
+ photo = @photos.get(id)
28
+
29
+ @view = new Application.Views.Photos.ShowView(model: photo)
30
+ $("#photos").html(@view.render().el)
31
+
32
+ edit: (id) ->
33
+ photo = @photos.get(id)
34
+
35
+ @view = new Application.Views.Photos.EditView(model: photo)
36
+ $("#photos").html(@view.render().el)
@@ -0,0 +1,20 @@
1
+ <h1>Edit photo</h1>
2
+
3
+ <form id="edit-photo" name="photo">
4
+ <div class="field">
5
+ <label for="image"> image:</label>
6
+ <input type="text" name="image" id="image" value="<%= image %>" >
7
+ </div>
8
+
9
+ <div class="field">
10
+ <label for="description"> description:</label>
11
+ <input type="text" name="description" id="description" value="<%= description %>" >
12
+ </div>
13
+
14
+ <div class="actions">
15
+ <input type="submit" value="Update Photo" />
16
+ </div>
17
+
18
+ </form>
19
+
20
+ <a href="#/index">Back</a>
@@ -0,0 +1,15 @@
1
+ <h1>Listing photos</h1>
2
+
3
+ <table id="photos-table">
4
+ <tr>
5
+ <th>Image</th>
6
+ <th>Description</th>
7
+ <th></th>
8
+ <th></th>
9
+ <th></th>
10
+ </tr>
11
+ </table>
12
+
13
+ <br/>
14
+
15
+ <a href="#/new">New Photo</a>
@@ -0,0 +1,14 @@
1
+ .modal.hide.fade.admix-photo-modal{id: "photo-modal-#{@id}"}
2
+ .modal-header
3
+ %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} ×
4
+ %h3 Detalhes da foto
5
+ .modal-body
6
+ .edit-area.pull-right
7
+ %textarea.span5{id: "input_photo_description_#{@id}",placeholder: 'Adicione uma descrição para esta foto.'}
8
+ #{@description}
9
+ .photo
10
+ %img{src: @image.medium.url}
11
+ %p One fine body…
12
+ .modal-footer
13
+ %a.btn{href:"#", "data-dismiss": "modal"} Cancelar
14
+ %a.btn.btn-primary.save{:href => "#"} Salvar mudanças
@@ -0,0 +1,20 @@
1
+ <h1>New photo</h1>
2
+
3
+ <form id="new-photo" name="photo">
4
+ <div class="field">
5
+ <label for="image"> image:</label>
6
+ <input type="text" name="image" id="image" value="<%= image %>" >
7
+ </div>
8
+
9
+ <div class="field">
10
+ <label for="description"> description:</label>
11
+ <input type="text" name="description" id="description" value="<%= description %>" >
12
+ </div>
13
+
14
+ <div class="actions">
15
+ <input type="submit" value="Create Photo" />
16
+ </div>
17
+
18
+ </form>
19
+
20
+ <a href="#/index">Back</a>
@@ -0,0 +1,6 @@
1
+ <td><%= image %></td>
2
+ <td><%= description %></td>
3
+
4
+ <td><a href="#/<%= id %>">Show</td>
5
+ <td><a href="#/<%= id %>/edit">Edit</td>
6
+ <td><a href="#/<%= id %>/destroy" class="destroy">Destroy</a></td>
@@ -0,0 +1,12 @@
1
+ <p>
2
+ <b>Image:</b>
3
+ <%= image %>
4
+ </p>
5
+
6
+ <p>
7
+ <b>Description:</b>
8
+ <%= description %>
9
+ </p>
10
+
11
+
12
+ <a href="#/index">Back</a>
@@ -0,0 +1,16 @@
1
+ .thumbnail.file-item
2
+ .file-title
3
+ = @title
4
+ %a.link-popover{"data-content" => "<i class=icon-edit></i> Edit"}
5
+ .loading-file
6
+ - if @image.url
7
+ %a.photo-link{href: "#"}
8
+ %img{src: ROOT_PATH + @image.thumb.url}
9
+ - else
10
+ %img{src: "http://placehold.it/130x90&text=Carregando"}
11
+ -if (@progress != null && @progress < 100)
12
+ %div{class: (@progress < 100) ? 'progress progress-striped active' : 'progress'}
13
+ .bar{style: "width:#{@progress}%;"}
14
+ .caption
15
+ %a.file-action.delete{href: "#"}
16
+ <%= image_tag "albums/delete.png" %>
@@ -0,0 +1,24 @@
1
+ Application.Views.Photos ||= {}
2
+
3
+ class Application.Views.Photos.EditView extends Backbone.View
4
+ template: JST["backbone/templates/photos/edit"]
5
+
6
+ events:
7
+ "submit #edit-photo": "update"
8
+
9
+ update: (e) ->
10
+ e.preventDefault()
11
+ e.stopPropagation()
12
+
13
+ @model.save(null,
14
+ success: (photo) =>
15
+ @model = photo
16
+ window.location.hash = "/#{@model.id}"
17
+ )
18
+
19
+ render: ->
20
+ @$el.html(@template(@model.toJSON() ))
21
+
22
+ this.$("form").backboneLink(@model)
23
+
24
+ return this
@@ -0,0 +1,20 @@
1
+ Application.Views.Photos ||= {}
2
+
3
+ class Application.Views.Photos.IndexView extends Backbone.View
4
+ template: JST["backbone/templates/photos/index"]
5
+
6
+ initialize: () ->
7
+ @options.photos.bind('reset', @addAll)
8
+
9
+ addAll: () =>
10
+ @options.photos.each(@addOne)
11
+
12
+ addOne: (photo) =>
13
+ view = new Application.Views.Photos.PhotoView({model : photo})
14
+ @$("tbody").append(view.render().el)
15
+
16
+ render: =>
17
+ @$el.html(@template(photos: @options.photos.toJSON() ))
18
+ @addAll()
19
+
20
+ return this
@@ -0,0 +1,37 @@
1
+ Application.Views.Photos ||= {}
2
+
3
+ class Application.Views.Photos.NewView extends Backbone.View
4
+ template: JST["backbone/templates/photos/new"]
5
+
6
+ events:
7
+ "submit #new-photo": "save"
8
+
9
+ constructor: (options) ->
10
+ super(options)
11
+ @model = new @collection.model()
12
+
13
+ @model.bind("change:errors", () =>
14
+ this.render()
15
+ )
16
+
17
+ save: (e) ->
18
+ e.preventDefault()
19
+ e.stopPropagation()
20
+
21
+ @model.unset("errors")
22
+
23
+ @collection.create(@model.toJSON(),
24
+ success: (photo) =>
25
+ @model = photo
26
+ window.location.hash = "/#{@model.id}"
27
+
28
+ error: (photo, jqXHR) =>
29
+ @model.set({errors: $.parseJSON(jqXHR.responseText)})
30
+ )
31
+
32
+ render: ->
33
+ @$el.html(@template(@model.toJSON() ))
34
+
35
+ this.$("form").backboneLink(@model)
36
+
37
+ return this
@@ -0,0 +1,19 @@
1
+ Application.Views.Photos ||= {}
2
+
3
+ class Application.Views.Photos.PhotoView extends Backbone.View
4
+ template: JST["backbone/templates/photos/photo"]
5
+
6
+ events:
7
+ "click .destroy" : "destroy"
8
+
9
+ tagName: "tr"
10
+
11
+ destroy: () ->
12
+ @model.destroy()
13
+ this.remove()
14
+
15
+ return false
16
+
17
+ render: ->
18
+ @$el.html(@template(@model.toJSON() ))
19
+ return this
@@ -0,0 +1,8 @@
1
+ Application.Views.Photos ||= {}
2
+
3
+ class Application.Views.Photos.ShowView extends Backbone.View
4
+ template: JST["backbone/templates/photos/show"]
5
+
6
+ render: ->
7
+ @$el.html(@template(@model.toJSON() ))
8
+ return this
@@ -0,0 +1,30 @@
1
+ Application.Views.Photos ||= {}
2
+
3
+ class Application.Views.Photos.PhotoView extends Backbone.View
4
+ template: JST["backbone/templates/photos/thumbnail"]
5
+
6
+ events:
7
+ "click .destroy" : "destroy"
8
+ "click .photo-link": "photo_link",
9
+
10
+ tagName: "li"
11
+ className: 'span2'
12
+
13
+ initialize: ->
14
+ @model.on "change", @render, this
15
+ @model.on "uploadCompleted", @removeProgressBar, this
16
+
17
+ removeProgressBar: ->
18
+ @$el.find(".progress").fadeOut() unless @$el is undefined
19
+
20
+ destroy: () ->
21
+ @model.destroy()
22
+ this.remove()
23
+
24
+ return false
25
+
26
+ photo_link: () ->
27
+
28
+ render: ->
29
+ @$el.html(@template(@model.toJSON() ))
30
+ return this
@@ -0,0 +1,22 @@
1
+ Application.Views.Photos ||= {}
2
+
3
+ class Application.Views.Photos.UploadIndexView extends Backbone.View
4
+ template: JST["backbone/templates/photos/upload_index"]
5
+ tagName: 'ul'
6
+ className: 'thumbnails'
7
+
8
+ initialize: () ->
9
+ @options.photos.bind('reset', @addAll)
10
+
11
+ addAll: () =>
12
+ @options.photos.each(@addOne)
13
+
14
+ addOne: (photo) =>
15
+ view = new Application.Views.Photos.PhotoView({model : photo})
16
+ @$(".photos-container").append(view.render().el)
17
+
18
+ render: =>
19
+ @$el.html(@template(photos: @options.photos.toJSON() ))
20
+ @addAll()
21
+
22
+ return this
@@ -1,4 +1,5 @@
1
1
  var FileList = Backbone.Collection.extend({
2
+ name: 'photos',
2
3
  initialize: function(){
3
4
 
4
5
  }
@@ -1,4 +1,7 @@
1
1
  var FileItem = Backbone.Model.extend({
2
+ name: 'photo',
3
+ url: 'photos',
4
+ idAttribute: '_id',
2
5
  defaults: {
3
6
  progress:0
4
7
  },
@@ -0,0 +1,9 @@
1
+ #= require ../backbone/application
2
+ #= require_self
3
+
4
+ <% url = Rails.application.routes.url_helpers %>
5
+
6
+ $ ->
7
+ $.getJSON $("#photos").data('url'),(json) ->
8
+ new Application.Routers.PhotosRouter(photos: json)
9
+ Backbone.history.start()
@@ -0,0 +1,7 @@
1
+ class window.PhotoRouter extends Backbone.Router
2
+ routes:
3
+ ":photo_id/ajax_edit": "ajax_edit"
4
+
5
+ ajax_edit: (photo_id) ->
6
+ console.log "Editando foto #{photo_id}"
7
+ $("#photo-modal-#{photo_id}").modal()
@@ -0,0 +1,14 @@
1
+ .modal.hide.fade.admix-photo-modal{id: "photo-modal-#{@id}"}
2
+ .modal-header
3
+ %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} ×
4
+ %h3 Detalhes da foto
5
+ .modal-body
6
+ .edit-area.pull-right
7
+ %textarea.span5{id: "input_photo_description_#{@id}",placeholder: 'Adicione uma descrição para esta foto.'}
8
+ #{@description}
9
+ .photo
10
+ %img{src: @image.medium.url}
11
+ %p One fine body…
12
+ .modal-footer
13
+ %a.btn{href:"#", "data-dismiss": "modal"} Cancelar
14
+ %a.btn.btn-primary.save{:href => "#"} Salvar mudanças
@@ -4,7 +4,7 @@
4
4
  %a.link-popover{"data-content" => "<i class=icon-edit></i> Edit"}
5
5
  .loading-file
6
6
  - if @image.url
7
- %a.fancybox{href: ROOT_PATH + @image.medium.url, rel: 'photo-album'}
7
+ %a.photo-link{href: "#"}
8
8
  %img{src: ROOT_PATH + @image.thumb.url}
9
9
  - else
10
10
  %img{src: "http://placehold.it/130x90&text=Carregando"}
@@ -9,7 +9,9 @@ var FileListView = Backbone.View.extend({
9
9
  },
10
10
  addOne: function(fileItem){
11
11
  var fileView = new FileView({model: fileItem});
12
+ var photoModalView = new PhotoModalView({model: fileItem});
12
13
  this.$el.append(fileView.render().el);
14
+ this.$el.append(photoModalView.render().el);
13
15
  }
14
16
 
15
17
  });
@@ -2,7 +2,8 @@ var FileView = Backbone.View.extend({
2
2
  tagName: 'li',
3
3
  className: 'span2',
4
4
  events: {
5
- "click .delete": "delete"
5
+ "click .delete": "delete",
6
+ "click .photo-link": "photo_link",
6
7
  },
7
8
  initialize: function(){
8
9
  this.template = JST['photo_view']
@@ -30,5 +31,9 @@ var FileView = Backbone.View.extend({
30
31
  }
31
32
  });
32
33
  this.$el.fadeOut();
34
+ },
35
+ photo_link: function(e) {
36
+ e.preventDefault();
37
+ Backbone.history.navigate(":photo_id/ajax_edit".replace(':photo_id', this.model.get('id')), {trigger: true});
33
38
  }
34
39
  });
@@ -0,0 +1,25 @@
1
+ class window.PhotoModalView extends Backbone.View
2
+ tagName: "div"
3
+ #className: "span2"
4
+ events:
5
+ "click .save": "save_changes"
6
+
7
+ initialize: ->
8
+ @template = JST["photo_modal_edit"]
9
+ @model.on "change", @render, this
10
+
11
+ render: ->
12
+ data = _.defaults(@model.attributes,
13
+ progress: null
14
+ id: null
15
+ title: null
16
+ )
17
+ html = @template(@model.attributes)
18
+ $(@el).html html
19
+ this
20
+
21
+ save_changes: (e) ->
22
+ e.preventDefault()
23
+ description = $("#input_photo_description_#{@model.get('id')}").val()
24
+ @model.set(description: description)
25
+ @model.save()
data/app/models/photo.rb CHANGED
@@ -3,9 +3,9 @@ class Photo
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
6
- attr_accessible :image, :image_cache
6
+ attr_accessible :description, :image, :image_cache
7
7
 
8
- field :legend
8
+ field :description
9
9
 
10
10
  embedded_in :album
11
11
 
@@ -1,5 +1,5 @@
1
1
  - content_for :javascripts do
2
- = javascript_include_tag 'admix/photos'
2
+ = javascript_include_tag 'photos/upload'
3
3
 
4
4
  %h3 Upload de fotos
5
5
  #upload-buttons{:style => "padding: 20px;"}
@@ -14,4 +14,4 @@
14
14
  %a.btn.btn-primary.btn-upload{:onclick => "jQuery('#uploaderZip').click();"}= t('photos.btn.upload_zip')
15
15
 
16
16
  #fileZip
17
- %ul#files.thumbnails{'data-url' => admix_album_photos_path(defined?(parent) ? parent : resource, format: :json)}
17
+ %ul#photos.thumbnails{'data-url' => admix_album_photos_path(defined?(parent) ? parent : resource)}
data/config/routes.rb CHANGED
@@ -6,7 +6,11 @@ Rails.application.routes.draw do
6
6
 
7
7
  scope Admix::namespace_path, as: :admix, module: :admix do
8
8
  resources :albums do
9
- resources :photos
9
+ resources :photos do
10
+ member do
11
+ get :edit_ajax
12
+ end
13
+ end
10
14
  end
11
15
  end
12
16
 
@@ -6,5 +6,5 @@ require "mini_magick"
6
6
 
7
7
  require "haml_coffee_assets"
8
8
 
9
- module Albums
9
+ module MixRailsAlbums
10
10
  end
@@ -2,7 +2,7 @@ module MixRailsAlbums
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 12
5
- TINY = 1
5
+ TINY = 2
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mix-rails-albums
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-23 00:00:00.000000000 Z
12
+ date: 2013-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -114,78 +114,98 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
- - app/uploaders/albums/image_uploader.rb
118
- - app/controllers/admix/albums_controller.rb
119
- - app/controllers/admix/photos_controller.rb
120
- - app/controllers/albums_controller.rb
121
- - app/assets/stylesheets/skins/tango/next-horizontal.png
117
+ - app/assets/stylesheets/skins/tango/next-vertical.png
122
118
  - app/assets/stylesheets/skins/tango/skin.css
119
+ - app/assets/stylesheets/skins/tango/next-horizontal.png
123
120
  - app/assets/stylesheets/skins/tango/prev-vertical.png
124
- - app/assets/stylesheets/skins/tango/next-vertical.png
125
121
  - app/assets/stylesheets/skins/tango/credits.txt
126
122
  - app/assets/stylesheets/skins/tango/prev-horizontal.png
127
- - app/assets/stylesheets/skins/ie7/loading.gif
128
- - app/assets/stylesheets/skins/ie7/prev-horizontal.gif
129
- - app/assets/stylesheets/skins/ie7/skin.css
130
- - app/assets/stylesheets/skins/ie7/loading_small.gif
131
- - app/assets/stylesheets/skins/ie7/credits.txt
132
123
  - app/assets/stylesheets/skins/ie7/loading-small.gif
124
+ - app/assets/stylesheets/skins/ie7/skin.css
133
125
  - app/assets/stylesheets/skins/ie7/next-horizontal.gif
126
+ - app/assets/stylesheets/skins/ie7/credits.txt
127
+ - app/assets/stylesheets/skins/ie7/loading_small.gif
128
+ - app/assets/stylesheets/skins/ie7/loading.gif
129
+ - app/assets/stylesheets/skins/ie7/prev-horizontal.gif
134
130
  - app/assets/stylesheets/colorbox/colorbox.css.scss
135
- - app/assets/images/albums/photos.png
136
- - app/assets/images/albums/delete.png
137
- - app/assets/images/albums/rotate_cw.png
138
- - app/assets/images/albums/crop.png
139
- - app/assets/images/albums/rotate_ccw.png
140
- - app/assets/images/colorbox/border.png
141
- - app/assets/images/colorbox/loading.gif
142
- - app/assets/images/colorbox/loading_background.png
143
- - app/assets/images/colorbox/controls.png
131
+ - app/assets/images/colorbox/ie6/borderMiddleLeft.png
132
+ - app/assets/images/colorbox/ie6/borderTopRight.png
133
+ - app/assets/images/colorbox/ie6/borderBottomLeft.png
134
+ - app/assets/images/colorbox/ie6/borderTopLeft.png
135
+ - app/assets/images/colorbox/ie6/borderBottomCenter.png
144
136
  - app/assets/images/colorbox/ie6/borderTopCenter.png
145
137
  - app/assets/images/colorbox/ie6/borderMiddleRight.png
146
138
  - app/assets/images/colorbox/ie6/borderBottomRight.png
147
- - app/assets/images/colorbox/ie6/borderBottomCenter.png
148
- - app/assets/images/colorbox/ie6/borderTopLeft.png
149
- - app/assets/images/colorbox/ie6/borderTopRight.png
150
- - app/assets/images/colorbox/ie6/borderBottomLeft.png
151
- - app/assets/images/colorbox/ie6/borderMiddleLeft.png
139
+ - app/assets/images/colorbox/border.png
140
+ - app/assets/images/colorbox/loading_background.png
141
+ - app/assets/images/colorbox/controls.png
142
+ - app/assets/images/colorbox/loading.gif
152
143
  - app/assets/images/colorbox/overlay.png
144
+ - app/assets/images/albums/delete.png
145
+ - app/assets/images/albums/photos.png
146
+ - app/assets/images/albums/rotate_cw.png
147
+ - app/assets/images/albums/rotate_ccw.png
148
+ - app/assets/images/albums/crop.png
149
+ - app/assets/javascripts/application.js
150
+ - app/assets/javascripts/backbone/views/photos/upload_index_view.js.coffee
151
+ - app/assets/javascripts/backbone/views/photos/thumbnail_view.js.coffee
152
+ - app/assets/javascripts/backbone/views/photos/index_view.js.coffee
153
+ - app/assets/javascripts/backbone/views/photos/show_view.js.coffee
154
+ - app/assets/javascripts/backbone/views/photos/photo_view.js.coffee
155
+ - app/assets/javascripts/backbone/views/photos/new_view.js.coffee
156
+ - app/assets/javascripts/backbone/views/photos/edit_view.js.coffee
157
+ - app/assets/javascripts/backbone/models/photo.js.coffee
158
+ - app/assets/javascripts/backbone/templates/photos/index.jst.ejs
159
+ - app/assets/javascripts/backbone/templates/photos/show.jst.ejs
160
+ - app/assets/javascripts/backbone/templates/photos/edit.jst.ejs
161
+ - app/assets/javascripts/backbone/templates/photos/thumbnail.hamlc.erb
162
+ - app/assets/javascripts/backbone/templates/photos/photo.jst.ejs
163
+ - app/assets/javascripts/backbone/templates/photos/modal.hamlc.erb
164
+ - app/assets/javascripts/backbone/templates/photos/new.jst.ejs
165
+ - app/assets/javascripts/backbone/templates/photos/upload_index.hamlc.erb
166
+ - app/assets/javascripts/backbone/application.js.coffee
167
+ - app/assets/javascripts/backbone/routers/photos_router.js.coffee
153
168
  - app/assets/javascripts/admix/photos.js.erb
154
- - app/assets/javascripts/albums/jquery.jcarousel.min.js
155
- - app/assets/javascripts/albums/show.js.coffee
156
- - app/assets/javascripts/templates/photo_view.hamlc.erb
157
- - app/assets/javascripts/collections/filelist.js
158
- - app/assets/javascripts/colorbox/jquery.colorbox-min.js
159
- - app/assets/javascripts/photo_uploader.coffee
160
- - app/assets/javascripts/models/fileitem.js
161
- - app/assets/javascripts/models/filezip.js
162
- - app/assets/javascripts/albums.js
163
- - app/assets/javascripts/views/filelistview.js
164
- - app/assets/javascripts/views/filezipview.js
165
169
  - app/assets/javascripts/views/fileview.js
166
- - app/helpers/admix/albums_helper.rb
167
- - app/models/admix/photos_datagrid.rb
168
- - app/models/admix/albums_datagrid.rb
169
- - app/models/album.rb
170
- - app/models/photo.rb
171
- - app/views/admix/albums/_show.html.haml
172
- - app/views/admix/albums/_table_actions.html.haml
173
- - app/views/admix/albums/_form_fields.html.haml
170
+ - app/assets/javascripts/views/filezipview.js
171
+ - app/assets/javascripts/views/photo_modal_view.js.coffee
172
+ - app/assets/javascripts/views/filelistview.js
173
+ - app/assets/javascripts/photos/upload.js.coffee.erb
174
+ - app/assets/javascripts/models/filezip.js
175
+ - app/assets/javascripts/models/fileitem.js
176
+ - app/assets/javascripts/collections/filelist.js
177
+ - app/assets/javascripts/templates/photo_view.hamlc.erb
178
+ - app/assets/javascripts/templates/photo_modal_edit.hamlc.erb
179
+ - app/assets/javascripts/routers/photo_router.js.coffee.erb
180
+ - app/assets/javascripts/albums/show.js.coffee
181
+ - app/assets/javascripts/albums/jquery.jcarousel.min.js
174
182
  - app/views/admix/photos/index.html.haml
175
183
  - app/views/admix/photos/_upload.html.haml
184
+ - app/views/admix/albums/_form_fields.html.haml
185
+ - app/views/admix/albums/_table_actions.html.haml
186
+ - app/views/admix/albums/_show.html.haml
176
187
  - app/views/albums/index.html.haml
177
188
  - app/views/albums/show.html.haml
178
- - config/locales/photos.pt-BR.yml
179
- - config/locales/albums.pt-BR.yml
180
- - config/locales/albums.en.yml
189
+ - app/controllers/albums_controller.rb
190
+ - app/controllers/admix/albums_controller.rb
191
+ - app/controllers/admix/photos_controller.rb
192
+ - app/models/album.rb
193
+ - app/models/admix/photos_datagrid.rb
194
+ - app/models/admix/albums_datagrid.rb
195
+ - app/models/photo.rb
196
+ - app/helpers/admix/albums_helper.rb
197
+ - app/uploaders/albums/image_uploader.rb
181
198
  - config/initializers/carrierwave.rb
182
199
  - config/initializers/albums.rb
183
200
  - config/routes.rb
184
201
  - config/application.rb
202
+ - config/locales/photos.pt-BR.yml
203
+ - config/locales/albums.pt-BR.yml
204
+ - config/locales/albums.en.yml
185
205
  - lib/tasks/albums_tasks.rake
186
- - lib/mix-rails-albums.rb
187
206
  - lib/mix-rails-albums/version.rb
188
207
  - lib/mix-rails-albums/engine.rb
208
+ - lib/mix-rails-albums.rb
189
209
  - MIT-LICENSE
190
210
  - Rakefile
191
211
  - README.rdoc
@@ -203,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
203
223
  version: '0'
204
224
  segments:
205
225
  - 0
206
- hash: -3744313959906207215
226
+ hash: -52676259253557303
207
227
  required_rubygems_version: !ruby/object:Gem::Requirement
208
228
  none: false
209
229
  requirements:
@@ -212,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
232
  version: '0'
213
233
  segments:
214
234
  - 0
215
- hash: -3744313959906207215
235
+ hash: -52676259253557303
216
236
  requirements: []
217
237
  rubyforge_project:
218
238
  rubygems_version: 1.8.24
@@ -1,4 +0,0 @@
1
- // ColorBox v1.3.20.2 - jQuery lightbox plugin
2
- // (c) 2012 Jack Moore - jacklmoore.com
3
- // License: http://www.opensource.org/licenses/mit-license.php
4
- (function(a,b,c){function Z(c,d,e){var g=b.createElement(c);return d&&(g.id=f+d),e&&(g.style.cssText=e),a(g)}function $(a){var b=y.length,c=(Q+a)%b;return 0>c?b+c:c}function _(a,b){return Math.round((/%/.test(a)?("x"===b?z.width():z.height())/100:1)*parseInt(a,10))}function ab(a){return K.photo||/\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(a)}function bb(){var b,c=a.data(P,e);null==c?(K=a.extend({},d),console&&console.log&&console.log("Error: cboxElement missing settings object")):K=a.extend({},c);for(b in K)a.isFunction(K[b])&&"on"!==b.slice(0,2)&&(K[b]=K[b].call(P));K.rel=K.rel||P.rel||a(P).data("rel")||"nofollow",K.href=K.href||a(P).attr("href"),K.title=K.title||P.title,"string"==typeof K.href&&(K.href=a.trim(K.href))}function cb(b,c){a.event.trigger(b),c&&c.call(P)}function db(){var a,d,e,b=f+"Slideshow_",c="click."+f;K.slideshow&&y[1]?(d=function(){F.html(K.slideshowStop).unbind(c).bind(j,function(){(K.loop||y[Q+1])&&(a=setTimeout(W.next,K.slideshowSpeed))}).bind(i,function(){clearTimeout(a)}).one(c+" "+k,e),r.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,K.slideshowSpeed)},e=function(){clearTimeout(a),F.html(K.slideshowStart).unbind([j,i,k,c].join(" ")).one(c,function(){W.next(),d()}),r.removeClass(b+"on").addClass(b+"off")},K.slideshowAuto?d():e()):r.removeClass(b+"off "+b+"on")}function eb(b){U||(P=b,bb(),y=a(P),Q=0,"nofollow"!==K.rel&&(y=a("."+g).filter(function(){var c,b=a.data(this,e);return b&&(c=a(this).data("rel")||b.rel||this.rel),c===K.rel}),Q=y.index(P),-1===Q&&(y=y.add(P),Q=y.length-1)),S||(S=T=!0,r.show(),K.returnFocus&&a(P).blur().one(l,function(){a(this).focus()}),q.css({opacity:+K.opacity,cursor:K.overlayClose?"pointer":"auto"}).show(),K.w=_(K.initialWidth,"x"),K.h=_(K.initialHeight,"y"),W.position(),o&&z.bind("resize."+p+" scroll."+p,function(){q.css({width:z.width(),height:z.height(),top:z.scrollTop(),left:z.scrollLeft()})}).trigger("resize."+p),cb(h,K.onOpen),J.add(D).hide(),I.html(K.close).show()),W.load(!0))}function fb(){!r&&b.body&&(Y=!1,z=a(c),r=Z(X).attr({id:e,"class":n?f+(o?"IE6":"IE"):""}).hide(),q=Z(X,"Overlay",o?"position:absolute":"").hide(),C=Z(X,"LoadingOverlay").add(Z(X,"LoadingGraphic")),s=Z(X,"Wrapper"),t=Z(X,"Content").append(A=Z(X,"LoadedContent","width:0; height:0; overflow:hidden"),D=Z(X,"Title"),E=Z(X,"Current"),G=Z(X,"Next"),H=Z(X,"Previous"),F=Z(X,"Slideshow").bind(h,db),I=Z(X,"Close")),s.append(Z(X).append(Z(X,"TopLeft"),u=Z(X,"TopCenter"),Z(X,"TopRight")),Z(X,!1,"clear:left").append(v=Z(X,"MiddleLeft"),t,w=Z(X,"MiddleRight")),Z(X,!1,"clear:left").append(Z(X,"BottomLeft"),x=Z(X,"BottomCenter"),Z(X,"BottomRight"))).find("div div").css({"float":"left"}),B=Z(X,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),J=G.add(H).add(E).add(F),a(b.body).append(q,r.append(s,B)))}function gb(){return r?(Y||(Y=!0,L=u.height()+x.height()+t.outerHeight(!0)-t.height(),M=v.width()+w.width()+t.outerWidth(!0)-t.width(),N=A.outerHeight(!0),O=A.outerWidth(!0),r.css({"padding-bottom":L,"padding-right":M}),G.click(function(){W.next()}),H.click(function(){W.prev()}),I.click(function(){W.close()}),q.click(function(){K.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;S&&K.escKey&&27===b&&(a.preventDefault(),W.close()),S&&K.arrowKey&&y[1]&&(37===b?(a.preventDefault(),H.click()):39===b&&(a.preventDefault(),G.click()))}),a(b).delegate("."+g,"click",function(a){a.which>1||a.shiftKey||a.altKey||a.metaKey||(a.preventDefault(),eb(this))})),!0):!1}var q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,Y,d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",open:!1,returnFocus:!0,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0},e="colorbox",f="cbox",g=f+"Element",h=f+"_open",i=f+"_load",j=f+"_complete",k=f+"_cleanup",l=f+"_closed",m=f+"_purge",n=!a.support.opacity&&!a.support.style,o=n&&!c.XMLHttpRequest,p=f+"_IE6",X="div";a.colorbox||(a(fb),W=a.fn[e]=a[e]=function(b,c){var f=this;if(b=b||{},fb(),gb()){if(!f[0]){if(f.selector)return f;f=a("<a/>"),b.open=!0}c&&(b.onComplete=c),f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b))}).addClass(g),(a.isFunction(b.open)&&b.open.call(f)||b.open)&&eb(f[0])}return f},W.position=function(a,b){function j(a){u[0].style.width=x[0].style.width=t[0].style.width=a.style.width,t[0].style.height=v[0].style.height=w[0].style.height=a.style.height}var c,h,i,d=0,e=0,g=r.offset();z.unbind("resize."+f),r.css({top:-9e4,left:-9e4}),h=z.scrollTop(),i=z.scrollLeft(),K.fixed&&!o?(g.top-=h,g.left-=i,r.css({position:"fixed"})):(d=h,e=i,r.css({position:"absolute"})),e+=K.right!==!1?Math.max(z.width()-K.w-O-M-_(K.right,"x"),0):K.left!==!1?_(K.left,"x"):Math.round(Math.max(z.width()-K.w-O-M,0)/2),d+=K.bottom!==!1?Math.max(z.height()-K.h-N-L-_(K.bottom,"y"),0):K.top!==!1?_(K.top,"y"):Math.round(Math.max(z.height()-K.h-N-L,0)/2),r.css({top:g.top,left:g.left}),a=r.width()===K.w+O&&r.height()===K.h+N?0:a||0,s[0].style.width=s[0].style.height="9999px",c={width:K.w+O,height:K.h+N,top:d,left:e},0===a&&r.css(c),r.dequeue().animate(c,{duration:a,complete:function(){j(this),T=!1,s[0].style.width=K.w+O+M+"px",s[0].style.height=K.h+N+L+"px",K.reposition&&setTimeout(function(){z.bind("resize."+f,W.position)},1),b&&b()},step:function(){j(this)}})},W.resize=function(a){S&&(a=a||{},a.width&&(K.w=_(a.width,"x")-O-M),a.innerWidth&&(K.w=_(a.innerWidth,"x")),A.css({width:K.w}),a.height&&(K.h=_(a.height,"y")-N-L),a.innerHeight&&(K.h=_(a.innerHeight,"y")),a.innerHeight||a.height||(A.css({height:"auto"}),K.h=A.height()),A.css({height:K.h}),W.position("none"===K.transition?0:K.speed))},W.prep=function(b){function g(){return K.w=K.w||A.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w,K.w}function h(){return K.h=K.h||A.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h,K.h}if(S){var c,d="none"===K.transition?0:K.speed;A.remove(),A=Z(X,"LoadedContent").append(b),A.hide().appendTo(B.show()).css({width:g(),overflow:K.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(t),B.hide(),a(R).css({"float":"none"}),o&&a("select").not(r.find("select")).filter(function(){return"hidden"!==this.style.visibility}).css({visibility:"hidden"}).one(k,function(){this.style.visibility="inherit"}),c=function(){function s(){n&&r[0].style.removeAttribute("filter")}var b,c,h,l,o,p,q,g=y.length,i="frameBorder",k="allowTransparency";if(S){if(l=function(){clearTimeout(V),C.detach().hide(),cb(j,K.onComplete)},n&&R&&A.fadeIn(100),D.html(K.title).add(A).show(),g>1){if("string"==typeof K.current&&E.html(K.current.replace("{current}",Q+1).replace("{total}",g)).show(),G[K.loop||g-1>Q?"show":"hide"]().html(K.next),H[K.loop||Q?"show":"hide"]().html(K.previous),K.slideshow&&F.show(),K.preloading)for(b=[$(-1),$(1)];c=y[b.pop()];)q=a.data(c,e),q&&q.href?(o=q.href,a.isFunction(o)&&(o=o.call(c))):o=c.href,ab(o)&&(p=new Image,p.src=o)}else J.hide();K.iframe?(h=Z("iframe")[0],i in h&&(h[i]=0),k in h&&(h[k]="true"),K.scrolling||(h.scrolling="no"),a(h).attr({src:K.href,name:(new Date).getTime(),"class":f+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",l).one(m,function(){h.src="//about:blank"}).appendTo(A),K.fastIframe&&a(h).trigger("load")):l(),"fade"===K.transition?r.fadeTo(d,1,s):s()}},"fade"===K.transition?r.fadeTo(d,0,function(){W.position(0,c)}):W.position(d,c)}},W.load=function(b){var c,d,e=W.prep;T=!0,R=!1,P=y[Q],b||bb(),cb(m),cb(i,K.onLoad),K.h=K.height?_(K.height,"y")-N-L:K.innerHeight&&_(K.innerHeight,"y"),K.w=K.width?_(K.width,"x")-O-M:K.innerWidth&&_(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=_(K.maxWidth,"x")-O-M,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=_(K.maxHeight,"y")-N-L,K.mh=K.h&&K.h<K.mh?K.h:K.mh),c=K.href,V=setTimeout(function(){C.show().appendTo(t)},100),K.inline?(Z(X).hide().insertBefore(a(c)[0]).one(m,function(){a(this).replaceWith(A.children())}),e(a(c))):K.iframe?e(" "):K.html?e(K.html):ab(c)?(a(R=new Image).addClass(f+"Photo").error(function(){K.title=!1,e(Z(X,"Error").html(K.imgError))}).load(function(){var a;R.onload=null,K.scalePhotos&&(d=function(){R.height-=R.height*a,R.width-=R.width*a},K.mw&&R.width>K.mw&&(a=(R.width-K.mw)/R.width,d()),K.mh&&R.height>K.mh&&(a=(R.height-K.mh)/R.height,d())),K.h&&(R.style.marginTop=Math.max(K.h-R.height,0)/2+"px"),y[1]&&(K.loop||y[Q+1])&&(R.style.cursor="pointer",R.onclick=function(){W.next()}),n&&(R.style.msInterpolationMode="bicubic"),setTimeout(function(){e(R)},1)}),setTimeout(function(){R.src=c},1)):c&&B.load(c,K.data,function(b,c){e("error"===c?Z(X,"Error").html(K.xhrError):a(this).contents())})},W.next=function(){!T&&y[1]&&(K.loop||y[Q+1])&&(Q=$(1),W.load())},W.prev=function(){!T&&y[1]&&(K.loop||Q)&&(Q=$(-1),W.load())},W.close=function(){S&&!U&&(U=!0,S=!1,cb(k,K.onCleanup),z.unbind("."+f+" ."+p),q.fadeTo(200,0),r.stop().fadeTo(300,0,function(){r.add(q).css({opacity:1,cursor:"auto"}).hide(),cb(m),A.remove(),setTimeout(function(){U=!1,cb(l,K.onClosed)},1)}))},W.remove=function(){a([]).add(r).add(q).remove(),r=null,a("."+g).removeData(e).removeClass(g),a(b).undelegate("."+g)},W.element=function(){return a(P)},W.settings=d)})(jQuery,document,window);
@@ -1,2 +0,0 @@
1
- class window.PhotoUploader
2
- sanity: -> true