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,49 @@
|
|
1
|
+
module Admin
|
2
|
+
class DocumentsController < BaseController
|
3
|
+
|
4
|
+
layout "admin"
|
5
|
+
|
6
|
+
before_filter :authenticate_user!
|
7
|
+
access_control do
|
8
|
+
allow :admin
|
9
|
+
end
|
10
|
+
|
11
|
+
def index
|
12
|
+
@search = Document.search(params[:search])
|
13
|
+
@documents = @search.order(:title).page(params[:page])
|
14
|
+
end
|
15
|
+
|
16
|
+
def new
|
17
|
+
@document = Document.new
|
18
|
+
end
|
19
|
+
|
20
|
+
def create
|
21
|
+
@document = Document.new(params[:document])
|
22
|
+
if @document.save
|
23
|
+
redirect_to admin_documents_path
|
24
|
+
else
|
25
|
+
render :new
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
@document = Document.find(params[:id])
|
31
|
+
end
|
32
|
+
|
33
|
+
def update
|
34
|
+
@document = Document.find(params[:id])
|
35
|
+
if @document.update_attributes(params[:document])
|
36
|
+
redirect_to admin_documents_path
|
37
|
+
else
|
38
|
+
render :edit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def destroy
|
43
|
+
@document = Document.find(params[:id])
|
44
|
+
@document.destroy
|
45
|
+
redirect_to admin_documents_path
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Admin
|
2
|
+
class ImagesController < BaseController
|
3
|
+
|
4
|
+
layout "admin"
|
5
|
+
|
6
|
+
before_filter :authenticate_user!
|
7
|
+
access_control do
|
8
|
+
allow :admin
|
9
|
+
end
|
10
|
+
|
11
|
+
def index
|
12
|
+
@search = Image.search(params[:search])
|
13
|
+
@images = @search.order(:title).page(params[:page])
|
14
|
+
end
|
15
|
+
|
16
|
+
def new
|
17
|
+
@image = Image.new
|
18
|
+
end
|
19
|
+
|
20
|
+
def create
|
21
|
+
@image = Image.new(params[:image])
|
22
|
+
if @image.save
|
23
|
+
redirect_to admin_images_path
|
24
|
+
else
|
25
|
+
render :new
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
@image = Image.find(params[:id])
|
31
|
+
end
|
32
|
+
|
33
|
+
def update
|
34
|
+
@image = Image.find(params[:id])
|
35
|
+
if @image.update_attributes(params[:image])
|
36
|
+
redirect_to admin_images_path
|
37
|
+
else
|
38
|
+
render :edit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def destroy
|
43
|
+
@image = Image.find(params[:id])
|
44
|
+
@image.destroy
|
45
|
+
redirect_to admin_images_path
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Admin
|
2
|
+
class VideosController < BaseController
|
3
|
+
|
4
|
+
layout "admin"
|
5
|
+
|
6
|
+
before_filter :authenticate_user!
|
7
|
+
access_control do
|
8
|
+
allow :admin
|
9
|
+
end
|
10
|
+
|
11
|
+
def index
|
12
|
+
@search = Video.search(params[:search])
|
13
|
+
@videos = @search.order(:title).page(params[:page])
|
14
|
+
end
|
15
|
+
|
16
|
+
def show
|
17
|
+
@video = Video.find(params[:id])
|
18
|
+
end
|
19
|
+
|
20
|
+
def new
|
21
|
+
@video = Video.new
|
22
|
+
3.times { @video.sources.build }
|
23
|
+
end
|
24
|
+
|
25
|
+
def create
|
26
|
+
@video = Video.new(params[:video])
|
27
|
+
if @video.save
|
28
|
+
redirect_to admin_videos_path
|
29
|
+
else
|
30
|
+
render :new
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def edit
|
35
|
+
@video = Video.find(params[:id])
|
36
|
+
n = 3 - @video.sources.size
|
37
|
+
n.times { @video.sources.build }
|
38
|
+
end
|
39
|
+
|
40
|
+
def update
|
41
|
+
@video = Video.find(params[:id])
|
42
|
+
if @video.update_attributes(params[:video])
|
43
|
+
redirect_to admin_videos_path
|
44
|
+
else
|
45
|
+
render :edit
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def destroy
|
50
|
+
@video = Video.find(params[:id])
|
51
|
+
@video.destroy
|
52
|
+
redirect_to admin_videos_path
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Admin
|
2
|
+
module BaseHelper
|
3
|
+
|
4
|
+
def render_subnav
|
5
|
+
if content_for?(:subnav)
|
6
|
+
yield(:subnav)
|
7
|
+
elsif File.exists?(File.join(File.dirname(__FILE__),'..','..','views',params[:controller],'_subnav.erb'))
|
8
|
+
render(:partial=> 'subnav')
|
9
|
+
else
|
10
|
+
render(:partial=> 'admin/shared/subnav')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -3,13 +3,9 @@ module Admin
|
|
3
3
|
|
4
4
|
def render_cat hash, options = {}, &block
|
5
5
|
sort_proc = options.delete :sort
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
block.call node, render_tree(hash[node], :sort => sort_proc, &block)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end if hash.present?
|
6
|
+
hash.keys.sort_by(&sort_proc).each do |node|
|
7
|
+
block.call node, render_tree(hash[node], :sort => sort_proc, &block)
|
8
|
+
end
|
13
9
|
end
|
14
10
|
|
15
11
|
def display_node(node)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Admin
|
2
|
+
module ImagesHelper
|
3
|
+
|
4
|
+
def display_image_links(image)
|
5
|
+
html = ""
|
6
|
+
html << "<strong>#{t('images.styles.original')}</strong> : #{image.image.url(:original, false)}<br/>"
|
7
|
+
image.image.styles.each do |style, file|
|
8
|
+
html << "<strong>#{t("images.styles.#{style}")}</strong> : #{image.image.url(style, false)}<br/>"
|
9
|
+
end
|
10
|
+
html
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Admin
|
2
|
+
module VideosHelper
|
3
|
+
|
4
|
+
def display_video_size(video)
|
5
|
+
main_source = video.sources.first
|
6
|
+
number_to_human_size main_source.video_file_size if main_source
|
7
|
+
end
|
8
|
+
|
9
|
+
def display_video(video, width=nil, height=nil)
|
10
|
+
return unless video
|
11
|
+
|
12
|
+
main_source = video.sources.first
|
13
|
+
if main_source.nil?
|
14
|
+
html = "<p>#{t('videos.no_source')}</p>"
|
15
|
+
return html
|
16
|
+
end
|
17
|
+
|
18
|
+
width = width ? width : main_source.width
|
19
|
+
height = height ? height : main_source.height
|
20
|
+
poster = main_source.video.url(:poster, false)
|
21
|
+
flash_player = 'http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf'
|
22
|
+
video_alt = 'Poster image'
|
23
|
+
poster_title = video.title
|
24
|
+
|
25
|
+
sources = video.sources.map do |source|
|
26
|
+
{ :src => "http://localhost:3000#{source.video.url(:original, false)}", :type => "#{source.video_content_type}" }
|
27
|
+
end
|
28
|
+
|
29
|
+
html = ""
|
30
|
+
|
31
|
+
html << "<div class='video-js-box vim-css'>"
|
32
|
+
|
33
|
+
html << "<video id='example_video_1' class='video-js' width='#{width}' height='#{height}' controls='controls' preload='auto' poster='#{poster}'>"
|
34
|
+
|
35
|
+
sources.each do |source|
|
36
|
+
html << "<source src='#{source[:src]}' type='#{source[:type]}' />"
|
37
|
+
end
|
38
|
+
|
39
|
+
html << "<object id='flash_fallback_1' class='vjs-flash-fallback' width='#{width}' height='#{height}' type='application/x-shockwave-flash' data='#{flash_player}'>"
|
40
|
+
html << "<param name='movie' value='#{flash_player}' />"
|
41
|
+
html << "<param name='allowfullscreen' value='true' />"
|
42
|
+
html << "<param name='flashvars' value='config={\"playlist\":[\"#{poster}\", {\"url\":\"#{sources[0][:src]}\",\"autoPlay\":false,\"autoBuffering\":true}]}' />"
|
43
|
+
|
44
|
+
html << "<img src='#{poster}' width='#{width}' height='#{height}' alt='#{video_alt}' title='#{poster_title}' />"
|
45
|
+
html << "</object>"
|
46
|
+
html << "</video>"
|
47
|
+
html << "</div>"
|
48
|
+
|
49
|
+
html
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
data/app/models/image.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
class Image < ActiveRecord::Base
|
2
|
+
include ValidatesAsImage
|
3
|
+
|
4
|
+
has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :whiny => false
|
5
|
+
validates_attachment_presence :image, :message => I18n.t('activerecord.errors.models.image.attributes.image.blank')
|
6
|
+
validates_as_image :image
|
7
|
+
validates_presence_of :title
|
8
|
+
|
9
|
+
end
|
data/app/models/video.rb
ADDED
@@ -8,7 +8,7 @@
|
|
8
8
|
<th><%= t('categories.link') %></th>
|
9
9
|
<th></th>
|
10
10
|
</tr>
|
11
|
-
|
11
|
+
<% render_cat @categories, :sort => lambda{|x| x.position } do |node, child| %>
|
12
12
|
<tr>
|
13
13
|
<td><%= display_node(node) %></td>
|
14
14
|
<td><%= node.link %></td>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_for [:admin, @document], :html => { :multipart => true } do |f| %>
|
2
|
+
<%= render "shared/error_messages", :target => @document %>
|
3
|
+
<div>
|
4
|
+
<%= f.label :title, t('documents.title'), :class => "desc required" %>
|
5
|
+
<%= f.text_field :title, :size => "80" %>
|
6
|
+
</div>
|
7
|
+
<div>
|
8
|
+
<%= f.label :doc, t('documents.doc_field') %>
|
9
|
+
<%= f.file_field :doc %>
|
10
|
+
</div>
|
11
|
+
<div>
|
12
|
+
<%= f.submit t('documents.submit') %>
|
13
|
+
<%= link_to t('cancel'), admin_documents_path %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% if @document.id %>
|
18
|
+
<%= form_for [:admin, @document], :html => { :method => "delete" } do |f| %>
|
19
|
+
<input type="hidden" name="_method" value="delete" />
|
20
|
+
<button type="submit"><%= t('documents.delete') %></button>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= form_for @search, :url => admin_documents_path, :html => {:method => :get, :class => 'search'} do |f| %>
|
2
|
+
<div>
|
3
|
+
<h3><%= t('documents.search.title') %></h3>
|
4
|
+
<div class='top'>
|
5
|
+
<%= f.label :title_contains, t('documents.search.document_title'), :class => 'desc' %>
|
6
|
+
<%= f.text_field :title_contains, :size => "20" %>
|
7
|
+
</div>
|
8
|
+
<div class='top'>
|
9
|
+
<label> </label>
|
10
|
+
<p>
|
11
|
+
<%= f.submit t('documents.search.submit') %>
|
12
|
+
</p>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1><%= t('documents.index.title') %></h1>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<%= link_to t('documents.links.new'), new_admin_document_path, :class => 'button' %>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<%= render "search" %>
|
8
|
+
|
9
|
+
<%= paginate @documents %>
|
10
|
+
|
11
|
+
<table>
|
12
|
+
<tr>
|
13
|
+
<th><%= t('documents.title') %></th>
|
14
|
+
<th><%= t('documents.link') %></th>
|
15
|
+
<th><%= t('documents.file_size') %></th>
|
16
|
+
</tr>
|
17
|
+
<% for document in @documents %>
|
18
|
+
<tr>
|
19
|
+
<td><%= link_to document.title, edit_admin_document_path(document) %></td>
|
20
|
+
<td><%= document.doc.url(:original, false) %></td>
|
21
|
+
<td><%= number_to_human_size document.doc_file_size %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</table>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_for [:admin, @image], :html => { :multipart => true } do |f| %>
|
2
|
+
<%= render "shared/error_messages", :target => @image %>
|
3
|
+
<div>
|
4
|
+
<%= f.label :title, t('images.title'), :class => "desc required" %>
|
5
|
+
<%= f.text_field :title, :size => "80" %>
|
6
|
+
</div>
|
7
|
+
<div>
|
8
|
+
<%= f.label :image, t('images.image_field') %>
|
9
|
+
<%= f.file_field :image %>
|
10
|
+
</div>
|
11
|
+
<div>
|
12
|
+
<%= f.submit t('images.submit') %>
|
13
|
+
<%= link_to t('cancel'), admin_images_path %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% if @image.id %>
|
18
|
+
<%= form_for [:admin, @image], :html => { :method => "delete" } do |f| %>
|
19
|
+
<input type="hidden" name="_method" value="delete" />
|
20
|
+
<button type="submit"><%= t('images.delete') %></button>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= form_for @search, :url => admin_images_path, :html => {:method => :get, :class => 'search'} do |f| %>
|
2
|
+
<div>
|
3
|
+
<h3><%= t('images.search.title') %></h3>
|
4
|
+
<div class='top'>
|
5
|
+
<%= f.label :title_contains, t('images.search.image_title'), :class => 'desc' %>
|
6
|
+
<%= f.text_field :title_contains, :size => "20" %>
|
7
|
+
</div>
|
8
|
+
<div class='top'>
|
9
|
+
<label> </label>
|
10
|
+
<p>
|
11
|
+
<%= f.submit t('images.search.submit') %>
|
12
|
+
</p>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<h1><%= t('images.index.title') %></h1>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<%= link_to t('images.links.new'), new_admin_image_path, :class => 'button' %>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<%= render "search" %>
|
8
|
+
|
9
|
+
<%= paginate @images %>
|
10
|
+
|
11
|
+
<table>
|
12
|
+
<tr>
|
13
|
+
<th width="100"><%= t('images.thumb') %></th>
|
14
|
+
<th><%= t('images.title') %></th>
|
15
|
+
<th><%= t('images.link') %></th>
|
16
|
+
<th><%= t('images.file_size') %></th>
|
17
|
+
</tr>
|
18
|
+
<% for image in @images %>
|
19
|
+
<tr>
|
20
|
+
<td><%= image_tag image.image.url(:thumb), :class => 'thumb' %></td>
|
21
|
+
<td><%= link_to image.title, edit_admin_image_path(image) %></td>
|
22
|
+
<td><%=raw display_image_links(image) %></td>
|
23
|
+
<td><%= number_to_human_size image.image_file_size %></td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</table>
|
@@ -14,20 +14,14 @@
|
|
14
14
|
<th><%= t('pages.state') %></th>
|
15
15
|
<th></th>
|
16
16
|
</tr>
|
17
|
-
<%
|
17
|
+
<% @pages.each do |page| %>
|
18
18
|
<tr>
|
19
|
-
<td
|
19
|
+
<td><%= link_to page.title, edit_admin_page_path(page) %></a></td>
|
20
|
+
<td><%= page.link %></td>
|
21
|
+
<td><%= display_page_category(page) %></td>
|
22
|
+
<td><%= display_state(page) %></td>
|
23
|
+
<td><%= display_events(page) %></td>
|
20
24
|
</tr>
|
21
|
-
<% else %>
|
22
|
-
<% @pages.each do |page| %>
|
23
|
-
<tr>
|
24
|
-
<td><%= link_to page.title, edit_admin_page_path(page) %></a></td>
|
25
|
-
<td><%= page.link %></td>
|
26
|
-
<td><%= display_page_category(page) %></td>
|
27
|
-
<td><%= display_state(page) %></td>
|
28
|
-
<td><%= display_events(page) %></td>
|
29
|
-
</tr>
|
30
|
-
<% end %>
|
31
25
|
<% end %>
|
32
26
|
</table>
|
33
27
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div id="nav">
|
2
|
+
<ul class="left">
|
3
|
+
<li><%= link_to t('admin.nav.pages'), admin_pages_path %></li>
|
4
|
+
<li><%= link_to t('admin.nav.categories'), admin_categories_path %></li>
|
5
|
+
<li><%= link_to t('admin.nav.translations'), admin_translations_path %></li>
|
6
|
+
<li><%= link_to t('admin.nav.media'), admin_images_path %></li>
|
7
|
+
</ul>
|
8
|
+
<ul class="right">
|
9
|
+
<li><%= link_to t('admin.nav.users'), admin_users_path %></li>
|
10
|
+
</ul>
|
11
|
+
</div>
|
File without changes
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<div id="toplinks">
|
2
2
|
<% if user_signed_in? %>
|
3
|
-
<%= t('admin.signed_in_as', :user => current_user.email) %>.
|
4
|
-
<%= link_to t('.sign_out'), destroy_user_session_path %>
|
3
|
+
<%= t('admin.toplinks.signed_in_as', :user => current_user.email) %>.
|
4
|
+
<%= link_to t('admin.toplinks.sign_out'), destroy_user_session_path %>
|
5
5
|
<% else %>
|
6
|
-
<%= link_to t('.sign_up'), new_user_registration_path %> <%= t('.or') %> <%= link_to t('.sign_in'), new_user_session_path %>
|
6
|
+
<%= link_to t('admin.toplinks.sign_up'), new_user_registration_path %> <%= t('.or') %> <%= link_to t('admin.toplinks.sign_in'), new_user_session_path %>
|
7
7
|
<% end %>
|
8
|
-
<a href='/'><%= t('admin.website_home') %></a>
|
8
|
+
<a href='/'><%= t('admin.toplinks.website_home') %></a>
|
9
9
|
</div>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<%= form_for [:admin, @video], :html => { :multipart => true } do |f| %>
|
2
|
+
<%= render "shared/error_messages", :target => @video %>
|
3
|
+
<div>
|
4
|
+
<%= f.label :title, t('videos.title'), :class => "desc required" %>
|
5
|
+
<%= f.text_field :title, :size => "80" %>
|
6
|
+
</div>
|
7
|
+
<h3><%= t('videos.sources.title') %></h3>
|
8
|
+
<%=raw t('videos.sources.instruct') %>
|
9
|
+
|
10
|
+
<% @index = 0 %>
|
11
|
+
<%= f.fields_for :sources do |source_form| %>
|
12
|
+
<div>
|
13
|
+
<%= source_form.label :video, t('videos.sources.file') %>
|
14
|
+
<%= source_form.object.attributes['video_file_name'] %>
|
15
|
+
<%= source_form.file_field :video %>
|
16
|
+
<%= source_form.label :container_type, t('videos.sources.container_type')%>
|
17
|
+
<%= source_form.hidden_field :container_type, :value => source_form.object.attributes[:container_type] || Source::CONTAINER_TYPES[@index] %>
|
18
|
+
<%= source_form.object.attributes[:container_type] || Source::CONTAINER_TYPES[@index] %>
|
19
|
+
<% if source_form.object.attributes && source_form.object.attributes['video_file_size'] %>
|
20
|
+
<strong><%= t('videos.file_size') %></strong>
|
21
|
+
<%= number_to_human_size source_form.object.attributes['video_file_size'] %>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
<% @index += 1 %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<div>
|
28
|
+
<%= f.submit t('videos.submit') %>
|
29
|
+
<%= link_to t('cancel'), admin_videos_path %>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<% if @video.id %>
|
34
|
+
<%= form_for [:admin, @video], :html => { :method => "delete" } do |f| %>
|
35
|
+
<input type="hidden" name="_method" value="delete" />
|
36
|
+
<button type="submit"><%= t('videos.delete') %></button>
|
37
|
+
<% end %>
|
38
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% content_for :head do %>
|
2
|
+
<link rel="stylesheet" href="/stylesheets/video-js.css" type="text/css" media="screen" title="Video JS">
|
3
|
+
<link rel="stylesheet" href="/stylesheets/skins/vim.css" type="text/css" media="screen" title="Video JS">
|
4
|
+
<link rel="stylesheet" href="/stylesheets/skins/hu.css" type="text/css" media="screen" title="Video JS">
|
5
|
+
|
6
|
+
<script src="/javascripts/video.js" type="text/javascript" charset="utf-8"></script>
|
7
|
+
|
8
|
+
<script type="text/javascript">
|
9
|
+
$(function(){
|
10
|
+
$("video").VideoJS()
|
11
|
+
});
|
12
|
+
</script>
|
13
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= form_for @search, :url => admin_videos_path, :html => {:method => :get, :class => 'search'} do |f| %>
|
2
|
+
<div>
|
3
|
+
<h3><%= t('videos.search.title') %></h3>
|
4
|
+
<div class='top'>
|
5
|
+
<%= f.label :title_contains, t('videos.search.video_title'), :class => 'desc' %>
|
6
|
+
<%= f.text_field :title_contains, :size => "20" %>
|
7
|
+
</div>
|
8
|
+
<div class='top'>
|
9
|
+
<label> </label>
|
10
|
+
<p>
|
11
|
+
<%= f.submit t('videos.search.submit') %>
|
12
|
+
</p>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<% end %>
|