first commit

This commit is contained in:
rulingcom 2026-06-02 16:30:29 +08:00
commit b51e89156b
167 changed files with 4464 additions and 0 deletions

13
Gemfile Normal file
View File

@ -0,0 +1,13 @@
source "https://rubygems.org"
# Declare your gem's dependencies in personal_thesis_guidance.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
# To use debugger
# gem 'debugger'

104
Gemfile.lock Normal file
View File

@ -0,0 +1,104 @@
PATH
remote: .
specs:
personal_thesis_guidance (0.0.1)
mongoid (= 4.0.0.beta2)
rails (= 4.1.0.rc2)
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.0.rc2)
actionpack (= 4.1.0.rc2)
actionview (= 4.1.0.rc2)
mail (~> 2.5.4)
actionpack (4.1.0.rc2)
actionview (= 4.1.0.rc2)
activesupport (= 4.1.0.rc2)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
actionview (4.1.0.rc2)
activesupport (= 4.1.0.rc2)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.0.rc2)
activesupport (= 4.1.0.rc2)
builder (~> 3.1)
activerecord (4.1.0.rc2)
activemodel (= 4.1.0.rc2)
activesupport (= 4.1.0.rc2)
arel (~> 5.0.0)
activesupport (4.1.0.rc2)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
bson (2.3.0)
builder (3.2.2)
connection_pool (2.0.0)
erubis (2.7.0)
hike (1.2.3)
i18n (0.6.9)
json (1.8.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
minitest (5.3.4)
mongoid (4.0.0.beta2)
activemodel (>= 4.0.0)
moped (~> 2.0.beta6)
origin (~> 2.1)
tzinfo (>= 0.3.37)
moped (2.0.0.rc1)
bson (~> 2.2)
connection_pool (~> 2.0)
optionable (~> 0.2.0)
multi_json (1.10.1)
optionable (0.2.0)
origin (2.1.1)
polyglot (0.3.5)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.1.0.rc2)
actionmailer (= 4.1.0.rc2)
actionpack (= 4.1.0.rc2)
actionview (= 4.1.0.rc2)
activemodel (= 4.1.0.rc2)
activerecord (= 4.1.0.rc2)
activesupport (= 4.1.0.rc2)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.0.rc2)
sprockets-rails (~> 2.0.0)
railties (4.1.0.rc2)
actionpack (= 4.1.0.rc2)
activesupport (= 4.1.0.rc2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.2)
sprockets (2.12.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.0.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (1.2.1)
thread_safe (~> 0.1)
PLATFORMS
ruby
DEPENDENCIES
personal_thesis_guidance!

20
MIT-LICENSE Normal file
View File

@ -0,0 +1,20 @@
Copyright 2014 YOURNAME
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

3
README.rdoc Normal file
View File

@ -0,0 +1,3 @@
= PersonalThesisGuidance
This project rocks and uses MIT-LICENSE.

30
Rakefile Normal file
View File

@ -0,0 +1,30 @@
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'PersonalThesisGuidance'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
task default: :test

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- <?xml-stylesheet href="/assets/unit/svg-stylesheet.css" type="text/css"?> -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 120 120" style="enable-background:new 0 0 120 120;" xml:space="preserve">
<g id="journal_paper" width="100%" height="100%">
<g>
<circle cx="25" cy="57" r="15"/>
<path d="M25,77c-1.37,0-2.707-0.139-4-0.402c-2.958-0.601-5.673-1.862-8-3.612V110l12-10l12,10V72.987
c-2.327,1.749-5.042,3.011-8,3.612C27.707,76.861,26.37,77,25,77z"/>
<rect x="52" y="66" width="35" height="4"/>
<rect x="52" y="77" width="35" height="4"/>
<path d="M91.329,28.672L72.657,10H67H30c-4.962,0-9,4.038-9,9v18.402C22.293,37.139,23.63,37,25,37
s2.707,0.139,4,0.402V19c0-0.542,0.458-1,1-1h37v26c0,4.962,4.037,9,9,9h26v48c0,0.542-0.458,1-1,1H42v8h59c4.963,0,9-4.037,9-9
V53v-5.657L91.329,28.672z M76,45c-0.542,0-1-0.458-1-1V23.657v0l10.671,10.672L96.343,45H76z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

View File

@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

View File

@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

View File

@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

View File

@ -0,0 +1,5 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
jQuery ->
$('#product_category_name').autocomplete
source: $('#product_category_name').data('autocomplete-source')

View File

@ -0,0 +1,24 @@
$(document).ready(function() {
$('.main-forms .add-on').tooltip();
$(document).on('click', '#add_author', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_authors", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn-box').prev('.add-target-box').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target-box').append(("<%= escape_javascript(add_attribute 'form_author', f, :thesis_guidance_paper_authors) rescue "" %>").replace(old_id, new_id));
$(this).parent('.add-btn-box').prev('.add-target-box').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
});

View File

@ -0,0 +1,24 @@
$(document).ready(function() {
$('.main-forms .add-on').tooltip();
$(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_thesis_guidance_paper_files", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :thesis_guidance_paper_files) rescue "" %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
});

View File

@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

View File

@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/

View File

@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/

View File

@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/

View File

@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/

View File

@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/

View File

@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/

0
app/controllers/.keep Normal file
View File

View File

@ -0,0 +1,43 @@
class Admin::ThesisGuidanceLevelsController < OrbitMemberController
before_action :allow_admin_only
def new
@paper_level = ThesisGuidanceLevel.new
@url = admin_thesis_guidance_levels_path(@paper_level)
render :layout=>false
end
def create
@paper_level = ThesisGuidanceLevel.new(paper_level_params)
@paper_level.save
@paper_levels = ThesisGuidanceLevel.all
render :partial=>'index', :layout=>false
end
def edit
@paper_level = ThesisGuidanceLevel.find(params[:id])
@url = admin_thesis_guidance_level_path(@paper_level)
render :layout=>false
end
def update
@paper_level = ThesisGuidanceLevel.find(params[:id])
@paper_level.update_attributes(paper_level_params)
@paper_level.save
@paper_levels = ThesisGuidanceLevel.all
render :partial=>'index', :layout=>false
end
def destroy
paper_level = ThesisGuidanceLevel.find(params[:id])
paper_level.destroy
@paper_levels = ThesisGuidanceLevel.all
render :partial=>'index', :layout=>false
end
private
def paper_level_params
params.require(:thesis_guidance_level).permit! rescue nil
end
end

View File

@ -0,0 +1,43 @@
class Admin::ThesisGuidancePaperAuthorTypesController < OrbitMemberController
before_action :allow_admin_only
def new
@author_type = ThesisGuidancePaperAuthorType.new
@url = admin_thesis_guidance_paper_author_types_path(@author_type)
render :layout=>false
end
def create
@author_type = ThesisGuidancePaperAuthorType.new(author_type_params)
@author_type.save
@author_types = ThesisGuidancePaperAuthorType.all
render :partial=>'list', :layout=>false
end
def edit
@author_type = ThesisGuidancePaperAuthorType.find(params[:id])
@url = admin_thesis_guidance_paper_author_type_path(@author_type)
render :layout=>false
end
def update
@author_type = ThesisGuidancePaperAuthorType.find(params[:id])
@author_type.update_attributes(author_type_params)
@author_type.save
@author_types = ThesisGuidancePaperAuthorType.all
render :partial=>'list', :layout=>false
end
def destroy
author_type = ThesisGuidancePaperAuthorType.find(params[:id])
author_type.destroy
@author_types = ThesisGuidancePaperAuthorType.all
render :partial=>'list', :layout=>false
end
private
def author_type_params
params.require(:thesis_guidance_paper_author_type).permit! rescue nil
end
end

View File

@ -0,0 +1,43 @@
class Admin::ThesisGuidancePaperTypesController < OrbitMemberController
before_action :allow_admin_only
def new
@paper_type = ThesisGuidancePaperType.new
@url = admin_thesis_guidance_paper_types_path(@paper_type)
render :layout=>false
end
def create
@paper_type = ThesisGuidancePaperType.new(paper_type_params)
@paper_type.save
@paper_types = ThesisGuidancePaperType.all
render :partial=>'index', :layout=>false
end
def edit
@paper_type = ThesisGuidancePaperType.find(params[:id])
@url = admin_thesis_guidance_paper_type_path(@paper_type)
render :layout=>false
end
def update
@paper_type = ThesisGuidancePaperType.find(params[:id])
@paper_type.update_attributes(paper_type_params)
@paper_type.save
@paper_types = ThesisGuidancePaperType.all
render :partial=>'index', :layout=>false
end
def destroy
paper_type = ThesisGuidancePaperType.find(params[:id])
paper_type.destroy
@paper_types = ThesisGuidancePaperType.all
render :partial=>'index', :layout=>false
end
private
def paper_type_params
params.require(:thesis_guidance_paper_type).permit! rescue nil
end
end

View File

@ -0,0 +1,259 @@
require 'rubyXL'
class Admin::ThesisGuidancePapersController < OrbitMemberController
include Admin::ThesisGuidancePapersHelper
layout "member_plugin"
before_action :set_thesis_guidance_paper, only: [:show, :edit , :update, :destroy]
before_action :set_plugin
before_action :get_settings,:only => [:new, :edit, :setting]
before_action :need_access_right
before_action :allow_admin_only, :only => [:index, :setting]
def merge_process
params['journal_id'].each do |journal_id|
journal_ids = journal_id.split('/')
journals = ThesisGuidancePaper.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=ThesisGuidancePaper.sort_year_date.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
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
@writing_thesis_guidances = ThesisGuidancePaper.sort_year_date
if params[:keywords]
@writing_thesis_guidances = search_data(@writing_thesis_guidances,[:slug_title])
end
@writing_thesis_guidances = @writing_thesis_guidances.page(params[:page]).per(10)
if request.xhr?
render "index_js", :layout => false
end
end
def new
@member = Array(MemberProfile.find_by(:uid=>params['uid'].to_s)) rescue nil
@thesis_guidance_paper = ThesisGuidancePaper.new
if params[:desktop]
render :layout => false
end
end
def analysis
end
def analysis_report
role = params[:role_id]
year_start = params[:year_start].to_i
year_end = params[:year_end].to_i
graph_by = params[:graph_by]
@data = get_chart_data(year_start,year_end,role,params[:graph_by])
render :layout => false
end
def download_excel
year_start = params[:year_start].to_i
year_end = params[:year_end].to_i
@data = get_data_for_excel(year_start,year_end)
respond_to do |format|
format.xlsx {
response.headers['Content-Disposition'] = 'attachment; filename="thesis_guidance_papers.xlsx"'
}
end
end
def create
if !thesis_guidance_paper_params['member_profile_id'].blank?
@member = MemberProfile.find(thesis_guidance_paper_params['member_profile_id']) rescue nil
@thesis_guidance_paper = ThesisGuidancePaper.new(thesis_guidance_paper_params)
@thesis_guidance_paper.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
else
redirect_to params['referer_url']
end
elsif !params[:author_members].blank?
#params[:author_members].each do |author_member|
thesis_guidance_paper_params['member_profile_id'] = params[:author_members]
@thesis_guidance_paper = ThesisGuidancePaper.new(thesis_guidance_paper_params)
@thesis_guidance_paper.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
end
#end
redirect_to params['referer_url']
else
thesis_guidance_paper_params['member_profile_id'] = User.find(current_user.id).member_profile_id
@thesis_guidance_paper = ThesisGuidancePaper.new(thesis_guidance_paper_params)
@thesis_guidance_paper.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
end
redirect_to params['referer_url']
end
end
def edit
@member = get_member(@thesis_guidance_paper)
if params[:desktop]
render :layout => false
end
end
def update
@member = get_member(@thesis_guidance_paper)
thesis_guidance_paper_params['member_profile_id'] = params[:author_members]
@thesis_guidance_paper.update_attributes(thesis_guidance_paper_params)
@thesis_guidance_paper.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
else
redirect_to params['referer_url']
end
end
def destroy
@thesis_guidance_paper.destroy
respond_to do |format|
format.html { redirect_to(admin_thesis_guidance_papers_url) }
# format.xml { head :ok }
format.js
format.json {render json: {"success" => true}}
end
end
def excel_format
respond_to do |format|
format.xlsx {
response.headers['Content-Disposition'] = 'attachment; filename="thesis_guidance_paper_format.xlsx"'
}
end
end
def import_from_excel
workbook = RubyXL::Parser.parse(params["import_file"].tempfile)
sheet = workbook[0]
if sheet.count <= 503
sheet.each_with_index do |row, i|
next if i < 3
user = User.where(:user_name => row.cells[0].value).first rescue nil
if !user.nil?
mp = user.member_profile
import_this_thesis_guidance_paper(row,mp)
end
end
redirect_to admin_thesis_guidance_papers_url
else
redirect_to admin_thesis_guidance_papers_url(:error => "1")
end
end
def toggle_hide
if params[:ids]
@thesis_guidance_papers = ThesisGuidancePaper.any_in(_id: params[:ids])
@thesis_guidance_papers.each do |thesis_guidance_paper|
thesis_guidance_paper.is_hidden = params[:disable]
thesis_guidance_paper.save
end
end
render json: {"success"=>true}
end
def setting
end
def frontend_setting
@member = MemberProfile.find_by(:uid=>params['uid'].to_s) rescue nil
@intro = ThesisGuidancePaperIntro.find_by(:member_profile_id=>@member.id) rescue nil
@intro = @intro.nil? ? ThesisGuidancePaperIntro.new({:member_profile_id=>@member.id}) : @intro
end
def update_frontend_setting
@member = MemberProfile.find(intro_params['member_profile_id']) rescue nil
@intro = ThesisGuidancePaperIntro.find_by(:member_profile_id=>@member.id) rescue nil
@intro = @intro.nil? ? ThesisGuidancePaperIntro.new({:member_profile_id=>@member.id}) : @intro
@intro.update_attributes(intro_params)
@intro.save
redirect_to URI.encode('/admin/members/'+@member.to_param+'/ThesisGuidancePaper')
end
def get_settings
@thesis_guidance_levels = ThesisGuidanceLevel.all
@author_types = ThesisGuidancePaperAuthorType.all
@paper_types = ThesisGuidancePaperType.all
@thesis_guidance_types = ThesisGuidanceType.all
end
def set_plugin
@plugin = OrbitApp::Plugin::Registration.all.select{|plugin| plugin.app_name.eql? 'ThesisGuidancePaper'}.first
end
private
def set_thesis_guidance_paper
path = request.path.split('/')
if path.last.include? '-'
uid = path[-1].split("-").last
uid = uid.split("?").first
else
uid = path[-2].split("-").last
uid = uid.split("?").first
end
@thesis_guidance_paper = ThesisGuidancePaper.find_by(:uid => uid) rescue ThesisGuidancePaper.find(params[:id])
end
def thesis_guidance_paper_params
params.require(:thesis_guidance_paper).permit! rescue nil
end
def intro_params
params.require(:thesis_guidance_paper_intro).permit! rescue nil
end
end

View File

@ -0,0 +1,43 @@
class Admin::ThesisGuidanceTypesController < OrbitMemberController
before_action :allow_admin_only
def new
@thesis_guidance_type = ThesisGuidanceType.new
@url = admin_thesis_guidance_types_path(@thesis_guidance_type)
render :layout=>false
end
def create
@thesis_guidance_type = ThesisGuidanceType.new(thesis_guidance_type_params)
@thesis_guidance_type.save
@thesis_guidance_types = ThesisGuidanceType.all
render :partial=>'list', :layout=>false
end
def edit
@thesis_guidance_type = ThesisGuidanceType.find(params[:id])
@url = admin_thesis_guidance_type_path(@thesis_guidance_type)
render :layout=>false
end
def update
@thesis_guidance_type = ThesisGuidanceType.find(params[:id])
@thesis_guidance_type.update_attributes(thesis_guidance_type_params)
@thesis_guidance_type.save
@thesis_guidance_types = ThesisGuidanceType.all
render :partial=>'list', :layout=>false
end
def destroy
thesis_guidance_type = ThesisGuidanceType.find(params[:id])
thesis_guidance_type.destroy
@thesis_guidance_types = ThesisGuidanceType.all
render :partial=>'list', :layout=>false
end
private
def thesis_guidance_type_params
params.require(:thesis_guidance_type).permit! rescue nil
end
end

View File

@ -0,0 +1,27 @@
class Desktop::PersonalThesisGuidancesController < DesktopAdminController
include Admin::ThesisGuidancePapersHelper
def menu
user = OrbitHelper.current_user
[
{
"title" => "List",
"layout" => "list"
},
{
"title" => "Add/Edit",
"layout" => "form",
"new_file_attributes" => {
"file" => "thesis_guidance_paper[thesis_guidance_paper_files_attributes][{number}][thesis_guidance_file]",
"title" => "thesis_guidance_paper[thesis_guidance_paper_files_attributes][{number}][title_translations][{langugae}]"
},
"new_path" => "/admin/members/#{user.member_profile.to_param}/thesis_guidance_papers/new"
}
]
end
def list
get_paper_list
end
end

View File

@ -0,0 +1,238 @@
class PersonalThesisGuidancesController < ApplicationController
include Admin::ThesisGuidancePapersHelper
def index
params = OrbitHelper.params
page_data_count = OrbitHelper.page_data_count
page = OrbitHelper.page
custom_data_field = page.custom_data_field || {}
thesis_guidance_paper_query = ThesisGuidancePaper.sort_for_frontend
page_year = custom_data_field[:year]
page_thesis_guidance_type = custom_data_field[:thesis_guidance_type]
if (page_year.present?)
thesis_guidance_paper_query = thesis_guidance_paper_query.where(:year.in => page_year.to_a )
end
if (page_thesis_guidance_type.present?)
thesis_guidance_paper_query = thesis_guidance_paper_query.where(:thesis_guidance_type_ids.in => page_thesis_guidance_type.to_a )
end
thesis_guidance_papers = thesis_guidance_paper_query.page(OrbitHelper.params[:page_no]).per(page_data_count)
if params[:layout_type].start_with?('index_by_author')
return index_by_author(thesis_guidance_papers)
end
page = OrbitHelper.page
if page.custom_string_field == 'table'
fields_to_show = page.custom_array_field rescue []
if fields_to_show.blank?
fields_to_show = %w[
paper_title
journal_title
authors
year
vol_no
issue_no
level_type
]
end
else
fields_to_show = %w[
year
paper_title
]
end
if !params[:selectbox].nil?
thesis_guidance_papers_temp = thesis_guidance_paper_query.sort_by { |tp| [-tp[:year].to_i, -tp[:publication_date].to_i] }
case params[:selectbox]
when 'paper_title', 'default'
if page.custom_string_field == 'table'
thesis_guidance_papers_show = thesis_guidance_papers_temp.select { |value| search_all_words(value.paper_title, params[:keywords]) }
else
thesis_guidance_papers_show = thesis_guidance_papers_temp.select { |value| search_all_words(value.create_link, params[:keywords]) }
end
when 'level_type'
thesis_guidance_papers_show = thesis_guidance_papers_temp.select { |value| search_all_words(value.thesis_guidance_levels.collect(&:title).join(', ').to_s, params[:keywords]) }
when 'publication_date'
thesis_guidance_papers_show = thesis_guidance_papers_temp.select { |value| search_all_words((value.send('publication_date').strftime('%Y/%m/%d') rescue ''), params[:keywords]) }
when 'author_type'
thesis_guidance_papers_show = thesis_guidance_papers_temp.select { |value| search_all_words(value.thesis_guidance_paper_author_types.collect(&:title).join(', '), params[:keywords]) }
when 'paper_type'
thesis_guidance_papers_show = thesis_guidance_papers_temp.select { |value| search_all_words((value.thesis_guidance_paper_type.title rescue ''), params[:keywords]) }
when 'language'
thesis_guidance_papers_show = thesis_guidance_papers_temp.select { |value| search_all_words((!value.language.nil? ? t(value.language.to_s) : ''), params[:keywords]) }
when 'authors'
thesis_guidance_papers_show = thesis_guidance_papers_temp.select { |value| search_all_words(get_authors_text(value), params[:keywords]) }
else
if fields_to_show.include?(params[:selectbox])
thesis_guidance_papers_show = thesis_guidance_papers_temp.select { |value| search_all_words(value.send(params[:selectbox]).to_s, params[:keywords]) }
else
thesis_guidance_papers_show = thesis_guidance_papers_temp
end
end
page_to_show = params[:page_no].nil? ? 1 : params[:page_no].to_i
thesis_guidance_papers = thesis_guidance_papers_show[(page_to_show - 1) * page_data_count...page_to_show * page_data_count]
thesis_guidance_papers_total_pages = (thesis_guidance_papers_show.length / page_data_count.to_f).ceil
else
thesis_guidance_papers_total_pages = thesis_guidance_papers.total_pages
end
thesis_guidance_paper_list = []
thesis_guidance_papers.each do |thesis_guidance_paper|
t = []
fields_to_show.each do |fs|
case fs
when 'paper_title'
if page.custom_string_field == 'table'
t << { 'value' => "<a href='#{OrbitHelper.url_to_show(thesis_guidance_paper.to_param)}'>#{thesis_guidance_paper.paper_title}</a>" }
else
t << { 'value' => "<a href='#{OrbitHelper.url_to_show(thesis_guidance_paper.to_param)}'>#{thesis_guidance_paper.create_link}</a>" }
end
when 'level_type'
t << { 'value' => (!thesis_guidance_paper.thesis_guidance_levels.blank? ? "(#{thesis_guidance_paper.thesis_guidance_levels.collect(&:title).join(', ')})" : nil) }
when 'publication_date'
t << { 'value' => (thesis_guidance_paper.send(fs).strftime('%Y/%m') rescue '') }
when 'author_type'
t << { 'value' => (thesis_guidance_paper.thesis_guidance_paper_author_types.collect(&:title).join(', ') rescue '') }
when 'paper_type'
t << { 'value' => (thesis_guidance_paper.thesis_guidance_paper_type.title rescue '') }
when 'language'
t << { 'value' => (!thesis_guidance_paper.language.nil? ? t(thesis_guidance_paper.language.to_s) : '') }
when 'url'
t << { 'value' => thesis_guidance_paper.url.to_s.blank? ? "" : "<a href='#{thesis_guidance_paper.url}'>#{thesis_guidance_paper.url}</a>"}
when 'authors'
t << { 'value' => get_authors_show(thesis_guidance_paper) }
else
t << { 'value' => (thesis_guidance_paper.send(fs) rescue '') }
end
end
thesis_guidance_paper_list << { 'jps' => t }
end
headers = []
choice_show = []
fields_to_show.each do |fs|
col = 2
col = 3 if fs == 'paper_title'
headers << {
'head-title' => t("personal_thesis_guidance.#{fs}"),
'col' => col
}
choice_show << t("personal_thesis_guidance.#{fs}")
end
choice_value = fields_to_show
choice_value.unshift('default')
choice_select = choice_value.map { |iter| iter == params[:selectbox] ? 'selected' : '' }
choice_select = choice_select.map { |value| { 'choice_select' => value } }
choice_value = choice_value.map { |value| { 'choice_value' => value } }
choice_default = t('personal_thesis_guidance.select_class')
choice_show.unshift(choice_default)
choice_show = choice_show.map { |value| { 'choice_show' => value } }
choice = choice_value.zip(choice_show, choice_select)
choice = choice.map { |value| value.inject :merge }
select_text = t('personal_thesis_guidance.search_class')
search_text = t('personal_thesis_guidance.word_to_search')
@_request = OrbitHelper.request
csrf_value = form_authenticity_token
{
'thesis_guidance_papers' => thesis_guidance_paper_list,
'headers' => headers,
'extras' => { 'widget-title' => t('module_name.thesis_guidance_paper'),
'url' => '/' + I18n.locale.to_s + params[:url],
'select_text' => select_text,
'search_text' => search_text,
'search_value' => params[:keywords].to_s.gsub(/\"/,''),
'csrf_value' => csrf_value },
'total_pages' => thesis_guidance_papers_total_pages,
'choice' => choice
}
end
def index_by_author(thesis_guidance_papers)
thesis_guidance_papers_total_pages = thesis_guidance_papers.total_pages
thesis_guidance_papers_list = thesis_guidance_papers.group_by{|jp| jp.year}.collect do |year, jps|
jps_data = jps.group_by do |jp|
jp.member_profiles.collect{|v| v.name}.join(', ') rescue jp.authors
end.collect do |name, jps|
jps_data = jps.collect do |jp|
{'title' => jp.create_link_tag_for_title}
end
{'name' => name, 'jps' => jps_data}
end
{'year' => year, 'jps_list'=> jps_data}
end
{
'thesis_guidance_papers' => thesis_guidance_papers_list,
'extras' => { 'widget-title' => t('module_name.thesis_guidance_paper')},
'total_pages' => thesis_guidance_papers_total_pages
}
end
def show
params = OrbitHelper.params
plugin = ThesisGuidancePaper.where(is_hidden: false).find_by(uid: params[:uid].to_s)
fields_to_show = %w[
year
authors
author_type
paper_title
journal_title
vol_no
issue_no
form_to
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
def get_fields_for_index
@page = Page.find(params[:page_id]) rescue nil
@fields_to_show = %w[
year
authors
author_type
paper_title
journal_title
vol_no
issue_no
form_to
level_type
paper_type
total_pages
publication_date
isbn
abstract
language
url
]
@fields_to_show = @fields_to_show.map { |fs| [t("personal_thesis_guidance.#{fs}"), fs] }
@default_fields_to_show = %w[
paper_title
journal_title
authors
year
issue_no
vol_no
level_type
]
render layout: false
end
def save_index_fields
page = Page.find(params[:page_id]) rescue nil
page.custom_array_field = params[:keys]
page.save
render json: { 'success' => true }.to_json
end
private
def search_all_words(target, word)
target = target.upcase
words = word.upcase.split(' ')
words.select { |value| target.include? value } == words
end
end

0
app/helpers/.keep Normal file
View File

View File

@ -0,0 +1,257 @@
module Admin::ThesisGuidancePapersHelper
def get_authors_text(journal)
authors_text = Nokogiri::HTML(journal.authors.to_s).text
split_text = authors_text.match(/[、,,\/]/)
split_text = split_text.nil? ? '/' : split_text[0]
if authors_text.present?
authors_names = authors_text.split(split_text)
else
authors_names = []
end
full_authors_names = get_member(journal).collect do |member|
member_name = member.name
idx = authors_names.index{|a| a.match(/(^|[ \(\[])#{::Regexp.escape(member_name)}([ \)\]\*]|$)/)}
if idx
member_name = authors_names[idx]
authors_names[idx] = nil
end
member_name
end
full_authors_names += authors_names.compact
full_authors_names.join(split_text)
end
def get_authors_show(journal)
authors_text = Nokogiri::HTML(journal.authors.to_s).text
split_text = authors_text.match(/[、,,\/]/)
split_text = split_text.nil? ? '/' : split_text[0]
if authors_text.present?
authors_names = authors_text.split(split_text)
else
authors_names = []
end
full_authors = get_member(journal).collect do |member|
member_name = member.name
idx = authors_names.index{|a| a.match(/(^|[ \(\[])#{::Regexp.escape(member_name)}([ \)\]\*]|$)/)}
if idx
member_name = authors_names[idx]
authors_names[idx] = nil
end
"<a href='#{OrbitHelper.url_to_plugin_show(member.to_param,'member')}' title='#{member_name}'>#{member_name}</a>"
end
full_authors += authors_names.compact
full_authors.join(split_text)
end
def get_member(journal)
Array(MemberProfile.where(:id.in=>Array(journal).collect(&:member_profile_id).flatten))
end
def get_a_tag_from_members(members)
members.collect{|member| "<a href='#{OrbitHelper.url_to_plugin_show(member.to_param,'member')}' title='#{member.name}'>#{member.name}</a>"}
end
def get_member_show(journal)
get_a_tag_from_members(get_member(journal)).join('、')
end
def get_level_type(journal)
!journal.thesis_guidance_levels.blank? ? "(#{journal.thesis_guidance_levels.collect(&:title).join(', ')})" : nil
end
def get_author_type(journal)
journal.thesis_guidance_paper_author_types.collect(&:title).join(', ') rescue ''
end
def get_paper_type(journal)
journal.thesis_guidance_paper_type.title rescue ''
end
def get_publication_date(journal)
journal.publication_date.strftime('%Y/%m/%d') rescue ''
end
def page_for_thesis_guidance_paper(thesis_guidance_paper_object)
thesis_guidance_paper_page = nil
pages = Page.where(:module=>"thesis_guidance_paper")
thesis_guidance_paper_page = pages.first if thesis_guidance_paper_page.nil?
request.protocol+(request.host_with_port+thesis_guidance_paper_page.url+'/'+thesis_guidance_paper_object.to_param).gsub('//','/') rescue "/"
end
def get_paper_list
user = current_user.nil? ? OrbitHelper.current_user : current_user
user_profile = user.member_profile
journals = ThesisGuidancePaper.where(:member_profile_id => user_profile.id)
journals = journals.collect do |j|
files = j.thesis_guidance_paper_files.collect do |jpf|
{
"title" => jpf.title,
"description" => jpf.description,
"link" => jpf.thesis_guidance_file.url,
"extension" => (jpf.thesis_guidance_file.url.split(".").last rescue "")
}
end
{
"id" => j.id.to_s,
"edit_url" => "/#{I18n.locale.to_s}/admin/members/#{user_profile.to_param}/thesis_guidance_papers/#{j.to_param}/edit",
"delete_url" => "/#{I18n.locale.to_s}/admin/thesis_guidance_papers/#{j.id.to_s}",
"paper_title" => j.paper_title,
"journal_title" => j.journal_title,
"keywords" => j.keywords,
"abstract" => j.abstract,
"files" => files
}
end
journals
end
def import_this_thesis_guidance_paper(row,mp)
value = nil
jp = ThesisGuidancePaper.new
row.cells.each_with_index do |cell,index|
next if index < 2
next if cell.nil?
val = cell.value
next if val.nil? || val == ""
case index
when 2
value = {"en" => val}
when 3
begin
value["zh_tw"] = val
rescue
value = {"zh_tw" => val}
end
jp.paper_title_translations = value
when 4
value = {"en" => val}
when 5
begin
value["zh_tw"] = val
rescue
value = {"zh_tw" => val}
end
jp.journal_title_translations = value
when 6
value = {"en" => val}
when 7
begin
value["zh_tw"] = val
rescue
value = {"zh_tw" => val}
end
jp.authors_translations = value
when 8
jp.year = val
when 9
jp.language = val
when 10
jp.vol_no = val
when 11
jp.issue_no = val
when 12
jp.form_to_start = val
when 13
jp.form_to_end = val
when 14
jp.total_pages = val
when 15
jls = ThesisGuidanceLevel.asc(:created_at).all.to_a
ts = val.to_s.split(",")
ts.each do |t|
jp.thesis_guidance_level_ids << jls[t.to_i].id if t.to_s.is_i? && t.to_i < jls.count
end
when 16
jpts = ThesisGuidancePaperType.asc(:created_at).all.to_a
jp.thesis_guidance_paper_type = jpts[val.to_i] if val.to_s.is_i? && val.to_i < jpts.count
when 17
jpas = ThesisGuidancePaperAuthorType.asc(:created_at).all.to_a
ts = val.to_s.split(",")
ts.each do |t|
jp.thesis_guidance_paper_author_type_ids << jpas[t.to_i].id if t.to_s.is_i? && t.to_i < jpas.count
end
when 18
jp.number_of_authors = val
when 19
jp.isbn = val
when 20
jp.publication_date = val
when 21
jp.url = val
when 22
jp.keywords = val
when 23
jp.abstract = val
when 24
jp.note = val
when 25
jp.associated_project_translations = {"en" => val, "zh_tw" => val}
end
end
jp.member_profile = mp
jp.save
end
def get_data_for_excel(year_start,year_end)
data = []
roles = Role.where(:disabled => false, :title.ne => "", :title.ne => nil).asc(:key)
roles.each do |role|
d = {}
d["name"] = role.title
mps = role.member_profile_ids
d1 = DateTime.new(year_start,1,1,0,0)
d2 = DateTime.new(year_end,12,31,23,59)
d["data"] = ThesisGuidancePaper.where(:publication_date.gte => d1, :publication_date.lte => d2, :member_profile_id.in => mps) rescue []
data << d
end
return data
end
def get_chart_data(year_start,year_end,role,type)
case type
when "paper_type"
jls = ThesisGuidancePaperType.all
when "level_type"
jls = ThesisGuidanceLevel.all
when "author_type"
jls = ThesisGuidancePaperAuthorType.all
end
finaldata = []
role = Role.find(role) rescue nil
mps = []
if !role.nil?
mps = role.member_profile_ids
end
jls.each do |jl|
data = {}
data["name"] = jl.title
data["data"] = {}
(year_start..year_end).each do |year|
d1 = DateTime.new(year,1,1,0,0)
d2 = DateTime.new(year,12,31,23,59)
t = jl.thesis_guidance_papers.where(:publication_date.gte => d1, :publication_date.lte => d2, :member_profile_id.in => mps).count rescue 0
data["data"][year.to_s] = t
end
finaldata << data
end
data = {"name" => "N/A", "data" => {}}
(year_start..year_end).each do |year|
d1 = DateTime.new(year,1,1,0,0)
d2 = DateTime.new(year,12,31,23,59)
case type
when "paper_type"
t = ThesisGuidancePaper.where(:publication_date.gte => d1, :publication_date.lte => d2, :member_profile_id.in => mps, :thesis_guidance_paper_type_id => nil).count rescue 0
when "level_type"
t = ThesisGuidancePaper.where(:publication_date.gte => d1, :publication_date.lte => d2, :member_profile_id.in => mps, :thesis_guidance_level_ids => nil).count rescue 0
when "author_type"
t = ThesisGuidancePaper.where(:publication_date.gte => d1, :publication_date.lte => d2, :member_profile_id.in => mps, :thesis_guidance_paper_author_type_ids => nil).count rescue 0
end
data["data"][year.to_s] = t
end
finaldata << data
finaldata
end
end

0
app/mailers/.keep Normal file
View File

0
app/models/.keep Normal file
View File

View File

@ -0,0 +1,17 @@
class ThesisGuidanceLevel
include Mongoid::Document
include Mongoid::Timestamps
field :key, type: String
field :title, type: String, localize: true
has_and_belongs_to_many :thesis_guidance_papers
def self.from_id(id)
self.find(id) rescue nil
end
def self.is_localized?(field_name)
self.fields[field_name.to_s].localized?
end
end

View File

@ -0,0 +1,323 @@
class ThesisGuidancePaper
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include Admin::ThesisGuidancePapersHelper
include OrbitModel::Status
include MemberHelper
include Slug
HideTimeInLinK = (File.exist?("#{Rails.root}/hide_time_fields_for_plugins.txt") rescue false)
field :paper_title, as: :slug_title, type: String, localize: true
field :journal_title, type: String, localize: true
field :supervising_teacher, type: String, localize: true
field :degree, type: String, localize: true
field :graduation_semester, type: String, localize: true
field :graduation_year, type: String, localize: true
field :authors, type: String, localize: true
field :associated_project , type: String, localize: true
field :year, type: String
field :language, type: String
field :isbn, type: String
field :vol_no, type: String
field :issue_no, type: String
field :form_to_start, type: String
field :form_to_end, type: String
field :total_pages, type: String
field :keywords, type: String
field :abstract, type: String
field :publication_date, type: DateTime
field :url, type: String
field :note, type: String
field :number_of_authors
field :rss2_id
# paginates_per 10
#relations
field :member_profile_id, type: Array
belongs_to :thesis_guidance_paper_type
has_and_belongs_to_many :thesis_guidance_types
has_and_belongs_to_many :thesis_guidance_levels
has_many :thesis_guidance_paper_files, autosave: true, dependent: :destroy
accepts_nested_attributes_for :thesis_guidance_paper_files, :allow_destroy => true
# has_and_belongs_to_many :thesis_guidance_paper_authors, dependent: :destroy
# accepts_nested_attributes_for :thesis_guidance_paper_authors
has_and_belongs_to_many :thesis_guidance_paper_author_types
# after_save :save_thesis_guidance_paper_files, :save_thesis_guidance_paper_authors
before_validation :add_http
# validates :paper_title, presence: true
index({year: -1, :publication_date => -1, _id: -1}, { unique: false, background: false })
scope :sort_year_date, ->{ order_by(:year => "desc", :publication_date => "desc", :id=>"desc") }
scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:year => "desc", :publication_date => "desc", :id=>"desc") }
before_save :fix_member_profile_id
after_save :reload_member_profiles
def fix_member_profile_id
org_member_profile_id = self[:member_profile_id]
if org_member_profile_id.class == Array
self.member_profile_id = self[:member_profile_id].map{|id| BSON::ObjectId(id)}
else
self.member_profile_id = Array(org_member_profile_id).compact.map{|id| BSON::ObjectId(id)}
end
true
end
def reload_member_profiles
@member_profiles = MemberProfile.where(:id.in=>self.member_profile_id).to_a
@member_profile = @member_profiles.first
return @member_profiles
end
def create_link
title = []
title << self.authors if !self.authors.blank?
title << self.paper_title if self.paper_title.present?
title << self.journal_title if self.journal_title.present?
title << "vol. " + self.vol_no.strip if (self.vol_no.present? && self.vol_no != "0")
title << self.issue_no if (self.issue_no.present? && self.issue_no != "0")
title << "pp. " + self.form_to_start.to_s+"-"+self.form_to_end.to_s if (self.form_to_start.present? && self.form_to_start != "0")
# title << ( !self.thesis_guidance_levels.blank? ? "(#{self.thesis_guidance_levels.collect{|x| x.title}.join(', ')})" : nil)
unless HideTimeInLinK
if !self.publication_date.nil?
title << (self.publication_date.strftime("%b. %Y") rescue nil)
elsif self.year.present?
title << self.year
end
end
title.delete(nil)
title.join(', ').sub(/^\\s*,/,'').gsub(/,(\s*,)+/,',').strip
end
def form_to
if (self.form_to_start.present? && self.form_to_start != "0")
self.form_to_start.to_s+"-"+self.form_to_end.to_s
else
""
end
end
def self.get_plugin_datas_to_member(datas)
page = Page.where(:module => "personal_thesis_guidance").first rescue nil
if !page.nil? && page.custom_string_field == "table"
if !page.custom_array_field.blank?
fields_to_show = page.custom_array_field
else
fields_to_show = [
"paper_title",
"journal_title",
"authors",
"year",
"issue_no",
"vol_no",
"level_type"
]
end
else
fields_to_show = [
"year",
"paper_title"
]
end
fields_to_remove = []
pd_title = []
fields_to_show.each do |t|
if (self.fields[t].type.to_s == "String" rescue false)
fields_to_remove << t if (datas.where(t.to_sym.ne => nil).or(t.to_sym.ne => "").count == 0 rescue false)
else
t2 = t
case t
when "form_to"
t2 = "form_to_start"
when "author_type"
t2 = "thesis_guidance_paper_author_types"
end
fields_to_remove << t if (datas.where(t2.to_sym.ne => nil).count == 0 rescue false)
end
pd_title << {
"plugin_data_title" => I18n.t("personal_thesis_guidance.#{t}")
} if !fields_to_remove.include?(t)
end
fields_to_show = fields_to_show - fields_to_remove
plugin_datas = datas.sort_for_frontend.collect do |p|
pd_data = []
p_keywords = p.keywords.to_s.strip rescue ""
rep_mark_html = "<span class='rep-mark' style='display:none;'>#{p_keywords}</span>"
fields_to_show.each do |t|
if !page.nil? && page.custom_string_field == "table"
case t
when "paper_title"
link = OrbitHelper.url_to_plugin_show(p.to_param,'personal_thesis_guidance')
url_to_plugin_show_blank = OrbitHelper.instance_variable_get(:@url_to_plugin_show_blank)
tmp_title = p.paper_title
title_content = (url_to_plugin_show_blank ? tmp_title : "<a title=\"#{tmp_title}\" href=\"#{link}\" target=\"_blank\">#{tmp_title}</a>")
pd_data << { "data_title" => "#{title_content}#{rep_mark_html}".html_safe }
when "level_type"
pd_data << {"data_title" => ( !p.thesis_guidance_levels.blank? ? "(#{p.thesis_guidance_levels.collect{|x| x.title}.join(', ')})" : nil)}
when "publication_date"
pd_data << {"data_title" => (p.send(t).strftime("%Y/%m") rescue "")}
when "author_type"
pd_data << {"data_title" => (p.thesis_guidance_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")}
else
pd_data << {"data_title" => p.send(t)}
end
else
if t == "paper_title"
pd_data << { "data_title" => "#{p.create_link_tag_for_title}#{rep_mark_html}".html_safe }
else
pd_data << { "data_title" => p.send(t) }
end
end
end
{
"pd_datas" => pd_data
}
end
return [pd_title,plugin_datas]
end
def create_link_tag_for_title
link = OrbitHelper.url_to_plugin_show(self.to_param,'personal_thesis_guidance')
url_to_plugin_show_blank = OrbitHelper.instance_variable_get(:@url_to_plugin_show_blank)
tmp_title = self.create_link
(url_to_plugin_show_blank ? tmp_title : "<a title=\"#{tmp_title}\" href=\"#{link}\" target=\"_blank\">#{tmp_title}</a>")
end
# def self.member_data
# members = MemberProfile.all
# member_data = []
# members.each do |m|
# if (m.first_name || m.last_name)
# member_data << {"memberId" => m.id.to_s, "memberName" => m.name}
# else
# member_data << {"memberId" => m.id.to_s, "memberName" => "No Name"}
# end
# end
# member_data.to_json
# end
# def save_thesis_guidance_paper_files
# self.thesis_guidance_paper_files.each do |t|
# if t.should_destroy
# t.destroy
# end
# end
# end
# def save_thesis_guidance_paper_authors
# self.thesis_guidance_paper_authors.each do |t|
# if t.should_destroy
# t.destroy
# end
# end
# end
def get_plugin_data(fields_to_show)
plugin_datas = []
fields_to_show.each do |field|
plugin_data = self.get_plugin_field_data(field) rescue nil
next if plugin_data.blank? or plugin_data['value'].blank?
plugin_datas << plugin_data
end
plugin_datas
end
def member_profiles
@member_profiles ||= MemberProfile.where(:id.in=>self.member_profile_id).to_a
@member_profiles
end
def member_profiles=(mps)
self.member_profile_id = mps.map(&:id)
@member_profiles = mps
@member_profile = @member_profiles.first
@member_profiles
end
def member_profile
@member_profile ||= MemberProfile.where(:id.in=>self.member_profile_id).first
@member_profile
end
def member_profile=(mp)
if mp.class == MemberProfile
self.member_profile_id = [mp.id]
@member_profiles = [mp]
@member_profile = mp
else
self.member_profile_id = mp.map(&:id)
@member_profiles = mp
@member_profile = mp.first
end
end
def get_plugin_field_data(field)
case field
when "level_type"
value = self.thesis_guidance_levels.collect{|level| level.title}.join(',') rescue ""
when "author_type"
value = self.thesis_guidance_paper_author_types.collect{|type| type.title}.join(',') rescue ""
when "paper_type"
value = self.thesis_guidance_paper_type.title rescue ""
when "author_name"
value = []
([I18n.locale]+(Site.first.in_use_locales-[I18n.locale])).each do |locale|
if self.member_profile.first_name_translations[locale] || self.member_profile.last_name_translations[locale]
value << "#{self.member_profile.first_name_translations[locale]} #{self.member_profile.last_name_translations[locale]}"
end
end
value = value.join(" / ")
when "publication_date"
value = self.publication_date.strftime("%Y-%m-%d") rescue ""
when "language"
value = I18n.t(self.language) if !self.language.nil? rescue ""
when "abstract"
value = nl2br(self.abstract)
when "file"
files = []
self.thesis_guidance_paper_files.each do |file|
url = file.thesis_guidance_file.url
title = ((file.title.blank? ? File.basename(file.thesis_guidance_file.path) : file.title) rescue "")
files << (url.nil? ? "" : "<li><a href=\"#{url}\" target=\"_blank\">#{title}</a></li>")
end
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) rescue ""
else
value = self.send(field) rescue ""
end
{
"key"=>field,
"title_class"=>"journal-#{field.gsub('_','-')}-field",
"value_class"=>"journal-#{field.gsub('_','-')}-value",
"title"=>I18n.t('personal_thesis_guidance.'+field),
"value"=>value
}
end
protected
def add_http
unless self.url.blank? || self.url[/^http:\/\//] || self.url[/^https:\/\//]
self.url = 'http://' + self.url
end
end
end

View File

@ -0,0 +1,15 @@
class ThesisGuidancePaperAuthor
include Mongoid::Document
include Mongoid::Timestamps
field :name, type: String, localize: true
field :email, type: String
field :should_destroy, type: Boolean
has_and_belongs_to_many :thesis_guidance_papers
has_and_belongs_to_many :thesis_guidance_paper_author_types
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/
validates :email, format: { with: VALID_EMAIL_REGEX },
allow_blank: true
end

View File

@ -0,0 +1,10 @@
class ThesisGuidancePaperAuthorType
include Mongoid::Document
include Mongoid::Timestamps
field :key, type: String
field :title, type: String, localize: true
has_and_belongs_to_many :thesis_guidance_papers
has_and_belongs_to_many :thesis_guidance_paper_authors
end

View File

@ -0,0 +1,12 @@
class ThesisGuidancePaperFile
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
field :description, type: String, localize: true
field :title, type: String, localize: true
field :should_destroy, type: Boolean
mount_uploader :thesis_guidance_file, AssetUploader
belongs_to :thesis_guidance_paper
end

View File

@ -0,0 +1,3 @@
class ThesisGuidancePaperIntro < PersonalPluginIntro
end

View File

@ -0,0 +1,9 @@
class ThesisGuidancePaperType
include Mongoid::Document
include Mongoid::Timestamps
field :key, type: String
field :title, type: String, localize: true
has_many :thesis_guidance_papers
end

View File

@ -0,0 +1,7 @@
class ThesisGuidanceType
include Mongoid::Document
include Mongoid::Timestamps
field :title, type: String, localize: true
end

0
app/views/.keep Normal file
View File

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_thesis_guidance.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/thesis_guidance_papers/list_level_type', :collection => @paper_levels %>");
$('#paper_level_modal').modal('hide');

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

@ -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_thesis_guidance.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/thesis_guidance_papers/list_author_type', :collection => @author_types %>");
$('#author_type_modal').modal('hide');

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

@ -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_thesis_guidance.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/thesis_guidance_papers/list_paper_type', :collection => @paper_types %>");
$('#paper_type_modal').modal('hide');

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

@ -0,0 +1,382 @@
<% # encoding: utf-8 %>
<% 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" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker.js" %>
<%= javascript_include_tag "lib/bootstrap-typeahead.js" %>
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker" %>
<% end %>
<div class="form-group has-error">
<center><%= @thesis_guidance_paper.errors.full_messages.first if @thesis_guidance_paper.errors.any? %></center>
</div>
<!-- Input Area -->
<div class="input-area">
<!-- 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).to_s %></a>
</li>
<% end %>
<li class="pull-right">
<%= copy_to_all_language_button(".language-nav", ".language-area") %>
</li>
</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" : '' %>">
<!-- paper_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_thesis_guidance.paper_title") %></label>
<div class="controls">
<%= f.fields_for :paper_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_thesis_guidance.paper_title"), value: (@thesis_guidance_paper.paper_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- journal_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_thesis_guidance.journal_title") %></label>
<div class="controls">
<%= f.fields_for :journal_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_thesis_guidance.journal_title"), value: (@thesis_guidance_paper.journal_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- supervising_teacher-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_thesis_guidance.supervising_teacher") %></label>
<div class="controls">
<%= f.fields_for :supervising_teacher_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_thesis_guidance.supervising_teacher"), value: (@thesis_guidance_paper.supervising_teacher_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- degree-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_thesis_guidance.degree") %></label>
<div class="controls">
<%= f.fields_for :degree_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_thesis_guidance.degree"), value: (@thesis_guidance_paper.degree_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- graduation_semester-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_thesis_guidance.graduation_semester") %></label>
<div class="controls">
<%= f.fields_for :graduation_semester_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_thesis_guidance.graduation_semester"), value: (@thesis_guidance_paper.graduation_semester_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- graduation_year-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_thesis_guidance.graduation_year") %></label>
<div class="controls">
<%= f.fields_for :graduation_year_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_thesis_guidance.graduation_year"), value: (@thesis_guidance_paper.graduation_year_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- authors-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_thesis_guidance.authors") %></label>
<div class="controls">
<%= f.fields_for :authors_translations do |f| %>
<%= f.text_area locale, class: "ckeditor input-block-level", placeholder: t("personal_thesis_guidance.authors"), value: (@thesis_guidance_paper.authors_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if @thesis_guidance_paper && !@thesis_guidance_paper.thesis_guidance_paper_files.blank? %>
<div class="exist">
<% @thesis_guidance_paper.thesis_guidance_paper_files.each_with_index do |writing_thesis_guidance_file, i| %>
<%= f.fields_for :thesis_guidance_paper_files, writing_thesis_guidance_file do |f| %>
<%= render :partial => 'form_file', :object => writing_thesis_guidance_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'plugin_file_field_count', @thesis_guidance_paper.thesis_guidance_paper_files.count %>
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</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">
<% if !@member.nil? %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'author_members[]', email_members:@member} %>
<% else %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'author_members[]', email_members:[]} %>
<% end %>
</div>
</div>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_thesis_guidance.year") %></label>
<div class="controls">
<%= select_year((@thesis_guidance_paper.year ? @thesis_guidance_paper.year.to_i : DateTime.now.year), {:start_year => (DateTime.now.year+5), :end_year => 1930}, {:name => 'thesis_guidance_paper[year]', :class => "span1"} ) %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_thesis_guidance.language") %></label>
<div class="controls">
<select id="thesis_guidance_paper_language" name="thesis_guidance_paper[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @thesis_guidance_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_thesis_guidance.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_thesis_guidance.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_thesis_guidance.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_thesis_guidance.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_thesis_guidance.level_type") %></label>
<div class="controls">
<% @thesis_guidance_levels.each do |level_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'thesis_guidance_paper[thesis_guidance_level_ids][]', level_type.id, @thesis_guidance_paper.thesis_guidance_level_ids.include?(level_type.id)%>
<%= level_type.title %>
<%= hidden_field_tag 'thesis_guidance_paper[thesis_guidance_level_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- thesis_guidance_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_thesis_guidance.thesis_guidance_type") %></label>
<div class="controls">
<%= f.select :thesis_guidance_type_ids, @thesis_guidance_types.collect {|t| [ t.title, t.id ]}, {include_blank: ''}, {multiple: true, :class => "span3"} %>
</div>
</div>
<!-- paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_thesis_guidance.paper_type") %></label>
<div class="controls">
<%= f.select :thesis_guidance_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_thesis_guidance.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'thesis_guidance_paper[thesis_guidance_paper_author_type_ids][]', author_type.id, @thesis_guidance_paper.thesis_guidance_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_thesis_guidance.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_thesis_guidance.isbn") %></label>
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_thesis_guidance.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publication_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD", :value => @thesis_guidance_paper.publication_date, :new_record => @thesis_guidance_paper.new_record? %>
</div>
</div>
<!-- url -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_thesis_guidance.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_thesis_guidance.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_thesis_guidance.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_thesis_guidance.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_thesis_guidance.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 @thesis_guidance_paper.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<input type="hidden" name="referer_url" value="<%= request.referer %>">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<script>
$('.main-forms').find('.add-on').tooltip().end().on('click', '.trigger, .delete_file, .remove_existing_record', function() {
if($(this).hasClass('trigger')) {
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_thesis_guidance_paper_files", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :thesis_guidance_paper_files) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
// formTip();
} else if($(this).hasClass('delete_file')) {
$(this).parents('.input-prepend').remove();
} else if($(this).hasClass('remove_existing_record')) {
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
}
});
</script>

View File

@ -0,0 +1,39 @@
<% if form_author.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<% if form_author.name.present? %>
<%= form_author.name %>
<% end %>
<% end %>
<div class="input-prepend input-append">
<label>
<div class="span3 input-medium">
<span class="add-on icons-mail" title='<%= t(:email) %>'></span>
<%= f.email_field :email, placeholder: t(:email) %>
</div>
</label>
<span class="add-on icons-pencil" title='<%= t(:name) %>'></span>
<span class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :name_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t(:name), :value => (form_author.name_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
</span>
<% if form_author.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>
</div>

View File

@ -0,0 +1,45 @@
<% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<% if form_file.thesis_guidance_file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_file.thesis_guidance_file_identifier, form_file.thesis_guidance_file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.thesis_guidance_file_identifier} %>
<% end %>
<% end %>
<div class="input-prepend input-append">
<label>
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<i class="icons-paperclip"></i>
<%= f.file_field :thesis_guidance_file %>
</span>
<div class="uneditable-input input-medium">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.thesis_guidance_file.blank?) ? t(:select_file) : t(:change_file) %></span>
</div>
</label>
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<span class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
</span>
<% if form_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>
</div>

View File

@ -0,0 +1,10 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_author_type %>">
<td><%= list_author_type.title %></td>
<td class="span2">
<a href="<%= edit_admin_thesis_guidance_paper_author_type_path(list_author_type) %>#author_type_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
<%= link_to t(:delete_), admin_thesis_guidance_paper_author_type_path(list_author_type), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
</td>
</tr>

View File

@ -0,0 +1,10 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_thesis_guidance_type %>">
<td><%= list_thesis_guidance_type.title %></td>
<td class="span2">
<a href="<%= edit_admin_thesis_guidance_type_path(list_thesis_guidance_type) %>#thesis_guidance_type_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
<%= link_to t(:delete_), admin_thesis_guidance_type_path(list_thesis_guidance_type), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
</td>
</tr>

View File

@ -0,0 +1,10 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_level_type %>">
<td><%= list_level_type.title %></td>
<td class="span2">
<a href="<%= edit_admin_thesis_guidance_level_path(list_level_type) %>#paper_level_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
<%= link_to t(:delete_), admin_thesis_guidance_level_path(list_level_type), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
</td>
</tr>

View File

@ -0,0 +1,10 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_paper_type %>">
<td><%= list_paper_type.title %></td>
<td class="span2">
<a href="<%= edit_admin_thesis_guidance_paper_type_path(list_paper_type) %>#paper_type_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
<%= link_to t(:delete_), admin_thesis_guidance_paper_type_path(list_paper_type), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
</td>
</tr>

View File

@ -0,0 +1,19 @@
<% @writing_thesis_guidances.each do |writing_journal| %>
<tr id="<%= dom_id writing_journal %>" class="with_action">
<td class="span1"><%= writing_journal.year %></td>
<td class="span1">
<a href="<%= OrbitHelper.url_to_plugin_show(writing_journal.to_param,'personal_thesis_guidance').to_s %>" target="blank">
<span>
<%= "#{Nokogiri::HTML(writing_journal.create_link).text}" %>
</span>
</a>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('edit').to_s, edit_admin_thesis_guidance_paper_path(writing_journal) %></li>
<li><%= link_to t(:delete_), admin_thesis_guidance_paper_path(id: writing_journal.id), method: :delete, remote: true, data: { confirm: 'Are you sure?' } %></li>
</ul>
</div>
</td>
<td><%= get_member_show(writing_journal).html_safe %></td>
</tr>
<% end %>

View File

@ -0,0 +1,116 @@
<% # encoding: utf-8 %>
<% 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>
.graph-type {
margin-right: 10px !important;
}
.analysis-show-area{
margin-top: 25px;
}
.role {
margin: 15px auto;
width: 90%;
height: 400px;
}
.role h3{
border-bottom: 1px solid #000;
}
.role .graph-area{
text-align: center;
}
.role .graph-area .loader {
margin-top: 170px;
}
</style>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "//www.google.com/jsapi", "chartkick"%>
<%= javascript_include_tag "justgage.1.0.1.min" %>
<%= javascript_include_tag "raphael.2.1.0.min" %>
<%= javascript_include_tag "validator" %>
<% end %>
<div id="analysis-area">
<div class="analysis-form">
<form id="analysis-form" action="/admin/thesis_guidance_papers/analysis_report" class="form-horizontal main-forms">
<div class="input-area">
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_thesis_guidance.year") %> : </label>
<div class="controls">
<%= select_year(DateTime.now.year - 5, {:start_year => DateTime.now.year, :end_year => 1950}, {:name => 'start_year', :class => "span1"} ) %>
-
<%= select_year(DateTime.now.year, {:start_year => DateTime.now.year, :end_year => 1950}, {:name => 'end_year', :class => "span1"} ) %>
</div>
</div>
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_thesis_guidance.graph_by") %> : </label>
<div class="controls">
<%= t("personal_thesis_guidance.paper_type") %> <input type="radio" name="graph_by" class="graph-type" value="paper_type">
<%= t("personal_thesis_guidance.level_type") %> <input type="radio" name="graph_by" class="graph-type" value="level_type">
<%= t("personal_thesis_guidance.author_type") %> <input data-fv-validation="required;" data-fv-messages="Please select atleast one.;" type="radio" name="graph_by" class="graph-type" value="author_type">
</div>
</div>
</div>
<div class="form-actions">
<button id="generate_graph" class="btn btn-info">Graphs</button>
<a href="" id="generate_excel" class="btn btn-primary">Export</a>
</div>
</form>
</div>
<div class="analysis-show-area hide in">
<% Role.where(:disabled => false, :title.ne => "", :title.ne => nil).asc(:key).each do |role| %>
<div class="role muted" data-role-id="<%= role.id.to_s %>">
<h3><%= role.title %></h3>
<div class="graph-area">
<img class="loader" src="/assets/preloader.gif" alt="loading" width="70" height="70">
</div>
</div>
<% end %>
</div>
</div>
<script type="text/javascript">
var form = new FormValidator($("#analysis-form")),
roleArea = $("#analysis-area .analysis-show-area"),
totalRoles = roleArea.find(".role").length;
form.form.on("submit",function(){return false;})
$("#generate_excel").on("click",function(){
window.location.href = "/admin/thesis_guidance_papers/download_excel.xlsx?" + "year_start=" + form.form.find("select[name=start_year]").val() + "&year_end=" + form.form.find("select[name=end_year]").val();
return false;
})
$("#generate_graph").on("click",function(){
if(form.isFormValidated()){
generateCharts(0);
roleArea.removeClass("hide");
}
return false;
})
var generateCharts = function(index){
var role = roleArea.find(".role").eq(index);
$.ajax({
url : "/admin/thesis_guidance_papers/analysis_report",
data : {"role_id" : role.data("role-id"), "year_start" : form.form.find("select[name=start_year]").val(), "year_end" : form.form.find("select[name=end_year]").val(), "graph_by" : form.form.find("input[name=graph_by]:checked").val()},
type : "get",
dataType : "html"
}).done(function(html){
role.find(".graph-area").html(html);
if(index < totalRoles){
generateCharts(index + 1);
}
}).error(function(){
role.find(".graph-area").html("There was an error loading this graph.");
if(index < totalRoles){
generateCharts(index + 1);
}
})
}
</script>

View File

@ -0,0 +1 @@
<%= column_chart @data, :id => params[:role_id], :height => "350px", :xtitle => "Year", :ytitle => "Total number" %>

View File

@ -0,0 +1 @@
$("#<%= dom_id @thesis_guidance_paper %>").remove();

View File

@ -0,0 +1,96 @@
# encoding: utf-8
wb = xlsx_package.workbook
@data.each_with_index do |role,idx|
data = role["data"]
wb.add_worksheet(name: role["name"] + "-" + idx.to_s) do |sheet|
heading = sheet.styles.add_style(:b => true, :locked => true)
row = ["Name"]
@site_in_use_locales.each do |locale|
row << t("personal_thesis_guidance.paper_title") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_thesis_guidance.journal_title") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_thesis_guidance.authors") + " - " + t(locale)
end
row << t("personal_thesis_guidance.year")
row << t("personal_thesis_guidance.language")
row << t("personal_thesis_guidance.vol_no")
row << t("personal_thesis_guidance.issue_no")
row << t("personal_thesis_guidance.form_to_start")
row << t("personal_thesis_guidance.form_to_end")
row << t("personal_thesis_guidance.total_pages")
row << t("personal_thesis_guidance.level_type")
row << t("personal_thesis_guidance.paper_type")
row << t("personal_thesis_guidance.author_type")
row << t("personal_thesis_guidance.number_of_authors")
row << t("personal_thesis_guidance.isbn")
row << t("personal_thesis_guidance.publication_date")
row << t("personal_thesis_guidance.url")
row << t("personal_thesis_guidance.keywords")
row << t("personal_thesis_guidance.abstract")
row << t("personal_thesis_guidance.note")
row << t("personal_thesis_guidance.associated_project")
sheet.add_row row, :style => heading
data.each do |jp|
row = [(jp.member_profile_id.class == Array ? jp.member_profile_id.map{|member_id| MemberProfile.find(member_id).name rescue ""} : [jp.member_profile.name])]
@site_in_use_locales.each do |locale|
row << jp.paper_title_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << jp.journal_title_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << jp.authors_translations[locale.to_s]
end
row << jp.year
row << jp.language
row << jp.vol_no
row << jp.issue_no
row << jp.form_to_start
row << jp.form_to_end
row << jp.total_pages
row << (jp.thesis_guidance_levels.map{|jl| jl.title}.join(", ") rescue "")
row << (jp.thesis_guidance_paper_type.title rescue "")
row << (jp.thesis_guidance_paper_author_types.map{|jl| jl.title}.join(", ") rescue "")
row << jp.number_of_authors
row << jp.isbn
row << jp.publication_date.strftime("%Y-%m-%d") rescue ""
row << jp.url
row << jp.keywords
row << jp.abstract
row << jp.note
row << jp.associated_project
sheet.add_row row
end
end
end

View File

@ -0,0 +1,5 @@
<%= form_for @thesis_guidance_paper, url: admin_thesis_guidance_paper_path(@thesis_guidance_paper), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

@ -0,0 +1,153 @@
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: "Thesis Guidance") do |sheet|
heading = sheet.styles.add_style(:b => true, :locked => true)
example = sheet.styles.add_style(:i => true)
row = ["user_id"]
row1 = [""]
row2 = [""]
row << "name"
row1 << ""
row2 << ""
row << t("personal_thesis_guidance.paper_title") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_thesis_guidance.paper_title") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_thesis_guidance.journal_title") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_thesis_guidance.journal_title") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_thesis_guidance.authors") + " - " + t("en")
row1 << "textarea"
row2 << ""
row << t("personal_thesis_guidance.authors") + " - " + t("zh_tw")
row1 << "textarea"
row2 << ""
row << t("personal_thesis_guidance.year")
row1 << "number"
row2 << "Example : 2015 or 2014 or 1987"
row << t("personal_thesis_guidance.language")
row1 << "select"
row2 << "en -> English, zh_tw -> Chinese"
row << t("personal_thesis_guidance.vol_no")
row1 << "textfield"
row2 << ""
row << t("personal_thesis_guidance.issue_no")
row1 << "textfield"
row2 << ""
row << t("personal_thesis_guidance.form_to_start")
row1 << "number"
row2 << "Example: 11 or 21"
row << t("personal_thesis_guidance.form_to_end")
row1 << "number"
row2 << "Example: 13 or 23"
row << t("personal_thesis_guidance.total_pages")
row1 << "number"
row2 << "Example: 10 or 20 or 100"
row << t("personal_thesis_guidance.level_type")
row1 << "checkbox"
t = ""
ThesisGuidanceLevel.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", "
end
if ThesisGuidanceLevel.count > 0
t = t + " Example : 0, if more than one then : 0,1"
else
t = "Leave this field blank"
end
row2 << t
row << t("personal_thesis_guidance.paper_type")
row1 << "select"
t = ""
ThesisGuidancePaperType.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", "
end
if ThesisGuidancePaperType.count > 0
t = t + " Example : 0"
else
t = "Leave this field blank"
end
row2 << t
row << t("personal_thesis_guidance.author_type")
row1 << "checkbox"
t = ""
ThesisGuidancePaperAuthorType.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", "
end
if ThesisGuidancePaperAuthorType.count > 0
t = t + " Example : 0, if more than one then : 0,1"
else
t = "Leave this field blank"
end
row2 << t
row << t("personal_thesis_guidance.number_of_authors")
row1 << "number"
row2 << "Example: 1 or 2 or 10"
row << t("personal_thesis_guidance.isbn")
row1 << "textfield"
row2 << ""
row << t("personal_thesis_guidance.publication_date")
row1 << "date"
row2 << "Format: YYYY/MM/DD, Example: 2015/12/10"
row << t("personal_thesis_guidance.url")
row1 << "textfield"
row2 << "http://domain.com/path"
row << t("personal_thesis_guidance.keywords")
row1 << "textfield"
row2 << "Example: keyword1,keyword2"
row << t("personal_thesis_guidance.abstract")
row1 << "textarea"
row2 << ""
row << t("personal_thesis_guidance.note")
row1 << "textarea"
row2 << ""
row << t("personal_thesis_guidance.associated_project")
row1 << "textfield"
row2 << ""
sheet.add_row row, :style => heading
sheet.add_row row1
sheet.add_row row2, :style => example
User.where(:user_name.ne => "rulingcom").each do |user|
r = [user.user_name]
r << user.name
sheet.add_row r
end
end

View File

@ -0,0 +1,94 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<%= form_for(:thesis_guidance_paper_intro, :url => update_frontend_setting_admin_thesis_guidance_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.thesis_guidance_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? %>
<%= hidden_field_tag :member_profile_id, @member.id.to_s %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</fieldset>
<% end %>

View File

@ -0,0 +1,53 @@
<script src="https://kit.fontawesome.com/1fa49cfdc9.js" crossorigin="anonymous"></script>
<script>
function MergeUrl(){
location.href = '<%= merge_admin_thesis_guidance_papers_path %>'
}
</script>
<%= render_filter nil, "tbody_writing_thesis_guidances" %>
<table class="table main-list">
<thead>
<tr>
<th class="span1"><%= t('personal_thesis_guidance.year') %></th>
<th class="span7"><%= t('module_name.thesis_guidance_paper') %></th>
<th class="span1"><%= t("personal_plugins.author") %></th>
</tr>
</thead>
<tbody id="tbody_writing_thesis_guidances" class="sort-holder">
<%= render 'writing_journal' %>
</tbody>
</table>
<div class="bottomnav clearfix">
<div class="action pull-right">
<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_thesis_guidance.merge') %>
</button>
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
<i class="icon-upload-alt icon-white"></i><%= t('personal_thesis_guidance.upload') %>
<span class="caret"></span>
</button>
<div class="dropdown-menu upload-box">
<form action="/admin/thesis_guidance_papers/import_from_excel" method="post" enctype="multipart/form-data">
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
<input type="file" name="import_file" >
<button class="btn btn-primary" type="submit"><%= t(:submit) %></button>
<a class="" href="/admin/thesis_guidance_papers/download_excel_format.xlsx">Download excel format</a>
</form>
</div>
</div>
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_admin_thesis_guidance_paper_path, :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_writing_journal_setting_path, :class => 'btn btn-primary pull-right' %>
</div>
<div class="pagination pagination-centered">
<%= content_tag :div, paginate(@writing_thesis_guidances), class: "pagination pagination-centered", id: "writing_journal_pagination" %>
</div>
</div>
<% if params[:error] == "1" %>
<script type="text/javascript">
alert("File cannot be imported. File has more than 500 entries. Please seperate the entries in different files.");
window.location.href = "<%= admin_thesis_guidance_papers_url %>"
</script>
<% end %>

View File

@ -0,0 +1,4 @@
<script>
$("#tbody_writing_thesis_guidances").html("<%= j render :partial => 'writing_journal', :collection => @writing_thesis_guidances %>");
$("#writing_journal_pagination").html("<%= j paginate @writing_thesis_guidances, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
</script>

View File

@ -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_thesis_guidance.merge') %></button>
</form>
</nobr>
<form method="post" action='/admin/thesis_guidance_papers/merge_process?' name='merge_form'>
<%= token_tag(nil) %>
<table class="table main-list">
<thead>
<tr>
<th><%= t('personal_thesis_guidance.paper_title') %></th>
<th><%= t('personal_thesis_guidance.journal_title') %></th>
<% if params['mode']!='simple' %>
<th><%= t('personal_thesis_guidance.level_type') %></th>
<th><%= t('personal_thesis_guidance.author_type') %></th>
<th><%= t('personal_thesis_guidance.paper_type') %></th>
<th><%= t('personal_thesis_guidance.publication_date') %></th>
<% end %>
<th><%= t("personal_thesis_guidance.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_thesis_guidance.no_input') : v}.join('/') rescue t('personal_thesis_guidance.no_input') %>
</td>
<td rowspan="<%= len %>">
<%= key[1].values.map{|v| v=="" ? t('personal_thesis_guidance.no_input') : v}.join('/') rescue t('personal_thesis_guidance.no_input') %>
</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_thesis_guidance_paper_path(journal) %>" target="_blank">
<%= get_member(journal).collect(&:name).join(' / ') rescue t('personal_thesis_guidance.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_thesis_guidance.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_thesis_guidance_paper_path(journal_child) %>" target="_blank">
<%= get_member(journal_child).collect(&:name).join(' / ') rescue t('personal_thesis_guidance.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>

View File

@ -0,0 +1,5 @@
<%= form_for @thesis_guidance_paper, url: admin_thesis_guidance_papers_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

@ -0,0 +1,149 @@
<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_thesis_guidance_paper_type_path %>#paper_type_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_thesis_guidance.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_thesis_guidance_level_path %>#paper_level_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_thesis_guidance.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 => @thesis_guidance_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_thesis_guidance_paper_author_type_path %>#author_type_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_thesis_guidance.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="element span4">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= new_admin_thesis_guidance_type_path %>#thesis_guidance_type_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_thesis_guidance.thesis_guidance_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="thesis_guidance_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_thesis_guidance_type', :collection => @thesis_guidance_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>
<div id="thesis_guidance_type_qe">
<div style="display:none;" class="modal" id="thesis_guidance_type_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
</div>

View File

@ -0,0 +1,24 @@
<%= form_for(@thesis_guidance_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_thesis_guidance.thesis_guidance_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 => (@thesis_guidance_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 @@
$('#thesis_guidance_types tbody').html("<%= j render :partial => '/admin/thesis_guidance_papers/list_thesis_guidance_type', :collection => @thesis_guidance_types %>");
$('#thesis_guidance_type_modal').modal('hide');

View File

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

View File

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

View File

@ -0,0 +1,48 @@
<% if !@page.nil? %>
<form id="form_for_plugin_fields" action="">
<div class="form-inline">
<ul class="current-fields">
<% if @page.custom_array_field.blank? %>
<% @default_fields_to_show.each do |fs| %>
<li data-attrib-key="<%= fs %>" class="clearfix"><span class="field-value"><%= t("personal_thesis_guidance.#{fs}") %></span><span class="remove-field"><i class="icon-remove-sign"></i></span></li>
<% end %>
<% else %>
<% @page.custom_array_field.each do |fs| %>
<li data-attrib-key="<%= fs %>" class="clearfix"><span class="field-value"><%= t("personal_thesis_guidance.#{fs}") %></span><span class="remove-field"><i class="icon-remove-sign"></i></span></li>
<% end %>
<% end %>
</ul>
</div>
<div class="form-horizontal controls-row">
<div class="attr-type-wrap control-group">
<label class="attr control-label">Fields: </label>
<div class="attr controls">
<%= select_tag "fields_to_show_for_pp", options_for_select(@fields_to_show), prompt: "---Select something---" %>
</div>
</div>
<a href="#" class="add-pp-field btn btn-info">Add Field</a>
<input type="hidden" name="plugin_key" value="<%= @page.module %>">
<input type="hidden" name="plugin_page_frontend_id" value="<%= @page.id.to_s %>">
</div>
</form>
<script type="text/javascript">
$(".current-fields").sortable();
var select = $("select#fields_to_show_for_pp");
$(".add-pp-field").on("click",function(){
var val = select.val(),
text = select.find("option:selected").text(),
li = null;
if(val != ""){
li = '<li class="clearfix" data-attrib-key="' + val + '"><span class="field-value">' + text + '</span><span class="remove-field"><i class="icon-remove-sign"></i></span></li>';
}
$("#modify_plugin_fields ul.current-fields").append(li);
})
$(document).on("click",".remove-field",function(){
$(this).parent().remove();
})
</script>
<% else %>
<h3>Page not found.</h3>
<% end %>

View File

@ -0,0 +1 @@
<%= render_view%>

View File

@ -0,0 +1 @@
<%= render_view %>

View File

@ -0,0 +1,85 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/list-check" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/list-check" %>
<% end %>
<%
if has_access?
@writing_thesis_guidances = ThesisGuidancePaper.where(member_profile_id: @member.id).sort_year_date.page(params[:page]).per(10)
else
@writing_thesis_guidances = ThesisGuidancePaper.where(is_hidden: false, member_profile_id: @member.id).sort_year_date.page(params[:page]).per(10)
end
%>
<% if has_access? %>
<div class="list-active">
<div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => toggle_hide_admin_thesis_guidance_papers_path(member_profile_id: @member.id.to_s, disable: 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => toggle_hide_admin_thesis_guidance_papers_path(member_profile_id: @member.id.to_s, disable: 'false') ) %>
</div>
</div>
<% end -%>
<table class="table table-condensed table-striped main-list">
<thead>
<tr>
<% if has_access? %>
<th><input type="checkbox" /></th>
<% end -%>
<th class="span1"><%= t('personal_thesis_guidance.year') %></th>
<th><%= t('module_name.thesis_guidance_paper') %></th>
<% if not @user%>
<th><%= t('personal_thesis_guidance.authors') %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @writing_thesis_guidances.each do |writing_journal| %>
<tr id="<%= dom_id writing_journal %>" class="<%= writing_journal.is_hidden ? "checkHide" : "" %>">
<% if has_access? %>
<td>
<%= check_box_tag 'to_change[]', writing_journal.id.to_s, false, :class => "list-check" %>
</td>
<% end -%>
<td><%= writing_journal.year %></td>
<td>
<% link = OrbitHelper.url_to_plugin_show(writing_journal.to_param,'personal_thesis_guidance') %>
<%= (link =='#') ? writing_journal.create_link : link_to(writing_journal.create_link, link, target: "blank") %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<% if has_access? %>
<li><%= link_to t('edit'), '/admin/members/'+@member.to_param+'/thesis_guidance_papers/'+writing_journal.id+'/edit' %></li>
<li><%= link_to t(:delete_), admin_thesis_guidance_paper_path(id: writing_journal.id, member_profile_id: @member.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
<% end %>
</ul>
</div>
</td>
<td><%= writing_journal.authors %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="bottomnav clearfix">
<% if has_access? %>
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('setting'),'/admin/members/'+@member.to_param+'/thesis_guidance_papers/frontend_setting', :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'),
'/admin/members/'+@member.to_param+'/thesis_guidance_papers/new', :class => 'btn btn-primary' %>
</div>
<% end %>
<div class="pagination pagination-centered">
<%= paginate @writing_thesis_guidances, :params => {:direction => params[:direction], :sort => params[:sort] } %>
</div>
</div>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%= t(:sure?) %></h3>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
</div>
</div>

16
bin/rails Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/personal_thesis_guidance/engine', __FILE__)
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
require "mongoid"
require 'rails/engine/commands'

70
config/locales/en.yml Normal file
View File

@ -0,0 +1,70 @@
en:
module_name:
personal_thesis_guidance: Thesis Guidance
thesis_guidance_paper: Thesis Guidance
personal_thesis_guidance:
merge: Merge
upload: Upload
no_input: No Input
select_class: "——select class——"
search_class: "search class:"
word_to_search: "word to search:"
paper_title : "Paper Title"
associated_project: Associated Project
paper_type : "Paper Type"
number_of_authors: "Number of Authors"
journal_title : "Journal Title"
supervising_teacher : "Supervising Teacher"
degree : "Degree"
graduation_semester : "Graduation Semester"
graduation_year : "Graduation Year"
authors : "Authors"
author: "Author"
author_name: "Author Name"
co-authors: "Co-Authors"
tags : "Tags"
year : "Year"
language : "Language"
isbn : "ISSN(ISBN)"
vol_no : "Vol.No"
issue_no : "Issue.No"
form_to: "Page(s)"
form_to_start : "From"
form_to_end : "To"
total_pages : "Total Pages"
keywords : "Keywords"
abstract : "Abstract"
publication_date : "Date of Publication"
url : "Reference URL"
note : "Note"
level_type : "Level Type"
author_type : "Author Type"
from : "From"
to : "To"
graph_by : "Graph by"
file : "File"
file_name : "File name"
description : "File Description"
graph_by : "Graph By"
frontend:
writing_thesis_guidances: "Thesis Guidance Frontend"
thesis_guidance_type: Journal Name
strict_compare_mode: Strict Compare mode
create_success : "Successfully Create"
update_success : "Successfully Update"
delete_success : "Successfully Delete"
add: "Add"
back: "Back"
delete: "Delete"
edit: "Edit"
nothing: "Nothing"
show: "Show"
sure?: "Are you sure?"
update: "Update"
yes_: "Yes"
no_: "No"
cancel : "Cancel"
save: "Save"
hintText: "Type in a search term"
noResultsText: "No results"
searchingText: "Searching…"

69
config/locales/zh_tw.yml Normal file
View File

@ -0,0 +1,69 @@
zh_tw:
module_name:
personal_thesis_guidance: 論文指導
thesis_guidance_paper: 論文指導
personal_thesis_guidance:
merge: "合併"
upload: "上傳"
no_input: "未輸入"
select_class: "——選取分類——"
search_class: "搜尋類別:"
word_to_search: "關鍵字搜尋:"
associated_project: "所屬計畫案"
number_of_authors: "著作人數"
paper_title : "論文名稱"
journal_title : "期刊名稱"
supervising_teacher : "指導教師"
degree : "學位"
graduation_semester : "畢業學期"
graduation_year : "畢業學年度"
authors : "學生"
author: "作者"
author_name: "作者姓名"
tags : "領域"
year : "年度"
language : "語言"
isbn : "ISSN(ISBN)"
vol_no : "卷數"
issue_no : "期數"
form_to: "頁碼"
form_to_start : "起頁"
form_to_end : "迄頁"
total_pages : "總頁數"
keywords : "關鍵字"
abstract : "摘要"
publication_date : "發表日期"
url : "參考連結"
note : "記事"
level_type : "期刊等級"
author_type : "作者類別"
paper_type: "論文類型"
from : "起"
to : "迄"
graph_by : "Graph by"
file : "檔案"
file_name : "檔案名稱"
description : "描述"
graph_by : "Graph By"
frontend:
writing_thesis_guidances: "論文指導前台"
thesis_guidance_type: 期刊類別
strict_compare_mode: "嚴格比較模式"
create_success : "新增完成!!"
update_success : "更新完成!!"
delete_success : "刪除成功!!"
add: "新增"
back: "返回"
delete: "刪除"
edit: "編輯"
nothing: "無"
show: "顯示"
sure?: "您肯定嗎?"
update: "更新"
yes_: "是"
no_: "否"
cancel : "取消"
save: "儲存"
hintText: "請輸入搜尋關鍵字"
noResultsText: "沒有相關的比對結果"
searchingText: "搜尋中…"

42
config/routes.rb Normal file
View File

@ -0,0 +1,42 @@
Rails.application.routes.draw do
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do
get 'writing_journal_setting' => "thesis_guidance_papers#setting"
get 'thesis_guidance_papers/download_excel_format' => 'thesis_guidance_papers#excel_format'
post 'thesis_guidance_papers/import_from_excel' => 'thesis_guidance_papers#import_from_excel'
resources :thesis_guidance_papers do
collection do
post 'merge_process' => 'thesis_guidance_papers#merge_process'
get 'merge' => 'thesis_guidance_papers#merge'
get 'toggle_hide' => 'thesis_guidance_papers#toggle_hide'
get 'analysis'
get 'analysis_report'
get "download_excel"
end
end
resources :members do
collection do
scope '(:name-:uid)' do
resources :thesis_guidance_papers do
collection do
get 'frontend_setting' => 'thesis_guidance_papers#frontend_setting'
post 'update_frontend_setting' => 'thesis_guidance_papers#update_frontend_setting'
end
end
end
end
end
resources :thesis_guidance_levels
resources :thesis_guidance_paper_author_types
resources :thesis_guidance_paper_types
resources :thesis_guidance_types
resources :thesis_guidance_paper_intros
end
get "/xhr/personal_thesis_guidance/get_fields_for_index" => "personal_thesis_guidances#get_fields_for_index"
post "/xhr/personal_thesis_guidance/save_index_fields" => "personal_thesis_guidances#save_index_fields"
end
end

1
get_rail_path.rb Normal file
View File

@ -0,0 +1 @@
puts Rails.root

View File

@ -0,0 +1,4 @@
require "personal_thesis_guidance/engine"
module PersonalThesisGuidance
end

View File

@ -0,0 +1,38 @@
module PersonalThesisGuidance
class Engine < ::Rails::Engine
initializer "personal_thesis_guidance" do
require File.expand_path('../../../app/models/thesis_guidance_paper', __FILE__)
mp_id_maps = {}
ThesisGuidancePaper.where({'member_profile_id.0'=> {'$exists'=> false}, 'member_profile_id' => {'$ne'=> nil}}).pluck(:id, :member_profile_id).each do |jpv|
mp_id_maps[jpv[1]] = [] if !mp_id_maps[jpv[1]]
mp_id_maps[jpv[1]] << jpv[0]
end
mp_id_maps.each do |mp_id, ids|
ThesisGuidancePaper.where(:id.in => ids).update_all(member_profile_id: [mp_id])
end
OrbitApp.registration "PersonalThesisGuidance",:type=> 'ModuleApp' do
module_label 'module_name.thesis_guidance_paper'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :sort_number => '5', :app_name=>"ThesisGuidancePaper", :intro_app_name=>"ThesisGuidancePaperlIntro",:path=>"/plugin/personal_thesis_guidance/profile",:front_path=>"/profile",:admin_path=>"/admin/thesis_guidance_papers/",:i18n=>'module_name.thesis_guidance_paper', :module_app_name=>'PersonalThesisGuidance', :one_line_title => true, :field_modifiable => true, :analysis => true, :analysis_path => "/admin/thesis_guidance_papers/analysis"
begin
page_custom_option({year: '<%= select_tag "#{f.object_name}[custom_data_field][year][]", options_for_select((1930...(DateTime.now.year+5)).to_a.reverse, (f.object.custom_data_field[:year].to_a rescue [])), {multiple: true} %>'})
page_custom_option({thesis_guidance_type: '<% ThesisGuidanceType.all.each do |thesis_guidance_type| %><label><%= check_box_tag "#{f.object_name}[custom_data_field][thesis_guidance_type][]", thesis_guidance_type.id.to_s, (f.object.custom_data_field[:thesis_guidance_type].include?(thesis_guidance_type.id.to_s) rescue false) %><%= thesis_guidance_type.title %></label><% end %>'})
rescue => e
puts ['there_was_no_page_custom_option',e]
end
version "0.1"
desktop_enabled true
organization "Rulingcom"
author "RD dep"
intro "I am intro"
update_info 'some update_info'
authorizable
frontend_enabled
icon_class_no_sidebar "icons-user"
data_count 1..10
end
end
end
end

View File

@ -0,0 +1,3 @@
module PersonalThesisGuidance
VERSION = "0.0.1"
end

View File

@ -0,0 +1,14 @@
namespace :personal_thesis_guidance do
desc 'set_thesis_guidance_type'
task :set_thesis_guidance_type => :environment do |task,args|
ThesisGuidancePaper.where(:rss2_id.ne=>nil).update_all({"$unset"=>{"thesis_guidance_type_ids"=>""}})
MemberTag.all.each do |mt|
thesis_guidance_type = ThesisGuidanceType.where(:title=>mt.title).first
thesis_guidance_type = ThesisGuidanceType.create(:title_translations=>mt.title_translations) if thesis_guidance_type.nil?
thesis_guidance_type_id = thesis_guidance_type.id
thesis_guidance_paper_ids = ThesisGuidancePaper.where(:member_profile_id.in=>mt.member_profile_ids, :rss2_id.ne=>nil).pluck(:id)
ThesisGuidancePaper.where(:id.in=>thesis_guidance_paper_ids).update_all({"$addToSet"=>{"thesis_guidance_type_ids"=>thesis_guidance_type.id}})
# ThesisGuidanceType.where(:id=>thesis_guidance_type_id).update_all({"$addToSet"=>{"thesis_guidance_paper_ids"=>{"$each"=>thesis_guidance_paper_ids}}})
end
end
end

View File

@ -0,0 +1,14 @@
<table class="table table-hover table-striped projects-index">
<caption><h3>{{widget-title}}</h3></caption>
<thead>
<tr data-level="0" data-list="headers">
<th class="col-md-{{col}}">{{head-title}}</th>
</tr>
</thead>
<tbody data-level="0" data-list="thesis_guidance_papers">
<tr data-level="1" data-list="jps">
<td>{{value}}</td>
</tr>
</tbody>
</table>
{{pagination_goes_here}}

View File

@ -0,0 +1,13 @@
<h3 class="page-module-title">{{page-title}}</h3>
<article>
<div data-level="0" data-list="thesis_guidance_papers">
<h3 class="year">{{year}}</h3>
<div data-level="1" data-list="jps_list">
<h4>{{name}}</h4>
<ul data-level="2" data-list="jps">
<li>{{title}}</li>
</ul>
</div>
</div>
</article>
{{pagination_goes_here}}

View File

@ -0,0 +1,38 @@
<script type="text/javascript">
$( ".selectbox" ).ready(function() {
var option_len = $(".search-widget option").length
for (var i=0;i<option_len;i++){
if($(".search-widget option").eq(i).data('selected')=="selected"){
$(".search-widget option").eq(i).attr('selected','selected')
}
}
});
</script>
<h3>{{widget-title}}</h3>
<div class="search-widget">
<form action="{{url}}" method="get">
<input type="hidden" name="authenticity_token" value="{{csrf_value}}">
{{select_text}}
<select class="selectbox" name="selectbox" data-level="0" data-list="choice">
<option value={{choice_value}} data-selected='{{choice_select}}' >
{{choice_show}}</option>
</select>
{{search_text}}
<input name="keywords" placeholder="Keywords" type="text" value="{{search_value}}">
<button>Go</button>
<a id="filter" style="" href="{{url}}">Clear</a>
</form>
</div>
<table class="table table-hover table-striped personal_thesis_guidance-index">
<thead>
<tr data-level="0" data-list="headers">
<th class="col-md-{{col}}">{{head-title}}</th>
</tr>
</thead>
<tbody data-level="0" data-list="thesis_guidance_papers">
<tr data-level="1" data-list="jps">
<td>{{value}}</td>
</tr>
</tbody>
</table>
{{pagination_goes_here}}

View File

@ -0,0 +1,28 @@
{
"frontend": [
{
"filename" : "index",
"name" : {
"zh_tw" : "1. 列表",
"en" : "1. List"
},
"thumbnail" : "thumb.png"
},
{
"filename" : "index_search1",
"name" : {
"zh_tw" : "2. 列表(含搜尋)",
"en" : "2. List which includes search"
},
"thumbnail" : "thumb.png"
},
{
"filename" : "index_by_author",
"name" : {
"zh_tw" : "3. 作者論文",
"en" : "3. List by Author"
},
"thumbnail" : "thumb.png"
}
]
}

View File

@ -0,0 +1,8 @@
<table class="table table-striped plugin-show-table">
<tbody data-list="plugin_datas" data-level="0">
<tr>
<th class="{{title_class}}">{{title}}</th>
<td class="{{value_class}}">{{value}}</td>
</tr>
</tbody>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,34 @@
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "personal_thesis_guidance/version"
# Describe your gem and declare its dependencies:
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
if bundle_update_flag
app_path = File.expand_path(__dir__)
template_path = ENV['PWD'] + '/app/templates'
all_template = Dir.glob(template_path+'/*/')
puts 'copying module'
all_template.each do |folder|
if folder.split('/')[-1] != 'mobile'
begin
system ('cp -r '+ app_path + '/modules/ ' + folder)
rescue
puts 'error copy'
end
end
end
end
Gem::Specification.new do |s|
s.name = "personal_thesis_guidance"
s.version = PersonalThesisGuidance::VERSION
s.authors = ["Ruling Digital Inc."]
s.email = ["orbit@rulingcom.com"]
s.homepage = "http://www.rulingcom.com"
s.summary = "Thesis Guidances of Members"
s.description = "Thesis Guidances of Members"
s.license = "MIT"
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
end

Some files were not shown because too many files have changed in this diff Show More