diff --git a/.gitignore b/.gitignore index de5d954..58eb279 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ log/*.log pkg/ test/dummy/db/*.sqlite3 -test/dummy/db/*.sqlite3-journal +test/dummy/db/*.sqlite3-publication test/dummy/log/*.log test/dummy/tmp/ test/dummy/.sass-cache diff --git a/Gemfile b/Gemfile index dcbeefe..f589278 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ 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 # development dependencies will be added by default to the :development group. gemspec diff --git a/README.rdoc b/README.rdoc index d84a6ae..530c6d1 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,3 +1,3 @@ -= Journals += Publications This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/Rakefile b/Rakefile index 99add31..b8bc36e 100644 --- a/Rakefile +++ b/Rakefile @@ -8,7 +8,7 @@ require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'Journals' + rdoc.title = 'Publications' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.rdoc') rdoc.rdoc_files.include('lib/**/*.rb') diff --git a/app/controllers/admin/chapters_controller.rb b/app/controllers/admin/chapters_controller.rb index 84db07b..b28ad95 100644 --- a/app/controllers/admin/chapters_controller.rb +++ b/app/controllers/admin/chapters_controller.rb @@ -1,7 +1,7 @@ class Admin::ChaptersController < OrbitAdminController def initialize super - @app_title = "journal" + @app_title = "publication" end def index @@ -12,8 +12,8 @@ class Admin::ChaptersController < OrbitAdminController def new @chapter = Chapter.new - @journal = Journal.find(params[:journal_id]) - if can_edit_or_delete?(@journal) + @publication = Publication.find(params[:publication_id]) + if can_edit_or_delete?(@publication) @tags = @module_app.tags || [] else render_401 @@ -27,8 +27,8 @@ class Admin::ChaptersController < OrbitAdminController def edit @chapter = Chapter.find(params[:id]) - if can_edit_or_delete?(@journal) - @journal = @chapter.journal + if can_edit_or_delete?(@publication) + @publication = @chapter.publication else render_401 end @@ -42,9 +42,9 @@ class Admin::ChaptersController < OrbitAdminController def destroy chapter = Chapter.find(params[:id]) - journal = chapter.journal + publication = chapter.publication chapter.destroy - redirect_to admin_journal_path(journal.id, page: params[:page]) + redirect_to admin_publication_path(publication.id, page: params[:page]) end private @@ -54,6 +54,6 @@ class Admin::ChaptersController < OrbitAdminController end def setup_vars - @module_app = ModuleApp.where(key: "journal").first + @module_app = ModuleApp.where(key: "publication").first end end diff --git a/app/controllers/admin/journals_controller.rb b/app/controllers/admin/publications_controller.rb similarity index 52% rename from app/controllers/admin/journals_controller.rb rename to app/controllers/admin/publications_controller.rb index 3065d1a..93e0489 100644 --- a/app/controllers/admin/journals_controller.rb +++ b/app/controllers/admin/publications_controller.rb @@ -1,46 +1,46 @@ -class Admin::JournalsController < OrbitAdminController +class Admin::PublicationsController < OrbitAdminController before_action :categories, only: [:index, :new, :edit] def index @table_fields = [:title, :status, :author, :pub_date, :category] @filter_fields = filter_fields(@categories, @tags) - @journals = Journal.order_by(sort) + @publications = Publication.order_by(sort) .with_categories(filters("category")) .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? end def new - @journal = Journal.new + @publication = Publication.new end def create - journal = Journal.create(journal_params) - redirect_to admin_journals_path + publication = Publication.create(publication_params) + redirect_to admin_publications_path end def edit - @journal = Journal.find(params[:id]) + @publication = Publication.find(params[:id]) end def update - journal = Journal.find(params[:id]) - journal.update_attributes(journal_params) - redirect_to admin_journals_path + publication = Publication.find(params[:id]) + publication.update_attributes(publication_params) + redirect_to admin_publications_path end def show - @journal = Journal.find(params[:id]) - @chapters = @journal.chapters.order_by(sort).page(params[:page]).per(10) + @publication = Publication.find(params[:id]) + @chapters = @publication.chapters.order_by(sort).page(params[:page]).per(10) @table_fields = [:title, :author, :page, :sort_number] end def destroy - journal = Journal.find(params[:id]) - journal.destroy - redirect_to admin_journals_path + publication = Publication.find(params[:id]) + publication.destroy + redirect_to admin_publications_path end def save_chapter_order @@ -57,8 +57,8 @@ class Admin::JournalsController < OrbitAdminController private - def journal_params - params.require(:journal).permit! + def publication_params + params.require(:publication).permit! end def categories diff --git a/app/controllers/journals_controller.rb b/app/controllers/publications_controller.rb similarity index 61% rename from app/controllers/journals_controller.rb rename to app/controllers/publications_controller.rb index 6a6ab0a..ff477e3 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/publications_controller.rb @@ -1,16 +1,16 @@ -class JournalsController < ApplicationController +class PublicationsController < ApplicationController def index params = OrbitHelper.params categories = [] 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) - 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] end - journals.each do |node| + publications.each do |node| status = node.statuses_with_classname.collect do |stat| { status: stat[:name], @@ -31,24 +31,24 @@ class JournalsController < ApplicationController pub_date: node.pub_date.strftime('%Y-%m-%d'), cover: (OrbitHelper.is_mobile_view ? node.cover.mobile.url : node.cover.url), 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"), } end { - "journals" => data, + "publications" => data, "extras" => { - "widget-title" => t("module_name.journal"), - "th_cover" => t('journal.cover'), - "th_pub_date" => t('journal.pub_date'), - "th_title" => t('journal.title'), - "th_author" => t('journal.author'), - "th_chapter" => t('journal.chapter'), - "th_chapters" => t('journal.chapters'), + "widget-title" => t("module_name.publication"), + "th_cover" => t('publication.cover'), + "th_pub_date" => t('publication.pub_date'), + "th_title" => t('publication.title'), + "th_author" => t('publication.author'), + "th_chapter" => t('publication.chapter'), + "th_chapters" => t('publication.chapters'), categories: categories }, - "total_pages" => journals.total_pages + "total_pages" => publications.total_pages } end @@ -59,7 +59,7 @@ class JournalsController < ApplicationController elsif params[:mode] == 'chapter' show_chapter else - show_journal + show_publication end end @@ -71,8 +71,8 @@ class JournalsController < ApplicationController def show_list params = OrbitHelper.params - journal = Journal.find_by(uid: params[:uid]) - chapters = Chapter.where(journal_id: journal.id).order(sort_number: :asc) + publication = Publication.find_by(uid: params[:uid]) + chapters = Chapter.where(publication_id: publication.id).order(sort_number: :asc) .page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) data = [] chapters.each do |node| @@ -90,12 +90,12 @@ class JournalsController < ApplicationController { "chapters" => data, "extras" => { - "widget-title" => t("module_name.journal"), - "th_title" => t('journals.chapter'), + "widget-title" => t("module_name.publication"), + "th_title" => t('publications.chapter'), "th_author" => t('chapter.author'), "th_page" => t('chapter.page'), "th_action" => t('chapter.action'), - "journal_title" => journal.title, + "publication_title" => publication.title, "mode" => "many" }, "total_pages" => chapters.total_pages @@ -120,24 +120,24 @@ class JournalsController < ApplicationController } end - def show_journal + def show_publication params = OrbitHelper.params - journal = Journal.find_by(uid: params[:uid]) + publication = Publication.find_by(uid: params[:uid]) { - "title" => journal.title, - "title_title" => t('journal.title'), - "author" => journal.author, - "author_title" => t('journal.author'), - "cover" => journal.cover.url, - "cover_title" => t('journal.cover'), - "pub_date" => journal.pub_date.strftime('%Y-%m-%d'), - "pub_date_title" => t('journal.pub_date'), - "pub_information" => journal.pub_information, - "pub_information_title" => t('journal.pub_information'), - link_to_list: OrbitHelper.url_to_show("#{journal.to_param}?mode=many"), + "title" => publication.title, + "title_title" => t('publication.title'), + "author" => publication.author, + "author_title" => t('publication.author'), + "cover" => publication.cover.url, + "cover_title" => t('publication.cover'), + "pub_date" => publication.pub_date.strftime('%Y-%m-%d'), + "pub_date_title" => t('publication.pub_date'), + "pub_information" => publication.pub_information, + "pub_information_title" => t('publication.pub_information'), + link_to_list: OrbitHelper.url_to_show("#{publication.to_param}?mode=many"), "extras" => { - "mode" => "journal" + "mode" => "publication" } } end diff --git a/app/models/chapter.rb b/app/models/chapter.rb index df60d8d..4e22cb4 100644 --- a/app/models/chapter.rb +++ b/app/models/chapter.rb @@ -11,5 +11,5 @@ class Chapter mount_uploader :file, AssetUploader - belongs_to :journal + belongs_to :publication end diff --git a/app/models/journal.rb b/app/models/publication.rb similarity index 96% rename from app/models/journal.rb rename to app/models/publication.rb index 224de24..222b1d3 100644 --- a/app/models/journal.rb +++ b/app/models/publication.rb @@ -1,4 +1,4 @@ -class Journal +class Publication include Mongoid::Document include Mongoid::Timestamps include OrbitModel::Status diff --git a/app/views/admin/chapters/_form.html.erb b/app/views/admin/chapters/_form.html.erb index d140575..b6f91b6 100644 --- a/app/views/admin/chapters/_form.html.erb +++ b/app/views/admin/chapters/_form.html.erb @@ -13,7 +13,7 @@