visitor now can browse gallery

This commit is contained in:
Matthew K. Fu JuYuan 2012-11-21 18:34:15 +08:00 committed by chris
parent 6ca52226ba
commit ec0ec46303
4 changed files with 42 additions and 22 deletions

View File

@ -2,8 +2,10 @@ class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
include AdminHelper include AdminHelper
# 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? if is_manager? || is_admin? || is_sub_manager?
@authenticated = true #turn this value to false for view only @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_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_visitor,:only=>[:index,:show,:get_album_json,:get_imgs_json,:get_albums,:imgs]
before_filter :force_order_for_user,:except => [:index,:get_album_json,:get_imgs_json,:get_albums] 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,:get_album_json,:get_imgs_json,:get_albums] before_filter :for_app_sub_manager,:except => [:index,:show,:get_album_json,:get_imgs_json,:get_albums,:imgs]
# before_filter lambda # before_filter lambda
def index def index

View File

@ -30,6 +30,9 @@
</div> </div>
</div> </div>
</div> </div>
<% if is_admin? %>
<!-- #TODO or 類別屬於他 -->
<!-- tag part --> <!-- tag part -->
<div id="tag_panel" class="my_scroll"> <div id="tag_panel" class="my_scroll">
<div class="scrollbar"> <div class="scrollbar">
@ -61,6 +64,8 @@
<%# end %> <%# end %>
</div> </div>
<%end%>
<script type="text/javascript"> <script type="text/javascript">
var $tag_panel = $('#tag_panel'); var $tag_panel = $('#tag_panel');
@ -82,11 +87,14 @@
<!-- tag end --> <!-- tag end -->
<div class="form-actions form-fixed pagination-right rghead"> <div class="form-actions form-fixed pagination-right rghead">
<div class="rgfn"> <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> <%= 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 @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> <% if is_admin? %>
<% #end %> <!-- #TODO or類別屬於他 -->
<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.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> </div>
</div> </div>

View File

@ -7,6 +7,9 @@
</div> </div>
</div> </div>
<% if is_sub_manager? #TODO 或 這類別是他自己的 %>
<!-- tag part --> <!-- tag part -->
<div id="tag_panel" class="my_scroll"> <div id="tag_panel" class="my_scroll">
<div class="scrollbar"> <div class="scrollbar">
@ -25,18 +28,15 @@
<div class="viewport"> <div class="viewport">
<div class="overview"> <div class="overview">
<ul class="tag_list" id="gallery_tag_list"> <ul class="tag_list" id="gallery_tag_list">
<%# if @authenticated %>
<% @tags.each do |tag| %> <% @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> <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 %>
<%# end %>
</ul> </ul>
</div> </div>
</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> <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> </div>
<script type="text/javascript"> <script type="text/javascript">
@ -59,13 +59,23 @@
<!-- tag end --> <!-- tag end -->
<div class="form-actions form-fixed pagination-right rghead"> <div class="form-actions form-fixed pagination-right rghead">
<div class="rgfn"> <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> <%= 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" %>
<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> <%= 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? %>
<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> <!-- #TODO 或是類別屬於他 -->
<%# end %>
<%= 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> </div>
</div> </div>