ecm_pictures 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = EcmPictureGallery
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'EcmPictureGallery'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1,61 @@
1
+ include ActiveAdmin::ActsAsList::Helper
2
+
3
+ if defined?(ActiveAdmin)
4
+ ActiveAdmin.register Ecm::Pictures::PictureGallery do
5
+ menu :parent => I18n.t('ecm.pictures.active_admin.menu')
6
+
7
+ config.sort_order = 'position'
8
+ sortable_member_actions
9
+
10
+ form do |f|
11
+ f.inputs do
12
+ f.input :name
13
+ f.input :description
14
+ end
15
+
16
+ f.buttons
17
+ end
18
+
19
+ index do
20
+ sortable_columns
21
+ column :name
22
+ column :pictures_count
23
+ column :created_at
24
+ column :updated_at
25
+ default_actions
26
+ end
27
+
28
+ show do
29
+ attributes_table do
30
+ row :name
31
+ row :pictures_count
32
+ row :created_at
33
+ row :updated_at
34
+ end
35
+
36
+ panel Ecm::Pictures::PictureGallery.human_attribute_name(:description) do
37
+ div do
38
+ ecm_pictures_picture_gallery.description
39
+ end
40
+ end
41
+
42
+ panel Ecm::Pictures::PictureGallery.human_attribute_name(:pictures) do
43
+ table_for ecm_pictures_picture_gallery.pictures, :i18n => Ecm::Pictures::Picture do
44
+ sortable_columns
45
+ column :thumbnail do |picture|
46
+ link_to(image_tag(picture.image.url(:thumb)), admin_ecm_pictures_picture_path(picture))
47
+ end
48
+ column :picture_gallery
49
+ column :name
50
+ column :image_file_size, :sortable => :image_file_size do |picture|
51
+ number_to_human_size(picture.image_file_size)
52
+ end
53
+ column :created_at
54
+ column do |picture|
55
+ link_to I18n.t('active_admin.view'), admin_ecm_pictures_picture_path(picture), :class => "member_link view_link"
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,53 @@
1
+ include ActiveAdmin::ActsAsList::Helper
2
+
3
+ if defined?(ActiveAdmin)
4
+ ActiveAdmin.register Ecm::Pictures::Picture do
5
+ menu :parent => I18n.t('ecm.pictures.active_admin.menu')
6
+
7
+ # active_admin-acts_as_list
8
+ config.sort_order = 'picture_gallery_id, position'
9
+ sortable_member_actions
10
+
11
+ form :html => { :enctype => "multipart/form-data" } do |f|
12
+ f.inputs do
13
+ f.input :picture_gallery
14
+ f.input :name
15
+ f.input :image, :as => :file, :hint => f.template.image_tag(f.object.image.url(:thumb))
16
+ f.input :description
17
+ end
18
+
19
+ f.buttons
20
+ end
21
+
22
+ index do
23
+ column :thumbnail do |picture|
24
+ link_to(image_tag(picture.image.url(:thumb)), admin_ecm_pictures_picture_path(picture))
25
+ end
26
+ column :picture_gallery
27
+ column :name
28
+ column :image_file_size, :sortable => :image_file_size do |picture|
29
+ number_to_human_size(picture.image_file_size)
30
+ end
31
+ column :created_at
32
+ default_actions
33
+ end
34
+
35
+ show do
36
+ attributes_table do
37
+ row :picture_gallery
38
+ row :name
39
+ row :image_file_name
40
+ row :image_file_size do |picture|
41
+ number_to_human_size(picture.image_file_size)
42
+ end
43
+ row :image_fingerprint
44
+ end
45
+
46
+ panel Ecm::Pictures::Picture.human_attribute_name(:description) do
47
+ div do
48
+ ecm_pictures_picture.description
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,29 @@
1
+ module Ecm::PicturesHelper
2
+ def render_picture_gallery(name, options = {})
3
+ options = {:preview_style => :thumb}.merge(options)
4
+
5
+ gallery = Ecm::Pictures::PictureGallery.where(:name => name.to_s).first
6
+
7
+ content_tag(:div, :class => 'picture-gallery', :id => "picture-gallery-#{gallery.to_param}") do
8
+ if gallery.nil?
9
+ content_tag(:span, :class => 'warning') do
10
+ I18n.t('ecm.pictures.warnings.missing_gallery', :name => name.to_s)
11
+ end
12
+ else
13
+ content_tag(:h1, gallery.name) +
14
+ content_tag(:ul, {:class => 'pictures'}) do
15
+ gallery.pictures.collect do |picture|
16
+ content_tag(:li, {:class => 'picture', :id => "picture-#{picture.to_param}"}) do
17
+ concat(content_tag(:h2, picture.name, :class => 'picture-name')) unless picture.name.blank?
18
+ concat(link_to(image_tag(picture.image.url(options[:preview_style]), :alt => picture.description), picture.image.url, {:rel => "lightbox[#{gallery.to_param}]"}))
19
+ concat(content_tag(:div, picture.description, :class => 'picture-description'))
20
+ end
21
+ end.join.html_safe
22
+ end.html_safe
23
+ end
24
+ end.html_safe
25
+ end
26
+
27
+ def render_picture(name, options = {})
28
+ end
29
+ end
@@ -0,0 +1,22 @@
1
+ class Ecm::Pictures::Picture < ActiveRecord::Base
2
+ self.table_name = 'ecm_pictures_pictures'
3
+
4
+ # associations
5
+ belongs_to :picture_gallery, :counter_cache => true
6
+
7
+ # acts as list
8
+ acts_as_list :scope => :picture_gallery
9
+
10
+ # friendly id
11
+ extend FriendlyId
12
+ friendly_id :name, :use => :slugged
13
+
14
+ # paperclip
15
+ has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }
16
+
17
+ # attributes
18
+ attr_accessible :description, :image, :name, :picture_gallery_id
19
+
20
+ # validations
21
+ validates :image, :attachment_presence => true
22
+ end
@@ -0,0 +1,20 @@
1
+ class Ecm::Pictures::PictureGallery < ActiveRecord::Base
2
+ self.table_name = 'ecm_pictures_picture_galleries'
3
+
4
+ # associations
5
+ has_many :pictures
6
+
7
+ # acts as list
8
+ acts_as_list
9
+ default_scope :order => 'position ASC'
10
+
11
+ # friendly id
12
+ extend FriendlyId
13
+ friendly_id :name, :use => :slugged
14
+
15
+ # attributes
16
+ attr_accessible :description, :name
17
+
18
+ # validations
19
+ validates :name, :presence => true
20
+ end
@@ -0,0 +1,7 @@
1
+ de:
2
+ ecm:
3
+ pictures:
4
+ active_admin:
5
+ menu: "Bilder"
6
+ warnings:
7
+ missing_gallery: "Die Gallerie %{name} wurde nicht gefunden."
@@ -0,0 +1,18 @@
1
+ de:
2
+ activerecord:
3
+ attributes:
4
+ ecm/pictures/picture:
5
+ created_at: "Erstellt am"
6
+ description: "Beschreibung"
7
+ image: "Datei"
8
+ image_file_size: "Größe"
9
+ image_fingerprint: "Fingerabdruck"
10
+ name: "Name"
11
+ picture_gallery: "Gallerie"
12
+ position: "Position"
13
+ thumbnail: "Vorschau"
14
+ updated_at: "Aktualisiert am"
15
+ models:
16
+ ecm/pictures/picture:
17
+ one: "Bild"
18
+ other: "Bilder"
@@ -0,0 +1,15 @@
1
+ de:
2
+ activerecord:
3
+ attributes:
4
+ ecm/pictures/picture_gallery:
5
+ created_at: "Erstellt am"
6
+ description: "Beschreibung"
7
+ name: "Name"
8
+ pictures: "Bilder"
9
+ pictures_count: "Bilder"
10
+ position: "Position"
11
+ updated_at: "Aktualisiert am"
12
+ models:
13
+ ecm/pictures/picture_gallery:
14
+ one: "Bildgallerie"
15
+ other: "Bildgallerien"
@@ -0,0 +1,17 @@
1
+ class CreateEcmPicturesPictureGalleries < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_pictures_picture_galleries do |t|
4
+ t.string :name
5
+ t.text :description
6
+ t.integer :pictures_count
7
+
8
+ # acts as list
9
+ t.integer :position
10
+
11
+ # friendly id
12
+ t.string :slug
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ class CreateEcmPicturesPictures < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_pictures_pictures do |t|
4
+ t.string :name
5
+ t.text :description
6
+
7
+ # acts as list
8
+ t.integer :position
9
+
10
+ # friendly id
11
+ t.string :slug
12
+
13
+ # paperclip
14
+ t.attachment :image
15
+ t.string :image_fingerprint
16
+
17
+ # references
18
+ t.references :picture_gallery
19
+
20
+ t.timestamps
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+
3
+ require 'acts_as_list'
4
+ require 'active_admin-acts_as_list'
5
+ require 'friendly_id'
6
+ require 'paperclip'
7
+
8
+ # Ecm::Admin should do this!
9
+ require 'activeadmin'
10
+ require 'sass-rails'
11
+ require 'meta_search'
12
+
13
+ module Ecm
14
+ module Pictures
15
+ class Engine < Rails::Engine
16
+ paths["config/locales"] << File.dirname(__FILE__) + '/../../../config/locales'
17
+
18
+ config.to_prepare do
19
+ ApplicationController.helper(Ecm::PicturesHelper)
20
+ end
21
+
22
+ initializer :ecm_pictures_engine do
23
+ ActiveAdmin.setup do |active_admin_config|
24
+ active_admin_config.load_paths += Dir[File.dirname(__FILE__) + '/../../../app/admin']
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ module Ecm
2
+ module Pictures
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require 'ecm/pictures/engine'
2
+ require 'ecm/pictures/version'
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :ecm_pictures do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,235 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ecm_pictures
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Roberto Vasquez Angel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-06-19 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rails
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 3.2.5
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: paperclip
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: "3.0"
35
+ type: :runtime
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: friendly_id
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 4.0.1
46
+ type: :runtime
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: acts_as_list
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: 0.1.6
57
+ type: :runtime
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: active_admin-acts_as_list
61
+ prerelease: false
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 0.0.5
68
+ type: :runtime
69
+ version_requirements: *id005
70
+ - !ruby/object:Gem::Dependency
71
+ name: sqlite3
72
+ prerelease: false
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ type: :development
80
+ version_requirements: *id006
81
+ - !ruby/object:Gem::Dependency
82
+ name: rspec-rails
83
+ prerelease: false
84
+ requirement: &id007 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ type: :development
91
+ version_requirements: *id007
92
+ - !ruby/object:Gem::Dependency
93
+ name: capybara
94
+ prerelease: false
95
+ requirement: &id008 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: "0"
101
+ type: :development
102
+ version_requirements: *id008
103
+ - !ruby/object:Gem::Dependency
104
+ name: guard-rspec
105
+ prerelease: false
106
+ requirement: &id009 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: "0"
112
+ type: :development
113
+ version_requirements: *id009
114
+ - !ruby/object:Gem::Dependency
115
+ name: guard-spork
116
+ prerelease: false
117
+ requirement: &id010 !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: "0"
123
+ type: :development
124
+ version_requirements: *id010
125
+ - !ruby/object:Gem::Dependency
126
+ name: factory_girl_rails
127
+ prerelease: false
128
+ requirement: &id011 !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: "0"
134
+ type: :development
135
+ version_requirements: *id011
136
+ - !ruby/object:Gem::Dependency
137
+ name: thin
138
+ prerelease: false
139
+ requirement: &id012 !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: "0"
145
+ type: :development
146
+ version_requirements: *id012
147
+ - !ruby/object:Gem::Dependency
148
+ name: activeadmin
149
+ prerelease: false
150
+ requirement: &id013 !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: "0"
156
+ type: :development
157
+ version_requirements: *id013
158
+ - !ruby/object:Gem::Dependency
159
+ name: sass-rails
160
+ prerelease: false
161
+ requirement: &id014 !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: "0"
167
+ type: :development
168
+ version_requirements: *id014
169
+ - !ruby/object:Gem::Dependency
170
+ name: meta_search
171
+ prerelease: false
172
+ requirement: &id015 !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: 1.1.0.pre
178
+ type: :development
179
+ version_requirements: *id015
180
+ description: Provides picture galleries for active admin.
181
+ email:
182
+ - roberto@vasquez-angel.de
183
+ executables: []
184
+
185
+ extensions: []
186
+
187
+ extra_rdoc_files: []
188
+
189
+ files:
190
+ - app/helpers/ecm/pictures_helper.rb
191
+ - app/models/ecm/pictures/picture_gallery.rb
192
+ - app/models/ecm/pictures/picture.rb
193
+ - app/admin/ecm/pictures/pictures.rb
194
+ - app/admin/ecm/pictures/picture_galleries.rb
195
+ - config/locales/ecm.pictures.picture_gallery.de.yml
196
+ - config/locales/ecm.pictures.de.yml
197
+ - config/locales/ecm.pictures.picture.de.yml
198
+ - db/migrate/002_create_ecm_pictures_pictures.rb
199
+ - db/migrate/001_create_ecm_pictures_picture_galleries.rb
200
+ - lib/tasks/ecm_pictures_tasks.rake
201
+ - lib/ecm_pictures.rb
202
+ - lib/ecm/pictures/engine.rb
203
+ - lib/ecm/pictures/version.rb
204
+ - MIT-LICENSE
205
+ - Rakefile
206
+ - README.rdoc
207
+ homepage: http://blog.robotex.de
208
+ licenses: []
209
+
210
+ post_install_message:
211
+ rdoc_options: []
212
+
213
+ require_paths:
214
+ - lib
215
+ required_ruby_version: !ruby/object:Gem::Requirement
216
+ none: false
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ version: "0"
221
+ required_rubygems_version: !ruby/object:Gem::Requirement
222
+ none: false
223
+ requirements:
224
+ - - ">="
225
+ - !ruby/object:Gem::Version
226
+ version: "0"
227
+ requirements: []
228
+
229
+ rubyforge_project:
230
+ rubygems_version: 1.8.24
231
+ signing_key:
232
+ specification_version: 3
233
+ summary: Picture galleries for active admin.
234
+ test_files: []
235
+