something fix

This commit is contained in:
spen 2015-01-09 15:30:13 +08:00
parent 4a8a0df7da
commit 41d11e12a3
70 changed files with 768 additions and 941 deletions

View File

@ -1,51 +1,43 @@
class Admin::JournalLevelsController < OrbitMemberController class Admin::JournalLevelsController < OrbitMemberController
before_action :allow_admin_only before_action :allow_admin_only
before_action :set_journal_level, only: [:edit, :update, :destroy]
def initialize
super
@app_type = 'journal_level'
end
def new def new
@journal_level = JournalLevel.new @paper_level = JournalLevel.new
@url = admin_journal_levels_path(@paper_level)
render :layout=>false
end end
def create def create
@journal_level = JournalLevel.new(journal_level_attributes) @paper_level = JournalLevel.new(paper_level_params)
respond_to do |format| @paper_level.save
if @journal_level.save @paper_levels = JournalLevel.all
format.js { render 'create_writing_journal_setting' } render :partial=>'index', :layout=>false
end
end
end end
def edit def edit
@paper_level = JournalLevel.find(params[:id])
@url = admin_journal_level_path(@paper_level)
render :layout=>false
end end
def update def update
respond_to do |format| @paper_level = JournalLevel.find(params[:id])
if @journal_level.update_attributes(journal_level_attributes) @paper_level.update_attributes(paper_level_params)
format.js { render 'update_writing_journal_setting' } @paper_level.save
end @paper_levels = JournalLevel.all
end render :partial=>'index', :layout=>false
end end
def destroy def destroy
@journal_level.destroy paper_level = JournalLevel.find(params[:id])
respond_to do |format| paper_level.destroy
format.js { render 'delete_journal_setting' } @paper_levels = JournalLevel.all
end render :partial=>'index', :layout=>false
end end
private private
def set_journal_level def paper_level_params
@journal_level = JournalLevel.find(params[:id])
end
def journal_level_attributes
params.require(:journal_level).permit! rescue nil params.require(:journal_level).permit! rescue nil
end end
end end

View File

@ -1,51 +1,43 @@
class Admin::JournalPaperAuthorTypesController < OrbitMemberController class Admin::JournalPaperAuthorTypesController < OrbitMemberController
before_action :allow_admin_only before_action :allow_admin_only
before_action :set_journal_paper_author_type, only: [:edit, :update, :destroy]
def initialize
super
@app_type = 'journal_paper_author_type'
end
def new def new
@journal_author_type = JournalPaperAuthorType.new @author_type = JournalPaperAuthorType.new
@url = admin_journal_paper_author_types_path(@author_type)
render :layout=>false
end end
def create def create
@journal_author_type = JournalPaperAuthorType.new(journal_paper_author_type_attributes) @author_type = JournalPaperAuthorType.new(author_type_params)
respond_to do |format| @author_type.save
if @journal_author_type.save @author_types = JournalPaperAuthorType.all
format.js { render 'create_writing_journal_setting' } render :partial=>'list', :layout=>false
end
end
end end
def edit def edit
@author_type = JournalPaperAuthorType.find(params[:id])
@url = admin_journal_paper_author_type_path(@author_type)
render :layout=>false
end end
def update def update
respond_to do |format| @author_type = JournalPaperAuthorType.find(params[:id])
if @journal_author_type.update_attributes(journal_paper_author_type_attributes) @author_type.update_attributes(author_type_params)
format.js { render 'update_writing_journal_setting' } @author_type.save
end @author_types = JournalPaperAuthorType.all
end render :partial=>'list', :layout=>false
end end
def destroy def destroy
@journal_author_type.destroy author_type = JournalPaperAuthorType.find(params[:id])
respond_to do |format| author_type.destroy
format.js { render 'delete_journal_setting' } @author_types = JournalPaperAuthorType.all
end render :partial=>'list', :layout=>false
end end
private private
def set_journal_paper_author_type def author_type_params
@journal_author_type = JournalPaperAuthorType.find(params[:id])
end
def journal_paper_author_type_attributes
params.require(:journal_paper_author_type).permit! rescue nil params.require(:journal_paper_author_type).permit! rescue nil
end end
end end

View File

@ -1,8 +0,0 @@
class Admin::JournalPaperIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'journal_paper_intro'
@app_type_name = 'journal_paper'
@reback_name = 'JournalPaper'
end
end

View File

@ -1,50 +1,43 @@
class Admin::JournalPaperTypesController < OrbitMemberController class Admin::JournalPaperTypesController < OrbitMemberController
before_action :allow_admin_only before_action :allow_admin_only
before_action :set_journal_paper_type, only: [:edit, :update, :destroy]
def initialize
super
@app_type = 'journal_paper_type'
end
def new def new
@journal_paper_type = JournalPaperType.new @paper_type = JournalPaperType.new
@url = admin_journal_paper_types_path(@paper_type)
render :layout=>false
end end
def create def create
@journal_paper_type = JournalPaperType.new(journal_paper_type_attributes) @paper_type = JournalPaperType.new(paper_type_params)
respond_to do |format| @paper_type.save
if @journal_paper_type.save @paper_types = JournalPaperType.all
format.js { render 'create_writing_journal_setting' } render :partial=>'index', :layout=>false
end
end
end end
def edit def edit
@paper_type = JournalPaperType.find(params[:id])
@url = admin_journal_paper_type_path(@paper_type)
render :layout=>false
end end
def update def update
respond_to do |format| @paper_type = JournalPaperType.find(params[:id])
if @journal_paper_type.update_attributes(journal_paper_type_attributes) @paper_type.update_attributes(paper_type_params)
format.js { render 'update_writing_journal_setting' } @paper_type.save
end @paper_types = JournalPaperType.all
end render :partial=>'index', :layout=>false
end end
def destroy def destroy
@journal_paper_type.destroy paper_type = JournalPaperType.find(params[:id])
respond_to do |format| paper_type.destroy
format.js { render 'delete_journal_setting' } @paper_types = JournalPaperType.all
end render :partial=>'index', :layout=>false
end end
private private
def set_journal_paper_type def paper_type_params
@journal_paper_type = JournalPaperType.find(params[:id])
end
def journal_paper_type_attributes
params.require(:journal_paper_type).permit! rescue nil params.require(:journal_paper_type).permit! rescue nil
end end
end end

View File

@ -2,177 +2,104 @@ class Admin::JournalPapersController < OrbitMemberController
include Admin::JournalPapersHelper include Admin::JournalPapersHelper
layout "member_plugin" layout "member_plugin"
before_action :set_journal_paper, only: [:show, :edit , :update] before_action :set_journal_paper, only: [:show, :edit , :update, :destroy]
before_action :get_plugins, only: [:index, :writing_journal_setting, :new, :create, :edit, :update]
before_action :set_types, only: [:writing_journal_setting, :new, :edit, :create, :update]
before_action :find_journal_paper, only: [:destroy]
before_action :set_plugin before_action :set_plugin
before_action :get_settings,:only => [:new, :edit, :setting]
before_action :need_access_right before_action :need_access_right
before_action :allow_admin_only, :only => [:index, :writing_journal_setting] before_action :allow_admin_only, :only => [:index, :setting]
def index def index
@writing_journals = JournalPaper.order_by(:year=>'desc').page(params[:page]).per(10) @writing_journals = JournalPaper.order_by(:year=>'desc').page(params[:page]).per(10)
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @writing_journals }
end
end
def show
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @journal_paper }
end
end end
def new def new
@journal_paper = JournalPaper.new
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil @member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
@journal_paper = JournalPaper.new
if params[:desktop] if params[:desktop]
render :layout => false render :layout => false
end end
end end
def create
@member = MemberProfile.find(journal_paper_params['member_profile_id']) rescue nil
@journal_paper = JournalPaper.new(journal_paper_params)
@journal_paper.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
else
redirect_to params['referer_url']
end
end
def edit def edit
@member = @journal_paper.member_profile @member = @journal_paper.member_profile
if params[:desktop] if params[:desktop]
render :layout => false render :layout => false
end end
end end
def create
@journal_paper = JournalPaper.new(journal_paper_attributes)
respond_to do |format|
if @journal_paper.save
if params[:desktop] == "true"
format.json { render json: get_paper_list }
end
format.html { redirect_to params['referer_url'] }
format.json { render action: 'show', status: :created, location: @journal_paper }
else
format.html { render action: 'new' }
format.json { render json: @journal_paper.errors, status: :unprocessable_entity }
end
end
end
def update def update
respond_to do |format| @member = @journal_paper.member_profile
if @journal_paper.update_attributes(journal_paper_attributes) @journal_paper.update_attributes(journal_paper_params)
if params[:desktop] == "true" @journal_paper.save
format.json { render json: get_paper_list } if params[:desktop] == "true"
end render json: {"data" => get_paper_list}.to_json
format.html { redirect_to params['referer_url'] } else
# format.js { render 'toggle_enable' } redirect_to params['referer_url']
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @journal_paper.errors, status: :unprocessable_entity }
end
end end
end end
def destroy def destroy
@journal_paper.destroy @journal_paper.destroy
respond_to do |format| respond_to do |format|
format.html { redirect_to(admin_journal_papers_url) } format.html { redirect_to(admin_journal_paper_url) }
# format.xml { head :ok } # format.xml { head :ok }
format.js format.js
format.json {render json: {"success" => true}} format.json {render json: {"success" => true}}
end end
end end
def delete def toggle_hide
end
def writing_journal_setting
@set_level_type = JournalLevel.new(display: 'List')
@level_type_url = admin_journal_papers_path
@set_author_type = JournalPaperAuthorType.new(display: 'List')
@author_type_url = admin_journal_papers_path
@set_paper_type = JournalPaperType.new(display: 'List')
@paper_type_url = admin_journal_papers_path
end
def add_level
@set_level_type = JournalLevel.new(display: 'List')
@level_type_url = admin_journal_levels_path
@set_level_type.id = params[:id]
respond_to do |format|
format.js
end
end
def edit_level
@set_level_type = JournalLevel.find(params[:journal_paper_id])
@level_type_url = admin_journal_level_path(@set_level_type)
respond_to do |format|
format.js
end
end
def add_author_type
@set_author_type = JournalPaperAuthorType.new(display: 'List')
@author_type_url = admin_journal_paper_author_types_path
@set_author_type.id = params[:id]
respond_to do |format|
format.js
end
end
def edit_author_type
@set_author_type = JournalPaperAuthorType.find(params[:journal_paper_id])
@author_type_url = admin_journal_paper_author_type_path(@set_author_type)
respond_to do |format|
format.js
end
end
def add_paper_type
@set_paper_type = JournalPaperType.new(:display => 'List')
@paper_type_url = admin_journal_paper_types_path
@set_paper_type.id = params[:id]
respond_to do |format|
format.js
end
end
def edit_paper_type
@set_paper_type = JournalPaperType.find(params[:journal_paper_id])
@paper_type_url = admin_journal_paper_type_path(@set_paper_type)
respond_to do |format|
format.js
end
end
def data_share
if params[:ids] if params[:ids]
@writing_journals = JournalPaper.any_in(_id: params[:ids]) @journal_papers = JournalPaper.any_in(_id: params[:ids])
@writing_journals.each do |writing_journal| @journal_papers.each do |journal_paper|
writing_journal.is_hidden = params[:disable] journal_paper.is_hidden = params[:disable]
writing_journal.save journal_paper.save
end end
end end
respond_to do |format| render json: {"success"=>true}
format.html { redirect_to(admin_member_path(id: params[:member_profile_id],show_plugin_profile: "JournalPaper")) } end
format.json { render json: {"success"=>true}.to_json}
end
def setting
end
def frontend_setting
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
@intro = JournalPaperIntro.find_by(:member_profile_id=>@member.id) rescue nil
@intro = @intro.nil? ? JournalPaperIntro.new({:member_profile_id=>@member.id}) : @intro
end
def update_frontend_setting
@member = MemberProfile.find(intro_params['member_profile_id']) rescue nil
@intro = JournalPaperIntro.find_by(:member_profile_id=>@member.id) rescue nil
@intro = @intro.nil? ? JournalPaperIntro.new({:member_profile_id=>@member.id}) : @intro
@intro.update_attributes(intro_params)
@intro.save
redirect_to URI.encode('/admin/members/'+@member.to_param+'/JournalPaper')
end
def get_settings
@journal_levels = JournalLevel.all
@author_types = JournalPaperAuthorType.all
@paper_types = JournalPaperType.all
end
def set_plugin
@plugin = OrbitApp::Plugin::Registration.all.select{|plugin| plugin.app_name.eql? 'JournalPaper'}.first
end end
private private
@ -186,29 +113,14 @@ class Admin::JournalPapersController < OrbitMemberController
uid = path[-2].split("-").last uid = path[-2].split("-").last
uid = uid.split("?").first uid = uid.split("?").first
end end
@journal_paper = JournalPaper.find_by(uid: uid) @journal_paper = JournalPaper.find_by(:uid => uid) rescue JournalPaper.find(params[:id])
end end
def find_journal_paper def journal_paper_params
@journal_paper = JournalPaper.find_by(id: params[:id]) params.require(:journal_paper).permit! rescue nil
end end
def journal_paper_attributes def intro_params
params.require(:journal_paper).permit! rescue nil params.require(:journal_paper_intro).permit! rescue nil
end end
def get_plugins
@plugins = OrbitApp::Plugin::Registration.all rescue nil
end
def set_plugin
@plugin = OrbitApp::Plugin::Registration.all.select{|plugin| plugin.app_name.eql? 'JournalPaper'}.first
end
def set_types
@journal_levels = JournalLevel.all
@author_types = JournalPaperAuthorType.all
@paper_types = JournalPaperType.all
end
end end

View File

@ -1,52 +0,0 @@
class JournalPapersController < ApplicationController
def index
journal_papers = JournalPaper.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
journal_paper_list = journal_papers.collect do |journal_paper|
{
"year" => journal_paper.year,
"paper_title" => journal_paper.create_link,
"author" => journal_paper.authors,
"link_to_show" => OrbitHelper.url_to_show(journal_paper.to_param)
}
end
{
"journal_papers" => journal_paper_list,
"extras" => {
"widget-title" => t("module_name.journal_paper"),
"th_year" => t('personal_plugins.year'),
"th_title" => t("personal_conference.paper_title"),
"th_author" => t('personal_plugins.author')
},
"total_pages" => journal_papers.total_pages
}
end
def show
params = OrbitHelper.params
plugin = JournalPaper.find_by(uid: params[:uid])
fields_to_show = [
"paper_title",
"journal_title",
"level_type",
"paper_type",
"author_name",
"authors",
"author_type",
"year",
"publication_date",
"language",
"vol_no",
"issue_no",
"form_to_start",
"form_to_end",
"total_pages",
"isbn",
"url",
"associated_project",
"note",
"file"
]
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
end
end

View File

@ -0,0 +1,52 @@
class PersonalJournalsController < ApplicationController
def index
journal_papers = JournalPaper.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
journal_paper_list = journal_papers.collect do |journal_paper|
{
"year" => journal_paper.year,
"paper_title" => journal_paper.create_link,
"author" => journal_paper.authors,
"link_to_show" => OrbitHelper.url_to_show(journal_paper.to_param)
}
end
{
"journal_papers" => journal_paper_list,
"extras" => {
"widget-title" => t("module_name.journal_paper"),
"th_year" => t('personal_plugins.year'),
"th_title" => t("personal_conference.paper_title"),
"th_author" => t('personal_plugins.author')
},
"total_pages" => journal_papers.total_pages
}
end
def show
params = OrbitHelper.params
plugin = JournalPaper.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [
"year",
"author_name",
"authors",
"author_type",
"paper_title",
"journal_title",
"vol_no",
"issue_no",
"form_to_start",
"form_to_end",
"level_type",
"paper_type",
"total_pages",
"publication_date",
"isbn",
"abstract",
"language",
"url",
"associated_project",
"file"
]
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
end
end

View File

@ -1,2 +0,0 @@
module Admin::JournalLevelsHelper
end

View File

@ -1,2 +0,0 @@
module Admin::JournalPaperAuthorTypesHelper
end

View File

@ -1,2 +0,0 @@
module Admin::JournalPaperIntrosHelper
end

View File

@ -1,2 +0,0 @@
module Admin::JournalPaperTypesHelper
end

View File

@ -7,30 +7,30 @@ module Admin::JournalPapersHelper
request.protocol+(request.host_with_port+journal_paper_page.url+'/'+journal_paper_object.to_param).gsub('//','/') rescue "/" request.protocol+(request.host_with_port+journal_paper_page.url+'/'+journal_paper_object.to_param).gsub('//','/') rescue "/"
end end
def get_paper_list def get_paper_list
user = current_user.nil? ? OrbitHelper.current_user : current_user user = current_user.nil? ? OrbitHelper.current_user : current_user
user_profile = user.member_profile user_profile = user.member_profile
journals = JournalPaper.where(:member_profile_id => user_profile.id) journals = JournalPaper.where(:member_profile_id => user_profile.id)
journals = journals.collect do |j| journals = journals.collect do |j|
files = j.journal_paper_files.collect do |jpf| files = j.journal_paper_files.collect do |jpf|
{
"title" => jpf.title,
"description" => jpf.description,
"link" => jpf.journal_file.url,
"extension" => (jpf.journal_file.url.split(".").last rescue "")
}
end
{ {
"id" => j.id.to_s, "title" => jpf.title,
"edit_url" => "/#{I18n.locale.to_s}/admin/journal_papers/#{j.to_param}/edit", "description" => jpf.description,
"delete_url" => "/#{I18n.locale.to_s}/admin/journal_papers/#{j.id.to_s}", "link" => jpf.journal_file.url,
"paper_title" => j.paper_title, "extension" => (jpf.journal_file.url.split(".").last rescue "")
"journal_title" => j.journal_title,
"keywords" => j.keywords,
"abstract" => j.abstract,
"files" => files
} }
end end
journals
{
"id" => j.id.to_s,
"edit_url" => "/#{I18n.locale.to_s}/admin/members/#{user_profile.to_param}/journal_papers/#{j.to_param}/edit",
"delete_url" => "/#{I18n.locale.to_s}/admin/journal_papers/#{j.id.to_s}",
"paper_title" => j.paper_title,
"journal_title" => j.journal_title,
"keywords" => j.keywords,
"abstract" => j.abstract,
"files" => files
}
end end
journals
end
end end

View File

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

View File

@ -1,9 +1,6 @@
class JournalLevel class JournalLevel
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include OrbitCoreLib::ObjectDisable
field :key, type: String field :key, type: String
field :title, type: String, localize: true field :title, type: String, localize: true

View File

@ -53,16 +53,17 @@ class JournalPaper
title << self.member_profile.name if self.member_profile_id.present? title << self.member_profile.name if self.member_profile_id.present?
title << (!self.authors.blank? ? self.authors : nil) title << (!self.authors.blank? ? self.authors : nil)
if !self.publication_date.nil?
pd = self.publication_date.strftime("%Y-%m-%d").split('-')
title << pd[0]
end
title << self.paper_title if self.paper_title.present? title << self.paper_title if self.paper_title.present?
title << self.journal_title if self.journal_title.present? title << self.journal_title if self.journal_title.present?
title << self.vol_no if (self.vol_no.present? && self.vol_no != "0") title << self.vol_no if (self.vol_no.present? && self.vol_no != "0")
title << self.issue_no if (self.issue_no.present? && self.issue_no != "0") title << self.issue_no if (self.issue_no.present? && self.issue_no != "0")
title << "pp"+self.form_to_start+"-"+self.form_to_end if (self.form_to_start.present? && self.form_to_start != "0") title << "pp"+self.form_to_start+"-"+self.form_to_end if (self.form_to_start.present? && self.form_to_start != "0")
title << ( !self.journal_levels.blank? ? "(#{self.journal_levels.collect{|x| x.title}.join(', ')})" : nil) title << ( !self.journal_levels.blank? ? "(#{self.journal_levels.collect{|x| x.title}.join(', ')})" : nil)
# if !self.publication_date.nil?
# pd = self.publication_date.strftime("%Y-%m-%d").split('-')
# title << pd[0]
# end
title << self.year
title.join(', ').gsub(', ,',',') title.join(', ').gsub(', ,',',')
end end
@ -125,6 +126,8 @@ class JournalPaper
value = self.publication_date.to_date.strftime("%Y-%m-%d") rescue "" value = self.publication_date.to_date.strftime("%Y-%m-%d") rescue ""
when "language" when "language"
value = I18n.t(self.language) rescue "" value = I18n.t(self.language) rescue ""
when "abstract"
value = nl2br(self.abstract)
when "file" when "file"
files = [] files = []
self.journal_paper_files.each do |file| self.journal_paper_files.each do |file|

View File

@ -1,8 +1,6 @@
class JournalPaperAuthorType class JournalPaperAuthorType
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include OrbitCoreLib::ObjectDisable
field :key, type: String field :key, type: String
field :title, type: String, localize: true field :title, type: String, localize: true

View File

@ -1,8 +1,6 @@
class JournalPaperType class JournalPaperType
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include OrbitCoreLib::ObjectDisable
field :key, type: String field :key, type: String
field :title, type: String, localize: true field :title, type: String, localize: true

View File

@ -0,0 +1,24 @@
<%= form_for(@paper_level, :html =>{:class=>"form-horizontal", :style=>"margin: 0;"}, :remote => true, :url => @url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= t("personal_journal.level_type") %></h3>
</div>
<div class="modal-body">
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag t(locale), t(locale), :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :value => (@paper_level.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1,2 @@
$('#paper_levels tbody').html("<%= j render :partial => '/admin/journal_papers/list_level_type', :collection => @paper_levels %>");
$('#paper_level_modal').modal('hide');

View File

@ -1,2 +0,0 @@
$("#myModal1").modal('hide');
$('<%= j render :partial => 'admin/journal_papers/list_level_type', :collection => [@journal_level] %>').appendTo('#level_types').hide().fadeIn();

View File

@ -1,3 +0,0 @@
$('.delete_level').bind('ajax:success', function() {
$(this).closest('tr').fadeOut();
});

View File

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

View File

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

View File

@ -1,2 +0,0 @@
$("#myModal1").modal('hide');
$("#<%= dom_id @journal_level %>").replaceWith("<%= j render :partial => 'admin/journal_papers/list_level_type', :collection => [@journal_level] %>");

View File

@ -0,0 +1,24 @@
<%= form_for(@author_type, :html =>{:class=>"form-horizontal", :style=>"margin: 0;"}, :remote => true, :url => @url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= t("personal_journal.author_type") %></h3>
</div>
<div class="modal-body">
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag t(locale), t(locale), :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :value => (@author_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1,2 @@
$('#author_types tbody').html("<%= j render :partial => '/admin/journal_papers/list_author_type', :collection => @author_types %>");
$('#author_type_modal').modal('hide');

View File

@ -1,2 +0,0 @@
$("#myModal2").modal('hide');
$('<%= j render :partial => 'admin/journal_papers/list_author_type', :collection => [@journal_author_type] %>').appendTo('#author_types').hide().fadeIn();

View File

@ -1,3 +0,0 @@
$('.delete_author').bind('ajax:success', function() {
$(this).closest('tr').fadeOut();
});

View File

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

View File

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

View File

@ -1,2 +0,0 @@
$("#myModal2").modal('hide');
$("#<%= dom_id @journal_author_type %>").replaceWith("<%= j render :partial => 'admin/journal_papers/list_author_type', :collection => [@journal_author_type] %>");

View File

@ -0,0 +1,24 @@
<%= form_for(@paper_type, :html =>{:class=>"form-horizontal", :style=>"margin: 0;"}, :remote => true, :url => @url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= t("personal_journal.paper_type") %></h3>
</div>
<div class="modal-body">
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag t(locale), t(locale), :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :value => (@paper_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1,2 @@
$('#paper_types tbody').html("<%= j render :partial => '/admin/journal_papers/list_paper_type', :collection => @paper_types %>");
$('#paper_type_modal').modal('hide');

View File

@ -1,2 +0,0 @@
$("#myModal3").modal('hide');
$('<%= j render :partial => 'admin/journal_papers/list_paper_type', :collection => [@journal_paper_type] %>').appendTo('#paper_types').hide().fadeIn();

View File

@ -1,3 +0,0 @@
$('.delete_paper').bind('ajax:success', function() {
$(this).closest('tr').fadeOut();
});

View File

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

View File

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

View File

@ -1,2 +0,0 @@
$("#myModal3").modal('hide');
$("#<%= dom_id @journal_paper_type %>").replaceWith("<%= j render :partial => 'admin/journal_papers/list_paper_type', :collection => [@journal_paper_type] %>");

View File

@ -1,33 +0,0 @@
<script type="text/javascript">
var map = {},
members = [],
data = <%= raw @members_data %>;
$.each(data, function (i, member) {
map[member.memberName] = member;
members.push(member.memberName);
});
$(document).ready(function(){
$('#member_autocomplete').typeahead({
source: function (query, process) {
return members;
},
updater: function (item) {
selectedMember = map[item].memberId;
$('#member_value').val(selectedMember);
return item;
},
matcher: function (item) {
if (item.toLowerCase().indexOf(this.query.trim().toLowerCase()) != -1) {
        return true;
      }
},
sorter: function (items) {
    return items.sort();
},
highlighter: function (item) {
var regex = new RegExp( '(' + this.query + ')', 'gi' );
return item.replace( regex, "<strong>$1</strong>" );
},
});
});
</script>

View File

@ -1,33 +0,0 @@
<% # encoding: utf-8 %>
<%= form_for(@set_author_type, :remote => true, :url => @author_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabe2"><%= (@set_author_type.new_record? ? 'Add 作者型態' : 'Edit 作者型態') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "link-#{locale}", "Name-#{t(locale).to_s}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'control-label', :value => (@set_author_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'journal_paper[author_type]', @set_author_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -1,9 +0,0 @@
<div class="table-label">
<div id="sort_headers" class="table-label">
<%= render 'sort_headers' %>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "sort_header" %>
<% end %>

View File

@ -3,6 +3,7 @@
<%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %> <%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %> <%= stylesheet_link_tag "lib/main-list" %>
<%= stylesheet_link_tag "lib/main-form-col2" %>
<% end %> <% end %>
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %> <%= javascript_include_tag "lib/bootstrap-fileupload" %>
@ -19,201 +20,6 @@
<!-- Input Area --> <!-- Input Area -->
<div class="input-area"> <div class="input-area">
<!-- Module Tabs -->
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= @member.name rescue ''%>
<%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %>
</div>
</div>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.year") %></label>
<div class="controls">
<%= select_year((@journal_paper.year ? @journal_paper.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'journal_paper[year]', :class => "span1"} ) %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.language") %></label>
<div class="controls">
<select id="journal_paper_language" name="journal_paper[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @journal_paper.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- level_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.level_type") %></label>
<div class="controls">
<% @journal_levels.each do |level_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'journal_paper[journal_level_ids][]', level_type.id, @journal_paper.journal_level_ids.include?(level_type.id)%>
<%= level_type.title %>
<%= hidden_field_tag 'journal_paper[journal_level_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.paper_type") %></label>
<div class="controls">
<%= f.select :journal_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]}, :class => "span3" %>
</div>
</div>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'journal_paper[journal_paper_author_type_ids][]', author_type.id, @journal_paper.journal_paper_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<% end %>
<% end %>
</div>
</div>
<!-- number_of_authors -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.number_of_authors") %></label>
<div class="controls">
<%= f.text_field :number_of_authors, :class=>'span1' %>
</div>
</div>
<!-- associated_project -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.associated_project") %></label>
<div class="controls">
<%= f.text_field :associated_project %>
</div>
</div>
<!-- vol_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.vol_no") %></label>
<div class="controls">
<%= f.text_field :vol_no %>
</div>
</div>
<!-- issue_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.issue_no") %></label>
<div class="controls">
<%= f.text_field :issue_no %>
</div>
</div>
<!-- form_to -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.form_to") %></label>
<div class="controls">
<%= f.text_field :form_to_start, :class=>'span1' %> ~ <%= f.text_field :form_to_end, :class=>'span1' %>
</div>
</div>
<!-- total_pages -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.total_pages") %></label>
<div class="controls">
<%= f.text_field :total_pages %>
</div>
</div>
<!-- isbn -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.isbn") %></label>
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publication_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- abstract -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.abstract") %></label>
<div class="controls">
<%= f.text_area :abstract, rows: 2, class: "input-block-level" %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @journal_paper.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
<!-- Language Tabs --> <!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div> <div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav"> <ul class="nav nav-pills language-nav">
@ -294,6 +100,201 @@
</div> </div>
</div> </div>
<!-- Module Tabs -->
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= @member.name rescue ''%>
<%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %>
</div>
</div>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.year") %></label>
<div class="controls">
<%= select_year((@journal_paper.year ? @journal_paper.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'journal_paper[year]', :class => "span1"} ) %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.language") %></label>
<div class="controls">
<select id="journal_paper_language" name="journal_paper[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @journal_paper.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- vol_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.vol_no") %></label>
<div class="controls">
<%= f.text_field :vol_no %>
</div>
</div>
<!-- issue_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.issue_no") %></label>
<div class="controls">
<%= f.text_field :issue_no %>
</div>
</div>
<!-- form_to -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.form_to") %></label>
<div class="controls">
<%= f.text_field :form_to_start, :class=>'span1' %> ~ <%= f.text_field :form_to_end, :class=>'span1' %>
</div>
</div>
<!-- total_pages -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.total_pages") %></label>
<div class="controls">
<%= f.text_field :total_pages %>
</div>
</div>
<!-- level_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.level_type") %></label>
<div class="controls">
<% @journal_levels.each do |level_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'journal_paper[journal_level_ids][]', level_type.id, @journal_paper.journal_level_ids.include?(level_type.id)%>
<%= level_type.title %>
<%= hidden_field_tag 'journal_paper[journal_level_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.paper_type") %></label>
<div class="controls">
<%= f.select :journal_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]}, :class => "span3" %>
</div>
</div>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'journal_paper[journal_paper_author_type_ids][]', author_type.id, @journal_paper.journal_paper_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<% end %>
<% end %>
</div>
</div>
<!-- number_of_authors -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.number_of_authors") %></label>
<div class="controls">
<%= f.text_field :number_of_authors, :class=>'span1' %>
</div>
</div>
<!-- isbn -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.isbn") %></label>
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publication_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- url -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_journal.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_journal.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- abstract -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_journal.abstract") %></label>
<div class="controls">
<%= f.text_area :abstract, rows: 2, class: "input-block-level" %>
</div>
</div>
<!-- note -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_journal.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
<!-- associated_project -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_journal.associated_project") %></label>
<div class="controls">
<%= f.text_field :associated_project %>
</div>
</div>
</div>
<!-- Status Module -->
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @journal_paper.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
</div> </div>
<!-- Form Actions --> <!-- Form Actions -->

View File

@ -1,34 +0,0 @@
<% # encoding: utf-8 %>
<%= form_for(@set_level_type, remote: true, url: @level_type_url) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= (@set_level_type.new_record? ? 'Add 等級' : 'Edit 等級') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "link-#{locale}", "Name-#{t(locale).to_s}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'control-label', :value => (@set_level_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'journal_paper[journal_level]', @set_level_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -1,11 +1,10 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<tr id="<%= dom_id list_author_type %>"> <tr id="<%= dom_id list_author_type %>">
<td><%= list_author_type.title %></td> <td><%= list_author_type.title %></td>
<td class="span2"> <td class="span2">
<a href="<%= admin_journal_paper_edit_author_type_path(list_author_type) %>#myModal2" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a> <a href="<%= edit_admin_journal_paper_author_type_path(list_author_type) %>#author_type_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
<%= link_to 'Delete', <%= link_to t(:delete_), admin_journal_paper_author_type_path(list_author_type), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
polymorphic_path([:admin, list_author_type]), data: { confirm: t('sure?') }, method: :delete, remote:true, class: "delete_author archive_toggle action" %> </td>
</td> </tr>
</tr>

View File

@ -1,11 +1,10 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<tr id="<%= dom_id list_level_type %>"> <tr id="<%= dom_id list_level_type %>">
<td><%= list_level_type.title %></td> <td><%= list_level_type.title %></td>
<td class="span2"> <td class="span2">
<a href="<%= admin_journal_paper_edit_level_path(journal_paper_id: list_level_type.id) %>#myModal1" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a> <a href="<%= edit_admin_journal_level_path(list_level_type) %>#paper_level_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
<%= link_to 'Delete', <%= link_to t(:delete_), admin_journal_level_path(list_level_type), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
polymorphic_path([:admin, list_level_type]), data: { confirm: t('sure?') }, method: :delete, remote: true, class: "delete_level archive_toggle action" %> </td>
</td> </tr>
</tr>

View File

@ -1,11 +1,10 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<tr id="<%= dom_id list_paper_type %>"> <tr id="<%= dom_id list_paper_type %>">
<td><%= list_paper_type.title %></td> <td><%= list_paper_type.title %></td>
<td class="span2"> <td class="span2">
<a href="<%= admin_journal_paper_edit_paper_type_path(list_paper_type) %>#myModal3" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a> <a href="<%= edit_admin_journal_paper_type_path(list_paper_type) %>#paper_type_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
<%= link_to 'Delete', <%= link_to t(:delete_), admin_journal_paper_type_path(list_paper_type), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
polymorphic_path([:admin, list_paper_type]), data: { confirm: t('sure?') }, method: :delete, remote: true,class: "delete_paper archive_toggle action" %> </td>
</td> </tr>
</tr>

View File

@ -1,29 +0,0 @@
<% # encoding: utf-8 %>
<%= form_for(@set_paper_type, remote: true, url: @paper_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabe3"><%= (@set_paper_type.new_record? ? 'Add 論文型態' : 'Edit 論文型態') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<div class="control-group">
<label for="http" class="control-label">Title</label>
<div class="controls">
<%= f.text_field :title %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'writing_journal_category[paper_type]', @set_paper_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -10,6 +10,6 @@
</ul> </ul>
</div> </div>
</td> </td>
<td class="span1"><%= writing_journal.authors%></td> <td><%= writing_journal.member_profile.name rescue "" %></td>
</tr> </tr>
<% end %> <% end %>

View File

@ -1 +0,0 @@
$("#myModal2").html("<%= j render "author_type_qe" %>");

View File

@ -1 +0,0 @@
$("#myModal1").html("<%= j render "level_type_qe" %>");

View File

@ -1 +0,0 @@
$("#myModal3").html("<%= j render "paper_type_qe" %>");

View File

@ -1,15 +0,0 @@
<% if !@journal_level_type.blank? %>
$("#myModal1").modal('hide');
$('<%= j render :partial => 'list_level_type', :collection => [@journal_level_type] %>').appendTo('#level_types').hide().fadeIn();
<% end %>
<% if !@journal_author_type.blank? %>
$("#myModal2").modal('hide');
$('<%= j render :partial => 'list_author_type', :collection => [@journal_author_type] %>').appendTo('#author_types').hide().fadeIn();
<% end %>
<% if !@journal_paper_type.blank? %>
$("#myModal3").modal('hide');
$('<%= j render :partial => 'list_paper_type', :collection => [@journal_paper_type] %>').appendTo('#paper_types').hide().fadeIn();
<% end %>

View File

@ -1 +0,0 @@
$("#myModal2").html("<%= j render "author_type_qe" %>");

View File

@ -1 +0,0 @@
$("#myModal1").html("<%= j render "level_type_qe" %>");

View File

@ -1 +0,0 @@
$("#myModal3").html("<%= j render "paper_type_qe" %>");

View File

@ -0,0 +1,93 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<%= form_for(:journal_paper_intro, :url => update_frontend_setting_admin_journal_papers_path, :method => "post", html: {class: "form-horizontal main-forms previewable"} ) do |f| %>
<fieldset>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t("module_name.journal_paper") %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<% if !@member.blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= @member.name rescue ''%>
<%= f.hidden_field :member_profile_id, :value => @member.id %>
</div>
</div>
<% end %>
<!-- frontend_page -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.frontend_page") %></label>
<div class="controls">
<%= f.check_box :brief_intro, :checked => @intro.brief_intro %> <%= t("personal_plugins.brief_intro") %>
<%= f.check_box :complete_list, :checked => @intro.complete_list %> <%= t("personal_plugins.complete_list") %>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t(:content) %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :text_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@intro.text_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</fieldset>
<% end %>

View File

@ -3,7 +3,7 @@
<tr> <tr>
<th class="span1"><%= t('personal_journal.year') %></th> <th class="span1"><%= t('personal_journal.year') %></th>
<th class="span7"><%= t('module_name.journal_paper') %></th> <th class="span7"><%= t('module_name.journal_paper') %></th>
<th class="span1"><%= t('personal_journal.authors') %></th> <th class="span1"><%= t("personal_plugins.author") %></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody_writing_journals" class="sort-holder"> <tbody id="tbody_writing_journals" class="sort-holder">

View File

@ -1 +0,0 @@
$("#myModal1").html("<%= j render "level_type_qe" %>");

View File

@ -0,0 +1,116 @@
<style type="text/css">
.element{
background: #FFF;
margin-bottom: 10px;
border-radius: 5px;
border: 1px solid #DDD;
}
.detail{
padding: 10px;
min-height: 250px;
}
.totle{
margin-bottom: 25px;
}
.totle span{
font-size: 18px;
}
</style>
<div class="row">
<div class="element span4">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= new_admin_journal_paper_type_path %>#paper_type_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_journal.paper_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="paper_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_paper_type', :collection => @paper_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="element span4">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= new_admin_journal_level_path %>#paper_level_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_journal.level_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="paper_levels" class="table table-striped">
<tbody>
<%= render :partial => 'list_level_type', :collection => @journal_levels %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="element span4">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= new_admin_journal_paper_author_type_path %>#author_type_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_journal.author_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="author_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_author_type', :collection => @author_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="paper_type_qe">
<div style="display:none;" class="modal" id="paper_type_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
</div>
<div id="paper_level_qe">
<div style="display:none;" class="modal" id="paper_level_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
</div>
<div id="author_type_qe">
<div style="display:none;" class="modal" id="author_type_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
</div>

View File

@ -1,14 +0,0 @@
<% if !@journal_level_type.blank? %>
$("#myModal1").modal('hide');
$("#<%= dom_id @journal_level_type %>").replaceWith("<%= j render :partial => 'list_level_type', :collection => [@journal_level_type] %>");
<% end %>
<% if !@journal_author_type.blank? %>
$("#myModal2").modal('hide');
$("#<%= dom_id @journal_author_type %>").replaceWith("<%= j render :partial => 'list_author_type', :collection => [@journal_author_type] %>");
<% end %>
<% if !@journal_paper_type.blank? %>
$("#myModal3").modal('hide');
$("#<%= dom_id @journal_paper_type %>").replaceWith("<%= j render :partial => 'list_paper_type', :collection => [@journal_paper_type] %>");
<% end %>

View File

@ -1,131 +0,0 @@
<% # encoding: utf-8 %>
<div id="isotope">
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= admin_journal_paper_add_level_path('add') %>#myModal1" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_journal.level_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="level_types" class="table table-striped">
<tbody>
<%= render partial: 'list_level_type', collection: @journal_levels %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= admin_journal_paper_add_author_type_path('add') %>#myModal2" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_journal.author_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="author_types" class="table table-striped">
<tbody>
<%= render partial: 'list_author_type', collection: @author_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= admin_journal_paper_add_paper_type_path('add') %>#myModal3" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_journal.paper_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="paper_types" class="table table-striped">
<tbody>
<%= render partial: 'list_paper_type', collection: @paper_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-actions form-fixed pagination-right">
<!-- <a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯出</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯入</a>&nbsp; -->
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_admin_journal_paper_path, :class => 'btn btn-primary pull-right' %>
</div>
<div id="level_type_qe">
<div style="display:none;" class="modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render "level_type_qe" %>
</div>
</div>
<div id="author_type_qe">
<div style="display:none;" class="modal" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render "author_type_qe" %>
</div>
</div>
<div id="paper_type_qe">
<div style="display:none;" class="modal" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render "paper_type_qe" %>
</div>
</div>
<div style="display:none;" class="modal" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">領域</h3>
</div>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="modal-body">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputvalue">名稱</label>
<div class="controls">
<input type="text" id="inputvalue" placeholder="Value">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>

View File

@ -14,12 +14,12 @@
%> %>
<% if has_access? %> <% if has_access? %>
<div class="list-active"> <div class="list-active">
<div class="btn-group"> <div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_admin_journal_papers_path(member_profile_id: params[:id], disable: 'true') ) %> <%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => toggle_hide_admin_journal_papers_path(member_profile_id: params[:id], disable: 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_admin_journal_papers_path(member_profile_id: params[:id], disable: 'false') ) %> <%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => toggle_hide_admin_journal_papers_path(member_profile_id: params[:id], disable: 'false') ) %>
</div>
</div> </div>
</div>
<% end -%> <% end -%>
<table class="table table-condensed table-striped main-list"> <table class="table table-condensed table-striped main-list">
@ -47,7 +47,7 @@
<% end -%> <% end -%>
<td><%= writing_journal.year %></td> <td><%= writing_journal.year %></td>
<td> <td>
<%= link_to writing_journal.create_link, page_for_journal_paper(writing_journal), target: "blank"%> <%= link_to writing_journal.create_link, OrbitHelper.url_to_plugin_show(writing_journal.to_param,'personal_journal'), target: "blank"%>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<% if has_access? %> <% if has_access? %>
@ -66,19 +66,18 @@
</tbody> </tbody>
</table> </table>
<% if has_access? %>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<% if has_access? %>
<div class="action pull-right"> <div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('setting'),admin_journal_paper_intros_path(member_profile_id: @member.id), :class => 'btn btn-primary' %> <%= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('setting'),'/admin/members/'+@member.to_param+'/journal_papers/frontend_setting', :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'),
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('new_'), '/admin/members/'+@member.to_param+'/journal_papers/new', :class => 'btn btn-primary' %> '/admin/members/'+@member.to_param+'/journal_papers/new', :class => 'btn btn-primary' %>
</div> </div>
<% end %>
<div class="pagination pagination-centered"> <div class="pagination pagination-centered">
<%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort]} %> <%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort] } %>
</div> </div>
</div> </div>
<% end %>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true"> <div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header"> <div class="modal-header">

View File

@ -1,5 +1,6 @@
en: en:
module_name: module_name:
personal_journal: Journal Paper
journal_paper: Journal Paper journal_paper: Journal Paper
personal_journal: personal_journal:
paper_title : "Paper Title" paper_title : "Paper Title"

View File

@ -1,5 +1,6 @@
zh_tw: zh_tw:
module_name: module_name:
personal_journal: 期刊論文
journal_paper: 期刊論文 journal_paper: 期刊論文
personal_journal: personal_journal:
associated_project: "所屬計畫案" associated_project: "所屬計畫案"
@ -28,7 +29,7 @@ zh_tw:
author_type : "作者類別" author_type : "作者類別"
paper_type: "論文類型" paper_type: "論文類型"
from : "起" from : "起"
to : "" to : ""
file : "檔案" file : "檔案"
file_name : "檔案名稱" file_name : "檔案名稱"
description : "描述" description : "描述"

View File

@ -1,39 +1,32 @@
Rails.application.routes.draw do 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
match 'writing_journal_setting' => "journal_papers#writing_journal_setting" ,as: :writing_journal_setting, via: [:get] get 'writing_journal_setting' => "journal_papers#setting"
resources :journal_papers do
collection do
get 'delete'
get 'data_share'
end
match "add_level" => "journal_papers#add_level" ,as: :add_level, via: [:get, :post]
match "edit_level" => "journal_papers#edit_level" ,as: :edit_level, via: [:get, :post]
match "add_author_type" => "journal_papers#add_author_type" ,as: :add_author_type, via: [:get, :post]
match "edit_author_type" => "journal_papers#edit_author_type" ,as: :edit_author_type, via: [:get, :post]
match "add_paper_type" => "journal_papers#add_paper_type" ,as: :add_paper_type, via: [:get, :post]
match "edit_paper_type" => "journal_papers#edit_paper_type" ,as: :edit_paper_type, via: [:get, :post]
end
resources :members do resources :journal_papers do
collection do collection do
scope '(:name-:uid)' do get 'toggle_hide' => 'journal_papers#toggle_hide'
resources :journal_papers do end
collection do end
get 'frontend_setting' => 'journal_papers#frontend_setting'
post 'update_frontend_setting' => 'journal_papers#update_frontend_setting'
end
end
end
end
end
resources :journal_levels resources :members do
resources :journal_paper_author_types collection do
resources :journal_paper_types scope '(:name-:uid)' do
resources :journal_paper_intros resources :journal_papers do
collection do
get 'frontend_setting' => 'journal_papers#frontend_setting'
post 'update_frontend_setting' => 'journal_papers#update_frontend_setting'
end
end
end
end
end
resources :journal_levels
resources :journal_paper_author_types
resources :journal_paper_types
resources :journal_paper_intros
end end
end end
end end

View File

@ -1,10 +1,10 @@
module PersonalJournal module PersonalJournal
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "journal_paper" do initializer "personal_journal" do
OrbitApp.registration "JournalPaper",:type=> 'ModuleApp' do OrbitApp.registration "PersonalJournal",:type=> 'ModuleApp' do
module_label 'module_name.journal_paper' module_label 'module_name.journal_paper'
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :sort_number => '5', :app_name=>"JournalPaper", :intro_app_name=>"JournalPaperlIntro",:path=>"/plugin/journal_paper/profile",:front_path=>"/profile",:admin_path=>"/admin/journal_papers/",:i18n=>'module_name.journal_paper', :module_app_name=>'JournalPaper' personal_plugin :enable => true, :sort_number => '5', :app_name=>"JournalPaper", :intro_app_name=>"JournalPaperlIntro",:path=>"/plugin/personal_journal/profile",:front_path=>"/profile",:admin_path=>"/admin/journal_papers/",:i18n=>'module_name.journal_paper', :module_app_name=>'PersonalJournal'
version "0.1" version "0.1"
desktop_enabled true desktop_enabled true
@ -19,3 +19,4 @@ module PersonalJournal
end end
end end
end end