rename to publication

This commit is contained in:
邱博亞 2023-06-04 22:41:53 +08:00
parent 2f3177ef3c
commit 6b316a41c0
78 changed files with 138 additions and 805 deletions

2
.gitignore vendored
View File

@ -2,7 +2,7 @@
log/*.log log/*.log
pkg/ pkg/
test/dummy/db/*.sqlite3 test/dummy/db/*.sqlite3
test/dummy/db/*.sqlite3-journal test/dummy/db/*.sqlite3-publication
test/dummy/log/*.log test/dummy/log/*.log
test/dummy/tmp/ test/dummy/tmp/
test/dummy/.sass-cache test/dummy/.sass-cache

View File

@ -1,6 +1,6 @@
source "https://rubygems.org" source "https://rubygems.org"
# Declare your gem's dependencies in journals.gemspec. # Declare your gem's dependencies in publications.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and # Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group. # development dependencies will be added by default to the :development group.
gemspec gemspec

View File

@ -1,3 +1,3 @@
= Journals = Publications
This project rocks and uses MIT-LICENSE. This project rocks and uses MIT-LICENSE.

View File

@ -8,7 +8,7 @@ require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc| RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc' rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Journals' rdoc.title = 'Publications'
rdoc.options << '--line-numbers' rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc') rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb') rdoc.rdoc_files.include('lib/**/*.rb')

View File

@ -1,7 +1,7 @@
class Admin::ChaptersController < OrbitAdminController class Admin::ChaptersController < OrbitAdminController
def initialize def initialize
super super
@app_title = "journal" @app_title = "publication"
end end
def index def index
@ -12,8 +12,8 @@ class Admin::ChaptersController < OrbitAdminController
def new def new
@chapter = Chapter.new @chapter = Chapter.new
@journal = Journal.find(params[:journal_id]) @publication = Publication.find(params[:publication_id])
if can_edit_or_delete?(@journal) if can_edit_or_delete?(@publication)
@tags = @module_app.tags || [] @tags = @module_app.tags || []
else else
render_401 render_401
@ -27,8 +27,8 @@ class Admin::ChaptersController < OrbitAdminController
def edit def edit
@chapter = Chapter.find(params[:id]) @chapter = Chapter.find(params[:id])
if can_edit_or_delete?(@journal) if can_edit_or_delete?(@publication)
@journal = @chapter.journal @publication = @chapter.publication
else else
render_401 render_401
end end
@ -42,9 +42,9 @@ class Admin::ChaptersController < OrbitAdminController
def destroy def destroy
chapter = Chapter.find(params[:id]) chapter = Chapter.find(params[:id])
journal = chapter.journal publication = chapter.publication
chapter.destroy chapter.destroy
redirect_to admin_journal_path(journal.id, page: params[:page]) redirect_to admin_publication_path(publication.id, page: params[:page])
end end
private private
@ -54,6 +54,6 @@ class Admin::ChaptersController < OrbitAdminController
end end
def setup_vars def setup_vars
@module_app = ModuleApp.where(key: "journal").first @module_app = ModuleApp.where(key: "publication").first
end end
end end

View File

@ -1,46 +1,46 @@
class Admin::JournalsController < OrbitAdminController class Admin::PublicationsController < OrbitAdminController
before_action :categories, only: [:index, :new, :edit] before_action :categories, only: [:index, :new, :edit]
def index def index
@table_fields = [:title, :status, :author, :pub_date, :category] @table_fields = [:title, :status, :author, :pub_date, :category]
@filter_fields = filter_fields(@categories, @tags) @filter_fields = filter_fields(@categories, @tags)
@journals = Journal.order_by(sort) @publications = Publication.order_by(sort)
.with_categories(filters("category")) .with_categories(filters("category"))
.with_status(filters("status")) .with_status(filters("status"))
@journals = search_data(@journals, [:title]).page(params[:page]).per(10) @publications = search_data(@publications, [:title]).page(params[:page]).per(10)
render partial: "index" if request.xhr? render partial: "index" if request.xhr?
end end
def new def new
@journal = Journal.new @publication = Publication.new
end end
def create def create
journal = Journal.create(journal_params) publication = Publication.create(publication_params)
redirect_to admin_journals_path redirect_to admin_publications_path
end end
def edit def edit
@journal = Journal.find(params[:id]) @publication = Publication.find(params[:id])
end end
def update def update
journal = Journal.find(params[:id]) publication = Publication.find(params[:id])
journal.update_attributes(journal_params) publication.update_attributes(publication_params)
redirect_to admin_journals_path redirect_to admin_publications_path
end end
def show def show
@journal = Journal.find(params[:id]) @publication = Publication.find(params[:id])
@chapters = @journal.chapters.order_by(sort).page(params[:page]).per(10) @chapters = @publication.chapters.order_by(sort).page(params[:page]).per(10)
@table_fields = [:title, :author, :page, :sort_number] @table_fields = [:title, :author, :page, :sort_number]
end end
def destroy def destroy
journal = Journal.find(params[:id]) publication = Publication.find(params[:id])
journal.destroy publication.destroy
redirect_to admin_journals_path redirect_to admin_publications_path
end end
def save_chapter_order def save_chapter_order
@ -57,8 +57,8 @@ class Admin::JournalsController < OrbitAdminController
private private
def journal_params def publication_params
params.require(:journal).permit! params.require(:publication).permit!
end end
def categories def categories

View File

@ -1,16 +1,16 @@
class JournalsController < ApplicationController class PublicationsController < ApplicationController
def index def index
params = OrbitHelper.params params = OrbitHelper.params
categories = [] categories = []
data = [] data = []
journals = Journal.order(created_at: :desc).filter_by_categories.filter_by_tags publications = Publication.order(created_at: :desc).filter_by_categories.filter_by_tags
.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) .page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
ModuleApp.find_by(key: 'journal').categories.each do |e| ModuleApp.find_by(key: 'publication').categories.each do |e|
categories << [e.id.to_s, e.title] categories << [e.id.to_s, e.title]
end end
journals.each do |node| publications.each do |node|
status = node.statuses_with_classname.collect do |stat| status = node.statuses_with_classname.collect do |stat|
{ {
status: stat[:name], status: stat[:name],
@ -31,24 +31,24 @@ class JournalsController < ApplicationController
pub_date: node.pub_date.strftime('%Y-%m-%d'), pub_date: node.pub_date.strftime('%Y-%m-%d'),
cover: (OrbitHelper.is_mobile_view ? node.cover.mobile.url : node.cover.url), cover: (OrbitHelper.is_mobile_view ? node.cover.mobile.url : node.cover.url),
chapters: node.chapters.count, chapters: node.chapters.count,
link_to_show: OrbitHelper.url_to_show("#{node.to_param}?mode=journal"), link_to_show: OrbitHelper.url_to_show("#{node.to_param}?mode=publication"),
link_to_list: OrbitHelper.url_to_show("#{node.to_param}?mode=many"), link_to_list: OrbitHelper.url_to_show("#{node.to_param}?mode=many"),
} }
end end
{ {
"journals" => data, "publications" => data,
"extras" => { "extras" => {
"widget-title" => t("module_name.journal"), "widget-title" => t("module_name.publication"),
"th_cover" => t('journal.cover'), "th_cover" => t('publication.cover'),
"th_pub_date" => t('journal.pub_date'), "th_pub_date" => t('publication.pub_date'),
"th_title" => t('journal.title'), "th_title" => t('publication.title'),
"th_author" => t('journal.author'), "th_author" => t('publication.author'),
"th_chapter" => t('journal.chapter'), "th_chapter" => t('publication.chapter'),
"th_chapters" => t('journal.chapters'), "th_chapters" => t('publication.chapters'),
categories: categories categories: categories
}, },
"total_pages" => journals.total_pages "total_pages" => publications.total_pages
} }
end end
@ -59,7 +59,7 @@ class JournalsController < ApplicationController
elsif params[:mode] == 'chapter' elsif params[:mode] == 'chapter'
show_chapter show_chapter
else else
show_journal show_publication
end end
end end
@ -71,8 +71,8 @@ class JournalsController < ApplicationController
def show_list def show_list
params = OrbitHelper.params params = OrbitHelper.params
journal = Journal.find_by(uid: params[:uid]) publication = Publication.find_by(uid: params[:uid])
chapters = Chapter.where(journal_id: journal.id).order(sort_number: :asc) chapters = Chapter.where(publication_id: publication.id).order(sort_number: :asc)
.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) .page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
data = [] data = []
chapters.each do |node| chapters.each do |node|
@ -90,12 +90,12 @@ class JournalsController < ApplicationController
{ {
"chapters" => data, "chapters" => data,
"extras" => { "extras" => {
"widget-title" => t("module_name.journal"), "widget-title" => t("module_name.publication"),
"th_title" => t('journals.chapter'), "th_title" => t('publications.chapter'),
"th_author" => t('chapter.author'), "th_author" => t('chapter.author'),
"th_page" => t('chapter.page'), "th_page" => t('chapter.page'),
"th_action" => t('chapter.action'), "th_action" => t('chapter.action'),
"journal_title" => journal.title, "publication_title" => publication.title,
"mode" => "many" "mode" => "many"
}, },
"total_pages" => chapters.total_pages "total_pages" => chapters.total_pages
@ -120,24 +120,24 @@ class JournalsController < ApplicationController
} }
end end
def show_journal def show_publication
params = OrbitHelper.params params = OrbitHelper.params
journal = Journal.find_by(uid: params[:uid]) publication = Publication.find_by(uid: params[:uid])
{ {
"title" => journal.title, "title" => publication.title,
"title_title" => t('journal.title'), "title_title" => t('publication.title'),
"author" => journal.author, "author" => publication.author,
"author_title" => t('journal.author'), "author_title" => t('publication.author'),
"cover" => journal.cover.url, "cover" => publication.cover.url,
"cover_title" => t('journal.cover'), "cover_title" => t('publication.cover'),
"pub_date" => journal.pub_date.strftime('%Y-%m-%d'), "pub_date" => publication.pub_date.strftime('%Y-%m-%d'),
"pub_date_title" => t('journal.pub_date'), "pub_date_title" => t('publication.pub_date'),
"pub_information" => journal.pub_information, "pub_information" => publication.pub_information,
"pub_information_title" => t('journal.pub_information'), "pub_information_title" => t('publication.pub_information'),
link_to_list: OrbitHelper.url_to_show("#{journal.to_param}?mode=many"), link_to_list: OrbitHelper.url_to_show("#{publication.to_param}?mode=many"),
"extras" => { "extras" => {
"mode" => "journal" "mode" => "publication"
} }
} }
end end

View File

@ -11,5 +11,5 @@ class Chapter
mount_uploader :file, AssetUploader mount_uploader :file, AssetUploader
belongs_to :journal belongs_to :publication
end end

View File

@ -1,4 +1,4 @@
class Journal class Publication
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include OrbitModel::Status include OrbitModel::Status

View File

@ -13,7 +13,7 @@
<fieldset> <fieldset>
<div class="input-area"> <div class="input-area">
<input type="hidden" name="chapter[journal_id]" value="<%= @journal.id.to_s %>"> <input type="hidden" name="chapter[publication_id]" value="<%= @publication.id.to_s %>">
<!-- File Upload --> <!-- File Upload -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t('chapter.file') %></label> <label class="control-label muted"><%= t('chapter.file') %></label>

View File

@ -1,5 +0,0 @@
<div id="journal">
<%= form_for @journal, url: {action: :update}, html: {class: 'form-horizontal main-forms'} do |f| %>
<%= render partial: 'form', locals: {f: f} %>
<% end %>
</div>

View File

@ -1,5 +0,0 @@
<div id="journal">
<%= form_for @journal, url: {action: :create}, html: {class: 'form-horizontal main-forms'} do |f| %>
<%= render partial: 'form', locals: {f: f} %>
<% end %>
</div>

View File

@ -27,7 +27,7 @@
<a href="#status" data-toggle="tab"><%= t(:status) %></a> <a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li> </li>
<li> <li>
<a href="#imageupload" data-toggle="tab"><%= t("journal.cover") %></a> <a href="#imageupload" data-toggle="tab"><%= t("publication.cover") %></a>
</li> </li>
</ul> </ul>
@ -50,9 +50,9 @@
<!-- Date Time Picker --> <!-- Date Time Picker -->
<div class="control-group input-title"> <div class="control-group input-title">
<label class="control-label muted"><%= t 'journal.pub_date' %></label> <label class="control-label muted"><%= t 'publication.pub_date' %></label>
<div class="controls"> <div class="controls">
<%= f.datetime_picker :pub_date, no_label: true, new_record: @journal.new_record?, data: {} %> <%= f.datetime_picker :pub_date, no_label: true, new_record: @publication.new_record?, data: {} %>
</div> </div>
</div> </div>
@ -92,7 +92,7 @@
if (location.pathname.substr(-3)=='new'){ if (location.pathname.substr(-3)=='new'){
var getDate = new Date(); var getDate = new Date();
var toDay = getDate.getFullYear()+"/"+ (Appendzero(getDate.getMonth()+1))+"/"+Appendzero(getDate.getDate())+" "+Appendzero(getDate.getHours())+":"+Appendzero(getDate.getMinutes()); var toDay = getDate.getFullYear()+"/"+ (Appendzero(getDate.getMonth()+1))+"/"+Appendzero(getDate.getDate())+" "+Appendzero(getDate.getHours())+":"+Appendzero(getDate.getMinutes());
$('input[name="journal[pub_date]"]').val(toDay); $('input[name="publication[pub_date]"]').val(toDay);
} }
$("#main-wrap").after(""); $("#main-wrap").after("");
}); });

View File

@ -1,9 +1,9 @@
<div class="control-group input-title"> <div class="control-group input-title">
<%= f.label node ,t("journal.#{node}"), class: "control-label muted" %> <%= f.label node ,t("publication.#{node}"), class: "control-label muted" %>
<%= f.fields_for "#{node}_translations".to_sym do |f| %> <%= f.fields_for "#{node}_translations".to_sym do |f| %>
<div class="controls"> <div class="controls">
<div class="textarea"> <div class="textarea">
<%= f.text_area locale, style: "width:100%", class: 'ckeditor input-block-level', value: (@journal.send("#{node}_translations")[locale] rescue nil) %> <%= f.text_area locale, style: "width:100%", class: 'ckeditor input-block-level', value: (@publication.send("#{node}_translations")[locale] rescue nil) %>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@ -1,8 +1,8 @@
<div class="control-group input-title"> <div class="control-group input-title">
<%= f.label node, t("journal.#{node}"), class: "control-label muted" %> <%= f.label node, t("publication.#{node}"), class: "control-label muted" %>
<div class="controls"> <div class="controls">
<%= f.fields_for "#{node}_translations".to_sym do |f| %> <%= f.fields_for "#{node}_translations".to_sym do |f| %>
<%= f.text_field locale, class: "post-title #{style}", value: (@journal.send("#{node}_translations")[locale] rescue nil) %> <%= f.text_field locale, class: "post-title #{style}", value: (@publication.send("#{node}_translations")[locale] rescue nil) %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -1,5 +1,5 @@
<div class="control-group input-title"> <div class="control-group input-title">
<%= f.label node, t("journal.#{node}"), class: "control-label muted" %> <%= f.label node, t("publication.#{node}"), class: "control-label muted" %>
<div class="controls"> <div class="controls">
<%= f.text_field node, class: "post-title" %> <%= f.text_field node, class: "post-title" %>
</div> </div>

View File

@ -11,18 +11,18 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @journals.each do |node| %> <% @publications.each do |node| %>
<tr> <tr>
<td> <td>
<%= link_to node.title, journal_path(node.id) %> <%= link_to node.title, publication_path(node.id) %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<% if can_edit_or_delete?(node) %> <% if can_edit_or_delete?(node) %>
<% if can_edit_or_delete?(node) %> <% if can_edit_or_delete?(node) %>
<li><a href="<%= admin_journal_path(node.id) %>"><%= t("journals.add_chapter") %></a></li> <li><a href="<%= admin_publication_path(node.id) %>"><%= t("publications.add_chapter") %></a></li>
<% end %> <% end %>
<li><%= link_to t(:edit), edit_admin_journal_path(node.id) %></li> <li><%= link_to t(:edit), edit_admin_publication_path(node.id) %></li>
<li><%= link_to t(:delete_), admin_journal_path(node.id), method: :delete, data: {confirm: "Are you sure?"} %></li> <li><%= link_to t(:delete_), admin_publication_path(node.id), method: :delete, data: {confirm: "Are you sure?"} %></li>
<% end %> <% end %>
</ul> </ul>
</div> </div>
@ -42,6 +42,6 @@
</table> </table>
<%= <%=
content_tag :div, class: "bottomnav clearfix" do content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@journals), class: "pagination pagination-centered" content_tag :div, paginate(@publications), class: "pagination pagination-centered"
end end
%> %>

View File

@ -37,19 +37,19 @@
<!-- Images Upload --> <!-- Images Upload -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t("journal.cover") %></label> <label class="control-label muted"><%= t("publication.cover") %></label>
<div class="controls"> <div class="controls">
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @journal.cover.file %>" data-provides="fileupload"> <div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @publication.cover.file %>" data-provides="fileupload">
<div class="fileupload-new thumbnail pull-left"> <div class="fileupload-new thumbnail pull-left">
<% if @journal.cover.file %> <% if @publication.cover.file %>
<%= image_tag @journal.cover %> <%= image_tag @publication.cover %>
<% else %> <% else %>
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" /> <img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
<% end %> <% end %>
</div> </div>
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div> <div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
<span class="btn btn-file"> <span class="btn btn-file">
<span class="fileupload-new"><%= t('journals.select_cover') %></span> <span class="fileupload-new"><%= t('publications.select_cover') %></span>
<span class="fileupload-exists"><%= t(:change) %></span> <span class="fileupload-exists"><%= t(:change) %></span>
<%= f.file_field :cover %> <%= f.file_field :cover %>
</span> </span>

View File

@ -0,0 +1,5 @@
<div id="publication">
<%= form_for @publication, url: {action: :update}, html: {class: 'form-horizontal main-forms'} do |f| %>
<%= render partial: 'form', locals: {f: f} %>
<% end %>
</div>

View File

@ -0,0 +1,5 @@
<div id="publication">
<%= form_for @publication, url: {action: :create}, html: {class: 'form-horizontal main-forms'} do |f| %>
<%= render partial: 'form', locals: {f: f} %>
<% end %>
</div>

View File

@ -64,11 +64,11 @@
</tbody> </tbody>
</table> </table>
<% if can_edit_or_delete?(@journal) %> <% if can_edit_or_delete?(@publication) %>
<div class="bottomnav clearfix" style="left: 81px;"> <div class="bottomnav clearfix" style="left: 81px;">
<div class="action pull-right"> <div class="action pull-right">
<%= link_to t("journals.add_chapter"), new_admin_chapter_path(page: params[:page], journal_id: @journal.id), class: "btn btn-primary" %> <%= link_to t("publications.add_chapter"), new_admin_chapter_path(page: params[:page], publication_id: @publication.id), class: "btn btn-primary" %>
<a class="btn btn-info" href="#sort-chapters-modal" data-toggle="modal"><%= t('journals.order')%></a> <a class="btn btn-info" href="#sort-chapters-modal" data-toggle="modal"><%= t('publications.order')%></a>
</div> </div>
<%= content_tag :div, paginate(@chapters), class: "pagination pagination-centered" %> <%= content_tag :div, paginate(@chapters), class: "pagination pagination-centered" %>
</div> </div>
@ -80,7 +80,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<ul class="order-list"> <ul class="order-list">
<% @journal.chapters.asc(:sort_number).each do |chapter| %> <% @publication.chapters.asc(:sort_number).each do |chapter| %>
<li class="order-list-chapter" data-chapter-id="<%= chapter.id.to_s %>"> <li class="order-list-chapter" data-chapter-id="<%= chapter.id.to_s %>">
<i class="icons-list-2"></i> <i class="icons-list-2"></i>
<h4><%= chapter.title %>:<%= chapter.page%><h4> <h4><%= chapter.title %>:<%= chapter.page%><h4>
@ -112,8 +112,8 @@
ids.push($(chapter).data("chapter-id")); ids.push($(chapter).data("chapter-id"));
}) })
$.ajax({ $.ajax({
url : "/admin/journals/save_chapter_order", url : "/admin/publications/save_chapter_order",
data : {"ids" : ids, "journal_id" : "<%= @journal.id.to_s %>"}, data : {"ids" : ids, "publication_id" : "<%= @publication.id.to_s %>"},
dataType : "json", dataType : "json",
type : "post" type : "post"
}).done(function(){ }).done(function(){

View File

@ -4,5 +4,5 @@
<% elsif data['extras']['mode'] == 'chapter' %> <% elsif data['extras']['mode'] == 'chapter' %>
<%= render_view('show_detail') %> <%= render_view('show_detail') %>
<% else %> <% else %>
<%= render_view('show_journal') %> <%= render_view('show_publication') %>
<% end %> <% end %>

2
bin/rails Executable file → Normal file
View File

@ -2,7 +2,7 @@
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application. # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
ENGINE_ROOT = File.expand_path('../..', __FILE__) ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/journals/engine', __FILE__) ENGINE_PATH = File.expand_path('../../lib/publications/engine', __FILE__)
# Set up gems listed in the Gemfile. # Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

View File

@ -1,8 +1,8 @@
en: en:
module_name: module_name:
journal: Journal publication: Publication
journal: publication:
category: Category category: Category
cover: Cover cover: Cover
title: Title title: Title
@ -20,8 +20,8 @@ en:
page: Page page: Page
sort_number: Sort number sort_number: Sort number
journals: publications:
journal: Journal publication: Publication
select_cover: Select cover select_cover: Select cover
add_chapter: Add chapter add_chapter: Add chapter
order: Order order: Order

View File

@ -1,8 +1,8 @@
zh_tw: zh_tw:
module_name: module_name:
journal: 通訊期刊 publication: 出版品
journal: publication:
category: 類別 category: 類別
cover: 封面 cover: 封面
title: 標題 title: 標題
@ -22,8 +22,8 @@ zh_tw:
action: 動作 action: 動作
sort_number: 排序 sort_number: 排序
journals: publications:
journal: 通訊期刊 publication: 出版品
select_cover: 選擇封面 select_cover: 選擇封面
add_chapter: 新增章節 add_chapter: 新增章節
order: 排序 order: 排序

View File

@ -3,11 +3,11 @@ Rails.application.routes.draw do
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do namespace :admin do
resources :journals do resources :publications do
post :save_chapter_order, on: :collection post :save_chapter_order, on: :collection
end end
resources :chapters, except: [:show] resources :chapters, except: [:show]
end end
resources :journals resources :publications
end end
end end

View File

@ -1,9 +0,0 @@
{
"type": "sftp",
"host": "192.168.68.25",
"username": "rulingcom",
"password": "Rulingcom.com",
"port": 22,
"remotePath": "/home/rulingcom/journals",
"uploadOnSave": true
}

View File

@ -1,4 +0,0 @@
require "journals/engine"
module Journals
end

4
lib/publications.rb Normal file
View File

@ -0,0 +1,4 @@
require "publications/engine"
module Publications
end

View File

@ -1,8 +1,8 @@
module Journals module Publications
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "journals" do initializer "publications" do
OrbitApp.registration "Journals", :type => "ModuleApp" do OrbitApp.registration "Publications", :type => "ModuleApp" do
module_label "journals.journal" module_label "publications.publication"
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
widget_methods ['widget'] widget_methods ['widget']
widget_settings [{"data_count"=>30}] widget_settings [{"data_count"=>30}]
@ -14,27 +14,27 @@ module Journals
data_count 1..30 data_count 1..30
side_bar do side_bar do
head_label_i18n 'journals.journal', icon_class: "icon-book" head_label_i18n 'publications.publication', icon_class: "icon-book"
available_for "users" available_for "users"
active_for_controllers (['admin/journals']) active_for_controllers (['admin/publications'])
head_link_path "admin_journals_path" head_link_path "admin_publications_path"
context_link 'all', context_link 'all',
:link_path=>"admin_journals_path" , :link_path=>"admin_publications_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{'admin/journals'=>"index"}, :active_for_action=>{'admin/publications'=>"index"},
:available_for => 'users' :available_for => 'users'
context_link 'new_', context_link 'new_',
:link_path=>"new_admin_journal_path" , :link_path=>"new_admin_publication_path" ,
:priority=>2, :priority=>2,
:active_for_action=>{'admin/journals'=>"new"}, :active_for_action=>{'admin/publications'=>"new"},
:available_for => 'sub_managers' :available_for => 'sub_managers'
context_link 'categories', context_link 'categories',
:link_path=>"admin_module_app_categories_path" , :link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'journal').id}", :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'publication').id}",
:priority=>3, :priority=>3,
:active_for_action=>{'admin/journals'=>'categories'}, :active_for_action=>{'admin/publications'=>'categories'},
:active_for_category => 'Journals', :active_for_category => 'Publications',
:available_for => 'managers' :available_for => 'managers'
end end
end end

View File

@ -1,3 +1,3 @@
module Journals module Publications
VERSION = "0.0.1" VERSION = "0.0.1"
end end

View File

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

View File

@ -1,17 +1,17 @@
$:.push File.expand_path("../lib", __FILE__) $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version: # Maintain your gem's version:
require "journals/version" require "publications/version"
# Describe your gem and declare its dependencies: # Describe your gem and declare its dependencies:
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "journals" s.name = "publications"
s.version = Journals::VERSION s.version = Publications::VERSION
s.authors = ["Archer Lin"] s.authors = ["Archer Lin"]
s.email = ["twbcs@yahoo.com.tw"] s.email = ["twbcs@yahoo.com.tw"]
s.homepage = "https://github.com/twbcs" s.homepage = "https://github.com/twbcs"
s.summary = "Journals." s.summary = "Publications."
s.description = "Description of Journals." s.description = "Description of Publications."
s.license = "MIT" s.license = "MIT"
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]

View File

@ -1,28 +0,0 @@
== README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.

View File

@ -1,6 +0,0 @@
# 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__)
Rails.application.load_tasks

View File

@ -1,13 +0,0 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require_tree .

View File

@ -1,15 +0,0 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/

View File

@ -1,5 +0,0 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end

View File

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

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Dummy</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')

View File

@ -1,4 +0,0 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'

View File

@ -1,4 +0,0 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run

View File

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

View File

@ -1,23 +0,0 @@
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require "journals"
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.
# 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
end
end

View File

@ -1,5 +0,0 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)

View File

@ -1,25 +0,0 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# 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:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3

View File

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

View File

@ -1,37 +0,0 @@
Rails.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
# Do not eager load code on boot.
config.eager_load = false
# 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
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end

View File

@ -1,78 +0,0 @@
Rails.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
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = 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.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# 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
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(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"
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end

View File

@ -1,39 +0,0 @@
Rails.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
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
config.static_cache_control = 'public, max-age=3600'
# 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
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end

View File

@ -1,8 +0,0 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )

View File

@ -1,7 +0,0 @@
# 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

@ -1,3 +0,0 @@
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json

View File

@ -1,4 +0,0 @@
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]

View File

@ -1,16 +0,0 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end

View File

@ -1,4 +0,0 @@
# 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

View File

@ -1,3 +0,0 @@
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_dummy_session'

View File

@ -1,14 +0,0 @@
# 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] if respond_to?(:wrap_parameters)
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end

View File

@ -1,23 +0,0 @@
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"

View File

@ -1,4 +0,0 @@
Rails.application.routes.draw do
mount Journals::Engine => "/journals"
end

View File

@ -1,22 +0,0 @@
# Be sure to restart your server when you modify this file.
# Your secret key is used 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.
# You can use `rake secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: 5763e07e161684b4015f3e1bbe709c4be8785bfca6bfca44a30fcbf42e1dda417ad850cf06cb12a8bbd75bb0afbc7b8b60745572879135f157fc61a8fb709052
test:
secret_key_base: fe9697a769edb83759e8a8ced186f9738869d3e37d0415fdd67afe7897fbcfc062dc4b0040ae53fcbd3fb23129992629a160e15cec151de8e91bcc9578681601
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

View File

View File

@ -1,67 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<div>
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>

View File

@ -1,67 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/422.html -->
<div class="dialog">
<div>
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>

View File

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<div>
<h1>We're sorry, but something went wrong.</h1>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>

View File

@ -1,10 +0,0 @@
require 'test_helper'
class NavigationTest < ActionDispatch::IntegrationTest
fixtures :all
# test "the truth" do
# assert true
# end
end

View File

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

View File

@ -1,19 +0,0 @@
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
require "rails/test_help"
# Filter out Minitest backtrace while allowing backtrace from other libraries
# to be shown.
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
# Load fixtures from the engine
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
end