forked from saurabh/personal-journal
fix the problem of multiple creating data when multiple authors are add
This commit is contained in:
parent
295b6cbf0f
commit
0f1f7c7b90
|
@ -2,20 +2,70 @@ require 'rubyXL'
|
||||||
class Admin::JournalPapersController < OrbitMemberController
|
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, :destroy]
|
before_action :set_journal_paper, only: [:show, :edit , :update, :destroy]
|
||||||
before_action :set_plugin
|
before_action :set_plugin
|
||||||
before_action :get_settings,:only => [:new, :edit, :setting]
|
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, :setting]
|
before_action :allow_admin_only, :only => [:index, :setting]
|
||||||
|
def merge_process
|
||||||
|
params['journal_id'].each do |journal_id|
|
||||||
|
journal_ids = journal_id.split('/')
|
||||||
|
journals = JournalPaper.find(journal_ids)
|
||||||
|
member_ids = journals.collect(&:member_profile_id).uniq
|
||||||
|
journals.each_with_index do |journal,index1|
|
||||||
|
if index1== 0
|
||||||
|
journal.member_profile_id = member_ids
|
||||||
|
journal.save!
|
||||||
|
else
|
||||||
|
journal.delete
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
redirect_to :action=> 'index'
|
||||||
|
end
|
||||||
|
def merge
|
||||||
|
@journals=JournalPaper.order_by(:year=>'desc').map{|value| value}.group_by{|v| [v[:paper_title],v[:journal_title]]}
|
||||||
|
@journals.each do |key,value|
|
||||||
|
if value.length<=1
|
||||||
|
@journals.delete key
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#journals = JournalPaper.order_by(:year=>'desc').map{|value| value}
|
||||||
|
#journals_name1 = journals.map{|value| value[:paper_title]}
|
||||||
|
#journals_name2 = journals.map{|value| value[:journal_title]}
|
||||||
|
#compare1 = journals_name1.map{|v1| journals_name1.select{|v2| v2==v1}.count>1}
|
||||||
|
#compare2 = journals_name2.map{|v1| journals_name2.select{|v2| v2==v1}.count>1}
|
||||||
|
#compare = compare1 and compare2
|
||||||
|
#@journal = Hash.new
|
||||||
|
#compare.each_with_index do |b,i|
|
||||||
|
# if b && !(@journal.keys.include? [journals_name1[i],journals_name2[i]])
|
||||||
|
# @journal[[journals_name1[i],journals_name2[i]]] = [journals[i]]
|
||||||
|
# elsif b
|
||||||
|
# @journal[[journals_name1[i],journals_name2[i]]] << journals[i]
|
||||||
|
# end
|
||||||
|
#end
|
||||||
|
if params['mode']!='simple'
|
||||||
|
@journals.each do |key,value|
|
||||||
|
@journals[key] = value.group_by{|v| [get_level_type(v),get_author_type(v),get_paper_type(v),get_publication_date(v)]}
|
||||||
|
@journals[key].each do |key1,value1|
|
||||||
|
if value1.length<=1
|
||||||
|
@journals[key].delete key1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if @journals[key].length==0
|
||||||
|
@journals.delete key
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
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)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
@member = Array(MemberProfile.find_by(:uid=>params['uid'])) rescue nil
|
||||||
@journal_paper = JournalPaper.new
|
@journal_paper = JournalPaper.new
|
||||||
|
|
||||||
if params[:desktop]
|
if params[:desktop]
|
||||||
|
@ -64,17 +114,17 @@ class Admin::JournalPapersController < OrbitMemberController
|
||||||
|
|
||||||
elsif !params[:author_members].blank?
|
elsif !params[:author_members].blank?
|
||||||
|
|
||||||
params[:author_members].each do |author_member|
|
#params[:author_members].each do |author_member|
|
||||||
|
|
||||||
journal_paper_params['member_profile_id'] = author_member
|
journal_paper_params['member_profile_id'] = params[:author_members]
|
||||||
@journal_paper = JournalPaper.new(journal_paper_params)
|
@journal_paper = JournalPaper.new(journal_paper_params)
|
||||||
@journal_paper.save
|
@journal_paper.save
|
||||||
|
|
||||||
if params[:desktop] == "true"
|
if params[:desktop] == "true"
|
||||||
render json: {"data" => get_paper_list}.to_json
|
render json: {"data" => get_paper_list}.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
#end
|
||||||
|
|
||||||
redirect_to params['referer_url']
|
redirect_to params['referer_url']
|
||||||
|
|
||||||
|
@ -96,14 +146,15 @@ class Admin::JournalPapersController < OrbitMemberController
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@member = @journal_paper.member_profile
|
@member = get_member(@journal_paper)
|
||||||
if params[:desktop]
|
if params[:desktop]
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@member = @journal_paper.member_profile
|
@member = get_member(@journal_paper)
|
||||||
|
journal_paper_params['member_profile_id'] = params[:author_members]
|
||||||
@journal_paper.update_attributes(journal_paper_params)
|
@journal_paper.update_attributes(journal_paper_params)
|
||||||
@journal_paper.save
|
@journal_paper.save
|
||||||
if params[:desktop] == "true"
|
if params[:desktop] == "true"
|
||||||
|
@ -192,7 +243,6 @@ class Admin::JournalPapersController < OrbitMemberController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_journal_paper
|
def set_journal_paper
|
||||||
path = request.path.split('/')
|
path = request.path.split('/')
|
||||||
if path.last.include? '-'
|
if path.last.include? '-'
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
class PersonalJournalsController < ApplicationController
|
class PersonalJournalsController < ApplicationController
|
||||||
|
include Admin::JournalPapersHelper
|
||||||
def index
|
def index
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
page_data_count = OrbitHelper.page_data_count
|
page_data_count = OrbitHelper.page_data_count
|
||||||
|
@ -42,6 +43,8 @@ class PersonalJournalsController < ApplicationController
|
||||||
journal_papers_show = journal_papers_temp.select { |value| search_all_words((value.journal_paper_type.title rescue ''), params[:keywords]) }
|
journal_papers_show = journal_papers_temp.select { |value| search_all_words((value.journal_paper_type.title rescue ''), params[:keywords]) }
|
||||||
when 'language'
|
when 'language'
|
||||||
journal_papers_show = journal_papers_temp.select { |value| search_all_words((!value.language.nil? ? t(value.language.to_s) : ''), params[:keywords]) }
|
journal_papers_show = journal_papers_temp.select { |value| search_all_words((!value.language.nil? ? t(value.language.to_s) : ''), params[:keywords]) }
|
||||||
|
when 'authors'
|
||||||
|
journal_papers_show = journal_papers_temp.select { |value| search_all_words(get_authors_text(value), params[:keywords]) }
|
||||||
else
|
else
|
||||||
journal_papers_show = journal_papers_temp.select { |value| search_all_words(value.send(params[:selectbox]).to_s, params[:keywords]) }
|
journal_papers_show = journal_papers_temp.select { |value| search_all_words(value.send(params[:selectbox]).to_s, params[:keywords]) }
|
||||||
end
|
end
|
||||||
|
@ -72,6 +75,10 @@ class PersonalJournalsController < ApplicationController
|
||||||
t << { 'value' => (journal_paper.journal_paper_type.title rescue '') }
|
t << { 'value' => (journal_paper.journal_paper_type.title rescue '') }
|
||||||
when 'language'
|
when 'language'
|
||||||
t << { 'value' => (!journal_paper.language.nil? ? t(journal_paper.language.to_s) : '') }
|
t << { 'value' => (!journal_paper.language.nil? ? t(journal_paper.language.to_s) : '') }
|
||||||
|
when 'url'
|
||||||
|
t << { 'value' => journal_paper.url.to_s.blank? ? "" : "<a href='#{journal_paper.url}'>#{journal_paper.url}</a>"}
|
||||||
|
when 'authors'
|
||||||
|
t << { 'value' => get_authors_show(journal_paper) }
|
||||||
else
|
else
|
||||||
t << { 'value' => (journal_paper.send(fs) rescue '') }
|
t << { 'value' => (journal_paper.send(fs) rescue '') }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,25 @@
|
||||||
module Admin::JournalPapersHelper
|
module Admin::JournalPapersHelper
|
||||||
|
def get_authors_text(journal)
|
||||||
|
(journal.authors.to_s.blank? ? get_member(journal).collect(&:name).join('/') : Nokogiri::HTML(journal.authors.to_s).text rescue "")
|
||||||
|
end
|
||||||
|
def get_authors_show(journal)
|
||||||
|
(journal.authors.to_s.blank? ? get_member(journal).collect{|member| "<a href='#{OrbitHelper.url_to_plugin_show(member.to_param,'member')}' title='#{member.name}'>#{member.name}</a>"}.join('/') : (journal.authors.to_s) rescue "")
|
||||||
|
end
|
||||||
|
def get_member(journal)
|
||||||
|
Array(MemberProfile.find(Array(journal).collect(&:member_profile_id)))
|
||||||
|
end
|
||||||
|
def get_level_type(journal)
|
||||||
|
!journal.journal_levels.blank? ? "(#{journal.journal_levels.collect(&:title).join(', ')})" : nil
|
||||||
|
end
|
||||||
|
def get_author_type(journal)
|
||||||
|
journal.journal_paper_author_types.collect(&:title).join(', ') rescue ''
|
||||||
|
end
|
||||||
|
def get_paper_type(journal)
|
||||||
|
journal.journal_paper_type.title rescue ''
|
||||||
|
end
|
||||||
|
def get_publication_date(journal)
|
||||||
|
journal.publication_date.strftime('%Y/%m/%d') rescue ''
|
||||||
|
end
|
||||||
def page_for_journal_paper(journal_paper_object)
|
def page_for_journal_paper(journal_paper_object)
|
||||||
journal_paper_page = nil
|
journal_paper_page = nil
|
||||||
pages = Page.where(:module=>"journal_paper")
|
pages = Page.where(:module=>"journal_paper")
|
||||||
|
|
|
@ -2,7 +2,7 @@ class JournalPaper
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
include Mongoid::Attributes::Dynamic
|
include Mongoid::Attributes::Dynamic
|
||||||
|
include Admin::JournalPapersHelper
|
||||||
include OrbitModel::Status
|
include OrbitModel::Status
|
||||||
include MemberHelper
|
include MemberHelper
|
||||||
include Slug
|
include Slug
|
||||||
|
@ -215,6 +215,11 @@ class JournalPaper
|
||||||
files << (url.nil? ? "" : "<li><a href='#{url}'' target='_blank'>#{title}</li>")
|
files << (url.nil? ? "" : "<li><a href='#{url}'' target='_blank'>#{title}</li>")
|
||||||
end
|
end
|
||||||
value = files.join("")
|
value = files.join("")
|
||||||
|
when "url"
|
||||||
|
value = self.url.to_s.blank? ? "" : "<a href='#{self.url}'>#{self.url}</a>"
|
||||||
|
when "authors"
|
||||||
|
value = get_authors_show(self)
|
||||||
|
puts ['author_here',value]
|
||||||
else
|
else
|
||||||
value = self.send(field) rescue ""
|
value = self.send(field) rescue ""
|
||||||
end
|
end
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
<label class="control-label muted"><%= t("personal_journal.authors") %></label>
|
<label class="control-label muted"><%= t("personal_journal.authors") %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.fields_for :authors_translations do |f| %>
|
<%= f.fields_for :authors_translations do |f| %>
|
||||||
<%= f.text_area locale, class: "input-block-level", placeholder: t("personal_journal.authors"), value: (@journal_paper.authors_translations[locale] rescue nil) %>
|
<%= f.text_area locale, class: "ckeditor input-block-level", placeholder: t("personal_journal.authors"), value: (@journal_paper.authors_translations[locale] rescue nil) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -120,27 +120,17 @@
|
||||||
<!-- Basic Module -->
|
<!-- Basic Module -->
|
||||||
<div class="tab-pane fade in active" id="basic">
|
<div class="tab-pane fade in active" id="basic">
|
||||||
|
|
||||||
<% if !@member.nil? %>
|
|
||||||
|
|
||||||
<div class="control-group big-group">
|
<div class="control-group big-group">
|
||||||
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
|
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= @member.name rescue ''%>
|
<% if !@member.nil? %>
|
||||||
<%= f.hidden_field :member_profile_id, :value => @member.id %>
|
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'author_members[]', email_members:@member} %>
|
||||||
</div>
|
<% else %>
|
||||||
</div>
|
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'author_members[]', email_members:[]} %>
|
||||||
|
<% end %>
|
||||||
<% else %>
|
|
||||||
|
|
||||||
<div class="control-group big-group">
|
|
||||||
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'author_members[]', email_members:[]} %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- year -->
|
<!-- year -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("personal_journal.year") %></label>
|
<label class="control-label muted"><%= t("personal_journal.year") %></label>
|
||||||
|
|
|
@ -2,10 +2,14 @@
|
||||||
<tr id="<%= dom_id writing_journal %>" class="with_action">
|
<tr id="<%= dom_id writing_journal %>" class="with_action">
|
||||||
<td class="span1"><%= writing_journal.year %></td>
|
<td class="span1"><%= writing_journal.year %></td>
|
||||||
<td class="span1">
|
<td class="span1">
|
||||||
<%= link_to writing_journal.create_link, OrbitHelper.url_to_plugin_show(writing_journal.to_param,'personal_journal').to_s, target: "blank"%>
|
<a href="<%= OrbitHelper.url_to_plugin_show(writing_journal.to_param,'personal_journal').to_s %>" target="blank">
|
||||||
|
<span>
|
||||||
|
<%= "#{Nokogiri::HTML(writing_journal.create_link).text}" %>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills hide">
|
<ul class="nav nav-pills hide">
|
||||||
<li><%= link_to t('edit'), edit_admin_journal_paper_path(writing_journal) %></li>
|
<li><%= link_to t('edit').to_s, edit_admin_journal_paper_path(writing_journal) %></li>
|
||||||
<li><%= link_to t(:delete_), admin_journal_paper_path(id: writing_journal.id), method: :delete, remote: true, data: { confirm: 'Are you sure?' } %></li>
|
<li><%= link_to t(:delete_), admin_journal_paper_path(id: writing_journal.id), method: :delete, remote: true, data: { confirm: 'Are you sure?' } %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
<script src="https://kit.fontawesome.com/1fa49cfdc9.js" crossorigin="anonymous"></script>
|
||||||
|
<script>
|
||||||
|
function MergeUrl(){
|
||||||
|
var temp_url = location.href
|
||||||
|
if (temp_url.search("locale=")!=-1){
|
||||||
|
var tp=temp_url.lastIndexOf('/')
|
||||||
|
location.href = temp_url.substring(0,tp+1)+"merge/"+temp_url.substring(tp+1)
|
||||||
|
}
|
||||||
|
else if (temp_url.slice(-1)=='/'){
|
||||||
|
location.href = location.href + "merge"
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
location.href = location.href + "/merge"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<table class="table main-list">
|
<table class="table main-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -14,8 +30,12 @@
|
||||||
<div class="bottomnav clearfix">
|
<div class="bottomnav clearfix">
|
||||||
<div class="action pull-right">
|
<div class="action pull-right">
|
||||||
<div class="dropup upload-button">
|
<div class="dropup upload-button">
|
||||||
|
<button class="btn btn-primary" type="button" onclick="MergeUrl()">
|
||||||
|
<i class="far fa-object-group"></i>
|
||||||
|
<span class="group"></span><%= t('personal_journal.merge') %>
|
||||||
|
</button>
|
||||||
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
|
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
|
||||||
<i class="icon-upload-alt icon-white"></i>上傳
|
<i class="icon-upload-alt icon-white"></i><%= t('personal_journal.upload') %>
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu upload-box">
|
<div class="dropdown-menu upload-box">
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
<% content_for :page_specific_css do %>
|
||||||
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||||
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
||||||
|
<%= stylesheet_link_tag "lib/main-list" %>
|
||||||
|
<%= stylesheet_link_tag "lib/main-form-col2" %>
|
||||||
|
<style>
|
||||||
|
table.table.main-list.tablet.footable-loaded td{
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<% end %>
|
||||||
|
<script>
|
||||||
|
function change_mode(){
|
||||||
|
var value = $("form[name='mode_form']").find("input[type='checkbox']")[0].checked
|
||||||
|
if (value){
|
||||||
|
$("input[name='mode']").val("strict")
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("input[name='mode']").val("simple")
|
||||||
|
}
|
||||||
|
document.mode_form.submit()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<nobr>
|
||||||
|
<form method="get" action='?' name='mode_form'>
|
||||||
|
<%= t('strict_compare_mode') +':' %>
|
||||||
|
<input type='hidden' name='mode' value=''>
|
||||||
|
<% if params['mode']!='simple' %>
|
||||||
|
<input type="checkbox" onchange='change_mode()' checked><span style="margin-right: 2em;"><%= t('yes_') %></span>
|
||||||
|
<% else %>
|
||||||
|
<input type="checkbox" onchange='change_mode()'><span style="margin-right: 2em;"><%= t('no_') %></span>
|
||||||
|
<% end %>
|
||||||
|
<button type="button" onclick="merge_form.submit()"><%= t('personal_journal.merge') %></button>
|
||||||
|
</form>
|
||||||
|
</nobr>
|
||||||
|
<form method="post" action='/admin/journal_papers/merge_process?' name='merge_form'>
|
||||||
|
<%= token_tag(nil) %>
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><%= t('personal_journal.paper_title') %></th>
|
||||||
|
<th><%= t('personal_journal.journal_title') %></th>
|
||||||
|
<% if params['mode']!='simple' %>
|
||||||
|
<th><%= t('personal_journal.level_type') %></th>
|
||||||
|
<th><%= t('personal_journal.author_type') %></th>
|
||||||
|
<th><%= t('personal_journal.paper_type') %></th>
|
||||||
|
<th><%= t('personal_journal.publication_date') %></th>
|
||||||
|
<% end %>
|
||||||
|
<th><%= t("personal_journal.merge") %></th>
|
||||||
|
<th><%= t("personal_plugins.author") %></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @journals.each do |key,journals| %>
|
||||||
|
<tr>
|
||||||
|
<% if params['mode']=='simple'
|
||||||
|
len = journals.length
|
||||||
|
else
|
||||||
|
len = journals.values.reduce(0){|sum,num| sum+num.length}
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<td rowspan="<%= len %>">
|
||||||
|
<%= key[0].values.map{|v| v=="" ? t('personal_journal.no_input') : v}.join('/') %>
|
||||||
|
</td>
|
||||||
|
<td rowspan="<%= len %>">
|
||||||
|
<%= key[1].values.map{|v| v=="" ? t('personal_journal.no_input') : v}.join('/') %>
|
||||||
|
</td>
|
||||||
|
<% if params['mode']=='simple' %>
|
||||||
|
<td rowspan="<%= len %>">
|
||||||
|
<input type="checkbox" class="checkbox" name="journal_id[]" value="<%= journals.collect(&:id).join('/') %>">
|
||||||
|
</td>
|
||||||
|
<% journals.each_with_index do |journal,i| %>
|
||||||
|
<td>
|
||||||
|
<a href="<%= edit_admin_journal_paper_path(journal) %>" target="_blank">
|
||||||
|
<%= get_member(journal).collect(&:name).join(' / ') rescue t('personal_journal.no_input') %>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<% if len!=(i+1) %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<% i=0 %>
|
||||||
|
<% journals.each do |k,v| %>
|
||||||
|
<% len1 = v.length %>
|
||||||
|
<% k.each do |keychild| %>
|
||||||
|
<td rowspan="<%= len1 %>">
|
||||||
|
<%= keychild.to_s.blank? ? t('personal_journal.no_input') : keychild %>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
<td rowspan="<%= len1 %>">
|
||||||
|
<input type="checkbox" class="checkbox" name="journal_id[]" value="<%= v.collect(&:id).join('/') %>">
|
||||||
|
</td>
|
||||||
|
<% v.each_with_index do |journal_child,index1| %>
|
||||||
|
<td>
|
||||||
|
<a href="<%= edit_admin_journal_paper_path(journal_child) %>" target="_blank">
|
||||||
|
<%= get_member(journal_child).collect(&:name).join(' / ') rescue t('personal_journal.no_input') %>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<% if len1!=index1 %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if len1!=(i+1) %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<% end %>
|
||||||
|
<% i =i+1 %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
|
@ -4,7 +4,6 @@
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
<%= javascript_include_tag "lib/list-check" %>
|
<%= javascript_include_tag "lib/list-check" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
if has_access?
|
if has_access?
|
||||||
@writing_journals = JournalPaper.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
@writing_journals = JournalPaper.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
||||||
|
@ -12,7 +11,6 @@
|
||||||
@writing_journals = JournalPaper.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
@writing_journals = JournalPaper.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<% if has_access? %>
|
<% if has_access? %>
|
||||||
<div class="list-active">
|
<div class="list-active">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
@ -21,7 +19,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<table class="table table-condensed table-striped main-list">
|
<table class="table table-condensed table-striped main-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -56,16 +53,13 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td><%= writing_journal.authors %></td>
|
<td><%= writing_journal.authors %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="bottomnav clearfix">
|
<div class="bottomnav clearfix">
|
||||||
<% if has_access? %>
|
<% if has_access? %>
|
||||||
<div class="action pull-right">
|
<div class="action pull-right">
|
||||||
|
@ -78,7 +72,6 @@
|
||||||
<%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort] } %>
|
<%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort] } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
@ -89,4 +82,3 @@
|
||||||
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
|
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@ en:
|
||||||
personal_journal: Journal Paper
|
personal_journal: Journal Paper
|
||||||
journal_paper: Journal Paper
|
journal_paper: Journal Paper
|
||||||
personal_journal:
|
personal_journal:
|
||||||
|
merge: Merge
|
||||||
|
upload: Upload
|
||||||
|
no_input: No Input
|
||||||
select_class: "——select class——"
|
select_class: "——select class——"
|
||||||
search_class: "search class:"
|
search_class: "search class:"
|
||||||
word_to_search: "word to search:"
|
word_to_search: "word to search:"
|
||||||
|
@ -41,7 +44,7 @@ en:
|
||||||
graph_by : "Graph By"
|
graph_by : "Graph By"
|
||||||
frontend:
|
frontend:
|
||||||
writing_journals: "Journal Paper Front-end"
|
writing_journals: "Journal Paper Front-end"
|
||||||
|
strict_compare_mode: Strict Compare mode
|
||||||
create_success : "Successfully Create"
|
create_success : "Successfully Create"
|
||||||
update_success : "Successfully Update"
|
update_success : "Successfully Update"
|
||||||
delete_success : "Successfully Delete"
|
delete_success : "Successfully Delete"
|
||||||
|
|
|
@ -3,6 +3,9 @@ zh_tw:
|
||||||
personal_journal: 期刊論文
|
personal_journal: 期刊論文
|
||||||
journal_paper: 期刊論文
|
journal_paper: 期刊論文
|
||||||
personal_journal:
|
personal_journal:
|
||||||
|
merge: "合併"
|
||||||
|
upload: "上傳"
|
||||||
|
no_input: "未輸入"
|
||||||
select_class: "——選取分類——"
|
select_class: "——選取分類——"
|
||||||
search_class: "搜尋類別:"
|
search_class: "搜尋類別:"
|
||||||
word_to_search: "關鍵字搜尋:"
|
word_to_search: "關鍵字搜尋:"
|
||||||
|
@ -40,7 +43,7 @@ zh_tw:
|
||||||
graph_by : "Graph By"
|
graph_by : "Graph By"
|
||||||
frontend:
|
frontend:
|
||||||
writing_journals: "期刊論文前台"
|
writing_journals: "期刊論文前台"
|
||||||
|
strict_compare_mode: "嚴格比較模式"
|
||||||
create_success : "新增完成!!"
|
create_success : "新增完成!!"
|
||||||
update_success : "更新完成!!"
|
update_success : "更新完成!!"
|
||||||
delete_success : "刪除成功!!"
|
delete_success : "刪除成功!!"
|
||||||
|
|
|
@ -1,39 +1,41 @@
|
||||||
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
|
||||||
get 'writing_journal_setting' => "journal_papers#setting"
|
get 'writing_journal_setting' => "journal_papers#setting"
|
||||||
get 'journal_papers/download_excel_format' => 'journal_papers#excel_format'
|
get 'journal_papers/download_excel_format' => 'journal_papers#excel_format'
|
||||||
post 'journal_papers/import_from_excel' => 'journal_papers#import_from_excel'
|
post 'journal_papers/import_from_excel' => 'journal_papers#import_from_excel'
|
||||||
|
|
||||||
resources :journal_papers do
|
resources :journal_papers do
|
||||||
collection do
|
collection do
|
||||||
get 'toggle_hide' => 'journal_papers#toggle_hide'
|
post 'merge_process' => 'journal_papers#merge_process'
|
||||||
get 'analysis'
|
get 'merge' => 'journal_papers#merge'
|
||||||
get 'analysis_report'
|
get 'toggle_hide' => 'journal_papers#toggle_hide'
|
||||||
get "download_excel"
|
get 'analysis'
|
||||||
end
|
get 'analysis_report'
|
||||||
end
|
get "download_excel"
|
||||||
|
end
|
||||||
resources :members do
|
end
|
||||||
collection do
|
|
||||||
scope '(:name-:uid)' do
|
resources :members do
|
||||||
resources :journal_papers do
|
collection do
|
||||||
collection do
|
scope '(:name-:uid)' do
|
||||||
get 'frontend_setting' => 'journal_papers#frontend_setting'
|
resources :journal_papers do
|
||||||
post 'update_frontend_setting' => 'journal_papers#update_frontend_setting'
|
collection do
|
||||||
|
get 'frontend_setting' => 'journal_papers#frontend_setting'
|
||||||
|
post 'update_frontend_setting' => 'journal_papers#update_frontend_setting'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
resources :journal_levels
|
||||||
|
resources :journal_paper_author_types
|
||||||
resources :journal_levels
|
resources :journal_paper_types
|
||||||
resources :journal_paper_author_types
|
resources :journal_paper_intros
|
||||||
resources :journal_paper_types
|
end
|
||||||
resources :journal_paper_intros
|
get "/xhr/personal_journal/get_fields_for_index" => "personal_journals#get_fields_for_index"
|
||||||
end
|
post "/xhr/personal_journal/save_index_fields" => "personal_journals#save_index_fields"
|
||||||
get "/xhr/personal_journal/get_fields_for_index" => "personal_journals#get_fields_for_index"
|
|
||||||
post "/xhr/personal_journal/save_index_fields" => "personal_journals#save_index_fields"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue