From 9129835f2381445448b212f11072246e67bae0fa Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 16 May 2012 18:19:41 +0800 Subject: [PATCH] Add tags to assets --- app/controllers/admin/asset_tags_controller.rb | 8 ++++++++ app/helpers/admin/dashboard_helper.rb | 2 +- app/models/asset_tag.rb | 5 +++++ app/views/layouts/_side_bar.html.erb | 10 ++++++++++ config/routes.rb | 1 + 5 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 app/controllers/admin/asset_tags_controller.rb create mode 100644 app/models/asset_tag.rb diff --git a/app/controllers/admin/asset_tags_controller.rb b/app/controllers/admin/asset_tags_controller.rb new file mode 100644 index 00000000..ea3fc41e --- /dev/null +++ b/app/controllers/admin/asset_tags_controller.rb @@ -0,0 +1,8 @@ +class Admin::AssetTagsController < Admin::TagsController + + def initialize + super + @app_title = 'asset' + end + +end \ No newline at end of file diff --git a/app/helpers/admin/dashboard_helper.rb b/app/helpers/admin/dashboard_helper.rb index f69185f3..dfe5763f 100644 --- a/app/helpers/admin/dashboard_helper.rb +++ b/app/helpers/admin/dashboard_helper.rb @@ -20,7 +20,7 @@ module Admin::DashboardHelper when 'news_bulletin' panel_news_front_end_news_bulletin_path(object) when'page_context' - panel_page_content_front_end_page_context_path(object) + "/#{object.page.path}" when'web_link' panel_web_resource_front_end_web_link_path(object) end diff --git a/app/models/asset_tag.rb b/app/models/asset_tag.rb new file mode 100644 index 00000000..344a8e2e --- /dev/null +++ b/app/models/asset_tag.rb @@ -0,0 +1,5 @@ +class AssetTag < Tag + + has_and_belongs_to_many :assets + +end \ No newline at end of file diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 7a9bcf4e..852bfd4c 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -67,3 +67,13 @@ <%= content_tag :li, link_to(t('announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') %> <% end -%> <% end -%> + +<%= content_tag :li, :class => active_for_controllers('assets', '/admin/asset_tags', 'asset_categories') do -%> + <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.asset'), admin_assets_path %> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('assets', '/admin/asset_tags', 'asset_categories')) do -%> + <%= content_tag :li, link_to(t('admin.all_assets'), admin_assets_path), :class => active_for_action('assets', 'index') %> + <%= content_tag :li, link_to(t('admin.add_new'), new_admin_asset_path), :class => active_for_action('assets', 'new') %> + <%= content_tag :li, link_to(t('admin.categories'), admin_asset_categories_path), :class => active_for_action('asset_categories', 'index') %> + <%= content_tag :li, link_to(t('admin.tags'), admin_asset_tags_path), :class => active_for_action('/admin/asset_tags', 'index') %> + <% end -%> +<% end -%> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 24862361..214f58b2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,6 +19,7 @@ Orbit::Application.routes.draw do end end resources :asset_categories + resources :asset_tags resources :app_auths resources :object_auths do match 'new_interface/:ob_type/:title/new' => "object_auths_new_interface#new" ,:as => :init_ob_auth,:via => :get