added edit mode button in frontend

This commit is contained in:
Harry Bomrah 2015-05-12 17:30:45 +08:00
parent a160c6b020
commit 694f839217
2 changed files with 11 additions and 0 deletions

View File

@ -31,6 +31,7 @@ class PagesController < ApplicationController
impressionist(page)
page.inc(view_count: 1)
end
params[:is_frontend_view] = "true"
OrbitHelper.set_params params,current_user
OrbitHelper.set_site_locale locale
render :html => render_final_page("home",page,true).html_safe
@ -39,6 +40,7 @@ class PagesController < ApplicationController
def show
display_type = ""
path = request.path.split('/')
params[:is_frontend_view] = "true"
if path.size <= 2
redirect_to root_path
else

View File

@ -138,6 +138,15 @@
<ul>
<li><%= link_to content_tag(:i, nil, class: 'icons-tools') + ' ' + t("users.change_passwd"),admin_member_edit_passwd_path(current_user.member_profile.to_param), tabindex: '-1' %></li>
<li><%= link_to content_tag(:i, nil, class: 'icons-vcard') + ' ' + t("users.user_basic_data"),admin_member_path(current_user.member_profile.to_param), tabindex: '-1' %></li>
<% if current_user.is_admin? && params[:is_frontend_view] == "true" %>
<li>
<% if params[:editmode] == "on" %>
<a tabindex="-1" href="<%= request.fullpath.split("?").first %>" style="color:red;"><i class="icons-bolt"></i>Edit Mode Off</a>
<% else %>
<a tabindex="-1" href="<%= request.fullpath + "?editmode=on" %>"><i class="icons-bolt"></i>Edit Mode On</a>
<% end %>
</li>
<% end %>
<li>
<a href="/logout"><i class="icons-logout"></i><%= t(:logout) %></a>
</li>