From 31baa2cb633a364f9866a1fd0b9b2faf3a0aaf61 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 | 10 + .../_bulletin_category.html.erb | 1 - .../bulletin_categorys/index.html.erb | 1 - .../back_end/bulletins/_form.html.erb | 2 +- vendor/built_in_modules/archive/.gitignore | 6 + vendor/built_in_modules/archive/Gemfile | 17 + vendor/built_in_modules/archive/MIT-LICENSE | 20 ++ vendor/built_in_modules/archive/README.rdoc | 3 + vendor/built_in_modules/archive/Rakefile | 39 +++ .../app/assets/images/archive/.gitkeep | 0 .../app/assets/javascripts/archive/.gitkeep | 0 .../app/assets/stylesheets/archive/.gitkeep | 0 .../archive/app/controllers/.gitkeep | 0 .../app/controllers/application_controller.rb | 23 ++ .../archive_file_categorys_controller.rb | 97 +++++ .../back_end/archive_files_controller.rb | 117 +++++++ .../panel/archive/back_end/tags_controller.rb | 8 + .../archive/app/helpers/.gitkeep | 0 .../archive/app/mailers/.gitkeep | 0 .../archive/app/models/.gitkeep | 0 .../archive/app/models/archive_file.rb | 63 ++++ .../app/models/archive_file_category.rb | 14 + .../archive/app/models/archive_tag.rb | 10 + .../archive/app/views/.gitkeep | 0 .../_archive_file_category.html.erb | 16 + .../archive_file_categorys/_form.html.erb | 30 ++ .../archive_file_categorys/create.js.erb | 2 + .../archive_file_categorys/destroy.js.erb | 1 + .../archive_file_categorys/edit.js.erb | 1 + .../archive_file_categorys/index.html.erb | 23 ++ .../archive_file_categorys/new.js.erb | 1 + .../archive_file_categorys/update.js.erb | 4 + .../archive_files/_archive_files.html.erb | 30 ++ .../back_end/archive_files/_form.html.erb | 84 +++++ .../back_end/archive_files/destroy.js.erb | 1 + .../back_end/archive_files/edit.html.erb | 5 + .../back_end/archive_files/index.html.erb | 23 ++ .../back_end/archive_files/new.html.erb | 9 + .../back_end/archive_files/show.html.erb | 57 +++ .../built_in_modules/archive/archive.gemspec | 23 ++ vendor/built_in_modules/archive/archive.json | 12 + .../archive/config/locales/en.yml | 129 +++++++ .../archive/config/locales/zh_tw.yml | 330 ++++++++++++++++++ .../built_in_modules/archive/config/routes.rb | 22 ++ .../built_in_modules/archive/lib/archive.rb | 4 + .../archive/lib/archive/engine.rb | 4 + .../archive/lib/archive/version.rb | 3 + .../archive/lib/tasks/archive_tasks.rake | 4 + vendor/built_in_modules/archive/script/rails | 6 + .../archive/test/archive_test.rb | 7 + .../archive/test/dummy/Rakefile | 7 + .../app/assets/javascripts/application.js | 9 + .../app/assets/stylesheets/application.css | 7 + .../app/controllers/application_controller.rb | 3 + .../dummy/app/helpers/application_helper.rb | 2 + .../archive/test/dummy/app/mailers/.gitkeep | 0 .../archive/test/dummy/app/models/.gitkeep | 0 .../app/views/layouts/application.html.erb | 14 + .../archive/test/dummy/config.ru | 4 + .../archive/test/dummy/config/application.rb | 45 +++ .../archive/test/dummy/config/boot.rb | 10 + .../archive/test/dummy/config/database.yml | 25 ++ .../archive/test/dummy/config/environment.rb | 5 + .../dummy/config/environments/development.rb | 30 ++ .../dummy/config/environments/production.rb | 60 ++++ .../test/dummy/config/environments/test.rb | 39 +++ .../initializers/backtrace_silencers.rb | 7 + .../dummy/config/initializers/inflections.rb | 10 + .../dummy/config/initializers/mime_types.rb | 5 + .../dummy/config/initializers/secret_token.rb | 7 + .../config/initializers/session_store.rb | 8 + .../config/initializers/wrap_parameters.rb | 14 + .../archive/test/dummy/config/locales/en.yml | 5 + .../archive/test/dummy/config/routes.rb | 58 +++ .../archive/test/dummy/lib/assets/.gitkeep | 0 .../archive/test/dummy/log/.gitkeep | 0 .../archive/test/dummy/public/404.html | 26 ++ .../archive/test/dummy/public/422.html | 26 ++ .../archive/test/dummy/public/500.html | 26 ++ .../archive/test/dummy/public/favicon.ico | 0 .../archive/test/dummy/script/rails | 6 + .../test/integration/navigation_test.rb | 10 + .../archive/test/test_helper.rb | 10 + .../back_end/page_contexts_controller.rb | 2 +- .../back_end/page_contexts/index.html.erb | 2 + .../back_end/web_links_controller.rb | 3 +- .../back_end/web_links/index.html.erb | 2 + 87 files changed, 1744 insertions(+), 5 deletions(-) create mode 100644 vendor/built_in_modules/archive/.gitignore create mode 100644 vendor/built_in_modules/archive/Gemfile create mode 100644 vendor/built_in_modules/archive/MIT-LICENSE create mode 100644 vendor/built_in_modules/archive/README.rdoc create mode 100644 vendor/built_in_modules/archive/Rakefile create mode 100644 vendor/built_in_modules/archive/app/assets/images/archive/.gitkeep create mode 100644 vendor/built_in_modules/archive/app/assets/javascripts/archive/.gitkeep create mode 100644 vendor/built_in_modules/archive/app/assets/stylesheets/archive/.gitkeep create mode 100644 vendor/built_in_modules/archive/app/controllers/.gitkeep create mode 100644 vendor/built_in_modules/archive/app/controllers/application_controller.rb create mode 100644 vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb create mode 100644 vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_files_controller.rb create mode 100644 vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/tags_controller.rb create mode 100644 vendor/built_in_modules/archive/app/helpers/.gitkeep create mode 100644 vendor/built_in_modules/archive/app/mailers/.gitkeep create mode 100644 vendor/built_in_modules/archive/app/models/.gitkeep create mode 100644 vendor/built_in_modules/archive/app/models/archive_file.rb create mode 100644 vendor/built_in_modules/archive/app/models/archive_file_category.rb create mode 100644 vendor/built_in_modules/archive/app/models/archive_tag.rb create mode 100644 vendor/built_in_modules/archive/app/views/.gitkeep create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_form.html.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/create.js.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/destroy.js.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/edit.js.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/index.html.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/new.js.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/update.js.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_archive_files.html.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/destroy.js.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/edit.html.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/index.html.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/new.html.erb create mode 100644 vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/show.html.erb create mode 100644 vendor/built_in_modules/archive/archive.gemspec create mode 100644 vendor/built_in_modules/archive/archive.json create mode 100644 vendor/built_in_modules/archive/config/locales/en.yml create mode 100644 vendor/built_in_modules/archive/config/locales/zh_tw.yml create mode 100644 vendor/built_in_modules/archive/config/routes.rb create mode 100644 vendor/built_in_modules/archive/lib/archive.rb create mode 100644 vendor/built_in_modules/archive/lib/archive/engine.rb create mode 100644 vendor/built_in_modules/archive/lib/archive/version.rb create mode 100644 vendor/built_in_modules/archive/lib/tasks/archive_tasks.rake create mode 100644 vendor/built_in_modules/archive/script/rails create mode 100644 vendor/built_in_modules/archive/test/archive_test.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/Rakefile create mode 100644 vendor/built_in_modules/archive/test/dummy/app/assets/javascripts/application.js create mode 100644 vendor/built_in_modules/archive/test/dummy/app/assets/stylesheets/application.css create mode 100644 vendor/built_in_modules/archive/test/dummy/app/controllers/application_controller.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/app/helpers/application_helper.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/app/mailers/.gitkeep create mode 100644 vendor/built_in_modules/archive/test/dummy/app/models/.gitkeep create mode 100644 vendor/built_in_modules/archive/test/dummy/app/views/layouts/application.html.erb create mode 100644 vendor/built_in_modules/archive/test/dummy/config.ru create mode 100644 vendor/built_in_modules/archive/test/dummy/config/application.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/boot.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/database.yml create mode 100644 vendor/built_in_modules/archive/test/dummy/config/environment.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/environments/development.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/environments/production.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/environments/test.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/initializers/backtrace_silencers.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/initializers/inflections.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/initializers/mime_types.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/initializers/secret_token.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/initializers/session_store.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/initializers/wrap_parameters.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/config/locales/en.yml create mode 100644 vendor/built_in_modules/archive/test/dummy/config/routes.rb create mode 100644 vendor/built_in_modules/archive/test/dummy/lib/assets/.gitkeep create mode 100644 vendor/built_in_modules/archive/test/dummy/log/.gitkeep create mode 100644 vendor/built_in_modules/archive/test/dummy/public/404.html create mode 100644 vendor/built_in_modules/archive/test/dummy/public/422.html create mode 100644 vendor/built_in_modules/archive/test/dummy/public/500.html create mode 100644 vendor/built_in_modules/archive/test/dummy/public/favicon.ico create mode 100644 vendor/built_in_modules/archive/test/dummy/script/rails create mode 100644 vendor/built_in_modules/archive/test/integration/navigation_test.rb create mode 100644 vendor/built_in_modules/archive/test/test_helper.rb diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index f74f24f6..e8c8cbe5 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -48,6 +48,16 @@ <% end -%> <% 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/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb index 7f1b5626..e9396cba 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -12,5 +12,4 @@ <% @site_valid_locales.each do |locale| %> <%= bulletin_category.i18n_variable[locale] rescue nil %> <% end %> - <%= bulletin_category.display %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb index 0a6e7f83..28d2fde0 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb @@ -8,7 +8,6 @@ <% @site_valid_locales.each do |locale| %> <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %> <% end %> - <%= t('bulletin_category.display') %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index ef437e4d..9c997914 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -40,7 +40,7 @@
- <%= f.date_select :postdate, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'input-small'} %> + <%= f.date_select :postdate, {:use_month_numbers => true, :order => [:day, :month, :year] }, {:class => 'input-small'} %>
diff --git a/vendor/built_in_modules/archive/.gitignore b/vendor/built_in_modules/archive/.gitignore new file mode 100644 index 00000000..1463de6d --- /dev/null +++ b/vendor/built_in_modules/archive/.gitignore @@ -0,0 +1,6 @@ +.bundle/ +log/*.log +pkg/ +test/dummy/db/*.sqlite3 +test/dummy/log/*.log +test/dummy/tmp/ \ No newline at end of file diff --git a/vendor/built_in_modules/archive/Gemfile b/vendor/built_in_modules/archive/Gemfile new file mode 100644 index 00000000..f92bd902 --- /dev/null +++ b/vendor/built_in_modules/archive/Gemfile @@ -0,0 +1,17 @@ +source "http://rubygems.org" + +# Declare your gem's dependencies in archive.gemspec. +# Bundler will treat runtime dependencies like base dependencies, and +# development dependencies will be added by default to the :development group. +gemspec + +# jquery-rails is used by the dummy application +gem "jquery-rails" + +# Declare any dependencies that are still in development here instead of in +# your gemspec. These might include edge Rails or gems from your path or +# Git. Remember to move these dependencies to your gemspec before releasing +# your gem to rubygems.org. + +# To use debugger +# gem 'ruby-debug19', :require => 'ruby-debug' diff --git a/vendor/built_in_modules/archive/MIT-LICENSE b/vendor/built_in_modules/archive/MIT-LICENSE new file mode 100644 index 00000000..406f17b7 --- /dev/null +++ b/vendor/built_in_modules/archive/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright 2012 YOURNAME + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/built_in_modules/archive/README.rdoc b/vendor/built_in_modules/archive/README.rdoc new file mode 100644 index 00000000..2a19864e --- /dev/null +++ b/vendor/built_in_modules/archive/README.rdoc @@ -0,0 +1,3 @@ += Archive + +This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/vendor/built_in_modules/archive/Rakefile b/vendor/built_in_modules/archive/Rakefile new file mode 100644 index 00000000..b57290d4 --- /dev/null +++ b/vendor/built_in_modules/archive/Rakefile @@ -0,0 +1,39 @@ +#!/usr/bin/env rake +begin + require 'bundler/setup' +rescue LoadError + puts 'You must `gem install bundler` and `bundle install` to run rake tasks' +end +begin + require 'rdoc/task' +rescue LoadError + require 'rdoc/rdoc' + require 'rake/rdoctask' + RDoc::Task = Rake::RDocTask +end + +RDoc::Task.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'Archive' + rdoc.options << '--line-numbers' + rdoc.rdoc_files.include('README.rdoc') + rdoc.rdoc_files.include('lib/**/*.rb') +end + +APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__) +load 'rails/tasks/engine.rake' + + +Bundler::GemHelper.install_tasks + +require 'rake/testtask' + +Rake::TestTask.new(:test) do |t| + t.libs << 'lib' + t.libs << 'test' + t.pattern = 'test/**/*_test.rb' + t.verbose = false +end + + +task :default => :test diff --git a/vendor/built_in_modules/archive/app/assets/images/archive/.gitkeep b/vendor/built_in_modules/archive/app/assets/images/archive/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/archive/app/assets/javascripts/archive/.gitkeep b/vendor/built_in_modules/archive/app/assets/javascripts/archive/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/archive/app/assets/stylesheets/archive/.gitkeep b/vendor/built_in_modules/archive/app/assets/stylesheets/archive/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/archive/app/controllers/.gitkeep b/vendor/built_in_modules/archive/app/controllers/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/archive/app/controllers/application_controller.rb b/vendor/built_in_modules/archive/app/controllers/application_controller.rb new file mode 100644 index 00000000..307a4acd --- /dev/null +++ b/vendor/built_in_modules/archive/app/controllers/application_controller.rb @@ -0,0 +1,23 @@ +class ApplicationController < ActionController::Base + protect_from_forgery + before_filter :set_locale + + # Set I18n.locale + def set_locale + # update session if passed + session[:locale] = params[:locale] if params[:locale] + + # set locale based on session or default + begin + # check if locale is valid for non site pages + if !VALID_LOCALES.include?(session[:locale]) + I18n.locale = I18n.default_locale + else + I18n.locale = session[:locale] + end + rescue + I18n.locale = I18n.default_locale + end + end + +end 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 new file mode 100644 index 00000000..f9aba371 --- /dev/null +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb @@ -0,0 +1,97 @@ +class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendController + + def index + @archive_file_categorys = ArchiveFileCategory.all + @archive_file_category = ArchiveFileCategory.new(:display => 'List') + + @url = panel_archive_back_end_archive_file_categorys_path + + respond_to do |format| + format.html # index.html.erb + format.js + end + end + + # GET /archive_files/1 + # GET /archive_files/1.xml + def show + @archive_file_category = ArchiveFileCategory.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.js + end + end + + # GET /archive_files/new + # GET /archive_files/new.xml + def new + @archive_file_category = ArchiveFileCategory.new(:display => 'List') + + respond_to do |format| + format.html # new.html.erb + format.js + end + end + + # 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) + + respond_to do |format| + format.html + format.js + end + end + + # POST /archive_files + # POST /archive_files.xml + def create + @archive_file_category = ArchiveFileCategory.new(params[:archive_file_category]) + + respond_to do |format| + if @archive_file_category.save + format.html { redirect_to(panel_archive_back_end_archive_file_categorys_url, :notice => t('archive_file_category.create_archive_file_category_success')) } + format.js + else + format.html { render :action => "new" } + format.js { render action: "new" } + end + end + end + + # PUT /archive_files/1 + # PUT /archive_files/1.xml + def update + @archive_file_category = ArchiveFileCategory.find(params[:id]) + + @url = panel_archive_back_end_archive_file_category_path(@archive_file_category) + + respond_to do |format| + if @archive_file_category.update_attributes(params[:archive_file_category]) + format.html { redirect_to(panel_archive_back_end_archive_file_categorys_url, :notice => t('archive_file_category.update_archive_file_category_success')) } + # format.xml { head :ok } + format.js + else + format.html { render :action => "edit" } + format.js { render :action => "edit" } + end + end + end + + # DELETE /archive_files/1 + # DELETE /archive_files/1.xml + def destroy + @archive_file_category = ArchiveFileCategory.find(params[:id]) + @archive_file_category.destroy + + respond_to do |format| + format.html { redirect_to(panel_archive_back_end_archive_file_categorys_url) } + # format.xml { head :ok } + format.js + end + end +end 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 new file mode 100644 index 00000000..a4804bb5 --- /dev/null +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_files_controller.rb @@ -0,0 +1,117 @@ +class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController + + before_filter :authenticate_user! + before_filter :is_admin? + + def index + + get_categorys(params[:archive_file_category_id]) + + @archive_files = ArchiveFile.all.page(params[:page]).per(10) + + get_tags + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @archive_files } + end + end + + # GET /archive_files/1 + # GET /archive_files/1.xml + def show + @archive_file = ArchiveFile.find(params[:id]) + # get_categorys + + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @archive_file } + end + end + + # GET /archive_files/new + # GET /archive_files/new.xml + def new + @archive_file = ArchiveFile.new + + get_categorys + + get_tags + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @archive_file } + end + end + + # GET /archive_files/1/edit + def edit + @archive_file = ArchiveFile.find(params[:id]) + get_categorys + get_tags + end + + # POST /archive_files + # 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 + + respond_to do |format| + if @archive_file.save + format.html { redirect_to(panel_archive_back_end_archive_files_url) } + format.xml { render :xml => @archive_file, :status => :created, :location => @archive_file } + else + format.html { render :action => "new" } + format.xml { render :xml => @archive_file.errors, :status => :unprocessable_entity } + end + end + end + + # PUT /archive_files/1 + # PUT /archive_files/1.xml + def update + @archive_file = ArchiveFile.find(params[:id]) + + @archive_file.update_user_id = current_user.id + + params[:archive_file][:tag_ids] ||=[] + + respond_to do |format| + if @archive_file.update_attributes(params[:archive_file]) + format.html { redirect_to(panel_archive_back_end_archive_files_url) } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @archive_file.errors, :status => :unprocessable_entity } + end + end + end + + # DELETE /archive_files/1 + # DELETE /archive_files/1.xml + def destroy + @archive_file = ArchiveFile.find(params[:id]) + @archive_file.destroy + + respond_to do |format| + format.html { redirect_to(panel_archive_back_end_archive_files_url) } + # format.xml { head :ok } + format.js + end + end + + protected + + def get_categorys(id = nil) + @archive_file_categorys = (id ? ArchiveFileCategory.find(id).to_a : ArchiveFileCategory.excludes('disabled' => true)) + end + + def get_tags + module_app = ModuleApp.first(:conditions => {:key => 'archive'}) + @tags = Tag.all(:conditions => {:module_app_id => module_app.id}) + end + +end diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/tags_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/tags_controller.rb new file mode 100644 index 00000000..8dc1d4f3 --- /dev/null +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/tags_controller.rb @@ -0,0 +1,8 @@ +class Panel::Archive::BackEnd::TagsController < Admin::TagsController + + def initialize + super + @app_title = 'archive' + end + +end diff --git a/vendor/built_in_modules/archive/app/helpers/.gitkeep b/vendor/built_in_modules/archive/app/helpers/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/archive/app/mailers/.gitkeep b/vendor/built_in_modules/archive/app/mailers/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/archive/app/models/.gitkeep b/vendor/built_in_modules/archive/app/models/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/archive/app/models/archive_file.rb b/vendor/built_in_modules/archive/app/models/archive_file.rb new file mode 100644 index 00000000..61546825 --- /dev/null +++ b/vendor/built_in_modules/archive/app/models/archive_file.rb @@ -0,0 +1,63 @@ +# encoding: utf-8 + +class ArchiveFile + include Mongoid::Document + include Mongoid::Timestamps + include Mongoid::MultiParameterAttributes + + + has_one :name, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + + has_and_belongs_to_many :tags, :class_name => "ArchiveTag" + + field :create_user_id + field :update_user_id + + field :is_top, :type => Boolean, :default => false + field :is_hot, :type => Boolean, :default => false + field :is_hidden, :type => Boolean, :default => false + + belongs_to :archive_file_category + + validates_presence_of :name + + before_save :set_key + + 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, :name ) + + else + + find(:all).desc( :is_top, :name) + + end + + end + + + def self.widget_datas + + where( :is_hidden => false ).desc(:is_top, :name) + + end + + def is_top? + self.is_top + end + + def name + @name ||= I18nVariable.first(:conditions => {:key => 'name', :language_value_id => self.id, :language_value_type => self.class}) rescue nil + end + + protected + + def set_key + if name.new_record? + name.key = 'name' + end + end + +end \ No newline at end of file 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 new file mode 100644 index 00000000..abb08bd3 --- /dev/null +++ b/vendor/built_in_modules/archive/app/models/archive_file_category.rb @@ -0,0 +1,14 @@ +# encoding: utf-8 + +class ArchiveFileCategory + include Mongoid::Document + include Mongoid::Timestamps + # include Mongoid::MultiParameterAttributes + + field :key + + has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + + has_many :archive_files + +end \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/models/archive_tag.rb b/vendor/built_in_modules/archive/app/models/archive_tag.rb new file mode 100644 index 00000000..48aedc30 --- /dev/null +++ b/vendor/built_in_modules/archive/app/models/archive_tag.rb @@ -0,0 +1,10 @@ +class ArchiveTag < Tag + + has_and_belongs_to_many :archive_files + + + def get_visible_links(sort = :name) + self.archive_files.where(:is_hidden => false).desc(:is_top, sort) + end + +end \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/views/.gitkeep b/vendor/built_in_modules/archive/app/views/.gitkeep new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..c6bf4616 --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb @@ -0,0 +1,16 @@ + + + + + <%= archive_file_category.key %> +
+ +
+ + <% @site_valid_locales.each do |locale| %> + <%= archive_file_category.i18n_variable[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 new file mode 100644 index 00000000..f79bbab0 --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_form.html.erb @@ -0,0 +1,30 @@ +<% # encoding: utf-8 %> + +<%= form_for(@archive_file_category, :remote => true, :url => @url) do |f| %> + +

<%= (@archive_file_category.new_record? ? 'Add' : 'Edit') %>

+ +
+ <%= f.label :key %> + <%= f.text_field :key %> +
+ +
+ <%= f.fields_for :i18n_variable, (@archive_file_category.new_record? ? @archive_file_category.build_i18n_variable : @archive_file_category.i18n_variable) 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' %> +
+
+ <% end %> + <% end %> +
+ +
+ <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %> +
+ +<% end %> + \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/create.js.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/create.js.erb new file mode 100644 index 00000000..250d889b --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/create.js.erb @@ -0,0 +1,2 @@ +$('<%= j render :partial => 'archive_file_category', :collection => [@archive_file_category] %>').appendTo('#archive_file_categorys').hide().fadeIn(); +$("#new_archive_file_category")[0].reset(); \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/destroy.js.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/destroy.js.erb new file mode 100644 index 00000000..a8b303ed --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @archive_file_category %>").remove(); \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/edit.js.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/edit.js.erb new file mode 100644 index 00000000..eaff01fa --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/edit.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/index.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/index.html.erb new file mode 100644 index 00000000..0d2c0339 --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/index.html.erb @@ -0,0 +1,23 @@ + + +<%= flash_messages %> + + + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + + <%= render :partial => 'archive_file_category', :collection => @archive_file_categorys %> + + +
<%= t('archive_file_category.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
+ +
<%= render :partial => "form" %>
+ + diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/new.js.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/new.js.erb new file mode 100644 index 00000000..40061b9f --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/new.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/update.js.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/update.js.erb new file mode 100644 index 00000000..9a6f431e --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/update.js.erb @@ -0,0 +1,4 @@ +$("#<%= dom_id @archive_file_category %>").replaceWith("<%= j render :partial => 'link_category', :collection => [@archive_file_category] %>"); +<% @archive_file_category = WebLinkCategory.new(:display => 'List') # reset for new form %> +$(".edit_archive_file_category").replaceWith("<%= j render "form" %>") +$(".new_archive_file_category")[0].reset(); \ No newline at end of file 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 new file mode 100644 index 00000000..701ba989 --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_archive_files.html.erb @@ -0,0 +1,30 @@ + + + + <% if post.is_top? %> + <%= t(:top) %> + <% end %> + <% if post.is_hot? %> + <%= t(:hot) %> + <% end %> + <% if post.is_hidden? %> + <%= t(:hidden) %> + <% end %> +
+ +
+ + <%= post.archive_file_category.i18n_variable[I18n.locale] %> + + <%= link_to post.name[I18n.locale], panel_archive_back_end_archive_file_path(post) %> + + + <% post.tags.each do |tag| %> + <%= tag[I18n.locale] %> + <% end %> + + + 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 new file mode 100644 index 00000000..ef3e223b --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb @@ -0,0 +1,84 @@ +<% # encoding: utf-8 %> + + <%= f.error_messages %> + + + +
+ +
+
+ +
+

Status

+
+
+ <%= f.check_box :is_top %><%= t('top') %> + <%= f.check_box :is_hot %><%= t('hot') %> + <%= f.check_box :is_hidden %><%= t('hide') %> +
+
+
+ +
+
+ +
+

Tags

+
+ <% @tags.each do |tag| %> + <%= check_box_tag 'archive_file[tag_ids][]', tag.id, @archive_file.tag_ids.include?(tag.id)%> + <%= tag[I18n.locale] %> + <% end %> +
+
+ +
+ + + + + +
+
+ + <%= f.label :category %> + <%= f.select :archive_file_category_id, @archive_file_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %> + + + +
+ + <% @site_valid_locales.each_with_index do |locale, i| %> + +
"> +
+ <%= f.label :name %> + <%= f.fields_for :name, (@archive_file.new_record? ? @archive_file.build_name : @archive_file.name ) do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title' %> + <% end %> +
+ +
+ + <% end %> + +
+ +
+ + + + +
+ <%= f.submit t('submit'), :class=>'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
+ +
+ \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/destroy.js.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/destroy.js.erb new file mode 100644 index 00000000..7dc62871 --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @archive_file %>").remove(); \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/edit.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/edit.html.erb new file mode 100644 index 00000000..f2e347cc --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/edit.html.erb @@ -0,0 +1,5 @@ +

<%= t('archive.editing_archive') %>

+ +<%= form_for @archive_file, :url => panel_archive_back_end_archive_file_path(@archive_file), :html => {:class => 'clear'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/index.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/index.html.erb new file mode 100644 index 00000000..b00a3c4c --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/index.html.erb @@ -0,0 +1,23 @@ + +<%= flash_messages %> + + + + + + + + + + + + + <% @archive_files.each do |post| %> + <%= render :partial => 'archive_files', :locals => {:post => post} %> + <% end %> + + +
<%= t('archive_file.status') %><%= t('archive_file.category') %><%= t('archive_file.name') %><%= t('archive_file.tags') %>
+ +<%= paginate @archive_files %> + diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/new.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/new.html.erb new file mode 100644 index 00000000..dcdaf843 --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/new.html.erb @@ -0,0 +1,9 @@ + +<%= flash_messages %> +

<%= t('archive_file.new_archive') %>

+<%= form_for @archive_file, :url => panel_archive_back_end_archive_files_path, :html => {:class => 'clear'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> + +<%#= link_back %> + diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/show.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/show.html.erb new file mode 100644 index 00000000..f02d9156 --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/show.html.erb @@ -0,0 +1,57 @@ +<% # encoding: utf-8 %> + +
+
+
+ +

<%= flash_messages %>

+ +