Commit 5cd25bf876ed3276d0a2e7b3ddc2c10c99db5f6c

Authored by Daniela Feitosa
1 parent 658ecf81

Reverting now is working

Removed setting as versioned column
revert button is following the pattern
styling link-this-page

(ActionItem2822)
app/controllers/my_profile/cms_controller.rb
... ... @@ -68,6 +68,9 @@ class CmsController < MyProfileController
68 68 def edit
69 69 @success_back_to = params[:success_back_to]
70 70 @article = profile.articles.find(params[:id])
  71 + version = params[:version]
  72 + @article.revert_to(version) if version
  73 +
71 74 @parent_id = params[:parent_id]
72 75 @type = params[:type] || @article.class.to_s
73 76 translations if @article.translatable?
... ...
app/models/article.rb
... ... @@ -201,6 +201,7 @@ class Article < ActiveRecord::Base
201 201 acts_as_filesystem
202 202  
203 203 acts_as_versioned
  204 + self.non_versioned_columns << 'setting'
204 205  
205 206 def comment_data
206 207 comments.map {|item| [item.title, item.body].join(' ') }.join(' ')
... ...
app/views/content_viewer/versioned_article.rhtml
1 1 <div id="article" class="<%= @page.css_class_name %>">
2 2  
3   - <% if @page.allow_edit?(user) && !remove_content_button(:edit) %>
4   - <div id="article-revert-version">
5   - <% content = content_tag('span', _('Revert to this version')) %>
6   - <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id, :article => @versioned_article.attributes }) %>
7   - <%= expirable_button @page, :edit, content, url %>
  3 + <div id="article-actions">
  4 + <% if @page.allow_edit?(user) && !remove_content_button(:edit) %>
  5 + <div id="article-revert-version">
  6 + <% content = content_tag('span', _('Revert to this version')) %>
  7 + <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id, :version => @version }) %>
  8 + <%= expirable_button @page, :edit, content, url %>
  9 + </div>
8 10 <% end %>
9   -
10 11 </div>
11 12  
12 13 <div id="article-header">
... ...
public/stylesheets/application.css
... ... @@ -6548,3 +6548,9 @@ ul.article-versions li {
6548 6548 font-size: 13px;
6549 6549 }
6550 6550  
  6551 +#article ul.article-versions a.link-this-page {
  6552 + text-decoration: none;
  6553 + opacity: 0.5;
  6554 + filter: alpha(opacity=50);
  6555 +
  6556 +}
... ...