merrycms 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/base_controller.rb +1 -0
- data/app/controllers/admin/categories_controller.rb +1 -1
- data/app/controllers/admin/documents_controller.rb +49 -0
- data/app/controllers/admin/images_controller.rb +49 -0
- data/app/controllers/admin/pages_controller.rb +0 -1
- data/app/controllers/admin/translations_controller.rb +1 -1
- data/app/controllers/admin/videos_controller.rb +56 -0
- data/app/helpers/admin/base_helper.rb +15 -0
- data/app/helpers/admin/categories_helper.rb +3 -7
- data/app/helpers/admin/documents_helper.rb +4 -0
- data/app/helpers/admin/images_helper.rb +14 -0
- data/app/helpers/admin/videos_helper.rb +53 -0
- data/app/models/document.rb +7 -0
- data/app/models/image.rb +9 -0
- data/app/models/source.rb +8 -0
- data/app/models/video.rb +7 -0
- data/app/views/admin/categories/index.html.erb +1 -1
- data/app/views/admin/documents/_form.erb +22 -0
- data/app/views/admin/documents/_search.erb +15 -0
- data/app/views/admin/documents/_subnav.erb +7 -0
- data/app/views/admin/documents/edit.html.erb +7 -0
- data/app/views/admin/documents/index.html.erb +24 -0
- data/app/views/admin/documents/new.html.erb +3 -0
- data/app/views/admin/images/_form.erb +22 -0
- data/app/views/admin/images/_search.erb +15 -0
- data/app/views/admin/images/_subnav.erb +7 -0
- data/app/views/admin/images/edit.html.erb +7 -0
- data/app/views/admin/images/index.html.erb +26 -0
- data/app/views/admin/images/new.html.erb +3 -0
- data/app/views/admin/pages/index.html.erb +6 -12
- data/app/views/admin/shared/_nav.erb +11 -0
- data/app/views/admin/shared/_subnav.erb +0 -0
- data/app/views/{shared/_toplinks.html.erb → admin/shared/_toplinks.erb} +4 -4
- data/app/views/admin/videos/_form.erb +38 -0
- data/app/views/admin/videos/_head_info.erb +13 -0
- data/app/views/admin/videos/_search.erb +15 -0
- data/app/views/admin/videos/_subnav.erb +7 -0
- data/app/views/admin/videos/edit.html.erb +3 -0
- data/app/views/admin/videos/index.html.erb +24 -0
- data/app/views/admin/videos/new.html.erb +3 -0
- data/app/views/admin/videos/show.html.erb +8 -0
- data/app/views/layouts/admin.html.erb +8 -6
- data/config/locales/de/de.yml +193 -0
- data/config/locales/en/en-US.yml +182 -0
- data/config/locales/fr/admin/admin.fr.yml +11 -3
- data/config/locales/fr/admin/documents.fr.yml +38 -0
- data/config/locales/fr/admin/images.fr.yml +54 -0
- data/config/locales/fr/admin/toplinks.fr.yml +7 -8
- data/config/locales/fr/admin/videos.fr.yml +42 -0
- data/config/locales/fr/fr.yml +182 -0
- data/lib/generators/merrycms/install_documents_generator.rb +26 -0
- data/lib/generators/merrycms/install_images_generator.rb +30 -0
- data/lib/generators/merrycms/install_videos_generator.rb +26 -0
- data/lib/generators/merrycms/templates/create_documents_migration.rb +16 -0
- data/lib/generators/merrycms/templates/create_images_migration.rb +16 -0
- data/lib/generators/merrycms/templates/create_videos_migration.rb +25 -0
- data/lib/generators/merrycms/templates/paperclip_initializer.rb +6 -0
- data/lib/merrycms/engine.rb +6 -0
- data/lib/merrycms/rails/routes.rb +5 -0
- data/lib/merrycms/railties/merrycms_tasks.rake +3 -0
- data/lib/merrycms/validates_as_image.rb +20 -0
- data/lib/merrycms.rb +2 -1
- data/lib/paperclip_processors/poster.rb +38 -0
- data/lib/paperclip_processors/video_thumbnail.rb +42 -0
- metadata +92 -5
- data/app/views/admin/_nav.html.erb +0 -10
@@ -0,0 +1,182 @@
|
|
1
|
+
# French translations for Ruby on Rails
|
2
|
+
# by Christian Lescuyer (christian@flyingcoders.com)
|
3
|
+
# contributors:
|
4
|
+
# - Sebastien Grosjean - ZenCocoon.com
|
5
|
+
# - Bruno Michel - http://github.com/nono
|
6
|
+
# - Tsutomu Kuroda - http://github.com/kuroda (t-kuroda@oiax.jp)
|
7
|
+
|
8
|
+
fr:
|
9
|
+
date:
|
10
|
+
formats:
|
11
|
+
default: "%d/%m/%Y"
|
12
|
+
short: "%e %b"
|
13
|
+
long: "%e %B %Y"
|
14
|
+
day_names: [dimanche, lundi, mardi, mercredi, jeudi, vendredi, samedi]
|
15
|
+
abbr_day_names: [dim, lun, mar, mer, jeu, ven, sam]
|
16
|
+
month_names: [~, janvier, février, mars, avril, mai, juin, juillet, août, septembre, octobre, novembre, décembre]
|
17
|
+
abbr_month_names: [~, jan., fév., mar., avr., mai, juin, juil., août, sept., oct., nov., déc.]
|
18
|
+
order:
|
19
|
+
- :day
|
20
|
+
- :month
|
21
|
+
- :year
|
22
|
+
|
23
|
+
time:
|
24
|
+
formats:
|
25
|
+
default: "%d %B %Y %H:%M:%S"
|
26
|
+
short: "%d %b %H:%M"
|
27
|
+
long: "%A %d %B %Y %H:%M"
|
28
|
+
am: 'am'
|
29
|
+
pm: 'pm'
|
30
|
+
|
31
|
+
datetime:
|
32
|
+
distance_in_words:
|
33
|
+
half_a_minute: "une demi-minute"
|
34
|
+
less_than_x_seconds:
|
35
|
+
zero: "moins d'une seconde"
|
36
|
+
one: "moins d'une seconde"
|
37
|
+
other: "moins de %{count} secondes"
|
38
|
+
x_seconds:
|
39
|
+
one: "1 seconde"
|
40
|
+
other: "%{count} secondes"
|
41
|
+
less_than_x_minutes:
|
42
|
+
zero: "moins d'une minute"
|
43
|
+
one: "moins d'une minute"
|
44
|
+
other: "moins de %{count} minutes"
|
45
|
+
x_minutes:
|
46
|
+
one: "1 minute"
|
47
|
+
other: "%{count} minutes"
|
48
|
+
about_x_hours:
|
49
|
+
one: "environ une heure"
|
50
|
+
other: "environ %{count} heures"
|
51
|
+
x_days:
|
52
|
+
one: "1 jour"
|
53
|
+
other: "%{count} jours"
|
54
|
+
about_x_months:
|
55
|
+
one: "environ un mois"
|
56
|
+
other: "environ %{count} mois"
|
57
|
+
x_months:
|
58
|
+
one: "1 mois"
|
59
|
+
other: "%{count} mois"
|
60
|
+
about_x_years:
|
61
|
+
one: "environ un an"
|
62
|
+
other: "environ %{count} ans"
|
63
|
+
over_x_years:
|
64
|
+
one: "plus d'un an"
|
65
|
+
other: "plus de %{count} ans"
|
66
|
+
almost_x_years:
|
67
|
+
one: "presqu'un an"
|
68
|
+
other: "presque %{count} ans"
|
69
|
+
prompts:
|
70
|
+
year: "Année"
|
71
|
+
month: "Mois"
|
72
|
+
day: "Jour"
|
73
|
+
hour: "Heure"
|
74
|
+
minute: "Minute"
|
75
|
+
second: "Seconde"
|
76
|
+
|
77
|
+
number:
|
78
|
+
format:
|
79
|
+
separator: ","
|
80
|
+
delimiter: " "
|
81
|
+
precision: 3
|
82
|
+
significant: false
|
83
|
+
strip_insignificant_zeros: false
|
84
|
+
currency:
|
85
|
+
format:
|
86
|
+
format: "%n %u"
|
87
|
+
unit: "€"
|
88
|
+
separator: ","
|
89
|
+
delimiter: " "
|
90
|
+
precision: 2
|
91
|
+
significant: false
|
92
|
+
strip_insignificant_zeros: false
|
93
|
+
percentage:
|
94
|
+
format:
|
95
|
+
delimiter: ""
|
96
|
+
precision:
|
97
|
+
format:
|
98
|
+
delimiter: ""
|
99
|
+
human:
|
100
|
+
format:
|
101
|
+
delimiter: ""
|
102
|
+
precision: 2
|
103
|
+
significant: true
|
104
|
+
strip_insignificant_zeros: true
|
105
|
+
storage_units:
|
106
|
+
format: "%n %u"
|
107
|
+
units:
|
108
|
+
byte:
|
109
|
+
one: "octet"
|
110
|
+
other: "octets"
|
111
|
+
kb: "ko"
|
112
|
+
mb: "Mo"
|
113
|
+
gb: "Go"
|
114
|
+
tb: "To"
|
115
|
+
decimal_units:
|
116
|
+
format: "%n %u"
|
117
|
+
units:
|
118
|
+
unit: ""
|
119
|
+
thousand: "millier"
|
120
|
+
million: "million"
|
121
|
+
billion: "milliard"
|
122
|
+
trillion: "billion"
|
123
|
+
quadrillion: "million de milliards"
|
124
|
+
|
125
|
+
support:
|
126
|
+
array:
|
127
|
+
words_connector: ", "
|
128
|
+
two_words_connector: " et "
|
129
|
+
last_word_connector: " et "
|
130
|
+
select:
|
131
|
+
prompt: "Veuillez sélectionner"
|
132
|
+
|
133
|
+
helpers:
|
134
|
+
select:
|
135
|
+
prompt: "Veuillez sélectionner"
|
136
|
+
submit:
|
137
|
+
create: "Créer un %{model}"
|
138
|
+
update: "Modifier ce %{model}"
|
139
|
+
submit: "Enregistrer ce %{model}"
|
140
|
+
|
141
|
+
attributes:
|
142
|
+
created_at: "Créé le"
|
143
|
+
updated_at: "Modifié le"
|
144
|
+
|
145
|
+
errors:
|
146
|
+
format: "Le %{attribute} %{message}"
|
147
|
+
messages: &errors_messages
|
148
|
+
inclusion: "n'est pas inclus(e) dans la liste"
|
149
|
+
exclusion: "n'est pas disponible"
|
150
|
+
invalid: "n'est pas valide"
|
151
|
+
confirmation: "ne concorde pas avec la confirmation"
|
152
|
+
accepted: "doit être accepté(e)"
|
153
|
+
empty: "doit être rempli(e)"
|
154
|
+
blank: "doit être rempli(e)"
|
155
|
+
too_long: "est trop long (pas plus de %{count} caractères)"
|
156
|
+
too_short: "est trop court (au moins %{count} caractères)"
|
157
|
+
wrong_length: "ne fait pas la bonne longueur (doit comporter %{count} caractères)"
|
158
|
+
not_a_number: "n'est pas un nombre"
|
159
|
+
not_an_integer: "doit être un nombre entier"
|
160
|
+
greater_than: "doit être supérieur à %{count}"
|
161
|
+
greater_than_or_equal_to: "doit être supérieur ou égal à %{count}"
|
162
|
+
equal_to: "doit être égal à %{count}"
|
163
|
+
less_than: "doit être inférieur à %{count}"
|
164
|
+
less_than_or_equal_to: "doit être inférieur ou égal à %{count}"
|
165
|
+
odd: "doit être impair"
|
166
|
+
even: "doit être pair"
|
167
|
+
template: &errors_template
|
168
|
+
header:
|
169
|
+
one: "Impossible d'enregistrer ce %{model} : 1 erreur"
|
170
|
+
other: "Impossible d'enregistrer ce %{model} : %{count} erreurs"
|
171
|
+
body: "Veuillez vérifier les champs suivants : "
|
172
|
+
|
173
|
+
activerecord:
|
174
|
+
errors:
|
175
|
+
messages:
|
176
|
+
taken: "n'est pas disponible"
|
177
|
+
record_invalid: "La validation a échoué : %{errors}"
|
178
|
+
<<: *errors_messages
|
179
|
+
template:
|
180
|
+
<<: *errors_template
|
181
|
+
full_messages:
|
182
|
+
format: "%{attribute} %{message}"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
module Merrycms
|
5
|
+
class InstallDocumentsGenerator < Rails::Generators::Base
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.next_migration_number(dirname)
|
13
|
+
if ActiveRecord::Base.timestamped_migrations
|
14
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
15
|
+
else
|
16
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_translations_migration_files
|
21
|
+
migration_template 'create_documents_migration.rb', 'db/migrate/create_documents.rb'
|
22
|
+
sleep 1
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
module Merrycms
|
5
|
+
class InstallImagesGenerator < Rails::Generators::Base
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.next_migration_number(dirname)
|
13
|
+
if ActiveRecord::Base.timestamped_migrations
|
14
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
15
|
+
else
|
16
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_translations_migration_files
|
21
|
+
migration_template 'create_images_migration.rb', 'db/migrate/create_images.rb'
|
22
|
+
sleep 1
|
23
|
+
end
|
24
|
+
|
25
|
+
def copy_locale_initializer
|
26
|
+
copy_file 'paperclip_initializer.rb', 'config/initializers/paperclip.rb'
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
module Merrycms
|
5
|
+
class InstallVideosGenerator < Rails::Generators::Base
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.next_migration_number(dirname)
|
13
|
+
if ActiveRecord::Base.timestamped_migrations
|
14
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
15
|
+
else
|
16
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_translations_migration_files
|
21
|
+
migration_template 'create_videos_migration.rb', 'db/migrate/create_videos.rb'
|
22
|
+
sleep 1
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateDocuments < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :documents do |t|
|
4
|
+
t.string :title
|
5
|
+
t.string :doc_file_name
|
6
|
+
t.string :doc_content_type
|
7
|
+
t.integer :doc_file_size
|
8
|
+
t.datetime :doc_updated_at
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :documents
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateImages < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :images do |t|
|
4
|
+
t.string :title
|
5
|
+
t.string :image_file_name
|
6
|
+
t.string :image_content_type
|
7
|
+
t.integer :image_file_size
|
8
|
+
t.datetime :image_updated_at
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :images
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreateVideos < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :videos do |t|
|
4
|
+
t.string :title
|
5
|
+
t.timestamps
|
6
|
+
end
|
7
|
+
|
8
|
+
create_table :sources do |t|
|
9
|
+
t.integer :video_id
|
10
|
+
t.string :width
|
11
|
+
t.string :height
|
12
|
+
t.string :container_type
|
13
|
+
t.string :video_file_name
|
14
|
+
t.string :video_content_type
|
15
|
+
t.integer :video_file_size
|
16
|
+
t.datetime :video_updated_at
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.down
|
22
|
+
drop_table :videos
|
23
|
+
drop_table :sources
|
24
|
+
end
|
25
|
+
end
|
data/lib/merrycms/engine.rb
CHANGED
@@ -11,12 +11,18 @@ require 'i18n/active_record'
|
|
11
11
|
require 'merrycms/rails/routes'
|
12
12
|
require 'kaminari'
|
13
13
|
require 'meta_search'
|
14
|
+
require 'open4'
|
15
|
+
require 'rvideo'
|
16
|
+
require 'paperclip'
|
17
|
+
require 'paperclip_processors/video_thumbnail'
|
18
|
+
require 'paperclip_processors/poster'
|
14
19
|
|
15
20
|
module Merrycms
|
16
21
|
class Engine < Rails::Engine
|
17
22
|
|
18
23
|
# I18n config
|
19
24
|
#config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*', '*.{rb,yml}').to_s]
|
25
|
+
config.i18n.load_path += Dir[File.join(File.dirname(__FILE__), '../../config/locales/*/*.{rb,yml}')]
|
20
26
|
config.i18n.load_path += Dir[File.join(File.dirname(__FILE__), '../../config/locales/*/admin/*.{rb,yml}')]
|
21
27
|
config.i18n.default_locale = :fr
|
22
28
|
|
@@ -32,6 +32,11 @@ module ActionDispatch::Routing
|
|
32
32
|
match 'translations/pending/:language' => 'translations#pending', :as => 'pending_translations'
|
33
33
|
match 'translations/all/:language' => 'translations#all', :as => 'all_translations'
|
34
34
|
|
35
|
+
resources :images
|
36
|
+
resources :documents
|
37
|
+
resources :videos
|
38
|
+
|
39
|
+
|
35
40
|
root :to => 'pages#index'
|
36
41
|
end
|
37
42
|
end
|
@@ -5,6 +5,9 @@ namespace :merrycms do
|
|
5
5
|
system("rails generate merrycms:install_auth")
|
6
6
|
system("rails generate merrycms:install_pages")
|
7
7
|
system("rails generate merrycms:install_translations")
|
8
|
+
system("rails generate merrycms:install_images")
|
9
|
+
system("rails generate merrycms:install_documents")
|
10
|
+
system("rails generate merrycms:install_videos")
|
8
11
|
system("rails generate jquery:install")
|
9
12
|
|
10
13
|
Rake::Task['merrycms:import_assets'].invoke
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ValidatesAsImage
|
2
|
+
|
3
|
+
def self.included receiver
|
4
|
+
receiver.extend ClassMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
def validates_as_image fields
|
9
|
+
|
10
|
+
validates_each fields do |record, attr, value|
|
11
|
+
if !value.queued_for_write.empty? and value.to_file
|
12
|
+
`identify "#{value.to_file.path}"`
|
13
|
+
record.errors.add attr, I18n.t("activerecord.errors.models.#{record.class.table_name.singularize}.attributes.#{attr}.wrong_format") unless $? == 0
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/lib/merrycms.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require 'merrycms/engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
1
|
+
require 'merrycms/engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
2
|
+
require 'merrycms/validates_as_image'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rvideo'
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
module Paperclip
|
5
|
+
class Poster < Processor
|
6
|
+
|
7
|
+
attr_accessor :time_offset, :geometry, :whiny
|
8
|
+
|
9
|
+
def initialize(file, options = {}, attachment = nil)
|
10
|
+
super
|
11
|
+
@time_offset = options[:time_offset] || '-4'
|
12
|
+
@instance = attachment.instance
|
13
|
+
|
14
|
+
@video = RVideo::Inspector.new(:file => file.path)
|
15
|
+
@instance.width = @video.width
|
16
|
+
@instance.height = @video.height
|
17
|
+
|
18
|
+
@whiny = options[:whiny].nil? ? true : options[:whiny]
|
19
|
+
@basename = File.basename(file.path, File.extname(file.path))
|
20
|
+
end
|
21
|
+
|
22
|
+
def make
|
23
|
+
dst = Tempfile.new([ @basename, 'jpg' ].compact.join("."))
|
24
|
+
dst.binmode
|
25
|
+
|
26
|
+
cmd = %Q[-itsoffset #{time_offset} -i "#{File.expand_path(file.path)}" -y -vcodec mjpeg -vframes 1 -an -f rawvideo ]
|
27
|
+
cmd << "-s #{@video.resolution} " if @video && @video.resolution
|
28
|
+
cmd << %Q["#{File.expand_path(dst.path)}"]
|
29
|
+
|
30
|
+
begin
|
31
|
+
success = Paperclip.run('ffmpeg', cmd)
|
32
|
+
rescue PaperclipCommandLineError
|
33
|
+
raise PaperclipError, "There was an error processing the thumbnail for #{@basename}" if whiny
|
34
|
+
end
|
35
|
+
dst
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rvideo'
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
module Paperclip
|
5
|
+
class VideoThumbnail < Processor
|
6
|
+
|
7
|
+
attr_accessor :time_offset, :geometry, :whiny
|
8
|
+
|
9
|
+
def initialize(file, options = {}, attachment = nil)
|
10
|
+
super
|
11
|
+
@time_offset = options[:time_offset] || '-4'
|
12
|
+
|
13
|
+
logger = Logger.new(STDOUT)
|
14
|
+
|
15
|
+
logger.debug("FILE : #{file.inspect}")
|
16
|
+
logger.debug("FILE PATH : #{file.path}")
|
17
|
+
|
18
|
+
video = RVideo::Inspector.new(:file => file.path)
|
19
|
+
logger.debug("VIDEO : #{video.inspect}")
|
20
|
+
logger.debug("VIDEO WIDTH : #{video.width}")
|
21
|
+
|
22
|
+
@whiny = options[:whiny].nil? ? true : options[:whiny]
|
23
|
+
@basename = File.basename(file.path, File.extname(file.path))
|
24
|
+
end
|
25
|
+
|
26
|
+
def make
|
27
|
+
dst = Tempfile.new([ @basename, 'jpg' ].compact.join("."))
|
28
|
+
dst.binmode
|
29
|
+
|
30
|
+
cmd = %Q[-itsoffset #{time_offset} -i "#{File.expand_path(file.path)}" -y -vcodec mjpeg -vframes 1 -an -f rawvideo ]
|
31
|
+
cmd << "-s #{video.resolution} " if video && video.resolution
|
32
|
+
cmd << %Q["#{File.expand_path(dst.path)}"]
|
33
|
+
|
34
|
+
begin
|
35
|
+
success = Paperclip.run('ffmpeg', cmd)
|
36
|
+
rescue PaperclipCommandLineError
|
37
|
+
raise PaperclipError, "There was an error processing the thumbnail for #{@basename}" if whiny
|
38
|
+
end
|
39
|
+
dst
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 4
|
9
|
+
version: 0.1.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Franck D'agostini
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-03-
|
17
|
+
date: 2011-03-31 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -151,6 +151,45 @@ dependencies:
|
|
151
151
|
version: "0"
|
152
152
|
type: :runtime
|
153
153
|
version_requirements: *id010
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: paperclip
|
156
|
+
prerelease: false
|
157
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
segments:
|
163
|
+
- 0
|
164
|
+
version: "0"
|
165
|
+
type: :runtime
|
166
|
+
version_requirements: *id011
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: open4
|
169
|
+
prerelease: false
|
170
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
segments:
|
176
|
+
- 0
|
177
|
+
version: "0"
|
178
|
+
type: :runtime
|
179
|
+
version_requirements: *id012
|
180
|
+
- !ruby/object:Gem::Dependency
|
181
|
+
name: newbamboo-rvideo
|
182
|
+
prerelease: false
|
183
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
184
|
+
none: false
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
segments:
|
189
|
+
- 0
|
190
|
+
version: "0"
|
191
|
+
type: :runtime
|
192
|
+
version_requirements: *id013
|
154
193
|
description: "Admin panel for rails3 app : user management, pages, categories"
|
155
194
|
email: franck.dagostini@gmail.com
|
156
195
|
executables: []
|
@@ -162,29 +201,54 @@ extra_rdoc_files:
|
|
162
201
|
files:
|
163
202
|
- app/controllers/admin/base_controller.rb
|
164
203
|
- app/controllers/admin/categories_controller.rb
|
204
|
+
- app/controllers/admin/documents_controller.rb
|
205
|
+
- app/controllers/admin/images_controller.rb
|
165
206
|
- app/controllers/admin/pages_controller.rb
|
166
207
|
- app/controllers/admin/translations_controller.rb
|
167
208
|
- app/controllers/admin/users_controller.rb
|
209
|
+
- app/controllers/admin/videos_controller.rb
|
210
|
+
- app/helpers/admin/base_helper.rb
|
168
211
|
- app/helpers/admin/categories_helper.rb
|
212
|
+
- app/helpers/admin/documents_helper.rb
|
213
|
+
- app/helpers/admin/images_helper.rb
|
169
214
|
- app/helpers/admin/pages_helper.rb
|
170
215
|
- app/helpers/admin/translations_helper.rb
|
171
216
|
- app/helpers/admin/users_helper.rb
|
217
|
+
- app/helpers/admin/videos_helper.rb
|
172
218
|
- app/models/category.rb
|
219
|
+
- app/models/document.rb
|
220
|
+
- app/models/image.rb
|
173
221
|
- app/models/page.rb
|
174
222
|
- app/models/role.rb
|
223
|
+
- app/models/source.rb
|
175
224
|
- app/models/translation.rb
|
176
225
|
- app/models/user.rb
|
177
|
-
- app/
|
226
|
+
- app/models/video.rb
|
178
227
|
- app/views/admin/categories/_form.erb
|
179
228
|
- app/views/admin/categories/edit.html.erb
|
180
229
|
- app/views/admin/categories/index.html.erb
|
181
230
|
- app/views/admin/categories/new.html.erb
|
182
231
|
- app/views/admin/categories/sort.html.erb
|
232
|
+
- app/views/admin/documents/_form.erb
|
233
|
+
- app/views/admin/documents/_search.erb
|
234
|
+
- app/views/admin/documents/_subnav.erb
|
235
|
+
- app/views/admin/documents/edit.html.erb
|
236
|
+
- app/views/admin/documents/index.html.erb
|
237
|
+
- app/views/admin/documents/new.html.erb
|
238
|
+
- app/views/admin/images/_form.erb
|
239
|
+
- app/views/admin/images/_search.erb
|
240
|
+
- app/views/admin/images/_subnav.erb
|
241
|
+
- app/views/admin/images/edit.html.erb
|
242
|
+
- app/views/admin/images/index.html.erb
|
243
|
+
- app/views/admin/images/new.html.erb
|
183
244
|
- app/views/admin/pages/_form.html.erb
|
184
245
|
- app/views/admin/pages/_search.erb
|
185
246
|
- app/views/admin/pages/edit.html.erb
|
186
247
|
- app/views/admin/pages/index.html.erb
|
187
248
|
- app/views/admin/pages/new.html.erb
|
249
|
+
- app/views/admin/shared/_nav.erb
|
250
|
+
- app/views/admin/shared/_subnav.erb
|
251
|
+
- app/views/admin/shared/_toplinks.erb
|
188
252
|
- app/views/admin/translations/_edit_javascript.erb
|
189
253
|
- app/views/admin/translations/_filter.html.erb
|
190
254
|
- app/views/admin/translations/_form.erb
|
@@ -196,6 +260,14 @@ files:
|
|
196
260
|
- app/views/admin/users/edit.html.erb
|
197
261
|
- app/views/admin/users/index.html.erb
|
198
262
|
- app/views/admin/users/new.html.erb
|
263
|
+
- app/views/admin/videos/_form.erb
|
264
|
+
- app/views/admin/videos/_head_info.erb
|
265
|
+
- app/views/admin/videos/_search.erb
|
266
|
+
- app/views/admin/videos/_subnav.erb
|
267
|
+
- app/views/admin/videos/edit.html.erb
|
268
|
+
- app/views/admin/videos/index.html.erb
|
269
|
+
- app/views/admin/videos/new.html.erb
|
270
|
+
- app/views/admin/videos/show.html.erb
|
199
271
|
- app/views/devise/confirmations/new.html.erb
|
200
272
|
- app/views/devise/mailer/confirmation_instructions.html.erb
|
201
273
|
- app/views/devise/mailer/reset_password_instructions.html.erb
|
@@ -211,11 +283,14 @@ files:
|
|
211
283
|
- app/views/layouts/login.html.erb
|
212
284
|
- app/views/shared/_error_messages.html.erb
|
213
285
|
- app/views/shared/_flashbox.html.erb
|
214
|
-
-
|
286
|
+
- config/locales/de/de.yml
|
215
287
|
- config/locales/en/admin/missing.yml
|
288
|
+
- config/locales/en/en-US.yml
|
216
289
|
- config/locales/fr/admin/admin.fr.yml
|
217
290
|
- config/locales/fr/admin/category.fr.yml
|
218
291
|
- config/locales/fr/admin/devise.fr.yml
|
292
|
+
- config/locales/fr/admin/documents.fr.yml
|
293
|
+
- config/locales/fr/admin/images.fr.yml
|
219
294
|
- config/locales/fr/admin/merrycms.fr.yml
|
220
295
|
- config/locales/fr/admin/missing.yml
|
221
296
|
- config/locales/fr/admin/pages.fr.yml
|
@@ -223,21 +298,33 @@ files:
|
|
223
298
|
- config/locales/fr/admin/toplinks.fr.yml
|
224
299
|
- config/locales/fr/admin/translations.fr.yml
|
225
300
|
- config/locales/fr/admin/users.fr.yml
|
301
|
+
- config/locales/fr/admin/videos.fr.yml
|
302
|
+
- config/locales/fr/fr.yml
|
226
303
|
- lib/generators/merrycms/install_auth_generator.rb
|
304
|
+
- lib/generators/merrycms/install_documents_generator.rb
|
305
|
+
- lib/generators/merrycms/install_images_generator.rb
|
227
306
|
- lib/generators/merrycms/install_pages_generator.rb
|
228
307
|
- lib/generators/merrycms/install_translations_generator.rb
|
308
|
+
- lib/generators/merrycms/install_videos_generator.rb
|
309
|
+
- lib/generators/merrycms/templates/create_documents_migration.rb
|
310
|
+
- lib/generators/merrycms/templates/create_images_migration.rb
|
229
311
|
- lib/generators/merrycms/templates/create_pages_and_categories_migration.rb
|
230
312
|
- lib/generators/merrycms/templates/create_roles_migration.rb
|
231
313
|
- lib/generators/merrycms/templates/create_translations_migration.rb
|
314
|
+
- lib/generators/merrycms/templates/create_videos_migration.rb
|
232
315
|
- lib/generators/merrycms/templates/devise_create_users_migration.rb
|
233
316
|
- lib/generators/merrycms/templates/devise_initializer.rb
|
234
317
|
- lib/generators/merrycms/templates/locale_initializer.rb
|
318
|
+
- lib/generators/merrycms/templates/paperclip_initializer.rb
|
235
319
|
- lib/generators/merrycms/templates/roles_users_migration.rb
|
236
320
|
- lib/generators/merrycms/views_generator.rb
|
237
321
|
- lib/merrycms.rb
|
238
322
|
- lib/merrycms/engine.rb
|
239
323
|
- lib/merrycms/rails/routes.rb
|
240
324
|
- lib/merrycms/railties/merrycms_tasks.rake
|
325
|
+
- lib/merrycms/validates_as_image.rb
|
326
|
+
- lib/paperclip_processors/poster.rb
|
327
|
+
- lib/paperclip_processors/video_thumbnail.rb
|
241
328
|
- README
|
242
329
|
has_rdoc: true
|
243
330
|
homepage: https://github.com/franck/merrycms
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<div id="nav">
|
2
|
-
<ul id="left">
|
3
|
-
<li><%= link_to t('.pages'), admin_pages_path %></li>
|
4
|
-
<li><%= link_to t('.categories'), admin_categories_path %></li>
|
5
|
-
<li><%= link_to t('.translations'), admin_translations_path %></li>
|
6
|
-
</ul>
|
7
|
-
<ul id="right">
|
8
|
-
<li><%= link_to t('.users'), admin_users_path %></li>
|
9
|
-
</ul>
|
10
|
-
</div>
|