From e6c411b8e17f6b2aacbb3a86ad92bd4955288aa0 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Thu, 18 Jul 2013 16:53:41 +0800 Subject: [PATCH] Updated tagging with galleries in new ui --- .../gallery/back_end/albums_controller.rb | 5 ++- .../gallery/app/models/gallery_album.rb | 16 +++---- .../gallery/back_end/albums/_album.html.erb | 11 ++--- .../gallery/back_end/albums/index.html.erb | 45 +------------------ .../gallery/back_end/albums/new.html.erb | 15 +++---- 5 files changed, 23 insertions(+), 69 deletions(-) diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb index 0f513e1a..f9b24090 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb @@ -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 diff --git a/vendor/built_in_modules/gallery/app/models/gallery_album.rb b/vendor/built_in_modules/gallery/app/models/gallery_album.rb index 6bfb4f6d..f8587239 100644 --- a/vendor/built_in_modules/gallery/app/models/gallery_album.rb +++ b/vendor/built_in_modules/gallery/app/models/gallery_album.rb @@ -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 \ No newline at end of file diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/_album.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/_album.html.erb index 28d354d0..332ac53b 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/_album.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/_album.html.erb @@ -11,14 +11,11 @@ \ No newline at end of file diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/index.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/index.html.erb index 53557f67..5627cdd3 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/index.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/index.html.erb @@ -11,49 +11,6 @@ end %> <%= stylesheet_link_tag "gallery" %> <%#= stylesheet_link_tag "filter" %> - -
- - -
-
- -
-
- -
-
-
- <% @categories.each do |c| %> - <%= c.title %> - <% end %> -
-
- Clear -
-
-
- -
- Clear -
-
-
-
@@ -62,7 +19,7 @@ end %>
-