Updated tagging with galleries in new ui

This commit is contained in:
saurabhbhatia 2013-07-18 16:53:41 +08:00
parent 1c558a1783
commit e6c411b8e1
5 changed files with 23 additions and 69 deletions

View File

@ -16,7 +16,10 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
end
@categories = get_categories_for_index
@albums = GalleryAlbum.all
@tags = get_tags
@tags = get_tags
@c = []
@ac = @c.inject(@categories,:<<)
@album_category = @albums.map { |a| @categories.include?(a.category_id) }
end
def show

View File

@ -1,17 +1,17 @@
class GalleryAlbum
include Mongoid::Document
include Mongoid::Document
include Mongoid::Timestamps
include OrbitTag::Taggable
field :name, localize: true
field :description, localize: true
field :cover, default: "default"
field :cover_path #can refact
field :tag_names
field :name, localize: true
field :description, localize: true
field :cover, default: "default"
field :cover_path #can refact
field :tag_names
# has_and_belongs_to_many :tags, :class_name => "GalleryTag"
has_many :gallery_images, :autosave => true, :dependent => :destroy
has_many :gallery_images, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :gallery_images, :allow_destroy => true
end

View File

@ -11,14 +11,11 @@
<ul class="gallery_info clearfix">
<li class="view"><i class="icons-eye"></i> 321</li>
<li><i class="icons-tag"></i></li>
<li class="albumcateg"><%= @categories.find(album.category_id).title %></li>
<li><%= @ac%></li>
</ul>
<ul class="albumtag">
<li class="label">Fake Tag</li>
<li class="label">Fake Tag</li>
<li class="label">Fake Tag</li>
<li class="label">Fake Tag</li>
<li class="label">Fake Tag</li>
<li class="label">Fake Tag</li>
<% @tags.each do |tag| %>
<li class="label"><%=t(tag.name)%></li>
<%end%>
</ul>
</li>

View File

@ -11,49 +11,6 @@ end %>
<%= stylesheet_link_tag "gallery" %>
<%#= stylesheet_link_tag "filter" %>
<!-- Top Nav -->
<div id="filter" class="topnav clearfix">
<!--<ul class="breadcrumb text-info pull-left">
<li><a href="/orbit_4.0.1/admin/dashboards/dashboards.shtml">Dashboard</a> <span class="divider">/</span></li>
<li class="active">Gallery</li>
</ul> -->
<div class="searchClear pull-right">
<form>
<input id="filter-input" class="search-query input-medium" type="text" placeholder="Search" value="">
</form>
</div>
<ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-category" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Categories</a>
</div>
</li>
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-tags" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Tags</a>
</div>
</li>
</ul>
<div class="filter-group accordion-group">
<div class="accordion-body collapse" id="collapse-category">
<div class="accordion-inner pagination-right" data-toggle="buttons-checkbox">
<% @categories.each do |c| %>
<a href="#" class="btn btn-small"><%= c.title %></a>
<% end %>
</div>
<div class="filter-clear">
<a href="#" class="btn btn-link btn-small"><i class="icons-cycle"></i>Clear</a>
</div>
</div>
<div class="accordion-body collapse" id="collapse-tags">
<div class="filter-clear">
<a href="#" class="btn btn-link btn-small"><i class="icons-cycle"></i>Clear</a>
</div>
</div>
</div>
<!-- Bottom Nav -->
<div class="bottomnav clearfix">
<div class="action pull-right">
@ -62,7 +19,7 @@ end %>
</div>
</div>
<ul id="orbit_gallery" class="gallery" data-gallery-id="gallery">
<ul id="orbit_gallery" class="gallery" data-gallery-id="gallery">
<% @albums.each do |album| %>
<%= render :partial => "album", :object => album %>
<% end %>

View File

@ -36,15 +36,12 @@
<div class="control-group">
<label class="control-label muted">Tag</label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn">
<input type="checkbox" value="1"> Tag1
</label>
<label class="checkbox inline btn">
<input type="checkbox" value="2"> Tag2
</label>
<label class="checkbox inline btn">
<input type="checkbox" value="3"> Tag3
</label>
<%@tags.each do |t|%>
<label class="checkbox inline btn">
<%= check_box_tag "t[]", t.id %>
<%= label_tag t.name%>
</label>
<%end %>
</div>
</div>