Journal Papers,File,Author

This commit is contained in:
Saurabh Bhatia 2014-06-12 18:27:26 +08:00
parent 5ee5a2e648
commit 8700c79e41
81 changed files with 1693 additions and 10 deletions

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

@ -1,2 +1,5 @@
// Place all the behaviors and hooks related to the matching controller here. // Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js. // 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, :journal_paper_authors) %>").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_journal_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, :journal_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();
});
$(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,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,50 @@
class Admin::JournalLevelsController < ApplicationController
before_action :set_journal_level, only: [:edit, :update, :destroy]
def initialize
super
@app_type = 'journal_level'
end
def new
@journal_level = JournalLevel.new
end
def create
@journal_level = JournalLevel.new(journal_level_attributes)
respond_to do |format|
if @journal_level.save
format.js { render 'create_writing_journal_setting' }
end
end
end
def edit
end
def update
respond_to do |format|
if @journal_level.update_attributes(journal_level_attributes)
format.js { render 'update_writing_journal_setting' }
end
end
end
def destroy
@journal_level.destroy
respond_to do |format|
format.js { render 'delete_journal_setting' }
end
end
private
def set_journal_level
@journal_level = JournalLevel.find(params[:id])
end
def journal_level_attributes
params.require(:journal_level).permit! rescue nil
end
end

View File

@ -0,0 +1,50 @@
class Admin::JournalPaperAuthorTypesController < ApplicationController
before_action :set_journal_paper_author_type, only: [:edit, :update, :destroy]
def initialize
super
@app_type = 'journal_paper_author_type'
end
def new
@journal_author_type = JournalPaperAuthorType.new
end
def create
@journal_author_type = JournalPaperAuthorType.new(journal_paper_author_type_attributes)
respond_to do |format|
if @journal_author_type.save
format.js { render 'create_writing_journal_setting' }
end
end
end
def edit
end
def update
respond_to do |format|
if @journal_author_type.update_attributes(journal_paper_author_type_attributes)
format.js { render 'update_writing_journal_setting' }
end
end
end
def destroy
@journal_author_type.destroy
respond_to do |format|
format.js { render 'delete_journal_setting' }
end
end
private
def set_journal_paper_author_type
@journal_author_type = JournalPaperAuthorType.find(params[:id])
end
def journal_paper_author_type_attributes
params.require(:journal_paper_author_type).permit! rescue nil
end
end

View File

@ -0,0 +1,50 @@
class Admin::JournalPaperTypesController < ApplicationController
before_action :set_journal_paper_type, only: [:edit, :update, :destroy]
def initialize
super
@app_type = 'journal_paper_type'
end
def new
@journal_paper_type = JournalPaperType.new
end
def create
@journal_paper_type = JournalPaperType.new(journal_paper_type_attributes)
respond_to do |format|
if @journal_paper_type.save
format.js { render 'create_writing_journal_setting' }
end
end
end
def edit
end
def update
respond_to do |format|
if @journal_paper_type.update_attributes(journal_paper_type_attributes)
format.js { render 'update_writing_journal_setting' }
end
end
end
def destroy
@journal_paper_type.destroy
respond_to do |format|
format.js { render 'delete_journal_setting' }
end
end
private
def set_journal_paper_type
@journal_paper_type = JournalPaperType.find(params[:id])
end
def journal_paper_type_attributes
params.require(:journal_paper_type).permit! rescue nil
end
end

View File

@ -1,4 +1,188 @@
class Admin::JournalPapersController < ApplicationController class Admin::JournalPapersController < OrbitMemberController
before_action :set_journal_paper, only: [:show, :edit , :update, :destroy]
before_action :get_plugins, only: [:index, :writing_journal_setting, :new, :create, :edit, :update]
before_action :set_types, only: [:writing_journal_setting, :new, :edit, :create]
def index def index
@writing_journals = JournalPaper.all
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @writing_journals }
end
end
def show
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @journal_paper }
end end
end end
def new
@journal_paper = JournalPaper.new
@members_data = JournalPaper.member_data
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @journal_paper }
end
end
def edit
@journal_paper = JournalPaper.find(params[:id])
@members_data = JournalPaper.member_data
end
def create
@journal_paper = JournalPaper.new(journal_paper_attributes)
respond_to do |format|
if @journal_paper.save
format.html { redirect_to admin_journal_papers_path }
format.xml { render :xml => @journal_paper, :status => :created, :location => @journal_paper }
else
format.html { render :action => "new" }
format.xml { render :xml => @journal_paper.errors, :status => :unprocessable_entity }
end
end
end
def update
@writing_journal = JournalPaper.find(params[:id])
@journal_paper_authors = @writing_journal.journal_paper_authors
respond_to do |format|
if @writing_journal.update_attributes(journal_paper_attributes)
format.html { redirect_to admin_journal_papers_path }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @writing_journal.errors, :status => :unprocessable_entity }
end
end
end
def destroy
@journal_paper.destroy
respond_to do |format|
format.html { redirect_to(admin_journal_papers_url) }
# format.xml { head :ok }
format.js
end
end
def delete
end
def writing_journal_setting
@set_level_type = JournalLevel.new(display: 'List')
@level_type_url = admin_journal_papers_path
@set_author_type = JournalPaperAuthorType.new(display: 'List')
@author_type_url = admin_journal_papers_path
@set_paper_type = JournalPaperType.new(display: 'List')
@paper_type_url = admin_journal_papers_path
end
def add_level
@set_level_type = JournalLevel.new(display: 'List')
@level_type_url = admin_journal_levels_path
@set_level_type.id = params[:id]
respond_to do |format|
format.js
end
end
def edit_level
@set_level_type = JournalLevel.find(params[:journal_paper_id])
@level_type_url = admin_journal_level_path(@set_level_type)
respond_to do |format|
format.js
end
end
def add_author_type
@set_author_type = JournalPaperAuthorType.new(display: 'List')
@author_type_url = admin_journal_paper_author_types_path
@set_author_type.id = params[:id]
respond_to do |format|
format.js
end
end
def edit_author_type
@set_author_type = JournalPaperAuthorType.find(params[:journal_paper_id])
@author_type_url = admin_journal_paper_author_type_path(@set_author_type)
respond_to do |format|
format.js
end
end
def add_paper_type
@set_paper_type = JournalPaperType.new(:display => 'List')
@paper_type_url = admin_journal_paper_types_path
@set_paper_type.id = params[:id]
respond_to do |format|
format.js
end
end
def edit_paper_type
@set_paper_type = JournalPaperType.find(params[:journal_paper_id])
@paper_type_url = admin_journal_paper_type_path(@set_paper_type)
respond_to do |format|
format.js
end
end
def data_share
if params[:ids]
@writing_journals = JournalPaper.any_in(_id: params[:ids])
@writing_journals.each do |writing_journal|
writing_journal.is_hidden = params[:disable]
writing_journal.save
end
end
respond_to do |format|
format.html { redirect_to(admin_member_path(id: params[:member_profile_id],show_plugin_profile: "JournalPaper")) }
format.json { render json: {"success"=>true}.to_json}
end
end
private
def set_journal_paper
@journal_paper = JournalPaper.find(params[:id])
end
def journal_paper_attributes
params.require(:journal_paper).permit! rescue nil
end
def get_plugins
@plugins = OrbitApp::Plugin::Registration.all rescue nil
end
def set_types
@journal_levels = JournalLevel.all
@author_types = JournalPaperAuthorType.all
@paper_types = JournalPaperType.all
end
end

View File

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

View File

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

View File

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

View File

@ -0,0 +1,20 @@
class JournalLevel
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include OrbitCoreLib::ObjectDisable
field :key, type: String
field :title, type: String, localize: true
has_and_belongs_to_many :journal_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

@ -1,6 +1,7 @@
class JournalPaper class JournalPaper
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include OrbitModel::Status include OrbitModel::Status
@ -17,11 +18,72 @@ class JournalPaper
field :total_pages, type: String field :total_pages, type: String
field :keywords, type: String field :keywords, type: String
field :abstract, type: String field :abstract, type: String
field :publication_date, type: Date field :publication_date, type: DateTime
field :url, type: String field :url, type: String
field :note, type: String field :note, type: String
paginates_per 10 paginates_per 10
#relations
belongs_to :member_profile belongs_to :member_profile
belongs_to :journal_paper_type
has_and_belongs_to_many :journal_levels
has_many :journal_paper_files, autosave: true, dependent: :destroy
accepts_nested_attributes_for :journal_paper_files
has_and_belongs_to_many :journal_paper_authors
accepts_nested_attributes_for :journal_paper_authors
before_validation :add_http
validates :paper_title, presence: true
def create_link
title = []
title << self.member_profile.name if self.member_profile_id.present?
title << (!self.journal_levels.blank? ? "#{self.journal_paper_authors.collect{|j| j.name}.join(', ')}" : nil)
if !self.publication_date.nil?
pd = self.publication_date.strftime("%Y-%m-%d").split('-')
title << pd[0]
end
title << self.paper_title if self.paper_title.present?
title << self.journal_title if self.journal_title.present?
title << self.vol_no if (self.vol_no.present? && self.vol_no != "0")
title << self.issue_no if (self.issue_no.present? && self.issue_no != "0")
title << "pp"+self.form_to_start+"-"+self.form_to_end if (self.form_to_start.present? && self.form_to_start != "0")
title << ( !self.journal_levels.blank? ? "(#{self.journal_levels.collect{|x| x.title}.join(', ')})" : nil)
title.join(', ')
end
def authors
authors = []
authors << self.member_profile.name if self.member_profile_id.present?
authors << (!self.journal_levels.blank? ? "#{self.journal_paper_authors.collect{|j| j.name}.join(', ')}" : nil)
authors.join(', ')
end
def self.member_data
members = MemberProfile.all
member_data = []
members.each do |m|
member_data << {"memberId" => m.id.to_s, "memberName" => m.name}
end
member_data.to_json
end
protected
def add_http
unless self.url.blank? || self.url[/^http:\/\//] || self.url[/^https:\/\//]
self.url = 'http://' + self.url
end
end
def clean_checkboxs
self.tagged_ids.delete('')
self.journal_paper_author_type_ids.delete('')
self.journal_level_ids.delete('')
end
end end

View File

@ -0,0 +1,17 @@
class JournalPaperAuthor
include Mongoid::Document
include Mongoid::Timestamps
field :name, type: String, localize: true
field :email, type: String
has_and_belongs_to_many :journal_papers
has_and_belongs_to_many :journal_paper_author_types
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/
validates :email, format: { with: VALID_EMAIL_REGEX },
allow_blank: true,
uniqueness: { case_sensitive: false }
before_save { |author| author.email = email.downcase if not author.email.nil?}
end

View File

@ -0,0 +1,11 @@
class JournalPaperAuthorType
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include OrbitCoreLib::ObjectDisable
field :key, type: String
field :title, type: String, localize: true
has_and_belongs_to_many :journal_paper_authors
end

View File

@ -0,0 +1,11 @@
class JournalPaperFile
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
field :description, type: String, localize: true
field :title, type: String, localize: true
mount_uploader :journal_file, AssetUploader
belongs_to :journal_paper
end

View File

@ -0,0 +1,11 @@
class JournalPaperType
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include OrbitCoreLib::ObjectDisable
field :key, type: String
field :title, type: String, localize: true
has_many :journal_papers
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,372 @@
<% # 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" %>
<% 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 %>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<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>
<li>
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<% if !params[:user_id].blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
</div>
<% end %>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.year") %></label>
<div class="controls">
<%= select_year((@journal_paper.year ? @journal_paper.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'journal_paper[year]', :class => "span1"} ) %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.language") %></label>
<div class="controls">
<%= f.select :language, @site_valid_locales, :prompt => 'Select', :class => "span3" %>
</div>
</div>
<!-- level_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.level_type") %></label>
<div class="controls">
<% @journal_levels.each do |level_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'journal_paper[journal_level_ids][]', level_type.id, @journal_paper.journal_level_ids.include?(level_type.id)%>
<%= level_type.title %>
<%= hidden_field_tag 'journal_paper[journal_level_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.paper_type") %></label>
<div class="controls">
<%= f.select :journal_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]}, :class => "span3" %>
</div>
</div>
<!-- authors-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_journal.author") %></label>
<div class="controls">
<%= f.text_field :member_profile_id, id: "search", autocomplete: "off", data: { provide: "typeahead"}, class: "input-block-level", value: (@journal_paper.member_profile.name rescue nil), placeholder: t("personal_journal.author")%>
<%= f.hidden_field :member_profile_id, value: (@journal_paper.member_profile_id ? @journal_paper.member_profile_id : ""), id: "member_value" %>
</div>
</div>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'journal_paper[journal_paper_author_type_ids][]', author_type.id, @journal_paper.journal_paper_author_ids.include?(author_type.id)%>
<%= author_type.title %>
<%= hidden_field_tag 'journal_paper[journal_paper_author_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- vol_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.vol_no") %></label>
<div class="controls">
<%= f.text_field :vol_no %>
</div>
</div>
<!-- issue_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.issue_no") %></label>
<div class="controls">
<%= f.text_field :issue_no %>
</div>
</div>
<!-- form_to -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.form_to") %></label>
<div class="controls">
<%= f.text_field :form_to_start, :class=>'span1' %> ~ <%= f.text_field :form_to_end, :class=>'span1' %>
</div>
</div>
<!-- total_pages -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.total_pages") %></label>
<div class="controls">
<%= f.text_field :total_pages %>
</div>
</div>
<!-- isbn -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.isbn") %></label>
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publication_date, :no_label => true %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- abstract -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.abstract") %></label>
<div class="controls">
<%= f.text_area :abstract, rows: 2, class: "input-block-level" %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @journal_paper.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<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 %>"><%= I18nVariable.from_locale(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" : '' %>">
<!-- paper_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_journal.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_journal.paper_title"), value: (@journal_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_journal.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_journal.journal_title"), value: (@journal_paper.journal_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.co-authors") %></label>
<div class="controls">
<% if @journal_paper && !@journal_paper.journal_paper_authors.blank? %>
<div class="exist">
<% @journal_paper.journal_paper_authors.each_with_index do |author, i| %>
<%= f.fields_for :journal_paper_authors, author do |f| %>
<%= render :partial => 'form_author', :object => author, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target-box">
</div>
<p class="add-btn-box">
<a id="add_author" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if @journal_paper && !@journal_paper.journal_paper_files.blank? %>
<div class="exist">
<% @journal_paper.journal_paper_files.each_with_index do |writing_journal_file, i| %>
<%= f.fields_for :journal_paper_files, writing_journal_file do |f| %>
<%= render :partial => 'form_file', :object => writing_journal_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', @journal_paper.journal_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>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<%= render 'author_autocomplete'%>
<script>
$(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_journal_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, :journal_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();
});
$(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();
}
});
});
</script>
<script>
$(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, :journal_paper_authors) %>").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();
}
});
});
</script>
<% end %>

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 :_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.journal_file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_file.title, form_file.journal_file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.title} %>
<% 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 :journal_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.journal_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,34 @@
<% # encoding: utf-8 %>
<%= form_for(@set_level_type, remote: true, url: @level_type_url) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= (@set_level_type.new_record? ? 'Add 等級' : 'Edit 等級') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'control-label', :value => (@set_level_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'journal_paper[journal_level]', @set_level_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,15 @@
<tr id="<%= dom_id writing_journal %>" class="with_action">
<td class="span1"><%= writing_journal.year %></td>
<td class="span1">
<%= link_to writing_journal.create_link %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('edit'), edit_admin_journal_paper_path(writing_journal) %></li>
<li><%= link_to t(:delete_), admin_journal_paper_path(id: writing_journal.id), method: :delete, remote: true, data: { confirm: 'Are you sure?' } %></li>
</ul>
</div>
</td>
<td class="span1"><%= writing_journal.authors%></td>
</tr>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,15 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(site_id: current_site.id), :icon => 'icons-users', :side_bar_content => 'admin/members/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/personal_plugins/plugin_list' %>
</div>
<%= form_for @journal_paper, url: admin_journal_paper_path(@journal_paper), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

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

View File

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

View File

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

View File

@ -1,2 +1,31 @@
<h1>Admin::JournalPapers#index</h1> <% content_for :side_bar do %>
<p>Find me in app/views/admin/journal_papers/index.html.erb</p> <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(site_id: current_site.id), :icon => 'icons-users', :side_bar_content => 'admin/members/side_bar'} %>
<% end %>
<div class="subnav">
<%= render 'admin/personal_plugins/plugin_list' %>
</div>
<table class="table main-list">
<thead>
<tr>
<th class="span1"><%= t('personal_journal.year') %></th>
<th class="span7"><%= t('module_name.personal_journal') %></th>
<th class="span1"><%= t('personal_journal.authors') %></th>
</tr>
</thead>
<tbody id="tbody_writing_journals" class="sort-holder">
<%= render :partial => 'writing_journal', :collection => @writing_journals %>
</tbody>
</table>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_writing_journal_setting_path, :class => 'btn btn-primary pull-right' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_admin_journal_paper_path, :class => 'btn btn-primary pull-right' %>
</div>
<div class="pagination pagination-centered">
</div>
</div>

View File

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

View File

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

View File

@ -0,0 +1,15 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(site_id: current_site.id), :icon => 'icons-users', :side_bar_content => 'admin/members/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/personal_plugins/plugin_list' %>
</div>
<%= form_for @journal_paper, url: admin_journal_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,14 @@
<% if !@journal_level_type.blank? %>
$("#myModal1").modal('hide');
$("#<%= dom_id @journal_level_type %>").replaceWith("<%= j render :partial => 'list_level_type', :collection => [@journal_level_type] %>");
<% end %>
<% if !@journal_author_type.blank? %>
$("#myModal2").modal('hide');
$("#<%= dom_id @journal_author_type %>").replaceWith("<%= j render :partial => 'list_author_type', :collection => [@journal_author_type] %>");
<% end %>
<% if !@journal_paper_type.blank? %>
$("#myModal3").modal('hide');
$("#<%= dom_id @journal_paper_type %>").replaceWith("<%= j render :partial => 'list_paper_type', :collection => [@journal_paper_type] %>");
<% end %>

View File

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

View File

@ -0,0 +1,107 @@
<% 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 %>
<%
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
if @member && @member.user.is_admin?
@writing_journals = JournalPaper.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
else
@writing_journals = JournalPaper.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
end
%>
<% if current_user.is_admin? %>
<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 => data_share_admin_journal_papers_path(member_profile_id: params[:id], disable: 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_admin_journal_papers_path(member_profile_id: params[:id], disable: 'false') ) %>
</div>
</div>
<% end -%>
<table class="table table-condensed table-striped main-list">
<thead>
<tr>
<% if current_user.is_admin? %>
<th><input type="checkbox" /></th>
<% end -%>
<th class="span1"><%= t('personal_journal.year') %></th>
<th><%= t('module_name.personal_journal') %></th>
<% if not @user%>
<th><%= t('personal_journal.authors') %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @writing_journals.each do |writing_journal| %>
<tr id="<%= dom_id writing_journal %>" class="<%= writing_journal.is_hidden ? "checkHide" : "" %>">
<% if is_admin? %>
<td>
<%= check_box_tag 'to_change[]', writing_journal.id.to_s, false, :class => "list-check" %>
</td>
<% end -%>
<td><%= writing_journal.year %></td>
<td>
<%= link_to writing_journal.create_link, admin_journal_paper_path(writing_journal) %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('edit'), edit_admin_journal_paper_path(writing_journal, member_profile_id: @member.id) %></li>
<li><%= link_to t(:delete_), admin_journal_paper_path(id: writing_journal.id, member_profile_id: @member.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
</ul>
</div>
</td>
<td><%= writing_journal.authors %></td>
</tr>
<% end %>
</tbody>
</table>
<% if current_user.is_admin? %>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_admin_journal_paper_path(member_profile_id: @member.id), :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
<% end %>
<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>

View File

@ -5,6 +5,8 @@ en:
paper_title : "Paper Title" paper_title : "Paper Title"
journal_title : "Journal Title" journal_title : "Journal Title"
authors : "Authors" authors : "Authors"
author: "Author"
co-authors: "Co-Authors"
tags : "Tags" tags : "Tags"
year : "Year" year : "Year"
language : "Language" language : "Language"

View File

@ -5,6 +5,7 @@ zh_tw:
paper_title : "論文名稱" paper_title : "論文名稱"
journal_title : "期刊名稱" journal_title : "期刊名稱"
authors : "作者" authors : "作者"
author: "作者"
tags : "領域" tags : "領域"
year : "年度" year : "年度"
language : "語言" language : "語言"

View File

@ -1,9 +1,23 @@
Rails.application.routes.draw do Rails.application.routes.draw do
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do namespace :admin do
resources :journal_papers match 'writing_journal_setting' => "journal_papers#writing_journal_setting" ,as: :writing_journal_setting, via: [:get]
resources :journal_papers do
collection do
get 'delete'
get 'data_share'
end
match "add_level" => "journal_papers#add_level" ,as: :add_level, via: [:get, :post]
match "edit_level" => "journal_papers#edit_level" ,as: :edit_level, via: [:get, :post]
match "add_author_type" => "journal_papers#add_author_type" ,as: :add_author_type, via: [:get, :post]
match "edit_author_type" => "journal_papers#edit_author_type" ,as: :edit_author_type, via: [:get, :post]
match "add_paper_type" => "journal_papers#add_paper_type" ,as: :add_paper_type, via: [:get, :post]
match "edit_paper_type" => "journal_papers#edit_paper_type" ,as: :edit_paper_type, via: [:get, :post]
end
resources :journal_levels
resources :journal_paper_author_types
resources :journal_paper_types
end end
end end
end end

View File

@ -4,7 +4,7 @@ module PersonalJournal
OrbitApp.registration "PersonalJournal",:type=> 'ModuleApp' do OrbitApp.registration "PersonalJournal",:type=> 'ModuleApp' do
module_label 'module_name.personal_journal' module_label 'module_name.personal_journal'
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :sort_number => '5', :app_name=>"JournalPaper", :intro_app_name=>"PersonalJournalIntro",:path=>"/plugin/profile",:front_path=>"/profile",:admin_path=>"/admin/writing_journals",:i18n=>'module_name.personal_journal' personal_plugin :enable => true, :sort_number => '5', :app_name=>"JournalPaper", :intro_app_name=>"PersonalJournalIntro",:path=>"/plugin/journal_paper/profile",:front_path=>"/profile",:admin_path=>"/admin/journal_papers/",:i18n=>'module_name.personal_journal'
version "0.1" version "0.1"
organization "Rulingcom" organization "Rulingcom"

View File

@ -17,6 +17,6 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"] s.test_files = Dir["test/**/*"]
# s.add_dependency "rails", "4.1.0.rc2" s.add_dependency "rails", "4.1.0.rc2"
# s.add_dependency "mongoid", "4.0.0.beta2" s.add_dependency "mongoid", "4.0.0.beta2"
end end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class Admin::JournalLevelsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class Admin::JournalPaperAuthorTypesControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class Admin::JournalPaperTypesControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end

9
test/fixtures/journal_levels.yml vendored Normal file
View File

@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
key: MyString
title: MyString
two:
key: MyString
title: MyString

View File

@ -0,0 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
title: MyString
two:
title: MyString

View File

@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
email: MyString
two:
name: MyString
email: MyString

11
test/fixtures/journal_paper_files.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
description: MyString
should_destroy: false
title: MyString
two:
description: MyString
should_destroy: false
title: MyString

9
test/fixtures/journal_paper_types.yml vendored Normal file
View File

@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
key: MyString
title: MyString
two:
key: MyString
title: MyString

View File

@ -0,0 +1,4 @@
require 'test_helper'
class Admin::JournalLevelsHelperTest < ActionView::TestCase
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class Admin::JournalPaperAuthorTypesHelperTest < ActionView::TestCase
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class Admin::JournalPaperTypesHelperTest < ActionView::TestCase
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class JournalLevelTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class JournalPaperAuthorTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class JournalPaperAuthorTypeTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class JournalPaperFileTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class JournalPaperTypeTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end