Updated Gallery with authorizations
This commit is contained in:
parent
4c217ec12f
commit
e75873273c
|
@ -32,7 +32,6 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= index_table %>
|
<%= index_table %>
|
||||||
|
|
||||||
<%= @index_footer %>
|
<%= @index_footer %>
|
||||||
|
|
|
@ -3,15 +3,8 @@ class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
|
||||||
|
|
||||||
# before_filter :force_order_for_visitor,:only=>[:index]
|
# before_filter :force_order_for_visitor,:only=>[:index]
|
||||||
# before_filter :force_order_for_user#,:except => [:index]
|
# before_filter :force_order_for_user#,:except => [:index]
|
||||||
before_filter :force_order_for_visitor,:only=>[:index,:show]
|
|
||||||
before_filter :force_order_for_user,:except => [:index,:show]
|
|
||||||
before_filter :for_app_sub_manager,:except => [:index,:show]
|
|
||||||
def show
|
def show
|
||||||
if is_manager? || is_admin? || is_sub_manager?
|
|
||||||
@authenticated = true #turn this value to false for view only
|
|
||||||
else
|
|
||||||
@authenticated = false
|
|
||||||
end
|
|
||||||
@tags = get_tags
|
@tags = get_tags
|
||||||
@image = GalleryImage.find(params[:id])
|
@image = GalleryImage.find(params[:id])
|
||||||
@albumid = @image.gallery_album_id
|
@albumid = @image.gallery_album_id
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||||
|
open_for_visitor :only => [:index, :show]
|
||||||
|
open_for_manager :except => [:index,:show,:update]
|
||||||
|
open_for_sub_manager :except => [:index, :show]
|
||||||
|
|
||||||
# before_filter lambda
|
# before_filter lambda
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@categories = get_categories_for_index
|
@categories = get_categories_for_index
|
||||||
@albums = GalleryAlbum.all
|
|
||||||
@tags = get_tags
|
@tags = get_tags
|
||||||
@c = []
|
category_ids = @categories.collect{|t| t.id}
|
||||||
@ac = @c.inject(@categories,:<<)
|
@albums = get_sorted_and_filtered("gallery_album", :category_id.in => category_ids)
|
||||||
@album_category = @albums.map { |a| @categories.include?(a.category_id) }
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
@ -124,19 +124,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||||
tag_ids: values.tag_ids,
|
tag_ids: values.tag_ids,
|
||||||
tag_names: tags}
|
tag_names: tags}
|
||||||
end
|
end
|
||||||
if is_manager? || is_admin? || is_sub_manager?
|
|
||||||
@authenticated = true #turn this value to false for view only
|
|
||||||
else
|
|
||||||
@authenticated = false
|
|
||||||
end
|
|
||||||
if @authenticated
|
|
||||||
render :json=>{"images" => @output, "tags" => @album.tag_ids}.to_json
|
render :json=>{"images" => @output, "tags" => @album.tag_ids}.to_json
|
||||||
else
|
|
||||||
@album.tag_ids.each do |tag|
|
|
||||||
@tag_names << GalleryTag.find(tag)[I18n.locale]
|
|
||||||
end
|
|
||||||
render :json=>{"images" => @output, "tags" => @album.tag_ids, "tag_names" => @tag_names}.to_json
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,11 +163,6 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||||
def update
|
def update
|
||||||
@album = GalleryAlbum.find(params[:id])
|
@album = GalleryAlbum.find(params[:id])
|
||||||
@album.update_attributes(params[:gallery_album])
|
@album.update_attributes(params[:gallery_album])
|
||||||
if is_manager? || is_admin? || is_sub_manager?
|
|
||||||
@authenticated = true #turn this value to false for view only
|
|
||||||
else
|
|
||||||
@authenticated = false
|
|
||||||
end
|
|
||||||
if params['delete_cover'] == "true"
|
if params['delete_cover'] == "true"
|
||||||
@album.update_attributes(:cover=>"default")
|
@album.update_attributes(:cover=>"default")
|
||||||
end
|
end
|
||||||
|
|
Reference in New Issue