authorization fixed

This commit is contained in:
Harry Bomrah 2016-05-12 19:46:24 +08:00
parent 2da2e1e502
commit 0edcec7c2b
4 changed files with 6 additions and 5 deletions

View File

@ -1,9 +1,10 @@
class Admin::TextMarqueesController < OrbitAdminController class Admin::TextMarqueesController < OrbitAdminController
def index def index
@tags = @module_app.tags @tags = @module_app.tags
uac = @module_app.categories.enabled.authorized(current_user) if @user_authorized_categories.nil?
categories = @module_app.categories.enabled categories = @module_app.categories.enabled
@filter_fields = filter_fields(categories, @tags) @filter_fields = filter_fields(categories, @tags)
@categories = categories.collect{|c|[c.title, c.id]} @categories = uac.collect{|c|[c.title, c.id]}
@table_fields = [:title, :category] @table_fields = [:title, :category]
@marquees = Marquee.where(:title.ne => "") @marquees = Marquee.where(:title.ne => "")
.order_by(sort) .order_by(sort)

View File

@ -3,7 +3,7 @@
<a href="<%= text.url %>" target="_blank"><%= text.title %></a> <a href="<%= text.url %>" target="_blank"><%= text.title %></a>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<% if can_edit_or_delete?(text) %> <% if can_edit_or_delete?(@marquee) %>
<li><a href="<%= admin_text_marquee_edittext_path(text) %>"> <li><a href="<%= admin_text_marquee_edittext_path(text) %>">
<%= t(:edit) %> <%= t(:edit) %>
</a> </a>

View File

@ -15,7 +15,7 @@
</div> </div>
<div class="pagination pagination-centered"></div> <div class="pagination pagination-centered"></div>
</div> </div>
<% end %>
<div id="pageslide"> <div id="pageslide">
<div class="page-title clearfix"> <div class="page-title clearfix">
<a class="pull-right" href="javascript:$.pageslide.close()"> <a class="pull-right" href="javascript:$.pageslide.close()">
@ -40,7 +40,7 @@
</div> </div>
</div> </div>
<% end %>
<%= render 'layouts/delete_modal', delete_options: @delete_options %> <%= render 'layouts/delete_modal', delete_options: @delete_options %>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -12,7 +12,7 @@
</tbody> </tbody>
</div> </div>
<% if current_user.is_admin? or current_user.is_manager?(@module_app) %> <% if can_edit_or_delete?(@marquee) %>
<div class="bottomnav clearfix" style="left: 81px;"> <div class="bottomnav clearfix" style="left: 81px;">
<div class="action pull-right"> <div class="action pull-right">
<a data-fx="fade" class="btn btn-primary" href="/admin/text_marquees/<%= @marquee.id.to_s %>/newtext"> <a data-fx="fade" class="btn btn-primary" href="/admin/text_marquees/<%= @marquee.id.to_s %>/newtext">