visitor now can browse gallery

This commit is contained in:
Matthew K. Fu JuYuan 2012-11-21 18:34:15 +08:00
parent 1f8f58e930
commit f9b5f71930
4 changed files with 42 additions and 22 deletions

View File

@ -2,8 +2,10 @@ class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
include AdminHelper
# 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
if is_manager? || is_admin? || is_sub_manager?
@authenticated = true #turn this value to false for view only

View File

@ -3,9 +3,9 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
# before_filter :force_order_for_user, :except => [:index,:get_album_json,:get_imgs_json]
before_filter :force_order_for_visitor,:only=>[:index,:get_album_json,:get_imgs_json,:get_albums]
before_filter :force_order_for_user,:except => [:index,:get_album_json,:get_imgs_json,:get_albums]
before_filter :for_app_sub_manager,:except => [:index,:get_album_json,:get_imgs_json,:get_albums]
before_filter :force_order_for_visitor,:only=>[:index,:show,:get_album_json,:get_imgs_json,:get_albums,:imgs]
before_filter :force_order_for_user,:except => [:index,:show,:get_album_json,:get_imgs_json,:get_albums,:imgs]
before_filter :for_app_sub_manager,:except => [:index,:show,:get_album_json,:get_imgs_json,:get_albums,:imgs]
# before_filter lambda
def index

View File

@ -30,6 +30,9 @@
</div>
</div>
</div>
<% if is_admin? %>
<!-- #TODO or 類別屬於他 -->
<!-- tag part -->
<div id="tag_panel" class="my_scroll">
<div class="scrollbar">
@ -61,6 +64,8 @@
<%# end %>
</div>
<%end%>
<script type="text/javascript">
var $tag_panel = $('#tag_panel');
@ -82,11 +87,14 @@
<!-- tag end -->
<div class="form-actions form-fixed pagination-right rghead">
<div class="rgfn">
<a href="" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a>
<%# if @authenticated %>
<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="<%= edit_panel_gallery_back_end_album_path(@album) %>" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>
<% #end %>
<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.photo_tag") %>" href="#tags" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.photo_tag") %></a>
<%= link_to (content_tag(:i,I18n.t("gallery.back_to_photos"),:class=>"icon-arrow-left icon-black")),"",:class=>"bt-back btn pull-left btn-primary",:title=>I18n.t("gallery.back_to_photos")%>
<% if is_admin? %>
<!-- #TODO or類別屬於他 -->
<%= link_to (content_tag(:i,I18n.t("gallery.edit"),:class=>"icon-pencil icon-white")),edit_panel_gallery_back_end_album_path(@album),:class=>"bt-edit btn btn-primary pull-right",:title=>I18n.t("gallery.edit")%>
<%= link_to (content_tag(:i,I18n.t("gallery.photo_tag"),:class=>"icon-pencil icon-white")),'#tags',:class=>"bt-tag btn btn-primary pull-right",:title=>I18n.t("gallery.photo_tag")%>
<% end %>
</div>
</div>
</div>

View File

@ -7,6 +7,9 @@
</div>
</div>
<% if is_sub_manager? #TODO 或 這類別是他自己的 %>
<!-- tag part -->
<div id="tag_panel" class="my_scroll">
<div class="scrollbar">
@ -25,18 +28,15 @@
<div class="viewport">
<div class="overview">
<ul class="tag_list" id="gallery_tag_list">
<%# if @authenticated %>
<% @tags.each do |tag| %>
<li data-content="<%= tag.id %>"><input id="tag_<%= tag.id %>" type="checkbox"><label for="tag_<%= tag.id %>"><%= tag[I18n.locale] %></label><span style="display:none;"><%= tag[@locales[1]] %> <%= tag[@locales[0]] %></span></li>
<% end %>
<%# end %>
</ul>
</div>
</div>
<% #if @authenticated %>
<div class="tag_search"><div class="icon-search"></div><input type="text" value="<%= t('gallery.search_tags') %>" onblur="if(this.value=='')this.value='<%= t('gallery.search_tags') %>';" onfocus="if(this.value=='<%= t("gallery.search_tags") %>')this.value='';" id="tag_search_box"> <div class="tag_save"><a class="btn bt-save"><i class="icon-ok"></i><%= I18n.t("gallery.save") %></a></div></div>
<%# end %>
<%end%>
</div>
<script type="text/javascript">
@ -59,13 +59,23 @@
<!-- tag end -->
<div class="form-actions form-fixed pagination-right rghead">
<div class="rgfn">
<a class="bt-back btn btn-primary pull-left" title="<%= I18n.t("gallery.back_to_albums") %>" href="<%= panel_gallery_back_end_albums_path %>"><i class="icon-arrow-left icon-white"></i><%= I18n.t("gallery.back_to_albums") %></a>
<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.album_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.album_tag") %></ a>
<%# if @authenticated %>
<a class="bt-add btn btn-primary pull-right" title="<%= I18n.t("gallery.add_images") %>" href="images" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_images") %></a>
<a class="bt-del btn btn-primary pull-right" title="<%= I18n.t("gallery.del_album") %>" href="delete" onclick="return false;"><i class="icon-trash icon-white"></i><%= I18n.t("gallery.del_album") %></a>
<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="<%= edit_panel_gallery_back_end_album_path(@album) %>" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>
<%# end %>
<%= link_to (content_tag(:i,I18n.t("gallery.back_to_albums"),:class=>"icon-arrow-left icon-white")),panel_gallery_back_end_albums_path,:title=> I18n.t("gallery.back_to_albums") ,:class=>"bt-back btn btn-primary pull-left" %>
<%= link_to( (content_tag(:i,I18n.t("gallery.album_tag"),:class=>"icon-tag icon-white")),'',:title=> I18n.t("gallery.album_tag") ,:class=>"bt-tag btn btn-primary pull-right")if is_admin? %>
<!-- #TODO 或是類別屬於他 -->
<%= link_to (content_tag(:i,I18n.t("gallery.add_images"),:class=>"icon-plus icon-white")),'images',:title=> I18n.t("gallery.add_images") ,:class=>"bt-add btn btn-primary pull-right",:onclick=>"return false;" if is_admin?%>
<!-- #TODO 或是類別屬於他 -->
<%= link_to (content_tag(:i,I18n.t("gallery.del_album"),:class=>"icon-trash icon-white")),'delete',:title=> I18n.t("gallery.del_album") ,:class=>"bt-del btn btn-primary pull-right",:onclick=>"return false;" if is_admin?%>
<!-- #TODO 或是類別屬於他 -->
<%= link_to (content_tag(:i,I18n.t("gallery.edit"),:class=>"icon-plus icon-white")),edit_panel_gallery_back_end_album_path(@album),:title=> I18n.t("gallery.edit") ,:class=>"bt-edit btn btn-primary pull-right" if is_admin?%>
<!-- #TODO 或是類別屬於他 -->
</div>
</div>
</div>