mix-rails-albums 0.23.1 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 13fcbba330215aac7557e9898a7e6b0abd424b74
4
+ data.tar.gz: e8237ccc41d9d6074019347b39cabd29791bf2e7
5
+ SHA512:
6
+ metadata.gz: 9e9210bc3a51149b747feb3bfc1a5762ef1559f05c05b4607d67243085b657db4af9e56bb5b2dbb1d0b8b70d92a597b223b118c52ab7d32687925e80fa5a0ab8
7
+ data.tar.gz: e2ba0214e317185e7b8882359fe62a7e3bfff47671e7e1d8ca230bb5c726dd95d067191a1e4d8274139ea682fc2d2c6331a1eaeb29d3661ce2111eeac9156526
@@ -2,7 +2,7 @@
2
2
  %a.link-popover{"data-content" => "<i class=icon-edit></i> Edit"}
3
3
  .loading-file
4
4
  - if @get('image').url
5
- %a.edit{href: "#"}
5
+ %a.zoom-image.edit{href: ROOT_PATH + @get('image').url, rel: 'admix-albums-image'}
6
6
  %img{src: ROOT_PATH + @get('image').medium.url}
7
7
  - else
8
8
  %img{src: "http://placehold.it/130x90&text=Carregando"}
@@ -1,9 +1,8 @@
1
- #upload-buttons{:style => "padding: 20px;"}
1
+ #upload-buttons
2
2
  %div{:style => "display:none;"}
3
- %input#uploader{:multiple => "multiple", :name => "files", :style => "display:none;", :type => "file", :value => "Selecionar File(s)"}/
4
- %input#uploaderZip{:name => "files", :style => "display:none;", :type => "file", :value => "Selecionar File(s)"}/
5
- %p <%= "I18n.t('photos.upload.explanation')" %>
6
- %div
3
+ %input#uploader{:multiple => "multiple", :name => "files", :style => "display:none;", :type => "file", :value => "Selecionar File(s)"}
4
+ %input#uploaderZip{:name => "files", :style => "display:none;", :type => "file", :value => "Selecionar File(s)"}
5
+ %div.well
7
6
  %a.btn.btn-primary.btn-upload{:onclick => "jQuery('#uploader').click();"} <%= I18n.t('photos.btn.upload_pictures') %>
8
7
  -#
9
8
  <%= I18n.t('photos.or') %>
@@ -1,11 +1,12 @@
1
1
  class AlbumsController < ApplicationController
2
2
 
3
3
  def index
4
- @albums = Album.published.paginate(:page => params[:page], :per_page => 12)
4
+ @albums = Album.published.desc.paginate(:page => params[:page], :per_page => 12)
5
5
  end
6
6
 
7
7
  def show
8
8
  @album = Album.find(params[:id])
9
+ @photos = @album.photos.paginate(:page => params[:page], :per_page => 12)
9
10
  end
10
11
 
11
12
  end
@@ -1,11 +1,7 @@
1
1
  module Admix::AlbumsHelper
2
- def form2_attributes
3
- %w(name description date published)
4
- end
5
2
 
6
- def album_form_attributes(form)
7
- form.input :name
8
- form.input :date
3
+ def action_photos(obj)
4
+ link_to image_tag('albums/photos.png'), resource_url([obj, :photos]), class: 'btn', title:'Adicionar fotos'
9
5
  end
10
6
 
11
7
  end
@@ -10,14 +10,16 @@ module Concerns::Album
10
10
  enumerize :status, in: [:published, :unpublished], default: :published, predicates: true
11
11
  friendly_id :title, use: :slugged
12
12
 
13
- has_many :photos, :as => :related, dependent: :destroy
13
+ has_many :photos, dependent: :destroy
14
14
  belongs_to :related, :polymorphic => true
15
15
 
16
16
  validation_for_title
17
17
  validation_for_date
18
18
 
19
19
 
20
- scope :published, includes(:photos).where(status: :published).having('COUNT(photos.id) > 0')
20
+ scope :published, includes(:photos).where(status: :published)
21
+
22
+ scope :desc, order('albums.date DESC')
21
23
 
22
24
  end
23
25
 
data/app/models/photo.rb CHANGED
@@ -5,7 +5,7 @@ class Photo < ActiveRecord::Base
5
5
 
6
6
  friendly_id :description, use: :slugged
7
7
 
8
- belongs_to :related, :polymorphic => true
8
+ belongs_to :album
9
9
 
10
10
  mount_uploader :image, Albums::ImageUploader
11
11
  end
@@ -0,0 +1,9 @@
1
+ - admix_tab t('albums.album') do |t|
2
+ -t.tab_content do
3
+ = f.input :title, as: 'string', input_html: {class: 'span12'}
4
+ = f.input :description, as: 'text', input_html: {class: 'span12'}
5
+ = f.input :date, as: 'datepicker', input_html: {class: 'span12'}
6
+
7
+ - content_for :form_options do
8
+ = f.input :status, input_html: {class: 'span12'}
9
+
@@ -0,0 +1 @@
1
+ = grid_actions_for(obj, [:photos, :show, :edit, :destroy])
@@ -0,0 +1,9 @@
1
+ - grid.column name: input_label(:defaults, :title), attribute: 'title' do |obj|
2
+ - obj.title
3
+ - grid.column name: input_label(:defaults, :date), attribute: 'date' do |obj|
4
+ - obj.date
5
+
6
+ - grid.column name: input_label(:defaults, :status), attribute: 'status',
7
+ custom_filter: {t('enumerize.status.published') => 'published', t('enumerize.status.unpublished') => 'unpublished'} do |obj|
8
+ - obj.status.text
9
+ - column_actions(grid)
@@ -2,6 +2,6 @@
2
2
  %dt= input_label(:albums, :title)
3
3
  %dd= resource.title
4
4
  %dt= input_label(:albums, :date)
5
- %dd= resource.date
5
+ %dd= l(resource.date)
6
6
 
7
7
  = render('admix/photos/upload')
@@ -0,0 +1,2 @@
1
+ - content_for :content do
2
+ = content_for(:albums_content)
@@ -0,0 +1,2 @@
1
+ - content_for :content do
2
+ = content_for(:album_content)
@@ -1,3 +1,4 @@
1
+ # conding: utf-8
1
2
  pt-BR:
2
3
  resources:
3
4
  albums: 'albuns'
@@ -23,7 +24,7 @@ pt-BR:
23
24
  legend: 'Legenda'
24
25
  or: 'ou'
25
26
  upload:
26
- explanation: 'Clique no botão abaixo para adicionar as fotos.'
27
+ explanation: 'Adicione as fotos.'
27
28
  btn:
28
29
  upload_pictures: 'Enviar arquivos de imagem'
29
30
  upload_zip: 'Enviar arquivo ZIP'
@@ -0,0 +1,6 @@
1
+ class RemovePolymorphicAssociationFromPhotos < ActiveRecord::Migration
2
+ def change
3
+ rename_column :photos, :related_id, :album_id
4
+ remove_column :photos, :related_type
5
+ end
6
+ end
@@ -6,15 +6,12 @@ module MixRailsAlbums
6
6
  g.integration_tool :rspec
7
7
  end
8
8
 
9
- def navigation
10
- if defined? Admix
11
- Admix::Navigation::NavBar.post_menu do
12
- Admix::Navigation::NavBar.find(:content) do |menu|
13
- menu.submenu do |submenu|
14
- submenu.key = :albums
15
- submenu.title = I18n.t('albums.albums')
16
- submenu.url = 'admix_albums_url'
17
- end
9
+ initializer "mix-rails-albums.setup_menu", after: "admix.setup_menu" do
10
+ ActiveMenu::get('admix-nav') do |nav|
11
+ nav.get(:content) do |content|
12
+ content.child :albums do |albums|
13
+ albums.text Proc.new {t('albums.albums')}
14
+ albums.href Proc.new {admix_albums_url}
18
15
  end
19
16
  end
20
17
  end
@@ -1,8 +1,8 @@
1
1
  module MixRailsAlbums
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 23
5
- TINY = 1
4
+ MINOR = 24
5
+ TINY = 0
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mix-rails-albums
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.1
5
- prerelease:
4
+ version: 0.24.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sadjow Leão
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-18 00:00:00.000000000 Z
11
+ date: 2013-03-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,33 +27,29 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: mini_magick
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: haml_coffee_assets
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: This is a module for albums funcionality of mix-rails.
@@ -126,18 +119,19 @@ files:
126
119
  - app/assets/javascripts/views/filezipview.js
127
120
  - app/assets/javascripts/views/fileview.js
128
121
  - app/helpers/admix/albums_helper.rb
129
- - app/models/admix/photos_datagrid.rb
130
- - app/models/admix/albums_datagrid.rb
131
122
  - app/models/album.rb
132
123
  - app/models/photo.rb
133
124
  - app/models/concerns/album.rb
134
125
  - app/views/admix/albums/_show.html.haml
135
- - app/views/admix/albums/_table_actions.html.haml
136
- - app/views/admix/albums/_form_fields.html.haml
126
+ - app/views/admix/albums/_grid_actions.haml
127
+ - app/views/admix/albums/_grid_columns.haml
128
+ - app/views/admix/albums/_form_config.haml
137
129
  - app/views/admix/photos/index.html.haml
138
130
  - app/views/admix/photos/_upload.html.haml
139
131
  - app/views/albums/index.html.haml
140
132
  - app/views/albums/show.html.haml
133
+ - app/views/templates/albums/index.haml
134
+ - app/views/templates/albums/show.haml
141
135
  - app/views/photos/index.html.haml
142
136
  - app/views/photos/show.html.haml
143
137
  - config/locales/albums.pt-BR.yml
@@ -145,6 +139,7 @@ files:
145
139
  - config/initializers/albums.rb
146
140
  - config/routes.rb
147
141
  - config/application.rb
142
+ - db/migrate/20130219111930_remove_polymorphic_association_from_photos.rb
148
143
  - db/migrate/20130208020540_create_albums.rb
149
144
  - db/migrate/20130208021030_create_photos.rb
150
145
  - lib/tasks/albums_tasks.rake
@@ -156,32 +151,25 @@ files:
156
151
  - README.rdoc
157
152
  homepage: https://github.com/mixinternet/mix-rails
158
153
  licenses: []
154
+ metadata: {}
159
155
  post_install_message:
160
156
  rdoc_options: []
161
157
  require_paths:
162
158
  - lib
163
159
  required_ruby_version: !ruby/object:Gem::Requirement
164
- none: false
165
160
  requirements:
166
- - - ! '>='
161
+ - - '>='
167
162
  - !ruby/object:Gem::Version
168
163
  version: '0'
169
- segments:
170
- - 0
171
- hash: -4085379778431430325
172
164
  required_rubygems_version: !ruby/object:Gem::Requirement
173
- none: false
174
165
  requirements:
175
- - - ! '>='
166
+ - - '>='
176
167
  - !ruby/object:Gem::Version
177
168
  version: '0'
178
- segments:
179
- - 0
180
- hash: -4085379778431430325
181
169
  requirements: []
182
170
  rubyforge_project:
183
- rubygems_version: 1.8.24
171
+ rubygems_version: 2.0.0
184
172
  signing_key:
185
- specification_version: 3
173
+ specification_version: 4
186
174
  summary: This is a module for albums funcionality of mix-rails.
187
175
  test_files: []
@@ -1,32 +0,0 @@
1
- class Admix::AlbumsDatagrid
2
-
3
- include Datagrid
4
-
5
- extend AdmixHelper
6
-
7
-
8
- scope do
9
- Album.order("date DESC")
10
- end
11
-
12
- filter :title, :string
13
- filter :date do |value|
14
- value.to_s(:created_at)
15
- end
16
-
17
- column :title, header: input_label(:albums, :title)
18
- column :date, header: input_label(:albums, :date) do |album|
19
- album.date.strftime("%d/%m/%Y") #album.date.to_s(:created_at)
20
- end
21
- column :photos_quantity, header: input_label(:albums, :photos_quantity) do |album|
22
- album.photos.count
23
- end
24
-
25
- column :published, header: input_label(:albums, :status) do |album|
26
- album.status.text
27
- end
28
-
29
-
30
- include Admix::TableActions
31
-
32
- end
@@ -1,15 +0,0 @@
1
- class Admix::PhotosDatagrid
2
-
3
- include Datagrid
4
-
5
- scope do
6
- Photo
7
- end
8
-
9
- filter :name, :string
10
- filter :date, :date
11
-
12
- column :name
13
- column :date
14
-
15
- end
@@ -1,4 +0,0 @@
1
- = f.input :title, as: 'string'
2
- = f.input :description, as: 'text'
3
- = f.input :date, as: 'datepicker'
4
- = f.input :status
@@ -1,4 +0,0 @@
1
- = link_to image_tag('albums/photos.png'), resource_url([resource, :photos]), class: 'btn', title:'Adicionar fotos'
2
- = link_to image_tag('admix/zoom.png'), resource_url(resource), class: 'btn', title:'Visualizar registro'
3
- = link_to image_tag('admix/page_edit.png'), edit_resource_url(resource), class: 'btn', title:'Editar registro'
4
- = link_to image_tag('admix/cancel.png'), resource_url(resource), method: :delete, data: { confirm: t('admix.crud.destroy_confirm') }, class: 'btn', title:'Deletar registro'