added access level to this module

This commit is contained in:
Harry Bomrah 2014-07-31 17:12:57 +08:00
parent 1825842ad0
commit fb1a78c550
6 changed files with 29 additions and 19 deletions

View File

@ -1,4 +1,4 @@
class Admin::GalleriesController < ApplicationController class Admin::GalleriesController < OrbitAdminController
before_filter :setup_vars before_filter :setup_vars
before_action :authenticate_user, :log_user_action, :except => "imgs" before_action :authenticate_user, :log_user_action, :except => "imgs"
layout "back_end" layout "back_end"

View File

@ -1,4 +1,4 @@
class Admin::ImagesController < ApplicationController class Admin::ImagesController < OrbitAdminController
before_filter :setup_vars before_filter :setup_vars
def show def show
@image = AlbumImage.find(params[:id]) @image = AlbumImage.find(params[:id])

View File

@ -10,7 +10,9 @@
<ul class="gallery_info clearfix"> <ul class="gallery_info clearfix">
<!-- <li class="view"><i class="icons-eye"></i> 321</li> --> <!-- <li class="view"><i class="icons-eye"></i> 321</li> -->
<li><i class="icons-tag"></i></li> <li><i class="icons-tag"></i></li>
<li><%= link_to (content_tag(:i,"",:class=>"icon-trash danger")), admin_gallery_path(album.id), "data-confirm" => "Are you sure?", :method=>:delete %></li> <% if can_edit_or_delete?(album) %>
<li><%= link_to (content_tag(:i,"",:class=>"icon-trash danger")), admin_gallery_path(album.id), "data-confirm" => "Are you sure?", :method=>:delete %></li>
<% end %>
<li class="albumcateg"><%= Category.find(album.category_id).title %></li> <li class="albumcateg"><%= Category.find(album.category_id).title %></li>
</ul> </ul>
<ul class="albumtag"> <ul class="albumtag">

View File

@ -2,11 +2,13 @@
<a href="<%= admin_image_path(image.id) %>"> <a href="<%= admin_image_path(image.id) %>">
<img src="<%= image.file.thumb %>"> <img src="<%= image.file.thumb %>">
</a> </a>
<ul class="photo-action clearfix"> <% if can_edit_or_delete?(@album) %>
<li class="photo_cover"><i class="<%= (@album.cover.to_s == image.id.to_s)? "icons-star" : "icons-star-2" %>"></i></li> <ul class="photo-action clearfix">
<li class="phtot_depiction"><a href="#view-photo-depiction" class="open" for="description"><i class="icon-comment-alt"></i></a></li> <li class="photo_cover"><i class="<%= (@album.cover.to_s == image.id.to_s)? "icons-star" : "icons-star-2" %>"></i></li>
<li class="phtot_tag"><a href="#view-photo-tags" class="open" for="tags"><i class="icons-tag"></i></a></li> <li class="phtot_depiction"><a href="#view-photo-depiction" class="open" for="description"><i class="icon-comment-alt"></i></a></li>
</ul> <li class="phtot_tag"><a href="#view-photo-tags" class="open" for="tags"><i class="icons-tag"></i></a></li>
</ul>
<% end %>
<div class="check"> <div class="check">
<input type="checkbox" class="checkbox"> <input type="checkbox" class="checkbox">
</div> </div>

View File

@ -15,12 +15,14 @@
</div> </div>
<div class="action pull-right"> <div class="action pull-right">
<a href="#" class="btn btn-inverse btn-small deselect hide">Deselect</a> <a href="#" class="btn btn-inverse btn-small deselect hide">Deselect</a>
<a href="#dialog" data-toggle="modal" class="btn btn-warning btn-small deletephoto hide"><i class="icons-cross-3"></i> Delete Photo</a> <% if can_edit_or_delete?(@album) %>
<a href="#view-photo-tags" class="btn btn-primary btn-small addtags open hide" for="batch"><i class="icons-tag"></i> Add Tags</a> <a href="#dialog" data-toggle="modal" class="btn btn-warning btn-small deletephoto hide"><i class="icons-cross-3"></i> Delete Photo</a>
<a href="<%= edit_admin_gallery_path(@album.id) %>" class="btn btn-small btn-success"><i class="icon-edit"></i> Edit</a> <a href="#view-photo-tags" class="btn btn-primary btn-small addtags open hide" for="batch"><i class="icons-tag"></i> Add Tags</a>
<b class="divider"></b> <a href="<%= edit_admin_gallery_path(@album.id) %>" class="btn btn-small btn-success"><i class="icon-edit"></i> Edit</a>
<b class="divider"></b>
<a href="#" class="add-imgs btn btn-small btn-primary"><i class="icons-plus"></i> Add Image</a>
<a href="#" class="add-imgs btn btn-small btn-primary"><i class="icons-plus"></i> Add Image</a>
<% end %>
</div> </div>
<form action="<%= admin_galleries_upload_image_path %>", id='fileupload'> <form action="<%= admin_galleries_upload_image_path %>", id='fileupload'>
<!-- Redirect browsers with JavaScript disabled to the origin page --> <!-- Redirect browsers with JavaScript disabled to the origin page -->

View File

@ -12,33 +12,37 @@ module Gallery
data_count 1..10 data_count 1..10
side_bar do side_bar do
head_label_i18n 'gallery.gallery', icon_class: "icons-pictures" head_label_i18n 'gallery.gallery', icon_class: "icons-pictures"
available_for [:admin,:manager,:sub_manager] available_for "users"
active_for_controllers (['admin/galleries','admin/images']) active_for_controllers (['admin/galleries','admin/images'])
head_link_path "admin_galleries_path" head_link_path "admin_galleries_path"
context_link 'gallery.all', context_link 'gallery.all',
:link_path=>"admin_galleries_path" , :link_path=>"admin_galleries_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{'admin/galleries'=>"index"} :active_for_action=>{'admin/galleries'=>"index"},
:available_for => 'users'
context_link 'gallery.new', context_link 'gallery.new',
:link_path=>"new_admin_gallery_path" , :link_path=>"new_admin_gallery_path" ,
:priority=>2, :priority=>2,
:active_for_action=>{'admin/galleries'=>"new"} :active_for_action=>{'admin/galleries'=>"new"},
:available_for => 'sub_managers'
context_link 'categories', context_link 'categories',
:link_path=>"admin_module_app_categories_path" , :link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'gallery').id}", :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'gallery').id}",
:priority=>3, :priority=>3,
:active_for_action=>{'admin/galleries'=>'categories'}, :active_for_action=>{'admin/galleries'=>'categories'},
:active_for_category => 'Gallery' :active_for_category => 'Gallery',
:available_for => 'managers'
context_link 'tags', context_link 'tags',
:link_path=>"admin_module_app_tags_path" , :link_path=>"admin_module_app_tags_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'gallery').id}", :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'gallery').id}",
:priority=>4, :priority=>4,
:active_for_action=>{'admin/galleries'=>'tags'}, :active_for_action=>{'admin/galleries'=>'tags'},
:active_for_tag => 'Gallery' :active_for_tag => 'Gallery',
:available_for => 'managers'
end end
end end
end end