Commit 316925aec8348f4c985e1ed3c1c350ecc581cee3

Authored by Daniela Feitosa
1 parent d488fa59

video plugin: rename block type on database

Also, small fixes on forms
app/views/cms/edit.html.erb
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <%= render :partial => 'archived_warning', :locals => {:article => @article} %> 4 <%= render :partial => 'archived_warning', :locals => {:article => @article} %>
5 <% end %> 5 <% end %>
6 <div class='<%= (@article.display_media_panel? ? 'with_media_panel' : 'no_media_panel') %>'> 6 <div class='<%= (@article.display_media_panel? ? 'with_media_panel' : 'no_media_panel') %>'>
7 -<%= labelled_form_for 'article', :html => { :multipart => true, :class => @type } do |f| %> 7 +<%= labelled_form_for 'article', :html => { :multipart => true, :class => "#{@type} #{@type.to_css_class}" } do |f| %>
8 8
9 <%= hidden_field_tag("type", @type) if @type %> 9 <%= hidden_field_tag("type", @type) if @type %>
10 10
plugins/video/db/migrate/20160115185550_rename_video_block.rb 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +class RenameVideoBlock < ActiveRecord::Migration
  2 + def up
  3 + execute("UPDATE blocks SET type = 'VideoPlugin::VideoBlock' WHERE type = 'VideoBlock'")
  4 + end
  5 +
  6 + def down
  7 + say "this migration can't be reverted"
  8 + end
  9 +end
  10 +
plugins/video/public/style.css
@@ -63,4 +63,9 @@ @@ -63,4 +63,9 @@
63 width: 100%; 63 width: 100%;
64 margin-left: auto; 64 margin-left: auto;
65 margin-right: auto; 65 margin-right: auto;
66 -}  
67 \ No newline at end of file 66 \ No newline at end of file
  67 +}
  68 +
  69 +form.video-plugin_video .type-text input,
  70 +form.video-plugin_video .type-textarea textarea {
  71 + width: 100%;
  72 +}
plugins/video/views/cms/video_plugin/_video.html.erb
1 <%= required_fields_message %> 1 <%= required_fields_message %>
2 2
3 <div> 3 <div>
4 -<%= required f.text_field('name', :size => '64', :maxlength => 150) %>  
5 -<%= required labelled_form_field _('URL of the video'), text_field(:article, :video_url, :size => 80) %> 4 +<%= required f.text_field('name') %>
  5 +<%= required labelled_form_field _('URL of the video'), text_field(:article, :video_url) %>
6 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %> 6 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %>
7 <%= render :partial => 'general_fields' %> 7 <%= render :partial => 'general_fields' %>
8 <%= render :partial => 'translatable' %> 8 <%= render :partial => 'translatable' %>
plugins/video/views/cms/video_plugin/_video_gallery.html.erb
1 <%= required_fields_message %> 1 <%= required_fields_message %>
2 2
3 -<%= required f.text_field('name', :size => '64', :maxlength => 150) %> 3 +<%= required f.text_field('name', :maxlength => 150) %>
4 <%= render :partial => 'general_fields' %> 4 <%= render :partial => 'general_fields' %>
5 5
6 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %> 6 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %>
test/functional/cms_controller_test.rb
@@ -1738,7 +1738,7 @@ class CmsControllerTest &lt; ActionController::TestCase @@ -1738,7 +1738,7 @@ class CmsControllerTest &lt; ActionController::TestCase
1738 [Blog, TinyMceArticle, Forum].each do |klass| 1738 [Blog, TinyMceArticle, Forum].each do |klass|
1739 a = fast_create(klass, :profile_id => profile.id) 1739 a = fast_create(klass, :profile_id => profile.id)
1740 get :edit, :profile => profile.identifier, :id => a.id 1740 get :edit, :profile => profile.identifier, :id => a.id
1741 - assert_tag :tag => 'form', :attributes => {:class => klass.to_s} 1741 + assert_tag :tag => 'form', :attributes => {:class => "#{a.type} #{a.type.to_css_class}"}
1742 end 1742 end
1743 end 1743 end
1744 1744