From 8a5519073bc7da910f79dbac835f5ad4b5853b75 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Apr 2012 15:24:19 +0800 Subject: [PATCH] new archive --- app/views/layouts/_side_bar.html.erb | 14 ++++++++++++++ .../archive/app/models/archive_file.rb | 8 ++++---- .../archive/back_end/archive_files/_form.html.erb | 5 ++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 4fe5d602..ff8e7a29 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -106,3 +106,17 @@ <%= content_tag :li, :class => active_for_controllers(nil) do -%> <%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), nil %> <% end -%> + +<%= content_tag :li, :class => active_for_controllers('archive_files', 'tags', 'archive_file_categorys') do -%> + <%= link_to content_tag(:i, nil, :class => 'icons-archive') + t('admin.archive'), panel_archive_back_end_archive_files_path %> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('archive_files', 'tags', 'archive_file_categorys')) do -%> + <%= content_tag :li, link_to(t('admin.all_articles'), panel_archive_back_end_archive_files_path), :class => active_for_action('archive_file', 'index') %> + <%= content_tag :li, link_to(t('admin.add_new'), new_panel_archive_back_end_archive_file_path), :class => active_for_action('archive_file', 'new') %> + <%= content_tag :li, link_to(t('admin.categories'), panel_archive_back_end_archive_file_categorys_path), :class => active_for_action('archive_file_categorys', 'index') %> + <%= content_tag :li, link_to(t('admin.tags'), panel_archive_back_end_tags_path), :class => active_for_action('tags', 'index') %> + <% end -%> +<% end -%> + +<%= content_tag :li, :class => active_for_controllers(nil) do -%> + <%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), nil %> +<% end -%> diff --git a/vendor/built_in_modules/archive/app/models/archive_file.rb b/vendor/built_in_modules/archive/app/models/archive_file.rb index 3d9e7084..4cc26dde 100644 --- a/vendor/built_in_modules/archive/app/models/archive_file.rb +++ b/vendor/built_in_modules/archive/app/models/archive_file.rb @@ -19,7 +19,7 @@ class ArchiveFile field :is_hidden, :type => Boolean, :default => false belongs_to :archive_file_category - + has_many :archive_file_multiples, :autosave => true, :dependent => :destroy accepts_nested_attributes_for :archive_file_multiples, :allow_destroy => true @@ -31,7 +31,7 @@ class ArchiveFile def self.search( category_id = nil ) if category_id.to_s.size > 0 - + find(:all, :conditions => {archive_file_category_id: category_id}).desc( :is_top, :title ) else @@ -44,7 +44,7 @@ class ArchiveFile def self.widget_datas - + where( :is_hidden => false ).desc(:is_top, :title) end @@ -52,7 +52,7 @@ class ArchiveFile def is_top? self.is_top end - + def save_archive_file_multiples self.archive_file_multiples.each do |t| if t.should_destroy diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb index d00dd91e..4f1af56c 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb @@ -46,8 +46,7 @@ <%= f.select :archive_file_category_id, @archive_file_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %> @@ -70,7 +69,7 @@ <% end %> - +