Initial commit

This commit is contained in:
Bernie Chiu 2013-08-22 14:49:38 +08:00 committed by chris
parent d5dc3ef793
commit 5d8b65d625
107 changed files with 2312 additions and 0 deletions

View File

@ -0,0 +1,6 @@
.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/tmp/

View File

@ -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'

View File

@ -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.

View File

@ -0,0 +1,3 @@
= Archive
This project rocks and uses MIT-LICENSE.

View File

@ -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

View File

@ -0,0 +1,136 @@
/* General style with default layout */
.o-archives {}
.o-archives-content {}
.o-archives-group {
margin: 20px 0 0 0;
padding: 20px 0 0 0;
border-top: dashed 1px #eee;
}
.o-archives-group:first-child {
margin: 0;
padding: 0;
border: 0;
}
.o-archives-category {
padding-bottom: 16px;
border-bottom: solid 2px #ccc;
font-weight: bold;
}
.o-archives-list {}
.o-archives-list ul {
margin: 0;
padding: 0;
list-style: none;
}
.o-archives-list li {}
.o-archives-title {
border-left: solid 8px #eee;
border-bottom: solid 1px #eee;
padding: 0 0 0 16px;
}
.o-archives-list-item {}
.o-archives-list-item ol {
list-style-type: decimal;
}
.o-archives-list-item li {
margin: 0 0 10px 0;
}
.o-archives-file {}
.o-archives-file:hover {}
.o-archives-file-type {
display: inline-block;
vertical-align: middle;
margin-left: 8px;
padding: 0 4px;
height: 15px;
font-size: 9px;
text-transform: uppercase;
line-height: 15px;
background-color: #999;
color: #FFF;
border-radius: 3px;
-webkit-text-size-adjust: none;
}
/* Tag list */
.o-archives-tag-list {}
.o-archives-tag-list ul {
margin: 0 -4px;
padding: 0;
list-style: none;
}
.o-archives-tag-list ul:after {
content: ".";
clear: both;
display: block;
height: 0;
visibility: hidden;
}
.o-archives-tag-list li {
float: left;
margin: 0 4px 8px 4px;
}
.o-archives-tag {
display: block;
border: solid 1px #ccc;
padding: 2px 6px;
}
.o-archives-tag:hover {}
/* Table layout */
.o-archives.layout-table {}
.o-archives-search {
overflow: hidden;
margin: 0 0 10px 0;
}
.o-archives-search label {
display: inline-block;
margin: 0 8px 0 0;
}
.o-archives-search-option {
float: right;
}
.o-archives-search-option select {
width: 80px;
}
.o-archives-search-keyword {}
.o-archives-search-keyword input[type=submit] {
display: inline-block;
vertical-align: top;
margin: 0 0 0 8px;
}
.o-archives.layout-table table {
width: 100%;
table-layout: fixed;
}
.o-archives.layout-table tbody td {
vertical-align: top;
border-top: solid 1px #eee;
padding: 8px 4px;
}
.o-archives.layout-table .even {}
.o-archives.layout-table .even td {}
.o-archives.layout-table .column-ctrl {
text-align: left;
}
.o-archives.layout-table .column-ctrl.col-title { width: 30% }
.o-archives.layout-table .column-ctrl.col-file {}
.o-archives.layout-table .column-ctrl.col-category { width: 15%; }
.o-archives.layout-table .column-ctrl.col-tag { width: 20%; }
.o-archives.layout-table .o-archives-title {
font-weight: bold;
border: 0;
padding: 0;
}
.o-archives.layout-table .o-archives-category {
padding: 0;
margin: 0;
border: 0;
}
.o-archives.layout-table .o-archives-tag {
display: inline-block;
margin-bottom: 3px;
}
.o-archives.layout-table .o-archives-category {
font-weight: normal;
}

View File

@ -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

View File

@ -0,0 +1,147 @@
class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendController
include OrbitControllerLib::DivisionForDisable
before_filter :for_app_manager,:except => [:index,:get_categorys_json,:get_archive_files_json]
before_filter :force_order_for_visitor,:only=>[:index,:get_categorys_json,:get_archive_files_json]
before_filter :force_order_for_user,:except => [:index,:get_categorys_json,:get_archive_files_json]
before_filter :for_app_sub_manager,:except => [:index,:get_categorys_json,:get_archive_files_json]
def index
@archive_file_categorys = get_categories_for_index("ArchiveFileCategory")
# @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
def get_categorys_json
categorys = ArchiveFileCategory.all
data = Array.new
categorys.each do |c|
data << {
category: c.title,
link: "#{url_for( :action => "index",
:controller => "panel/archive/front_end/archive_files",
:format => :rss,
:only_path => false,
:inner=>true,
:category_id => c )}"
}
end
render :json => JSON.pretty_generate(data)
end
def get_archive_files_json
archive_file = ArchiveFileCategory.find(params[:archive_file_category_id]).archive_files
p archive_file
data = Array.new
archive_file.each do |b|
data << {
title: b.title,
link: "http://#{request.host_with_port}#{panel_archive_front_end_archive_file_path(b, :category_id => b.archive_file_category.id)}",
tag: b.sorted_tags.to_a,
}
end
render :json => JSON.pretty_generate(data)
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])
@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.disable = @archive_file_category.disable ? false : true
if @archive_file_category.save!
respond_to do |format|
flash[:notice] = t("update.success_")
# flash[:error] += @archive_file_category.disable ? t(:enable) : t(disable)
format.html { redirect_to(panel_archive_back_end_archive_file_categorys_url) }
# format.xml { head :ok }
format.js
end
else
flash[:error] = t("update.fail")
format.html { render :action => "index" }
end
end
end

View File

@ -0,0 +1,142 @@
class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
# before_filter :for_app_manager,:except => [:index,:show]
include OrbitControllerLib::DivisionForDisable
before_filter :force_order_for_visitor,:only=>[:index]
before_filter :force_order_for_user,:except => [:index]
before_filter :for_app_sub_manager,:except => [:index]
before_filter :only => [ :new,:edit,:update,:create] do |controller|
controller.get_categorys('ArchiveFileCategory')
end
def index
get_categorys("ArchiveFileCategory",params[:archive_file_category_id])
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
@archive_filecategories = get_categories_for_index("ArchiveFileCategory")
@archive_file_category_ids = @archive_file_categories.collect{|t| t.id.to_s} + [nil]
@archive_files = (params[:sort] || @filter) ? get_sorted_and_filtered("archive_file",:archive_file_category_id.in => @archive_file_category_ids) : get_viewable("archive_file",:archive_file_category_id.in => @archive_file_category_ids)
@tags = get_tags
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @archive_files }
format.js
end
end
# GET /archive_files/1
# GET /archive_files/1.xml
def show
@archive_file = ArchiveFile.find(params[:id])
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
@tags = 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])
@tags = 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
@tags = get_tags
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(:page => params[:page])) }
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
def delete
if params[:ids]
archive_files = ArchiveFile.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_archive_back_end_archive_files_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected
# def get_categorys(id = nil)
# @archive_file_categorys = (id ? ArchiveFileCategory.find(id).to_a : ArchiveFileCategory.excludes('disabled' => true))
# end
end

View File

@ -0,0 +1,8 @@
class Panel::Archive::BackEnd::TagsController < Admin::TagsController
def initialize
super
@app_title = 'archive'
end
end

View File

@ -0,0 +1,91 @@
class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
include AdminHelper
def initialize
super
@app_title = 'archive_files'
end
def get_search_result
@search = ArchiveFileCategory.solr_search do
fulltext params[:search_query]
with(:frontend_search,true)
end
search_result = @search.results.collect{|result| result.id}
params[:category_id] = @search.results.collect{|result| result.id}
@archive_file_categorys = ArchiveFileCategory.any_in(_id:search_result).page( params[:page_main]).per(@page_num)
end
def index
@item = Page.find(params[:page_id])
@title = @item.title
if !@item.frontend_data_count.blank?
@page_num = @item.frontend_data_count
else
@page_num = 10
end
date_now = Time.now
@archive_file_categorys = ArchiveFileCategory.all
# @archive_files = ArchiveFile.where( :is_hidden => false ).desc(:is_top).page(params[:page]).per(@page_num)
if !params[:category_id].blank? && !params[:tag_id].blank?
@archive_files = @archive_files.default_sort(params[:sort]).can_display.where(:archive_file_category_id.in => params[:category_id], :tagged_ids.in => params[:tag_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
elsif !params[:category_id].blank?
@archive_files = ArchiveFile.default_sort(params[:sort]).can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank?
@archive_files = ArchiveFile.default_sort(params[:sort]).can_display.where(:tagged_ids.in => params[:tag_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
else
@archive_files = ArchiveFile.default_sort(params[:sort]).can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num)
end
get_categorys
if params[:sort]
@archive_files = get_sorted_and_filtered('archive_file', nil, @archive_files)
end
end
def show
@item = Page.find(params[:page_id])
@title = @item.title
@archive_file = ArchiveFile.find(params[:id])
get_categorys
end
protected
def reload_archive_files
@item = Page.find(params[:page_id])
@title = @item.title
if @item.frontend_data_count
@page_num = @item.frontend_data_count
else
@page_num = 0
end
date_now = Time.now
@archive_file_categorys = ArchiveFileCategory.all
# @archive_files = ArchiveFile.where( :is_hidden => false ).desc(:is_top).page(params[:page]).per(@page_num)
if !params[:category_id].blank?
@archive_files = ArchiveFile.can_display.where(:archive_file_category_id => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank?
@archive_files = ArchiveFile.can_display.where(:tagged_ids => params[:tag_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
else
@archive_files = ArchiveFile.can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num)
end
get_categorys
end
def get_categorys
@archive_file_categorys = ArchiveFileCategory.excludes('disabled' => true)
end
end

View File

@ -0,0 +1,52 @@
class Panel::Archive::Widget::ArchiveFilesController < OrbitWidgetController
include AdminHelper
def initialize
super
@app_title = 'archive_files'
end
def index
@part = PagePart.find(params[:part_id])
if @part.widget_data_count
@page_num = @part.widget_data_count
else
@page_num = 4
end
if @part.widget_field
@widget_fields = @part.widget_field
else
@widget_fields = []
end
@widget_style = @part.widget_style
@category_id = @part.category
date_now = Time.now
if !params[:category_id].blank?
@archive_files = ArchiveFile.default_sort(params[:sort]).all.can_display.any_in(:archive_file_category_id => params[:category_id]).merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@archive_file_categorys = ArchiveFileCategory.any_in(:_id => params[:category_id]).excludes('disable' => true)
elsif !params[:tag_id].blank?
@archive_files = ArchiveFile.default_sort(params[:sort]).all.can_display.any_in(:tagged_ids => params[:tag_id]).merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
get_categorys
else
@archive_files = ArchiveFile.default_sort(params[:sort]).all.can_display.merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top).page( params[:page_main] ).per(@page_num)
get_categorys
end
if params[:sort]
@archive_files = get_sorted_and_filtered('archive_file', nil, @archive_files)
end
end
def get_categorys
@archive_file_categorys = ArchiveFileCategory.excludes('disable' => true)
end
end

View File

@ -0,0 +1,15 @@
module Panel::Archive::BackEnd::ArchiveFileCategorysHelper
include ActionView::Helpers::UrlHelper
def show_anc_cate_permission_link(archive_file_category)
type = 'submit'
oa = archive_file_category.get_object_auth_by_title(type)
if oa.nil?
archive_file_category.object_auths.new(title: type ).save
oa = archive_file_category.get_object_auth_by_title(type)
end
link_to t(:category_auth),admin_object_auth_ob_auth_path(oa)
end
end

View File

View File

@ -0,0 +1,88 @@
# encoding: utf-8
class ArchiveFile
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include Mongoid::Sortable
BelongsToCategory = :archive_file_category
include OrbitCoreLib::BelongsToCategoryMayDisable
PAYMENT_TYPES = @site_valid_locales
include OrbitTag::Taggable
taggable
field :title, localize: true
# 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
scope :can_display,where(is_hidden: 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
validates :title, :at_least_one => true
after_save :save_archive_file_multiples
# searchable do
# text :titles do
# title_translations.to_a.collect{|t| t[1]}
# end
# boolean :frontend_search do
# !is_hidden
# end
# end
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
find(:all).desc( :is_top, :title)
end
end
def self.widget_datas
where( :is_hidden => false ).desc(:is_top, :title)
end
def is_top?
self.is_top
end
def get_file_icon( file_data )
file_icon = "<span class=\"o-archives-file-type\">#{file_data.split('.')[-1]}</span>".html_safe
end
def save_archive_file_multiples
self.archive_file_multiples.each do |t|
if t.should_destroy
t.destroy
end
end
end
end

View File

@ -0,0 +1,47 @@
# encoding: utf-8
class ArchiveFileCategory
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectAuthable
include OrbitCoreLib::ObjectDisable
include Sunspot::Mongo
# include Mongoid::MultiParameterAttributes
APP_NAME = 'Archive'
ObjectAuthTitlesOptions = %W{submit_new fact_check}
AfterObjectAuthUrl = '/panel/archive/back_end/archive_file_categorys'
field :disable, type: Boolean, :default => false
field :display
field :key
field :title, localize: true
has_many :archive_files
validates :title, :at_least_one => true
searchable do
text :titles do
title_translations.to_a.collect{|t| t[1]}
end
boolean :frontend_search do
!disable
end
text :files do
archive_files.can_display.collect{|t| t.title_translations.to_a.collect{|t| t[1]}}
end
end
def pp_object
title
end
def self.from_id(id)
ArchiveFileCategory.find(id) rescue nil
end
end

View File

@ -0,0 +1,27 @@
class ArchiveFileMultiple
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Sortable
mount_uploader :file, AssetUploader
field :file_title, localize: true
# field :description
field :choose_lang, :type => Array, :default => nil
field :should_destroy, :type => Boolean
default_scope asc(:sort_number)
def choose_lang_display(lang)
self.choose_lang.include?(lang)
end
belongs_to :archive_file
# has_many :archive_file_multiple_langs, :autosave => true, :dependent => :destroy
# accepts_nested_attributes_for :archive_file_multiple_langs, :allow_destroy => true
end

View File

@ -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

View File

View File

@ -0,0 +1,20 @@
<tr id="<%= dom_id archive_file_category %>" class="with_action">
<td>
<%= archive_file_category.key %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<% if is_admin?%>
<li><%= link_to t(:edit), edit_panel_archive_back_end_archive_file_category_path(archive_file_category), :remote => true %></li>
<li><%= link_to show_toggle_archive_btn(archive_file_category) , panel_archive_back_end_archive_file_category_path(archive_file_category), :confirm => t(:sure?), :method => :delete, :remote => true,:class=> "archive_toggle" %></li>
<% end %>
<%if is_manager? || is_admin? %>
<li><%= show_anc_cate_permission_link(archive_file_category) %></li>
<% end %>
</ul>
</div>
</td>
<% @site_valid_locales.each do |locale| %>
<td><%= archive_file_category.title_translations[locale] rescue nil %></td>
<% end %>
</tr>

View File

@ -0,0 +1,30 @@
<% # encoding: utf-8 %>
<%= form_for(@archive_file_category, :remote => true, :url => @url) do |f| %>
<h2><%= (@archive_file_category.new_record? ? 'Add' : 'Edit') %></h2>
<div id="widget-title">
<%= f.label :key %>
<%= f.text_field :key %>
</div>
<div id="widget-title">
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class =>' input-xxlarge', :value => (@archive_file_category.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
<% end %>

View File

@ -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();

View File

@ -0,0 +1 @@
$("#<%= dom_id @archive_file_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@archive_file_category) %> ");

View File

@ -0,0 +1 @@
$("#form > form").replaceWith("<%= j render "form" %>");

View File

@ -0,0 +1,23 @@
<%= flash_messages %>
<table id="archive_file_categorys" class="table main-list">
<thead>
<tr>
<th class="span1-2"><%= t('archive_file_category.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
</tr>
</thead>
<tbody>
<%= render :partial => 'archive_file_category', :collection => @archive_file_categorys %>
</tbody>
</table>
<div id="form"><%= render :partial => "form" %></div>

View File

@ -0,0 +1 @@
$("#form > form").replaceWith("<%= j render "form" %>");

View File

@ -0,0 +1,4 @@
$("#<%= dom_id @archive_file_category %>").replaceWith("<%= j render :partial => 'archive_file_category', :collection => [@archive_file_category] %>");
<% @archive_file_category = ArchiveFileCategory.new(:display => 'List') # reset for new form %>
$(".edit_archive_file_category").replaceWith("<%= j render "form" %>")
$(".new_archive_file_category")[0].reset();

View File

@ -0,0 +1,49 @@
<tr id="<%= dom_id archive_file %>" class="with_action">
<td>
<% if (archive_file.create_user_id == current_or_guest_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', archive_file.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td>
<%= archive_file.sort_number %>
</td>
<td>
<div class="label-group">
<div class="label-td">
<% if archive_file.is_top? %>
<span class="label label-success"><%= t(:top) %></span>
<% end %>
<% if archive_file.is_hot? %>
<span class="label label-important"><%= t(:hot) %></span>
<% end %>
<% if archive_file.is_hidden? %>
<span class="label"><%= t(:hidden) %></span>
<% end %>
</div>
</div>
</td>
<td><%= archive_file.archive_file_category.title %></td>
<td>
<%= link_to archive_file.title, panel_archive_front_end_archive_file_path(archive_file) %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<% if (archive_file.create_user_id == current_or_guest_user.id) || is_manager? %>
<li><%= link_to t(:edit), edit_panel_archive_back_end_archive_file_path(archive_file) %></li>
<li class="dropdown"><%= link_to t(:delete_), panel_archive_back_end_archive_file_path(archive_file), :confirm => t(:sure?), :method => :delete, :remote => true %></li>
<% end -%>
</ul>
</div>
</td>
<td>
<div class="label-group">
<div class="label-td">
<% archive_file.sorted_tags.each do |tag| %>
<span class="label label-tags"><%= tag.name %></span>
<% end %>
</div>
</div>
</td>
</tr>

View File

@ -0,0 +1,3 @@
<div class="filter-clear">
<%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), panel_archive_back_end_archive_files_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %>
</div>

View File

@ -0,0 +1,37 @@
<div id='filter' class="subnav">
<ul class="nav nav-pills filter">
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle"><%= t(:status) %> <b class="web-symbol"></b></a>
</div>
</li>
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-category" data-toggle="collapse" data-parent="#filter" class="accordion-toggle"><%= t(:categories) %> <b class="web-symbol"></b></a>
</div>
</li>
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-tags" data-toggle="collapse" data-parent="#filter" class="accordion-toggle"><%= t(:tags) %> <b class="web-symbol"></b></a>
</div>
</li>
</ul>
<div class="filters accordion-group">
<div class="accordion-body collapse" id="collapse-status">
<%= render 'filter_status' %>
</div>
<div class="accordion-body collapse" id="collapse-category">
<%= render 'filter_categories' %>
</div>
<div class="accordion-body collapse" id="collapse-tags">
<%= render 'filter_tags' %>
</div>
<div id="sort_headers" class="table-label">
<%= render 'sort_headers' %>
</div>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "sort_header" %>
<% end %>

View File

@ -0,0 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<% @archive_file_categories.each do |category| -%>
<%= link_to category.title, panel_archive_back_end_archive_files_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('categories', category.id)}" %>
<% end -%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>

View File

@ -0,0 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<%= link_to t(:top), panel_archive_back_end_archive_files_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_top')}" %>
<%= link_to t(:hot), panel_archive_back_end_archive_files_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_hot')}" %>
<%= link_to t(:hidden), panel_archive_back_end_archive_files_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_hidden')}" unless(is_guest?)%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'status'} %>

View File

@ -0,0 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<% @tags.each do |tag| -%>
<%= link_to tag.name, panel_archive_back_end_archive_files_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('tags', tag.id)}" %>
<% end -%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>

View File

@ -0,0 +1,157 @@
<% # encoding: utf-8 %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<div id="widget-status" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting the announcement state">
<a class="action"><i class="icon-exclamation-sign icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-star"></i>Status</h3>
<div class="widget-content clear">
<div class="controls">
<%= f.check_box :is_top %><%= t('top') %>
<%= f.check_box :is_hot %><%= t('hot') %>
<%= f.check_box :is_hidden %><%= t('hide') %>
</div>
</div>
</div>
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= check_box_tag 'archive_file[tag_ids][]', tag.id, @archive_file.tag_ids.include?(tag.id)%>
<%= tag.name %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body">
<div id="post-body-content" class="clear">
<%= f.label :category %>
<%= f.select :archive_file_category_id, @archive_file_categorys.collect {|t| [ t.title, t.id ]} %>
<%= f.label :sort_number %>
<%= f.text_field :sort_number %>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<%# site_valid_locales_default_head.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :title %>
<%= f.fields_for :title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@archive_file.title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<% end %>
</div>
<div>
<div class="archive_file_multiples_block">
<table class="table table-condensed">
<thead>
<tr>
<th>排序數</th>
<th>File</th>
<th>File Name</th>
<th class="span2"><%= t('呈現語系')%></th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="4">
<div id='add_archive_file_multiple' class="info_input archive_file_multiples_block">
<%= hidden_field_tag 'archive_file_multiple_field_count', @archive_file.archive_file_multiples.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @archive_file.archive_file_multiples.asc(:_id).each_with_index do |archive_file_multiple, i| %>
<%= f.fields_for :archive_file_multiples, archive_file_multiple do |f| %>
<%= render :partial => 'form_file', :object => archive_file_multiple, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<!--Post End-->
<div class="form-actions">
<%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %>
<%= hidden_field_tag 'filter', params[:filter] %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "archive_form" %>
<script>
$('#add_archive_file_multiple a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_archive_file_multiples", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
var new_form_file = $("<%= escape_javascript(add_attribute 'form_file', f, :archive_file_multiples) %>".replace(old_id, new_id));
new_form_file.find('input#archive_file_archive_file_multiples_attributes_'+new_id+'_sort_number').val(new_id * 10)
$(this).parents('table').append(new_form_file);
});
$('.archive_file_multiples_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$('.action a.remove_existing_record').live('click', function(){
$(this).next('.should_destroy').attr('value', 1);
$("tr#archive_file_" + $(this).prev().attr('value')).hide();
});
</script>
<% end %>

View File

@ -0,0 +1,64 @@
<% # encoding: utf-8 %>
<tr id="<%= "archive_file_multiple_#{form_file.id}" if !form_file.new_record? %>" class='list_item'>
<td>
<div class="control-group">
<div class="controls">
<%= f.text_field :sort_number %>
</div>
</div>
</td>
<td>
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
</div>
</div>
</td>
<td>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %>
<%= f.fields_for :file_title_translations do |f| %>
<div class="control-group">
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label>
<div class="controls">
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</td>
<td>
<% @site_valid_locales.each do |locale| %>
<%= check_box_tag "archive_file[archive_file_multiples_attributes][#{( form_file.new_record? ? 'new_archive_file_multiples' : "#{i}" )}][choose_lang][]", locale, (form_file.choose_lang.nil? ? true : form_file.choose_lang.include?(locale)) %>
<%= I18nVariable.from_locale(locale) %>
<% end %>
<%= hidden_field_tag 'archive_file[archive_file_multiples_attributes][0][choose_lang][]', '' %>
</td>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>

View File

@ -0,0 +1,6 @@
<%= render_sort_bar(true, delete_panel_archive_back_end_archive_files_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
['sort_number', 'sort_number', 'span1', :sort_number],
['status', ['is_top', 'is_hot', 'is_hidden'], 'span1', :status],
['category', 'archive_file_category', 'span2', :category],
['title', 'title','span3', :title],
['tags', 'tags', 'span2', :tags]).html_safe %>

View File

@ -0,0 +1 @@
$("#<%= dom_id @archive_file %>").remove();

View File

@ -0,0 +1,5 @@
<h1><%= t('archive.editing_archive') %></h1>
<%= 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 %>

View File

@ -0,0 +1,24 @@
<%= render 'filter' %>
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span2"></th>
<th class="span3"></th>
<th class="span2"></th>
</tr>
</thead>
<tbody id="tbody_archive">
<%= render :partial => 'archive_file', :collection => @archive_files %>
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_panel_archive_back_end_archive_file_path, :class => 'btn btn-primary pull-right' if (is_manager? rescue nil) %>
<div id="archive_file_pagination" class="paginationFixed">
<%= paginate @archive_files, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>

View File

@ -0,0 +1,7 @@
$("#collapse-status").html("<%= j render 'filter_status' %>");
$("#collapse-category").html("<%= j render 'filter_categories' %>");
$("#collapse-tags").html("<%= j render 'filter_tags' %>");
$("#delete_all").attr("action", "<%= delete_panel_archive_back_end_archive_files_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>");
$("#sort_headers").html("<%= j render 'sort_headers' %>");
$("#tbody_archive").html("<%= j render :partial => 'archive_file', :collection => @archive_files %>");
$("#archive_file_pagination").html("<%= j paginate @archive_files, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");

View File

@ -0,0 +1,9 @@
<%= flash_messages %>
<h1><%= t('archive_file.new_archive') %></h1>
<%= 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 %>

View File

@ -0,0 +1,56 @@
<% # encoding: utf-8 %>
<div class="o-archives layout-table">
<table>
<thead>
<tr>
<th class="column-ctrl col-title"><%= sortable(:title, t("archive.Title"))%></th>
<th class="column-ctrl col-file"><%= t("archive.Files")%></th>
<th class="column-ctrl col-category"><%= sortable(:archive_file_category, t("archive.Category"))%></th>
</tr>
</thead>
<tbody>
<% @archive_files.each_with_index do |post,i| %>
<tr <% if ( (i + 1) % 2 ) == 0 %> class="even" <% end %>>
<td><div class="o-archives-title"><%= post.title %></div></td>
<td>
<div class="o-archives-list-item">
<% if !post.archive_file_multiples.blank? %>
<ol>
<% post.archive_file_multiples.asc(:_id).each do | afile | %>
<% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %>
<li>
<%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} %>
<%= post.get_file_icon(afile.file.url) %>
</li>
<% end %>
<% end %>
</ol>
<% end %>
</div>
</td>
<td><div class="o-archives-category">
<%= post.archive_file_category.title %>
</div></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= paginate @archive_files, :param_name => :page_main, :params => {:inner => 'false'} %>
<%= stylesheet_link_tag "archive/archives" %>

View File

@ -0,0 +1,18 @@
<%= stylesheet_link_tag "default_widget" %>
<script type='text/javascript' src='/assets/jquery.mu.image.resize.js'></script>
<script type='text/javascript' src='/assets/jquery.mu.image.resize.degsin.js'></script>
<div id="archive_file_widget">
<%= render 'index' %>
</div>
<%= stylesheet_link_tag "archive/archives" %>

View File

@ -0,0 +1 @@
$('#archive_file_widget').html("<%= j render 'index' %>")

View File

@ -0,0 +1,30 @@
<div class="o-archives">
<div class="o-archives-content">
<div class="o-archives-group">
<h2 class="o-archives-category h2"><%= @archive_file.archive_file_category.title rescue nil %></h2>
<div class="o-archives-content">
<div class="o-archives-list">
<ul>
<li>
<h3 class="o-archives-title h3"><%= @archive_file.title %></h3>
<div class="o-archives-list-item">
<ol>
<% @archive_file.archive_file_multiples.each do | afile | %>
<% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %>
<li>
<%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} %>
<%= @archive_file.get_file_icon(afile.file.url) %>
</li>
<% end %>
<% end %>
</ol>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<%= stylesheet_link_tag "archive/archives" %>

View File

@ -0,0 +1,10 @@
<% @bulletins.each do |bulletin| %>
<li>
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id , :tag_id => @selected_tag.id ) %>
</li>
<% end %>
<div class='pagination'>
<%= link_to_previous_page @bulletins, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
<%= link_to_next_page @bulletins, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
</div>

View File

@ -0,0 +1,98 @@
<% # encoding: utf-8 %>
<% if @widget_style == '1' %>
<div class="o-archives layout-table">
<table>
<thead>
<tr>
<th class="column-ctrl col-title"><%= sortable(:title, t("archive.Title"))%></th>
<th class="column-ctrl col-file"><%= t("archive.Files")%></th>
<th class="column-ctrl col-category"><%= sortable(:archive_file_category, t("archive.Category"))%></th>
</tr>
</thead>
<tbody>
<% @archive_files.each_with_index do |post,i| %>
<tr <% if ( (i + 1) % 2 ) == 0 %> class="even" <% end %>>
<td><div class="o-archives-title"><%= post.title %></div></td>
<td>
<div class="o-archives-list-item">
<% if !post.archive_file_multiples.blank? %>
<ol>
<% post.archive_file_multiples.asc(:_id).each do | afile | %>
<% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %>
<li>
<%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} %>
<%= post.get_file_icon(afile.file.url) %>
</li>
<% end %>
<% end %>
</ol>
<% end %>
</div>
</td>
<td><div class="o-archives-category">
<%= post.archive_file_category.title %>
</div></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pull_right">
<% if !params[:category_id].blank? %>
<%= link_to t(:more_plus), panel_archive_front_end_archive_files_path(:category_id => @part.category) %>
<% else %>
<%= link_to t(:more_plus), panel_archive_front_end_archive_files_path %>
<% end %>
</div>
<% elsif @widget_style == '2' %>
<div class="o-archives">
<div class="o-archives-content">
<% @archive_file_categorys.each do |afcpost| %>
<div class="o-archives-group">
<% if @category_id.blank? %>
<h2 class="o-archives-category h2"><%= afcpost.title %></h2>
<% end %>
<div class="o-archives-content">
<div class="o-archives-list">
<ul>
<% afcpost.archive_files.can_display.desc( :is_top ).each do |post| %>
<li>
<h3 class="o-archives-title h3"><%= post.title %></h3>
<div class="o-archives-list-item">
<% if !post.archive_file_multiples.blank? %>
<ol>
<% post.archive_file_multiples.asc(:_id).each do | afile | %>
<% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %>
<li>
<%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} %>
<%= post.get_file_icon(afile.file.url) %>
</li>
<% end %>
<% end %>
</ol>
<% end %>
</div>
</li>
<% end %>
</ul>
</div>
</div>
<% end %>
</div>
</div>
<% end %>

View File

@ -0,0 +1,3 @@
<li>
<%= link_to tag.name, panel_announcement_widget_bulletins_and_web_links_path(:id => tag.id), :remote => true, :class => ('active' if tag.eql?(@selected_tag)) %>
</li>

View File

@ -0,0 +1,10 @@
<% @web_links.each do |web_link| %>
<li>
<%= link_to web_link.title, web_link.url %>
</li>
<% end %>
<div class='pagination'>
<%= link_to_previous_page @web_links, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
<%= link_to_next_page @web_links, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
</div>

View File

@ -0,0 +1,8 @@
<%= form_tag panel_archive_front_end_archive_files_path, method: :get do %>
<%= hidden_field_tag :category_id, params[:category_id] %>
<%= hidden_field_tag :tag_id, params[:tag_id] %>
<p>
<%= text_field_tag :search_query, params[:search_query],{:value => (params[:search_query].blank?? '' : params[:search_query]),:placeholder => t("announcement.search") }%>
<%= submit_tag "Search", name: nil %>
</p>
<% end %>

View File

@ -0,0 +1,31 @@
<% # encoding: utf-8 %>
<% if @bulletins and !@bulletins.nil? %>
<div class="tag_block">
<ul class="tag_list">
<% @tags.each do |tag| %>
<li><%= tag.name %></li>
<% end %>
</ul>
</div>
<% @tags.each_with_index do |tag, index| %>
<div id="news_<%= index %>" class="news_block">
<h3 class="news_title2"><%= t("announcement.bulletins") %></h3>
<div class="news_prev">prev</div>
<div class="news_next">next</div>
<ul class="news_list">
<% tag.bulletins.each do |post| %>
<li><%= link_to post.title, panel_announcement_front_end_bulletin_path(post) %></li>
<% end %>
</ul>
</div>
<% end %>
<% end %>

View File

@ -0,0 +1,23 @@
<!-- <div class="search"> <input type="text" onfocus="this.value='';this.searchClickFlag=true;" onblur="if(this.value==''){this.value='公告搜尋';this.searchClickFlag=false;}" value="公告搜尋" id="q" class="search_key" name="q"/> <input type="submit" name="sa" id="sa" class="sa" value="." /> </div> -->
<div class="category_list">
<h3 class="h3"><%= t(:categories) %></h3>
<ul class="list">
<% @bulletin_categorys.each do |category| %>
<li class="<%= category.id.to_s.eql?(params[:category_id]) ? 'active' : nil %>">
<%= link_to category.title, panel_announcement_front_end_bulletins_path(:category_id => category.id) %>
</li>
<% end %>
</ul>
</div>
<div class="tag_cloud">
<h3 class="h3"><%= t(:tag_cloud) %></h3>
<div class="cloud">
<% @tags_and_class.each do |tag| %>
<%= link_to tag[0][I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag[0].id, :category_id => params[:category_id]), :class => "#{tag[1]} #{(tag[0].id.to_s.eql?(params[:tag_id]) || tag[0].key.eql?(params[:tag_id])) ? 'active' : nil} " %>
<% end %>
</div>
</div>
<!-- <div class="clear"></div> -->
<!-- <div class="rss_feed">
<a href="" class="rssimg"> Rss feed </a>
</div> -->

View File

@ -0,0 +1,9 @@
<%= stylesheet_link_tag "default_widget" %>
<script type='text/javascript' src='/assets/jquery.mu.image.resize.js'></script>
<script type='text/javascript' src='/assets/jquery.mu.image.resize.degsin.js'></script>
<div id="archive_file_widget">
<%= render 'index' %>
</div>
<%= stylesheet_link_tag "archive/archives" %>

View File

@ -0,0 +1 @@
$('#archive_file_widget').html("<%= j render 'index' %>")

View File

@ -0,0 +1 @@
$('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' if @bulletins %>")

View File

@ -0,0 +1 @@
$('#bulletins_web_links_web_links').html("<%= j render 'web_links' if @web_links %>")

View File

@ -0,0 +1,23 @@
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "archive/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "archive"
s.version = Archive::VERSION
s.authors = ["TODO: Your name"]
s.email = ["TODO: Your email"]
s.homepage = "TODO"
s.summary = "TODO: Summary of Archive."
s.description = "TODO: Description of Archive."
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
s.add_dependency "rails", "~> 3.1.4"
# s.add_dependency "jquery-rails"
s.add_development_dependency "sqlite3"
end

View File

@ -0,0 +1,12 @@
{
"title": "archive",
"version": "0.1",
"organization": "Rulingcom",
"author": "RD dep",
"intro": "Archive",
"update_info": "Some info",
"create_date": "11-11-2011",
"app_pages": ["archive_files"],
"widgets": {"archive_files":[]},
"enable_frontend": true
}

View File

@ -0,0 +1,11 @@
en:
archive:
archive: Archive
Title: Title
Files: Files
Category: Category
frontend:
archive: Archive Frontend
widget:
index: Archive Widget

View File

@ -0,0 +1,15 @@
zh_tw:
archive:
archive: 檔案室
Title: 標題
Files: 檔案
Category: 類別
frontend:
archive: 檔案室前台
widget:
index: 檔案室Widget
mongoid:
attributes:
archive_file:
sort_number: 排序數

View File

@ -0,0 +1,24 @@
Rails.application.routes.draw do
namespace :panel do
namespace :archive do
namespace :back_end do
resources :archive_files do
collection do
get 'delete'
end
end
resources :archive_file_categorys
resources :tags
end
namespace :front_end do
match "archive_files" => "archive_files#index"
resources :archive_files
end
namespace :widget do
match "index" => "archive_files#index"
match "archive_search_block" => "archive_files#archive_search_block"
end
end
end
match "/appfront/*path" => redirect("/panel/*path")
end

View File

@ -0,0 +1,88 @@
module Dictionary
OrbitApp.registration "Dictionary",:type=> 'ModuleApp' do
module_label 'archive.archive'
base_url File.expand_path File.dirname(__FILE__)
# personal_plugin :enable => true,:path=>"panel/archive/plugin/profile",:i18n=>'archive.archive'
version "0.1"
organization "Rulingcom"
author "RD dep"
intro "I am intro"
update_info 'some update_info'
front_end do
app_page 'archive_files' do
frontend_i18n "archive.frontend.archive"
end
end
category ["ArchiveFileCategory"]
taggable
widgets do
# default_widget do
# query 'ArchiveFile.all'
# field :category
# link_field :title,{:method => 'panel_archive_front_end_archive_file_path',:args=>:self}
# link_field :archive_file_category_with_title,{:method => 'panel_archive_front_end_archive_files_path',:args=>{:category_id => [:archive_file_category,:id]}}
# end
categories_query 'ArchiveFileCategory.all'
tags_query 'ArchiveTag.all'
customize_widget "index" do
widget_i18n "archive.widget.index"
style ["1"]
end
customize_widget "archive_search_block" do
widget_i18n "announcement.widget.search"
end
# item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"]
# item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
end
side_bar do
head_label_i18n 'archive.archive',:icon_class=>"icons-archive"
available_for [:admin,:guest,:manager,:sub_manager]
active_for_controllers ({:private=>['archive_file_categorys','archive_files'],:public=>['panel/archive/back_end/tags']})
active_for_object_auth ['ArchiveFileCategory']
head_link_path "panel_archive_back_end_archive_files_path"
context_link 'all',
:link_path=>"panel_archive_back_end_archive_files_path" ,
:priority=>1,
:active_for_action=>{:archive_files=>:index},
:available_for => [:all]
context_link 'add',
:link_path=>"new_panel_archive_back_end_archive_file_path" ,
:priority=>2,
:active_for_action=>{:archive_files=>:new},
:available_for => [:sub_manager]
context_link 'categories',
:link_path=>"panel_archive_back_end_archive_file_categorys_path" ,
:priority=>3,
:active_for_action=>{:archive_file_categorys=>:index},
:available_for => [:manager]
# context_link 'tags',
# :link_path=>"admin_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Archive'}))" ,
# :priority=>4,
# # :active_for_action=>{:bulletin_categorys=>:index},
# :available_for => [:manager]
context_link 'module_authorization',
:link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: 'Archive'}))",
:priority=>6,
:active_for_app_auth => 'Archive'
end
end
end

View File

@ -0,0 +1,4 @@
require "archive/engine"
module Archive
end

View File

@ -0,0 +1,4 @@
module Archive
class Engine < Rails::Engine
end
end

View File

@ -0,0 +1,3 @@
module Archive
VERSION = "0.0.1"
end

View File

@ -0,0 +1,4 @@
# desc "Explaining what the task does"
# task :archive do
# # Task goes here
# end

View File

@ -0,0 +1,6 @@
#!/usr/bin/env ruby.exe
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
ENGINE_PATH = File.expand_path('../..', __FILE__)
load File.expand_path('../../test/dummy/script/rails', __FILE__)

View File

@ -0,0 +1,7 @@
require 'test_helper'
class ArchiveTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, Archive
end
end

View File

@ -0,0 +1,7 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Dummy::Application.load_tasks

View File

@ -0,0 +1,9 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .

View File

@ -0,0 +1,7 @@
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require_tree .
*/

View File

@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end

View File

@ -0,0 +1,2 @@
module ApplicationHelper
end

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Dummy</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@ -0,0 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Dummy::Application

View File

@ -0,0 +1,45 @@
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require
require "archive"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
end
end

View File

@ -0,0 +1,10 @@
require 'rubygems'
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
if File.exist?(gemfile)
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
end
$:.unshift File.expand_path('../../../../lib', __FILE__)

View File

@ -0,0 +1,25 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000

View File

@ -0,0 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Dummy::Application.initialize!

View File

@ -0,0 +1,30 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
end

View File

@ -0,0 +1,60 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to Rails.root.join("public/assets")
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end

View File

@ -0,0 +1,39 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end

View File

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!

View File

@ -0,0 +1,10 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

View File

@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

View File

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Dummy::Application.config.secret_token = 'aec42790c63fdc0784df1572e74631a6f9c9d16729b813ecbd5f086eaab251cdf0bcba044a78b706d1f45d43c4ec5af5df5cc5ffd2ff7ca64953a5806ce49618'

View File

@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Dummy::Application.config.session_store :active_record_store

View File

@ -0,0 +1,14 @@
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
# Disable root element in JSON by default.
ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false
end

View File

@ -0,0 +1,5 @@
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
hello: "Hello world"

View File

@ -0,0 +1,58 @@
Dummy::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end

Some files were not shown because too many files have changed in this diff Show More