diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb index f9aba371d..beed6b8ab 100644 --- a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb @@ -37,7 +37,6 @@ class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendCont # GET /archive_files/1/edit def edit @archive_file_category = ArchiveFileCategory.find(params[:id]) - @i18n_variable = @archive_file_category.i18n_variable @url = panel_archive_back_end_archive_file_category_path(@archive_file_category) diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_files_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_files_controller.rb index a4804bb56..0336c11b7 100644 --- a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_files_controller.rb +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_files_controller.rb @@ -55,7 +55,6 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController # POST /archive_files.xml def create @archive_file = ArchiveFile.new(params[:archive_file]) - @archive_file.create_user_id = current_user.id @archive_file.update_user_id = current_user.id @@ -64,6 +63,8 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController format.html { redirect_to(panel_archive_back_end_archive_files_url) } format.xml { render :xml => @archive_file, :status => :created, :location => @archive_file } else + get_categorys + get_tags format.html { render :action => "new" } format.xml { render :xml => @archive_file.errors, :status => :unprocessable_entity } end diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb index 594b73488..a436f5a9d 100644 --- a/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb @@ -9,7 +9,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController @item = Page.find(params[:page_id]) - @title = @item.i18n_variable[I18n.locale] + @title = @item.title if @item.frontend_data_count @page_num = @item.frontend_data_count @@ -41,7 +41,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController @item = Page.find(params[:page_id]) - @title = @item.i18n_variable[I18n.locale] + @title = @item.title @archive_file = ArchiveFile.find(params[:id]) @@ -55,7 +55,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController @item = Page.find(params[:page_id]) - @title = @item.i18n_variable[I18n.locale] + @title = @item.title if @item.frontend_data_count @page_num = @item.frontend_data_count 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 9cf2eedd5..2d53e7ffb 100644 --- a/vendor/built_in_modules/archive/app/models/archive_file.rb +++ b/vendor/built_in_modules/archive/app/models/archive_file.rb @@ -26,7 +26,7 @@ class ArchiveFile accepts_nested_attributes_for :archive_file_multiples, :allow_destroy => true - validates_presence_of :title + validates :title, :at_least_one => true after_save :save_archive_file_multiples diff --git a/vendor/built_in_modules/archive/app/models/archive_file_category.rb b/vendor/built_in_modules/archive/app/models/archive_file_category.rb index abb08bd36..f3d2fcd95 100644 --- a/vendor/built_in_modules/archive/app/models/archive_file_category.rb +++ b/vendor/built_in_modules/archive/app/models/archive_file_category.rb @@ -7,8 +7,10 @@ class ArchiveFileCategory field :key - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + field :title, localize: true has_many :archive_files + + validates :title, :at_least_one => true end \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/models/archive_file_multiple.rb b/vendor/built_in_modules/archive/app/models/archive_file_multiple.rb index 0ac3070b2..9dc833632 100644 --- a/vendor/built_in_modules/archive/app/models/archive_file_multiple.rb +++ b/vendor/built_in_modules/archive/app/models/archive_file_multiple.rb @@ -9,8 +9,6 @@ class ArchiveFileMultiple # field :description field :choose_lang, :type => Array, :default => nil - # has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy - field :should_destroy, :type => Boolean def choose_lang_display(lang) diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb index c6bf4616c..d8c5e8e1b 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb @@ -11,6 +11,6 @@ <% @site_valid_locales.each do |locale| %> - <%= archive_file_category.i18n_variable[locale] rescue nil %> + <%= archive_file_category.title_translations[locale] rescue nil %> <% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_form.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_form.html.erb index f79bbab06..345390df6 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_form.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_form.html.erb @@ -10,12 +10,12 @@
- <%= f.fields_for :i18n_variable, (@archive_file_category.new_record? ? @archive_file_category.build_i18n_variable : @archive_file_category.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
- <%= f.text_field locale, :class => 'input-xxlarge' %> + <%= f.text_field locale, :class =>' input-xxlarge', :value => (@archive_file_category.title[locale] rescue nil) %>
<% end %> diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_archive_files.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_archive_files.html.erb index 9f9ca8f97..7f5404860 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_archive_files.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_archive_files.html.erb @@ -17,7 +17,7 @@
- <%= post.archive_file_category.i18n_variable[I18n.locale] %> + <%= post.archive_file_category.title %> <%= link_to post.title, panel_archive_front_end_archive_file_path(post) %> 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 09357f828..6a634ce5f 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 @@ -43,7 +43,7 @@
<%= f.label :category %> - <%= f.select :archive_file_category_id, @archive_file_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %> + <%= f.select :archive_file_category_id, @archive_file_categorys.collect {|t| [ t.title, t.id ]} %>