Change to apply page to had object_auth

This commit is contained in:
Matthew K. Fu JuYuan authored and Christophe Vilayphiou committed 2012-05-14 12:40:50 +08:00
1 parent f0dd1eb871
commit 9ba4c2cf2f
15 files changed
+95 -11

No files matched your search

@@ -10,7 +10,7 @@ class BulletinCategory
# include Mongoid::MultiParameterAttributes
PAYMENT_TYPES = [ "List", "Picture" ]
APP_NAME = 'Announcement'
field :key
field :display
@@ -10,7 +10,8 @@ class NewsBulletinCategory
# include Mongoid::MultiParameterAttributes
PAYMENT_TYPES = [ "List", "Picture" ]
APP_NAME = 'news'
field :key
field :display
@@ -1,7 +1,8 @@
class Panel::PageContent::BackEnd::PageContextsController < OrbitBackendController
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :for_app_manager,:except => [:index,:edit,:update,:view,:show]
before_filter :for_app_sub_manager,:only => [:edit,:update,:view,:show]
:authenticate_user!
#before_filter :is_admin?
def index
@@ -4,7 +4,9 @@ class PageContext
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include OrbitCoreLib::ObjectAuthable
has_one :context, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
@@ -17,6 +19,14 @@ class PageContext
belongs_to :page
AfterObjectAuthUrl = '/panel/page_content/back_end/page_contexts'
APP_NAME = 'page_content'
ObjectAuthTitlesOptions = %W{Edit}
def pp_object
page.i18n_variable[I18n.locale]
end
def is_top?
self.is_top
end
@@ -4,11 +4,20 @@
<%= page_context.page.path %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('page_context.edit'), edit_panel_page_content_back_end_page_context_path(page_context) %></li>
<%if is_manager? || is_admin? || page_context.authed_users(:edit).include?(current_user)%>
<li><%= link_to t('admin.page_context.edit'), edit_panel_page_content_back_end_page_context_path(page_context) %></li>
<%if (is_manager? || is_admin?) %>
<li><%=show_page_context_edit_auth_link page_context%></li>
<% end%>
<% end -%>
</ul>
</div>
</td>
<td><%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %></td>
<td>
<%if is_manager? || is_admin? || page_context.authed_users(:edit).include?(current_user)%>
<%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %>
<%end -%>
</td>
<td><%= page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %></td>
<td><%= User.find(page_context.create_user_id).name %></td>
</tr>