Commit 067a2a2d340a22058f239de75caf2a71ea4e7335

Authored by Lucas Melo
1 parent 1b7dcab6

articles, profiles: stop using ajax for some logged-in stuff

app/controllers/public/content_viewer_controller.rb
... ... @@ -43,11 +43,6 @@ class ContentViewerController < ApplicationController
43 43 return
44 44 end
45 45  
46   - if request.xhr? && params[:toolbar]
47   - render :partial => 'article_toolbar'
48   - return
49   - end
50   -
51 46 redirect_to_translation if @page.profile.redirect_l10n
52 47  
53 48 # At this point the page will be showed
... ...
app/views/blocks/profile_image.rhtml
... ... @@ -14,11 +14,13 @@
14 14 <p><%= h block.owner.short_name %></p>
15 15 <% end %>
16 16  
17   -<div style="text-align: center; font-size: 75%; clear: both" id="profile-admin-url-<%= block.id %>"></div>
18   -
19   -<div class="profile-info-options" id="profile-info-options-<%= block.id %>"></div>
  17 +<% if !user.nil? and user.has_permission?('edit_profile', profile) %>
  18 + <div class='admin-link'>
  19 + <%= link_to _('Control panel'), :controller => 'profile_editor' %>
  20 + </div>
  21 +<% end %>
20 22  
  23 +<div class="profile-info-options">
  24 + <%= render :file => view_for_profile_actions(block.owner.class) %>
  25 +</div>
21 26 </div><!-- end class="vcard" -->
22   -<script type="text/javascript">
23   - <%= remote_function :url => { :controller => 'profile', :profile => profile.identifier, :action => 'profile_info', :block_id => block.id } %>
24   -</script>
... ...
app/views/blocks/profile_info.rhtml
... ... @@ -14,13 +14,15 @@
14 14 </div>
15 15 </div>
16 16  
17   -<ul class="profile-info-data" id="profile-info-data-<%= block.id %>">
  17 +<ul class="profile-info-data">
18 18 <li><%= link_to __('Homepage'), block.owner.url, :class => 'url' %></li>
19 19 <li><%= link_to _('View profile'), block.owner.public_profile_url %></li>
20 20 <% if block.owner.enterprise? && !block.owner.environment.enabled?('disable_products_for_enterprises') %>
21 21 <li><%= link_to(_('Products/Services'), :controller => 'catalog', :profile => block.owner.identifier) %></li>
22 22 <% end %>
23   - <li id="profile-admin-url-<%= block.id %>"></li>
  23 + <% if !user.nil? and user.has_permission?('edit_profile', profile) %>
  24 + <li><%= link_to _('Control panel'), :controller => 'profile_editor' %></li>
  25 + <% end %>
24 26 <% if profile.person? %>
25 27 <li><%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %></li>
26 28 <% end %>
... ... @@ -37,9 +39,8 @@
37 39 </div>
38 40 <% end %>
39 41  
40   -<div class="profile-info-options" id="profile-info-options-<%= block.id %>"></div>
  42 +<div class="profile-info-options">
  43 + <%= render :file => view_for_profile_actions(@block.owner.class) %>
  44 +</div>
41 45  
42 46 </div><!-- end class="vcard" -->
43   -<script type="text/javascript">
44   - <%= remote_function :url => { :controller => 'profile', :profile => profile.identifier, :action => 'profile_info', :block_id => block.id } %>
45   -</script>
... ...
app/views/content_viewer/view_page.rhtml
... ... @@ -14,11 +14,9 @@
14 14 window.NO_COMMENT_YET = "<%= _('No comments yet') %>";
15 15 </script>
16 16  
17   -<div id="article-toolbar"></div>
18   -
19   -<script type="text/javascript">
20   - <%= remote_function :update => "article-toolbar", :url => @page.url.merge({ :toolbar => true, :only_path => true }) %>
21   -</script>
  17 +<div id="article-toolbar">
  18 + <%= render :partial => 'article_toolbar' %>
  19 +</div>
22 20  
23 21 <% if @page.display_hits? || @page.license.present? %>
24 22 <div id='article-sub-header'>
... ...
app/views/profile/profile_info.rjs
... ... @@ -1,6 +0,0 @@
1   -if !user.nil? and user.has_permission?('edit_profile', profile)
2   - page.replace_html "profile-admin-url-#{@block.id}", link_to(_('Control panel'), @block.owner.admin_url)
3   -else
4   - page.hide "profile-admin-url-#{@block.id}"
5   -end
6   -page.replace_html "profile-info-options-#{@block.id}", :file => view_for_profile_actions(@block.owner.class)
public/designs/themes/base/style.css
... ... @@ -575,6 +575,12 @@ div#notice {
575 575 color: #555;
576 576 }
577 577  
  578 +.profile-image-block .admin-link {
  579 + text-align: center;
  580 + font-size: 75%;
  581 + clear: both;
  582 +}
  583 +
578 584  
579 585 /*************************** My Network ******************************/
580 586  
... ...