Commit 4825fe8744c709e3f121e2433bd538e2835e285c

Authored by Junior Silva
1 parent 47669af4

article-version: improvements in article versions navegability. Added buttons

and warnings.
AI2822
app/views/content_viewer/article_versions.rhtml
1 -<% button_bar do %>  
2 - <%= button(:back, _('Back to the post'), {:action => 'view_page'}) %>  
3 -<% end %> 1 +<div class="article-versions">
  2 + <%= button(:back, _('Go back to post'), {:action => 'view_page'}) %>
  3 +</div>
4 4
5 <%= article_title(@page, :no_link => true) %> 5 <%= article_title(@page, :no_link => true) %>
6 6
app/views/content_viewer/versioned_article.rhtml
1 -<% button_bar do %> 1 +<div class="article-versions">
2 <%= button(:back, _('Back to the versions'), {:action => 'article_versions'}) %> 2 <%= button(:back, _('Back to the versions'), {:action => 'article_versions'}) %>
3 -<% end %>  
4 -  
5 -<% button_bar do %>  
6 - <%= button(:back, _('Go to current version'), {:action => 'view_page'}) %>  
7 -<% end %> 3 +</div>
8 4
9 <div id="article" class="<%= @page.css_class_name %>"> 5 <div id="article" class="<%= @page.css_class_name %>">
10 6
11 <div id="article-actions"> 7 <div id="article-actions">
12 <%= button(:clock, _('All versions'), {:controller => 'content_viewer', :profile => profile.identifier, :action => 'article_versions'}, :id => 'article-versions-link') %> 8 <%= button(:clock, _('All versions'), {:controller => 'content_viewer', :profile => profile.identifier, :action => 'article_versions'}, :id => 'article-versions-link') %>
13 9
14 - <% if @page.allow_edit?(user) && !remove_content_button(:edit) %> 10 + <% if @page.allow_edit?(user) && !remove_content_button(:undo) %>
15 <% content = content_tag('span', _('Revert to this version')) %> 11 <% content = content_tag('span', _('Revert to this version')) %>
16 <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id, :version => @version }) %> 12 <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id, :version => @version }) %>
17 - <%= expirable_button @page, :edit, content, url, :id => 'article-revert-version-link' %> 13 + <%= expirable_button @page, :undo, content, url, :id => 'article-revert-version-link' %>
18 <% end %> 14 <% end %>
19 - </div> 15 +
  16 + <%= button(:forward, _('Go to latest version'), {:action => 'view_page'}) %>
  17 +</div>
20 18
21 <div id="article-header"> 19 <div id="article-header">
22 <h1 class='title'><%= @versioned_article.name %></h1> 20 <h1 class='title'><%= @versioned_article.name %></h1>
23 <%= _("Version %{version} - %{author} on %{date}") % {:version => @version, :author => @page.author_name(@version), :date => show_time(@versioned_article.updated_at) } %> 21 <%= _("Version %{version} - %{author} on %{date}") % {:version => @version, :author => @page.author_name(@version), :date => show_time(@versioned_article.updated_at) } %>
24 </div> 22 </div>
25 23
26 -<i><%= _('This is not the current version.') %>.</i> 24 +<p id="no-current-version">
  25 + <%= _('This is not the latest version of this content.') %>
  26 +</p>
  27 +</div>
27 28
28 <% if @page.version_license(@version).present? %> 29 <% if @page.version_license(@version).present? %>
29 <div id='article-sub-header'> 30 <div id='article-sub-header'>
app/views/content_viewer/versions_diff.html.erb
1 -<% button_bar do %>  
2 - <%= button(:back, _('Back to the versions'), {:action => 'article_versions'}) %>  
3 -<% end %> 1 +<div class="article-versions">
  2 +<%= button(:back, _('Back to the versions'), {:action => 'article_versions'}) %>
  3 +</div>
4 4
5 <h1><%= _('Changes on "%s"') % @page.title %></h1> 5 <h1><%= _('Changes on "%s"') % @page.title %></h1>
6 6
7 <p> <%= _('Changes from %s &rarr; %s') % [show_time(@v1.updated_at), show_time(@v2.updated_at)] %> </p> 7 <p> <%= _('Changes from %s &rarr; %s') % [show_time(@v1.updated_at), show_time(@v2.updated_at)] %> </p>
8 8
9 -<% temp = Diffy::Diff.new(@v1.body, @v2.body, :context => 1).to_s(:text).blank? %>  
10 -<% if temp %>  
11 - <i><%= _('These versions are equals!')%></i> 9 +<% diffContent = Diffy::Diff.new(@v1.body, @v2.body, :context => 1) %>
  10 +<% if diffContent.to_s(:text).blank? %>
  11 + <p id="article-versions-no-diff">
  12 + <%= _('These versions range have no differences.')%>
  13 + </p>
12 <% else %> 14 <% else %>
13 - <%= Diffy::Diff.new(@v1.body, @v2.body, :context => 1).to_s(:html) %> 15 + <%= diffContent.to_s(:html) %>
14 <% end %> 16 <% end %>
public/designs/icons/tango/style.css
1 /******************SMALL ICONS********************/ 1 /******************SMALL ICONS********************/
2 .icon-edit { background-image: url(Tango/16x16/apps/text-editor.png) } 2 .icon-edit { background-image: url(Tango/16x16/apps/text-editor.png) }
  3 +.icon-undo { background-image: url(Tango/16x16/actions/edit-undo.png) }
3 .icon-home { background-image: url(Tango/16x16/actions/go-home.png) } 4 .icon-home { background-image: url(Tango/16x16/actions/go-home.png) }
4 .icon-home-not { background-image: url(mod/16x16/actions/go-home-not.png) } 5 .icon-home-not { background-image: url(mod/16x16/actions/go-home-not.png) }
5 .icon-new, 6 .icon-new,
public/stylesheets/application.css
@@ -6558,6 +6558,23 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img { @@ -6558,6 +6558,23 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
6558 background: #ff9; 6558 background: #ff9;
6559 } 6559 }
6560 6560
  6561 +#article-versions-no-diff {
  6562 + text-align: center;
  6563 + font-style: italic;
  6564 +}
  6565 +
  6566 +#no-current-version {
  6567 + text-align: center;
  6568 + font-style: italic;
  6569 + background: #faa;
  6570 + padding: 3px;
  6571 +}
  6572 +
  6573 +.article-versions {
  6574 + margin: 5px 0px;
  6575 + text-align: right;
  6576 +}
  6577 +
6561 .action-content_viewer-versions_diff .diff { 6578 .action-content_viewer-versions_diff .diff {
6562 text-align: justify; 6579 text-align: justify;
6563 } 6580 }