diff --git a/app/controllers/admin/archive_files_controller.rb b/app/controllers/admin/archive_files_controller.rb
index 647a333..6282676 100644
--- a/app/controllers/admin/archive_files_controller.rb
+++ b/app/controllers/admin/archive_files_controller.rb
@@ -87,7 +87,7 @@ class Admin::ArchiveFilesController < OrbitAdminController
respond_to do |format|
if @archive_file.save
- format.html { redirect_to(edit_admin_archive_file_path(@archive_file.id)) }
+ format.html { redirect_to(admin_archive_files_path) }
format.xml { render :xml => @archive_file, :status => :created, :location => @archive_file }
else
@tags = @module_app.tags
@@ -106,7 +106,7 @@ class Admin::ArchiveFilesController < OrbitAdminController
respond_to do |format|
if @archive_file.update_attributes(archive_vars)
- format.html { redirect_to(edit_admin_archive_file_path(@archive_file.id)) }
+ format.html { redirect_to(admin_archive_files_path) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb
index 6ec1756..8da3c05 100644
--- a/app/controllers/archives_controller.rb
+++ b/app/controllers/archives_controller.rb
@@ -48,6 +48,7 @@ class ArchivesController < ApplicationController
end
archives << {
"archive-title" => archive.title,
+ "description" => archive.description,
"created_at" => archive.created_at.strftime('%Y%m%d').to_i,
"archive-url" => archive.url,
"url" => archive.url,
@@ -103,6 +104,7 @@ class ArchivesController < ApplicationController
end
{
"archive-title" => archive.title,
+ "description" => archive.description,
"created_at" => archive.created_at.strftime('%Y%m%d').to_i,
"archive-url" => archive.url,
"url" => archive.url,
@@ -190,7 +192,8 @@ class ArchivesController < ApplicationController
end
end
{
- "categories" => cats_last
+ "categories" => cats_last,
+ "extras" =>{"description-head"=>I18n.t("archive.description")}
}
end
@@ -236,6 +239,7 @@ class ArchivesController < ApplicationController
files_by_category_tag[t].each_with_index do |archive,index|
a = {
"archive-title" => archive.title,
+ "description" => archive.description,
"archive-url" => archive.url,
"archive_url" => OrbitHelper.widget_more_url
}
@@ -309,6 +313,7 @@ class ArchivesController < ApplicationController
end
{
"archive-title" => archive.title,
+ "description" => archive.description,
"archive-url" => archive.url,
"archive_url" => url
}
@@ -323,6 +328,7 @@ class ArchivesController < ApplicationController
end
{
"archive-title" => archive.title,
+ "description" => archive.description,
"archive-url" => archive.url,
"archive_url" => url
}
diff --git a/app/models/archive_file.rb b/app/models/archive_file.rb
index fcd9d63..715dd3d 100644
--- a/app/models/archive_file.rb
+++ b/app/models/archive_file.rb
@@ -18,6 +18,7 @@ class ArchiveFile
field :title, as: :slug_title, localize: true
+ field :description, localize: true
field :url, localize: true
field :create_user_id
field :update_user_id
diff --git a/app/views/admin/archive_files/_form.html.erb b/app/views/admin/archive_files/_form.html.erb
index fd76711..bf20d54 100644
--- a/app/views/admin/archive_files/_form.html.erb
+++ b/app/views/admin/archive_files/_form.html.erb
@@ -121,6 +121,15 @@
<% end %>
+
+
<%= t(:url) %>
diff --git a/archive.gemspec b/archive.gemspec
index 0e7de18..24fa5ab 100644
--- a/archive.gemspec
+++ b/archive.gemspec
@@ -2,7 +2,58 @@ $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "archive/version"
-
+env_pwd = ENV['PWD']
+app_path = File.expand_path(__dir__)
+template_path = env_pwd + '/app/templates'
+all_template = Dir.glob(template_path+'/*/')
+all_template.each do |folder|
+ if !folder.include?('mobile')
+ begin
+ next unless File.exist?("#{folder}modules/archive/info.json")
+ info_json_file = "#{folder}modules/archive/info.json"
+ info_json = JSON.parse(File.read(info_json_file))
+ check_files = ["archive_index7","archive_index8"]
+ file_infos = [
+ {
+ "filename" : "archive_index7",
+ "name" : {
+ "zh_tw" : "7. 表格列表 ( 模組標題, 類別標題, 檔案名稱, 檔案簡介, 下載連結 )",
+ "en" : "7. Table list (widget-title, category, filename, download link)"
+ },
+ "thumbnail" : "ar5.png"
+ },
+ {
+ "filename" : "archive_index8",
+ "name" : {
+ "zh_tw" : "8. 表格列表 ( 模組標題, 檔案名稱, 檔案簡介, 下載連結 )",
+ "en" : "8. Table list (widget-title, filename, download link)"
+ },
+ "thumbnail" : "ar5.png"
+ }
+ ]
+ flags = []
+ check_files.each_with_index do |check_file,i|
+ flag = (info_json["frontend"].select{|h| h["filename"] == check_file}.count == 0 rescue false)
+ if flag
+ info_json["frontend"].push(file_infos[i])
+ end
+ flags << flag
+ end
+ if flags.select{|flag| flag }.count != 0
+ puts "updating archive index page"
+ flags.each_with_index do |flag,i|
+ if flag
+ Bundler.with_clean_env{%x[cp -f #{app_path}/modules/archive/#{check_files[i]} #{folder}modules/archive/#{check_files[i]}]}
+ end
+ end
+ File.open(info_json_file,"w+"){|f| f.write(info_json.to_json)}
+ end
+ Bundler.with_clean_env{%x[cp -f #{app_path}/modules/faq/faq_index2.html.erb #{folder}modules/faq/faq_index2.html.erb]}
+ rescue
+ puts "There has some error when updating archive index page."
+ end
+ end
+end
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "archive"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 1ec522f..c45b0f5 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2,6 +2,7 @@ en:
restful_actions:
categories_order: Categories Order
archive:
+ description: File description
category: Category
sort_number: Sort Order
save: Save
diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml
index 695fd11..e09534a 100644
--- a/config/locales/zh_tw.yml
+++ b/config/locales/zh_tw.yml
@@ -2,6 +2,7 @@ zh_tw:
restful_actions:
categories_order: 類別排序
archive:
+ description: 檔案簡介
category: 類別
sort_number: 排序號碼
save: 儲存
diff --git a/modules/archive/_archive_widget1.html.erb b/modules/archive/_archive_widget1.html.erb
new file mode 100644
index 0000000..2761be5
--- /dev/null
+++ b/modules/archive/_archive_widget1.html.erb
@@ -0,0 +1,18 @@
+
diff --git a/modules/archive/_archive_widget2.html.erb b/modules/archive/_archive_widget2.html.erb
new file mode 100644
index 0000000..3bdcf62
--- /dev/null
+++ b/modules/archive/_archive_widget2.html.erb
@@ -0,0 +1,28 @@
+
\ No newline at end of file
diff --git a/modules/archive/archive_index1.html.erb b/modules/archive/archive_index1.html.erb
new file mode 100644
index 0000000..725165d
--- /dev/null
+++ b/modules/archive/archive_index1.html.erb
@@ -0,0 +1,24 @@
+
+
{{page-title}}
+
+
+ {{category-title}}
+
+
+
+ {{archive-title}}
+
+ {{status}}
+
+
+
+
+ {{file-name}}
+ {{file-type}}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/archive/archive_index2.html.erb b/modules/archive/archive_index2.html.erb
new file mode 100644
index 0000000..70fe62e
--- /dev/null
+++ b/modules/archive/archive_index2.html.erb
@@ -0,0 +1,36 @@
+
+
+ {{page-title}}
+
+
+
+
+
+
+
+
+ {{archive-title}}
+
+ {{status}}
+
+
+
+
+ {{file-name}}
+ {{file-type}}
+
+
+
+
+
+
+ {{link_to_edit}}
+
+
\ No newline at end of file
diff --git a/modules/archive/archive_index3.html.erb b/modules/archive/archive_index3.html.erb
new file mode 100644
index 0000000..fc78836
--- /dev/null
+++ b/modules/archive/archive_index3.html.erb
@@ -0,0 +1,23 @@
+
+
{{page-title}}
+
+
+ {{category-title}}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/archive/archive_index4.html.erb b/modules/archive/archive_index4.html.erb
new file mode 100644
index 0000000..48ebcf4
--- /dev/null
+++ b/modules/archive/archive_index4.html.erb
@@ -0,0 +1,34 @@
+
+
+ {{page-title}}
+
+
+
+
+
+
+
+
+
+ {{status}}
+
+
+
+
+ {{file-name}}
+ {{file-type}}
+
+
+
+
+
+
+ {{link_to_edit}}
+
+
\ No newline at end of file
diff --git a/modules/archive/archive_index5.html.erb b/modules/archive/archive_index5.html.erb
new file mode 100644
index 0000000..5263026
--- /dev/null
+++ b/modules/archive/archive_index5.html.erb
@@ -0,0 +1,40 @@
+
+
+ {{page-title}}
+
+
+
{{category-title}}
+
+
+
+
+
+
{{created_at}}
+
+ {{archive-title}}
+
+ {{status}}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/archive/archive_index6.html.erb b/modules/archive/archive_index6.html.erb
new file mode 100644
index 0000000..2c46edf
--- /dev/null
+++ b/modules/archive/archive_index6.html.erb
@@ -0,0 +1,46 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/archive/archive_index7.html.erb b/modules/archive/archive_index7.html.erb
new file mode 100644
index 0000000..f004a98
--- /dev/null
+++ b/modules/archive/archive_index7.html.erb
@@ -0,0 +1,42 @@
+
+
+ {{page-title}}
+
+
+
{{category-title}}
+
+
+
上傳日期
+
標題
+
{{description-head}}
+
檔案下載
+
+
+
+
+
{{created_at}}
+
+ {{archive-title}}
+
+ {{status}}
+
+
+
{{description}}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/archive/archive_index8.html.erb b/modules/archive/archive_index8.html.erb
new file mode 100644
index 0000000..6e6ef93
--- /dev/null
+++ b/modules/archive/archive_index8.html.erb
@@ -0,0 +1,48 @@
+
+
+ {{page-title}}
+
+
+
{{category-title}}
+
+
+
上傳日期
+
標題
+
{{description-head}}
+
檔案下載
+
+
+
+
+
{{created_at}}
+
+
{{description}}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/archive/info.json b/modules/archive/info.json
new file mode 100644
index 0000000..3d25987
--- /dev/null
+++ b/modules/archive/info.json
@@ -0,0 +1,86 @@
+{
+ "frontend": [
+ {
+ "filename" : "archive_index1",
+ "name" : {
+ "zh_tw" : "1. 列表 ( 模組標題, 類別標題, 檔案名稱, 下載連結 )",
+ "en" : "1. List (widget-title, category, filename, download link)"
+ },
+ "thumbnail" : "ar1.png"
+ },
+ {
+ "filename" : "archive_index2",
+ "name" : {
+ "zh_tw" : "2. 手風琴式列表 ( 模組標題, 類別標題, 檔案名稱, 下載連結 )",
+ "en" : "2. Accordion list (widget-title, category, filename, download link)"
+ },
+ "thumbnail" : "ar2.png"
+ },
+ {
+ "filename" : "archive_index3",
+ "name" : {
+ "zh_tw" : "3. 列表( 無檔案名稱 ) ( 模組標題, 類別標題, 下載連結 )",
+ "en" : "3. List(no filename) (widget-title, category, download link)"
+ },
+ "thumbnail" : "ar3.png"
+ },
+ {
+ "filename" : "archive_index4",
+ "name" : {
+ "zh_tw" : "4. 手風琴式列表( 無檔案名稱 ( 模組標題, 類別標題, 下載連結 )",
+ "en" : "4. Accordion list(no filename) (widget-title, category, download link)"
+ },
+ "thumbnail" : "ar4.png"
+ },
+ {
+ "filename" : "archive_index5",
+ "name" : {
+ "zh_tw" : "5. 表格列表 ( 模組標題, 類別標題, 檔案名稱, 下載連結 )",
+ "en" : "5. Table list (widget-title, category, filename, download link)"
+ },
+ "thumbnail" : "ar5.png"
+ },
+ {
+ "filename" : "archive_index6",
+ "name" : {
+ "zh_tw" : "6. 表格列表 ( 模組標題, 檔案名稱, 下載連結 )",
+ "en" : "6. Table list (widget-title, filename, download link)"
+ },
+ "thumbnail" : "ar5.png"
+ },
+ {
+ "filename" : "archive_index7",
+ "name" : {
+ "zh_tw" : "7. 表格列表 ( 模組標題, 類別標題, 檔案名稱, 檔案簡介, 下載連結 )",
+ "en" : "7. Table list (widget-title, category, filename, download link)"
+ },
+ "thumbnail" : "ar5.png"
+ },
+ {
+ "filename" : "archive_index8",
+ "name" : {
+ "zh_tw" : "8. 表格列表 ( 模組標題, 檔案名稱, 檔案簡介, 下載連結 )",
+ "en" : "8. Table list (widget-title, filename, download link)"
+ },
+ "thumbnail" : "ar5.png"
+ }
+ ],
+ "widgets" : [
+ {
+ "filename" : "archive_widget1",
+ "name" : {
+ "zh_tw" : "1. 列表 ( 模組標題, 類別標題, 檔案名稱, 下載頁面連結 )",
+ "en" : "1. List (widget-title, category, link of download page)"
+ },
+ "thumbnail" : "thumb.png"
+ },
+ {
+ "filename" : "archive_widget2",
+ "name" : {
+ "zh_tw" : "2. 手風琴式列表 ( 模組標題, 類別標題, 下載頁面連結 )",
+ "en" : "2. Accordion list (widget-title, category, link of download page)"
+ },
+ "thumbnail" : "thumb.png"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/modules/archive/show.html.erb b/modules/archive/show.html.erb
new file mode 100644
index 0000000..11a8c05
--- /dev/null
+++ b/modules/archive/show.html.erb
@@ -0,0 +1,21 @@
+
+
+ {{title}}
+
+
+
+
+ {{archive-title}}
+
+ {{status}}
+
+
+
+
+ {{file-name}}
+ {{file-type}}
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/archive/thumbs/ar1.png b/modules/archive/thumbs/ar1.png
new file mode 100644
index 0000000..e7cc100
Binary files /dev/null and b/modules/archive/thumbs/ar1.png differ
diff --git a/modules/archive/thumbs/ar2.png b/modules/archive/thumbs/ar2.png
new file mode 100644
index 0000000..751fed2
Binary files /dev/null and b/modules/archive/thumbs/ar2.png differ
diff --git a/modules/archive/thumbs/ar3.png b/modules/archive/thumbs/ar3.png
new file mode 100644
index 0000000..723ba3a
Binary files /dev/null and b/modules/archive/thumbs/ar3.png differ
diff --git a/modules/archive/thumbs/ar4.png b/modules/archive/thumbs/ar4.png
new file mode 100644
index 0000000..2a7c106
Binary files /dev/null and b/modules/archive/thumbs/ar4.png differ
diff --git a/modules/archive/thumbs/ar5.png b/modules/archive/thumbs/ar5.png
new file mode 100644
index 0000000..1790944
Binary files /dev/null and b/modules/archive/thumbs/ar5.png differ
diff --git a/modules/archive/thumbs/thumb.png b/modules/archive/thumbs/thumb.png
new file mode 100644
index 0000000..266af56
Binary files /dev/null and b/modules/archive/thumbs/thumb.png differ