Updated tagging with galleries in new ui
This commit is contained in:
parent
1c558a1783
commit
e6c411b8e1
|
@ -17,6 +17,9 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||||
@categories = get_categories_for_index
|
@categories = get_categories_for_index
|
||||||
@albums = GalleryAlbum.all
|
@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
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
class GalleryAlbum
|
class GalleryAlbum
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
include OrbitTag::Taggable
|
include OrbitTag::Taggable
|
||||||
|
|
||||||
field :name, localize: true
|
field :name, localize: true
|
||||||
field :description, localize: true
|
field :description, localize: true
|
||||||
field :cover, default: "default"
|
field :cover, default: "default"
|
||||||
field :cover_path #can refact
|
field :cover_path #can refact
|
||||||
field :tag_names
|
field :tag_names
|
||||||
|
|
||||||
# has_and_belongs_to_many :tags, :class_name => "GalleryTag"
|
# 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
|
accepts_nested_attributes_for :gallery_images, :allow_destroy => true
|
||||||
|
|
||||||
end
|
end
|
|
@ -11,14 +11,11 @@
|
||||||
<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 class="albumcateg"><%= @categories.find(album.category_id).title %></li>
|
<li><%= @ac%></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="albumtag">
|
<ul class="albumtag">
|
||||||
<li class="label">Fake Tag</li>
|
<% @tags.each do |tag| %>
|
||||||
<li class="label">Fake Tag</li>
|
<li class="label"><%=t(tag.name)%></li>
|
||||||
<li class="label">Fake Tag</li>
|
<%end%>
|
||||||
<li class="label">Fake Tag</li>
|
|
||||||
<li class="label">Fake Tag</li>
|
|
||||||
<li class="label">Fake Tag</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
|
@ -11,49 +11,6 @@ end %>
|
||||||
<%= stylesheet_link_tag "gallery" %>
|
<%= stylesheet_link_tag "gallery" %>
|
||||||
<%#= stylesheet_link_tag "filter" %>
|
<%#= 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 -->
|
<!-- Bottom Nav -->
|
||||||
<div class="bottomnav clearfix">
|
<div class="bottomnav clearfix">
|
||||||
<div class="action pull-right">
|
<div class="action pull-right">
|
||||||
|
@ -62,7 +19,7 @@ end %>
|
||||||
</div>
|
</div>
|
||||||
</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| %>
|
<% @albums.each do |album| %>
|
||||||
<%= render :partial => "album", :object => album %>
|
<%= render :partial => "album", :object => album %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -36,15 +36,12 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted">Tag</label>
|
<label class="control-label muted">Tag</label>
|
||||||
<div class="controls" data-toggle="buttons-checkbox">
|
<div class="controls" data-toggle="buttons-checkbox">
|
||||||
<label class="checkbox inline btn">
|
<%@tags.each do |t|%>
|
||||||
<input type="checkbox" value="1"> Tag1
|
<label class="checkbox inline btn">
|
||||||
</label>
|
<%= check_box_tag "t[]", t.id %>
|
||||||
<label class="checkbox inline btn">
|
<%= label_tag t.name%>
|
||||||
<input type="checkbox" value="2"> Tag2
|
</label>
|
||||||
</label>
|
<%end %>
|
||||||
<label class="checkbox inline btn">
|
|
||||||
<input type="checkbox" value="3"> Tag3
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Reference in New Issue