Orbit PersonalJournal Module

This commit is contained in:
Manson Wang 2014-01-15 18:52:45 +08:00
parent fa3c63a095
commit e5f74f6a06
136 changed files with 4537 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/tmp/

17
Gemfile Normal file
View File

@ -0,0 +1,17 @@
source "http://rubygems.org"
# Declare your gem's dependencies in personal_journal.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# jquery-rails is used by the dummy application
gem "jquery-rails"
# 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 'ruby-debug19', :require => 'ruby-debug'

20
MIT-LICENSE Normal file
View File

@ -0,0 +1,20 @@
Copyright 2012 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 @@
= PersonalJournal
This project rocks and uses MIT-LICENSE.

39
Rakefile Normal file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'PersonalJournal'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
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 @@
//= require_tree ./personal_journal/desktop

View File

@ -0,0 +1,151 @@
orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // this init journal papers
this.initializeJournalPapers.formCallback = function(data){
if(data.success){
o.notify(data.msg,"success");
o.sub_menu_item($("div[content-type=menu] a").eq(0));
}else{
o.notify(data.msg,"alert");
}
}
this.initializeJournalPapers.list = function(){ // to open list part in journal papers page
var journalData;
var bindHandlers = function(){ // to bind handlers for list page
}
bindHandlers();
var bindSecondaryHandlers = function(){
$("#journal_p div#paper_list a.icon-check-empty").click(function(){
if($(this).hasClass("icon-check-empty")){
$(this).switchClass("icon-check-empty","icon-check",0);
} else if($(this) .hasClass("icon-check")) {
$(this).switchClass("icon-check","icon-check-empty",0);
} else if($(this).hasClass("icon-star")){
$(this).removeClass("icon-star").addClass("icon-star-empty");
} else if($(this).hasClass("icon-star-empty")){
$(this).removeClass("icon-star-empty").addClass("icon-star");
}
return false;
})
}
o.enableSharing("div.share_mode");
}
this.initializeJournalPapers.paperDelete = function(data,dom){
var parent = dom.parent().parent().parent();
if(data.success){
parent.hide("slide",function(){parent.remove();});
o.notify(data.msg,"success");
}
}
this.initializeJournalPapers.cancelpaper = function(){
o.highlight_sub_menu_item(0);
}
var uploadFiles = function(){
$('#add_plugin_file a.add').click(function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_writing_journal_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
var x = get_html(old_id,new_id);
var newfield = $(x);
$(this).parents('table').append(newfield);
newfield.find('.action a.delete').click(function(){
newfield.remove();
});
return false;
});
$('.action a.remove_existing_record').click(function(){
$(this).toggleClass("color-red",function(){
if($(this).hasClass('color-red')){
$(this).next('.should_destroy').attr('value', 1);
}else{
$(this).next('.should_destroy').removeAttr('value');
}
})
});
}
this.initializeJournalPapers.editpaper = function(){
o.highlight_sub_menu_item(1);
uploadFiles();
o.enablelanguageSelect();
}
this.initializeJournalPapers.addpaper = function(){ // to open add pages in journal papers page
uploadFiles();
o.enablelanguageSelect();
}
this.initializeJournalPapers.brief = function(){
o.enablelanguageSelect();
$("textarea.editor").ckeditor({
height: 300,
width: $(".overview").width() - 20
});
}
this.initializeJournalPapers.journal = function(){ // to open add pages in journal papers page
var bindHandlers = function(){ // to bind handlers for add page
}
bindHandlers();
}
this.initializeJournalPapers.coAuthorformCallback = function(data){
if(data.success){
o.notify(data.msg,"success");
o.sub_menu_item($("div[content-type=menu] a").eq(3));
}else{
o.notify(data.msg,"alert");
}
}
this.initializeJournalPapers.coauthor = function(){ // to open add pages in coauthor page
var bindHandlers = function(){ // to bind handlers for add page
}
bindHandlers();
}
this.initializeJournalPapers.coauthorRelationForm = function(data){
if(data.success){
o.notify(data.msg,"success");
$("#co_author_relation_table").html(data.newvalue);
}else{
o.notify(data.msg,"alert");
}
}
this.initializeJournalPapers.coauthorRelationEditForm = function(data){
if(data.success){
o.notify(data.msg,"success");
var x = o.layout_data.generate_layout_html(data.newvalue);
$("div[container=true] div.overview").html(x.markup);
}else{
o.notify(data.msg,"alert");
}
}
this.initializeJournalPapers.allnone = function(d,o){
switch(o.attr("href")){
case "all":
$("div.overview a.icon-check-empty").removeClass("icon-check-empty").addClass("icon-check");
break;
case "none":
$("div.overview a.icon-check").removeClass("icon-check").addClass("icon-check-empty");
break;
}
}
this.initializeJournalPapers.allnone = function(d,o){
switch(o.attr("href")){
case "all":
$("div.overview a.icon-check-empty").removeClass("icon-check-empty").addClass("icon-check");
break;
case "none":
$("div.overview a.icon-check").removeClass("icon-check").addClass("icon-check-empty");
break;
}
}
};

View File

@ -0,0 +1,109 @@
/* Journal Papers */
[page-name="journal_p_list"] .list_t_item .inner {
padding-left: 30px; }
[page-name="journal_p_list"] .list_item_action {
font-size: 12px;
float: left;
margin-left: -30px; }
[page-name="journal_p_list"] .list_item_action a {
display: block;
width: 20px;
height: 20px;
line-height: 20px;
margin: 1px 1px 6px 1px;
font-size: 20px; }
[page-name="journal_p_list"] .list_item_action .icon-star-empty, [page-name="journal_p_list"] .list_item_action .icon-check-empty {
color: #dddddd;
-webkit-transition: color 0.3s ease;
-moz-transition: color 0.3s ease;
transition: color 0.3s ease; }
[page-name="journal_p_list"] .list_item_action .icon-star-empty:hover, [page-name="journal_p_list"] .list_item_action .icon-check-empty:hover {
color: #aaaaaa; }
[page-name="journal_p_list"] .list_item_action .icon-star {
color: #faa732; }
[page-name="journal_p_list"] .list_item_action .icon-check {
color: #333; }
[page-name="journal_p_list"] .file_view .list_t_des {
overflow: hidden; }
[page-name="journal_p_list"] .file_view .file {
float: left;
width: 120px;
height: 50px;
padding: 6px;
margin: 1px;
position: relative;
-webkit-box-sizing: border-box;
/* webkit */
-khtml-box-sizing: border-box;
/* konqueror */
-moz-box-sizing: border-box;
/* firefox */
-ms-box-sizing: border-box;
/* ie */
box-sizing: border-box;
/* css3 */ }
[page-name="journal_p_list"] .file_view .file:hover {
background-color: #c4c4c4; }
[page-name="journal_p_list"] .file_view .file img {
width: 38px;
height: 38px;
position: absolute;
left: 6px;
top: 6px; }
[page-name="journal_p_list"] .file_view .file .filetitle {
display: block;
width: 100%;
height: 38px;
padding-left: 40px;
overflow: hidden;
-webkit-box-sizing: border-box;
/* webkit */
-khtml-box-sizing: border-box;
/* konqueror */
-moz-box-sizing: border-box;
/* firefox */
-ms-box-sizing: border-box;
/* ie */
box-sizing: border-box;
/* css3 */ }
/* Journal Journal list */
[page-name="journal_p_journal"] .datalist_item .inner {
padding-left: 30px; }
[page-name="journal_p_journal"] .list_item_action {
font-size: 12px;
float: left;
margin-left: -30px; }
[page-name="journal_p_journal"] .list_item_action i {
color: #999;
font-size: 20px;
display: block;
width: 20px;
height: 20px;
line-height: 20px;
margin: 1px 1px 6px 1px; }
[page-name="journal_p_journal"] .list_t_desc {
font-family: Arial, sans-serif;
font-size: 12px;
color: #999; }
/* Journal Co-Author */
[page-name="journal_p_coauthor"] .list_t_item {
height: 110px; }
[page-name="journal_p_coauthor"] .info {
font-family: Arial, sans-serif; }
[page-name="journal_p_coauthor"] .info li {
margin-bottom: 8px;
color: #999; }
[page-name="journal_p_coauthor"] .info .name {
font-size: 18px;
line-height: 24px;
color: #333; }
/* Journal Co-Author Relationship*/
[page-name="journal_p_coauthor_relation"] .edit_co_author_relation {
/*margin-left: -10px;*/ }
[page-name="journal_p_coauthor_relation"] .form_space {
margin-bottom: 10px;
font-size: 18px;
font-family: Arial, sans-serif; }

View File

@ -0,0 +1,124 @@
@import "desktop-helper";
/* Journal Papers */
[page-name="journal_p_list"] {
.list_t_item .inner { padding-left: 30px; }
.list_item_action {
font-size: 12px;
float: left;
margin-left: -30px;
a {
display: block;
width: 20px;
height: 20px;
line-height: 20px;
margin: 1px 1px 6px 1px;
font-size: 20px;
}
.icon-star-empty, .icon-check-empty {
color: $gray;
@include transition-type(color,0.3);
&:hover {
color: darken($gray, 20%);
}
}
.icon-star { color: #faa732; }
.icon-check { color: #333; }
}
.file_view {
.list_t_des {
overflow: hidden;
}
.file {
float: left;
width: 120px;
height: 50px;
padding: 6px;
margin: 1px;
position: relative;
@include box-sizing;
&:hover {
background-color: darken($gray, 10%);
}
img {
width: 38px;
height: 38px;
position: absolute;
left: 6px;
top: 6px;
}
.filetitle {
display: block;
width: 100%;
height: 38px;
padding-left: 40px;
overflow: hidden;
@include box-sizing;
}
}
}
}
/* Journal Journal list */
[page-name="journal_p_journal"] {
.datalist_item .inner {
padding-left: 30px;
}
.list_item_action {
font-size: 12px;
float: left;
margin-left: -30px;
}
.list_item_action i {
color: #999;
font-size: 20px;
display: block;
width: 20px;
height: 20px;
line-height: 20px;
margin: 1px 1px 6px 1px;
}
.list_t_desc {
font-family: Arial, sans-serif;
font-size: 12px;
color: #999;
}
}
/* Journal Co-Author */
[page-name="journal_p_coauthor"] {
.list_t_item {
height: 110px;
}
.list_item_function {}
.list_item_function a {}
.info {
font-family: Arial, sans-serif;
}
.info li {
margin-bottom: 8px;
color: #999;
}
.info .name {
font-size: 18px;
line-height: 24px;
color: #333;
}
}
/* Journal Co-Author Relationship*/
[page-name="journal_p_coauthor_relation"]{
.edit_co_author_relation {
/*margin-left: -10px;*/
}
.form_space {
margin-bottom: 10px;
font-size: 18px;
font-family: Arial, sans-serif;
}
}

0
app/controllers/.gitkeep Normal file
View File

View File

@ -0,0 +1,23 @@
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale
# Set I18n.locale
def set_locale
# update session if passed
session[:locale] = params[:locale] if params[:locale]
# set locale based on session or default
begin
# check if locale is valid for non site pages
if !VALID_LOCALES.include?(session[:locale])
I18n.locale = I18n.default_locale
else
I18n.locale = session[:locale]
end
rescue
I18n.locale = I18n.default_locale
end
end
end

View File

@ -0,0 +1,8 @@
class Panel::PersonalJournal::BackEnd::JournalAuthorTypesController < Panel::PersonalJournal::BackEnd::WritingJournalCategorysController
def initialize
super
@app_type = 'journal_author_type'
end
end

View File

@ -0,0 +1,8 @@
class Panel::PersonalJournal::BackEnd::JournalLevelTypesController < Panel::PersonalJournal::BackEnd::WritingJournalCategorysController
def initialize
super
@app_type = 'journal_level_type'
end
end

View File

@ -0,0 +1,8 @@
class Panel::PersonalJournal::BackEnd::JournalPaperTypesController < Panel::PersonalJournal::BackEnd::WritingJournalCategorysController
def initialize
super
@app_type = 'journal_paper_type'
end
end

View File

@ -0,0 +1,10 @@
class Panel::PersonalJournal::BackEnd::PersonalJournalIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'personal_journal_intro'
@app_type_name = 'personal_journal'
@reback_name = 'WritingJournal'
end
end

View File

@ -0,0 +1,143 @@
class Panel::PersonalJournal::BackEnd::WritingJournalCategorysController < OrbitBackendController
include OrbitControllerLib::DivisionForDisable
open_for_manager :except => [:indx]
def index
get_types
@writing_journal_categorys = @types.all
@writing_journal_category = @types.new(:display => 'List')
# @url = panel_personal_journal_back_end_writing_journal_categorys_path
@url = eval("panel_personal_journal_back_end_#{@app_type}s_path")
respond_to do |format|
format.html # index.html.erb
format.js
end
end
# GET /writing_journals/1
# GET /writing_journals/1.xml
def show
get_types
@writing_journal_category = @types.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js
end
end
# GET /writing_journals/new
# GET /writing_journals/new.xml
def new
get_types
@writing_journal_category = @types.new(:display => 'List')
@verb = :post
respond_to do |format|
format.html # new.html.erb
format.js
end
end
# GET /writing_journals/1/edit
def edit
get_types
@writing_journal_category = @types.find(params[:id])
# @url = panel_personal_journal_back_end_writing_journal_category_path(@writing_journal_category)
# @url = eval("panel_personal_journal_back_end_#{@app_type}_path(@writing_journal_category)")
@url = polymorphic_path([:panel, :personal_journal, :back_end, @writing_journal_category])
@verb = :put
respond_to do |format|
format.html
format.js
end
end
# POST /writing_journals
# POST /writing_journals.xml
def create
get_types
@writing_journal_category = @types.new(params[:writing_journal_category])
respond_to do |format|
if @writing_journal_category.save
format.html { redirect_to(panel_personal_journal_back_end_writing_journal_categorys_url, :notice => t('writing_journal_category.create_writing_journal_category_success')) }
format.js
else
format.html { render :action => "new" }
format.js { render action: "new" }
end
end
end
# PUT /writing_journals/1
# PUT /writing_journals/1.xml
def update
get_types
@writing_journal_category = @types.find(params[:id])
# debugger
# @url = panel_personal_journal_back_end_writing_journal_category_path(@writing_journal_category)
# @url = eval("panel_personal_journal_back_end_#{@app_type}_path(#{@writing_journal_category})")
@url = polymorphic_path([:panel, :personal_journal, :back_end, @writing_journal_category])
respond_to do |format|
if @writing_journal_category.update_attributes(params[:writing_journal_category])
format.html { redirect_to(panel_personal_journal_back_end_writing_journal_categorys_url, :notice => t('writing_journal_category.update_writing_journal_category_success')) }
# format.xml { head :ok }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
end
end
end
# DELETE /writing_journals/1
# DELETE /writing_journals/1.xml
def destroy
get_types
@writing_journal_category = @types.find(params[:id])
@writing_journal_category.disable = @writing_journal_category.disable ? false : true
if @writing_journal_category.save!
respond_to do |format|
format.html { redirect_to(panel_personal_journal_back_end_writing_journal_categorys_url) }
# format.xml { head :ok }
format.js
end
else
flash[:error] = t("writing_journal_category.update_failed")
format.html { render :action => "index" }
end
end
protected
def get_types
@types = @app_type.classify.constantize
end
end

View File

@ -0,0 +1,366 @@
class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
before_filter :only => [ :new,:edit,:update] do |controller|
controller.get_categorys('WritingJournalCategory')
end
def index
get_plugins
# @tags = get_tags
# @categories = get_categories_for_index
# @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
@paper_type_ids = JournalPaperType.all.collect{|t| t.id.to_s} + [nil]
@writing_journals = get_sorted_and_filtered("writing_journal", :journal_paper_type_id.in => @paper_type_ids)
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @writing_journals }
end
end
def writing_journal_setting
get_plugins
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all
@tags = get_tags
# @writing_journal_categorys = JournalLevelType.all
@set_level_type = JournalLevelType.new(:display => 'List')
@level_type_url = panel_personal_journal_back_end_writing_journals_path
@set_author_type = JournalAuthorType.new(:display => 'List')
@author_type_url = panel_personal_journal_back_end_writing_journals_path
@set_paper_type = JournalPaperType.new(:display => 'List')
@paper_type_url = panel_personal_journal_back_end_writing_journals_path
end
def level_type_quick_add
@set_level_type = JournalLevelType.new(:display => 'List')
@level_type_url = panel_personal_journal_back_end_writing_journals_path
@set_level_type.id = params[:id]
respond_to do |format|
format.js
end
end
def level_type_quick_edit
@set_level_type = JournalLevelType.find(params[:writing_journal_id])
@level_type_url = panel_personal_journal_back_end_writing_journal_path(@set_level_type)
respond_to do |format|
format.js
end
end
def author_type_quick_add
@set_author_type = JournalAuthorType.new(:display => 'List')
@author_type_url = panel_personal_journal_back_end_writing_journals_path
@set_author_type.id = params[:id]
respond_to do |format|
format.js
end
end
def author_type_quick_edit
@set_author_type = JournalAuthorType.find(params[:writing_journal_id])
@author_type_url = panel_personal_journal_back_end_writing_journal_path(@set_author_type)
respond_to do |format|
format.js
end
end
def paper_type_quick_add
@set_paper_type = JournalPaperType.new(:display => 'List')
@paper_type_url = panel_personal_journal_back_end_writing_journals_path
@set_paper_type.id = params[:id]
respond_to do |format|
format.js
end
end
def paper_type_quick_edit
@set_paper_type = JournalPaperType.find(params[:writing_journal_id])
@paper_type_url = panel_personal_journal_back_end_writing_journal_path(@set_paper_type)
respond_to do |format|
format.js
end
end
# GET /writing_journals/1
# GET /writing_journals/1.xml
def show
@writing_journal = WritingJournal.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @writing_journal }
end
end
# GET /writing_journals/new
# GET /writing_journals/new.xml
def new
get_plugins
@writing_journal = WritingJournal.new
# @writing_journal_files = WritingJournalFile.all
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all
@tags = get_tags
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @writing_journal }
end
end
# GET /writing_journals/1/edit
def edit
get_plugins
@writing_journal = WritingJournal.find(params[:id])
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all
@tags = get_tags
end
# POST /writing_journals
# POST /writing_journals.xml
def create
if params[:journal_level_type]
@journal_level_type = JournalLevelType.new(params[:journal_level_type])
respond_to do |format|
if @journal_level_type.save
format.js { render 'create_writing_journal_setting' }
end
end
elsif params[:journal_author_type]
@journal_author_type = JournalAuthorType.new(params[:journal_author_type])
respond_to do |format|
if @journal_author_type.save
format.js { render 'create_writing_journal_setting' }
end
end
elsif params[:journal_paper_type]
@journal_paper_type = JournalPaperType.new(params[:journal_paper_type])
respond_to do |format|
if @journal_paper_type.save
format.js { render 'create_writing_journal_setting' }
end
end
else
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all
@tags = get_tags
@writing_journal = WritingJournal.new(params[:writing_journal])
if params[:writing_journal][:user_id]
@writing_journal.create_user_id = params[:writing_journal][:user_id]
@writing_journal.update_user_id = params[:writing_journal][:user_id]
else
@writing_journal.create_user_id = current_user.id
@writing_journal.update_user_id = current_user.id
end
respond_to do |format|
if @writing_journal.save
if params[:writing_journal][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_journal][:user_id],:show_plugin_profile=>"WritingJournal")) }
else
format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) }
end
format.xml { render :xml => @writing_journal, :status => :created, :location => @writing_journal }
else
format.html { render :action => "new" }
format.xml { render :xml => @writing_journal.errors, :status => :unprocessable_entity }
end
end
end
end
# PUT /writing_journals/1
# PUT /writing_journals/1.xml
def update
if params[:journal_level_type]
@journal_level_type = JournalLevelType.find(params[:id])
respond_to do |format|
if @journal_level_type.update_attributes(params[:journal_level_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_journal_setting' }
end
end
elsif params[:journal_author_type]
@journal_author_type = JournalAuthorType.find(params[:id])
respond_to do |format|
if @journal_author_type.update_attributes(params[:journal_author_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_journal_setting' }
end
end
elsif params[:journal_paper_type]
@journal_paper_type = JournalPaperType.find(params[:id])
respond_to do |format|
if @journal_paper_type.update_attributes(params[:journal_paper_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_journal_setting' }
end
end
else
@writing_journal = WritingJournal.find(params[:id])
@writing_journal.update_user_id = current_user.id
params[:writing_journal][:tag_ids] ||=[]
respond_to do |format|
if @writing_journal.update_attributes(params[:writing_journal])
format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) }
# 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
end
# DELETE /writing_journals/1
# DELETE /writing_journals/1.xml
def destroy
@writing_journal = WritingJournal.find(params[:id])
@writing_journal.destroy
respond_to do |format|
format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) }
# format.xml { head :ok }
format.js
end
end
def delete
if params[:ids]
writing_journals = WritingJournal.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_personal_journal_back_end_writing_journals_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def data_share
if params[:ids]
@writing_journals = WritingJournal.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_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"WritingJournal")) }
format.json { render json: {"success"=>true}.to_json}
end
end
protected
# def get_index_categories(id = nil)
# @bulletin_categorys = []
# if(is_manager? || is_admin?)
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
# elsif is_sub_manager?
# @bulletin_categorys = BulletinCategory.all
# end
# @bulletin_categorys
# end
# def get_categorys(id = nil)
# @writing_journal_categorys = []
# if(is_manager? || is_admin?)
# @writing_journal_categorys = (id ? WritingJournalCategory.admin_manager_all.find(id).to_a : WritingJournalCategory.admin_manager_all))
# elsif is_sub_manager?
# @writing_journal_categorys = WritingJournalCategory.all.authed_for_user(current_user,'edit')
# end
# if @writing_journal_categorys.empty? && params[:action] != "index"
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
# redirect_to :action => :index
# end
# end
def get_plugins
@plugins = OrbitApp::Plugin::Registration.all
end
end

View File

@ -0,0 +1,66 @@
class Panel::PersonalJournal::Desktop::JournalCoAuthorRelationsController < ApplicationController
def index
page = params[:page]
page ||= 1
@journal_co_author_relations = JournalCoAuthorRelation.all
new
@journal_co_author_relations = @journal_co_author_relations.page(page).per(50)
respond_to do |format|
format.html {render layout: false }
end
end
def edit
@journal_co_author_relation = JournalCoAuthorRelation.find(params[:id])
respond_to do |format|
format.html { render :layout => false}
end
end
def new
@journal_co_author_relation = JournalCoAuthorRelation.new
end
def create
@journal_co_author_relation = JournalCoAuthorRelation.new(params[:journal_co_author_relation])
@journal_co_author_relations = JournalCoAuthorRelation.all
if @journal_co_author_relation.save
newv = render_to_string partial: "show_form", object: @journal_co_author_relations
render json: {success: true, msg: t("create_success"), newvalue: newv}.to_json
else
error_msg = @journal_co_author_relation.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def update
@journal_co_author_relation = JournalCoAuthorRelation.find(params[:id])
if @journal_co_author_relation.update_attributes(params[:journal_co_author_relation])
@journal_co_author_relations = JournalCoAuthorRelation.all
newv = render_to_string partial: "show_form", object: @journal_co_author_relations
render json: {success: true, msg: t("update_success"), newvalue: newv}.to_json
else
error_msg = @journal_co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@journal_co_author_relation = JournalCoAuthorRelation.find(params[:id])
@journal_co_author_relation.destroy
reset_co_author_relation
render :json => {success: true, msg: "delete_success"}
end
private
def reset_co_author_relation
co_author = JournalCoAuthor.where(journal_co_author_relations_id: @journal_co_author_relation.id)
co_author.map do |c|
c.update_attributes(journal_co_author_relations_id: nil)
end
end
end

View File

@ -0,0 +1,61 @@
class Panel::PersonalJournal::Desktop::JournalCoAuthorsController < ApplicationController
def index
page = params[:page]
page ||= 1
@journal_co_authors = JournalCoAuthor.where(name_id: current_user.id).asc(:co_author)
@journal_co_author_relations = JournalCoAuthorRelation.all
@journal_co_authors = @journal_co_authors.page(page).per(40)
respond_to do |format|
format.html { render :layout => false}
end
end
def new
@journal_co_author = JournalCoAuthor.new
@journal_co_author_relations = JournalCoAuthorRelation.all
respond_to do |format|
format.html { render :layout => false}
end
end
def edit
@journal_co_author = JournalCoAuthor.find(params[:id])
@journal_co_author_relations = JournalCoAuthorRelation.all
respond_to do |format|
format.html { render :layout => false}
end
end
def create
@journal_co_author = JournalCoAuthor.new(params[:journal_co_author])
@journal_co_author.name_id= current_user.id
if @journal_co_author.save
render json: {success:true, msg: t('create_success')}.to_json
else
error_msg = @journal_co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def update
@journal_co_author = JournalCoAuthor.find(params[:id])
if @journal_co_author.update_attributes(params[:journal_co_author])
render json: {success:true, msg: t('update_success')}.to_json
else
error_msg = @journal_co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@journal_co_author = JournalCoAuthor.find(params[:id])
@journal_co_author.destroy
render :json => {success: true, msg: "delete_success"}
end
end

View File

@ -0,0 +1,124 @@
class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationController
def index
@writing_journals = WritingJournal.where(create_user_id: current_user.id)
@level_types = JournalLevelType.all
@view_by = params[:view]
page = params[:page]
page ||= 1
@per_column = 5
case @view_by
when "abstract"
@per_column = 1
when "file"
@per_column = 2
end
if @view_by.nil?
@view_by = " "
@writing_journals = @writing_journals.asc(:paper_title)
else
@writing_journals = @writing_journals.asc(@view_by).asc(:paper_title)
end
@level_types = ConferencePaperType.all
@writing_journals = @writing_journals.page(page).per(50)
respond_to do |format|
format.html { render :layout => false}
end
end
def new
@writing_journal = WritingJournal.new
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types= JournalPaperType.all
@journal_candidate =
WritingJournal.where(create_user_id: current_user.id).map{|j|j.journal_title}.uniq
if (not params[:q].nil?) and (current_user.name.include?params[:q])
@user = [{ :id => 0, :text => current_user.name, :email => current_user.email}] # self account name
else
@user = []
end
@co_authors = JournalCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/).asc(:co_author)
# search string + self account name + match pattern
@co_authors = [{ :id => params[:q], :text => params[:q], :email => "#{t("add")}#{t("author")}" }] +
@user +
@co_authors.map{|m| { :id => m.id, :text => m.co_author, :email => m.email } }
respond_to do |format|
format.html { render :layout => false}
format.json { render :json => {:results => @co_authors}.to_json }
end
end
def edit
@writing_journal = WritingJournal.find(params[:id])
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types= JournalPaperType.all
respond_to do |format|
format.html { render :layout => false}
end
end
def create
params[:writing_journal][:create_user_id] = current_user.id
@writing_journal = WritingJournal.new(params[:writing_journal])
if @writing_journal.save
render json: {success: true, msg: t('create_success')}.to_json
else
error_msg = @writing_journal.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def update
params[:writing_journal][:update_user_id] = current_user.id
@writing_journal= WritingJournal.find(params[:id])
if @writing_journal.update_attributes(params[:writing_journal])
render json: {success: true, msg: t('update_success')}.to_json
else
error_msg = @writing_journal.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@writing_journal = WritingJournal.find(params[:id])
@writing_journal.destroy
render :json => {success: true, msg: t('delete_success')}
end
def journal_type
page = params[:page]
page ||= 1
level_types = JournalLevelType.all
all_journal_lists = WritingJournal.where(create_user_id: current_user.id)
all_journal_lists = all_journal_lists.asc(:journal_title)
all_journal_lists = all_journal_lists.page(page).per(50)
all_journal_lists = all_journal_lists.map do |j|
[ j.journal_title,
j.journal_level_type_ids.map do |type|
level_types.find(type).title
end]
end
@journal_lists = all_journal_lists
respond_to do |format|
format.html { render :layout => false}
end
end
end

View File

@ -0,0 +1,5 @@
class Panel::PersonalJournal::Desktop::JournalWindowsController < ApplicationController
def journal_window
render panel_personal_journal_desktop_journal_window_path, :layout => false
end
end

View File

@ -0,0 +1,32 @@
class Panel::PersonalJournal::Desktop::PluginIntrosController < ApplicationController
def index
@intro = PersonalJournalIntro.where(:user_id => current_user.id.to_s).first
if @intro.blank?
@intro = PersonalJournalIntro.new
render "new", :layout => false
else
render "edit", :layout => false
end
end
def create
@intro = PersonalJournalIntro.new(params[:personal_journal_intro])
@intro.user_id = current_user.id
if @intro.save
render :json => {"success" => true}.to_json
else
render :json => {"success" => false}.to_json
end
end
def update
@intro = PersonalJournalIntro.find(params[:id])
if @intro.update_attributes(params[:personal_journal_intro])
render :json => {"success" => true}.to_json
else
render :json => {"success" => false}.to_json
end
end
end

View File

@ -0,0 +1,26 @@
class Panel::PersonalJournal::FrontEnd::WritingJournalsController < OrbitWidgetController
def initialize
super
@app_title = 'personal_journal'
end
def index
@writing_journals = WritingJournal.where(:is_hidden => false).desc(:year, :publication_date).page(params[:page]).per(10)
end
# GET /writing_journals/1
# GET /writing_journals/1.xml
def show
@writing_journal = WritingJournal.find(params[:id])
@journal_level_types = ( !@writing_journal.journal_level_types.blank? ? @writing_journal.journal_level_types.collect{|x| x.title}.join(', ') : nil)
@journal_author_types = ( !@writing_journal.journal_author_types.blank? ? @writing_journal.journal_author_types.collect{|x| x.title}.join(', ') : nil)
end
end

View File

@ -0,0 +1,180 @@
class Panel::PersonalJournal::Plugin::WritingJournalsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
before_filter :only => [ :new,:edit,:update] do |controller|
controller.get_categorys('WritingJournalCategory')
end
def index
get_categorys("JournalPaperType",params[:journal_paper_type_id])
@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
@paper_types = JournalPaperType.all
@paper_type_ids = @paper_types.collect{|t| t.id.to_s} + [nil]
@level_types = JournalLevelType.all
# @writing_journals = WritingJournal.search(params[:category_id])
#@writing_journals = (params[:sort] || @filter) ? get_sorted_and_filtered_writing_journals : WritingJournal.all.page(params[:page]).per(10)
@writing_journals = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_journal",:create_user_id => current_user.id) : get_viewable("writing_journal",:create_user_id => current_user.id)
@tags = get_tags
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @writing_journals }
format.js
end
end
# GET /writing_journals/1
# GET /writing_journals/1.xml
def show
@writing_journal = WritingJournal.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @writing_journal }
end
end
# GET /writing_journals/new
# GET /writing_journals/new.xml
def new
@writing_journal = WritingJournal.new
# @writing_journal_files = WritingJournalFile.all
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all
@tags = get_tags
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @writing_journal }
end
end
# GET /writing_journals/1/edit
def edit
@writing_journal = WritingJournal.find(params[:id])
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all
@tags = get_tags
end
# POST /writing_journals
# POST /writing_journals.xml
def create
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all
@tags = get_tags
@writing_journal = WritingJournal.new(params[:writing_journal])
@writing_journal.create_user_id = current_user.id
@writing_journal.update_user_id = current_user.id
respond_to do |format|
if @writing_journal.save
format.html { redirect_to(panel_personal_journal_plugin_writing_journals_url) }
format.xml { render :xml => @writing_journal, :status => :created, :location => @writing_journal }
else
format.html { render :action => "new" }
format.xml { render :xml => @writing_journal.errors, :status => :unprocessable_entity }
end
end
end
# PUT /writing_journals/1
# PUT /writing_journals/1.xml
def update
@writing_journal = WritingJournal.find(params[:id])
@writing_journal.update_user_id = current_user.id
params[:writing_journal][:tag_ids] ||=[]
respond_to do |format|
if @writing_journal.update_attributes(params[:writing_journal])
format.html { redirect_to(panel_personal_journal_plugin_writing_journals_url) }
# 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
# DELETE /writing_journals/1
# DELETE /writing_journals/1.xml
def destroy
@writing_journal = WritingJournal.find(params[:id])
@writing_journal.destroy
respond_to do |format|
format.html { redirect_to(panel_personal_journal_plugin_writing_journals_url) }
# format.xml { head :ok }
format.js
end
end
def delete
if params[:ids]
writing_journals = WritingJournal.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_personal_journal_plugin_writing_journals_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected
# def get_index_categories(id = nil)
# @bulletin_categorys = []
# if(is_manager? || is_admin?)
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
# elsif is_sub_manager?
# @bulletin_categorys = BulletinCategory.all
# end
# @bulletin_categorys
# end
# def get_categorys(id = nil)
# @writing_journal_categorys = []
# if(is_manager? || is_admin?)
# @writing_journal_categorys = (id ? WritingJournalCategory.admin_manager_all.find(id).to_a : WritingJournalCategory.admin_manager_all))
# elsif is_sub_manager?
# @writing_journal_categorys = WritingJournalCategory.all.authed_for_user(current_user,'edit')
# end
# if @writing_journal_categorys.empty? && params[:action] != "index"
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
# redirect_to :action => :index
# end
# end
end

0
app/helpers/.gitkeep Normal file
View File

View File

View File

@ -0,0 +1,126 @@
module Panel::PersonalJournal::Desktop::JournalPagesHelper
def publication_record publication, view
content_tag :li,
"item" => "true",
"data-id" => publication.id.to_s,
:class => "list_t_item #{view.blank? ? '' : "#{view}_view" } #{publication.is_hidden? ? "private" : "public" }" do
content_tag :div,
:class => "inner" do
marker(publication.id) + \
content(publication, view) + \
edit_or_delete(publication)
end
end
end
def get_height view
case view
when "journal_title"
height = "50px"
when "keywords"
height = "100px"
when "abstract"
height = "200px"
when "file"
height = "200px"
else
height = "50px"
end
height
end
def marker id
content_tag :div,
:class => "list_item_action" do
content_tag(:a, "",:href=>"",
:class => "icon-check-empty",
"toggle-onclick"=>"icon-check-empty icon-check",
"data-id" => id.to_s,
"ajax-remote"=>"false") + \
content_tag(:a, "",:href=>"",
:class => "icon-star-empty",
"toggle-onclick"=>"icon-star-empty icon-star",
"data-id" => id.to_s,
"ajax-remote"=>"false")
end
end
def content publication, view
case view
when "journal_title"
des = content_tag(:div, publication.journal_title,
:class => "list_t_des")
when "keywords"
des = content_tag(:div, publication.keywords,
:class => "list_t_des")
when "abstract"
des = content_tag(:div, publication.abstract,
:class => "list_t_des")
when "file"
des = content_tag(:div, link_publication_file(publication),
:class => "list_t_des")
else
end
content_tag(:div, publication.paper_title,
:class => "list_t_title") + des
end
def edit_or_delete publication
content_tag :div,
:class => "list_item_function" do
content_tag(:a, t("edit"),
:class => "journal_paper_edit admbg2 admtxt",
:href => edit_panel_personal_journal_desktop_journal_page_path(publication),
"callback-method" => "editpaper",
"ajax-remote" => "get") + \
content_tag(:a, t(:delete_),
"ajax-remote" => "delete",
"confirm-message" => t("sure?"),
"callback-method" => "paperDelete",
"delete-item" => "true",
:class => "journal_paper_delete admbg2 admtxt",
:href => panel_personal_journal_desktop_journal_page_path(publication))
end
end
def link_publication_file publication
publication.writing_journal_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url,
:class => "file",
"target" => "_blank",
"title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+)
end
def check_file_type file
if not file.nil?
x = file.split(/[\s\.]/)
file_type = x[x.length - 1]
file_type = file_type.downcase
file_type = "/assets/ft-icons/#{file_type}/#{file_type}-sm-32_32.png"
else
file_type = ""
end
end
def generate_authors_name ids
author_name = ids.map{|m|
if m == "0"
#{:id => 0, :text => current_user.name, :email => current_user.email }
{:id => 0, :text => current_user.name}
else
#{:id => m, :text => JournalCoAuthor.find(m).co_author, :email => JournalCoAuthor.find(m).email}
{:id => m, :text => JournalCoAuthor.find(m).co_author}
end
}
author_name.to_json
end
end

0
app/mailers/.gitkeep Normal file
View File

0
app/models/.gitkeep Normal file
View File

View File

@ -0,0 +1,5 @@
class JournalAuthorType < WritingJournalCategory
field :title, localize: true
has_and_belongs_to_many :writing_journals
end

View File

@ -0,0 +1,21 @@
class JournalCoAuthor
include Mongoid::Document
LANGUAGE_TYPES = [ "English", "Chinese" ]
field :name_id, type: BSON::ObjectId
field :co_author, localize: true
field :email
belongs_to :journal_co_author_relations
has_and_belongs_to_many :writing_journals
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 }
validates :co_author, presence: true
before_save { |coauthor| coauthor.email = email.downcase if not coauthor.email.nil?}
end

View File

@ -0,0 +1,11 @@
class JournalCoAuthorRelation
include Mongoid::Document
include Mongoid::Timestamps
field :relation, localize: true
has_and_belongs_to_many :journal_co_authors
validates :relation, presence: true,
uniqueness: { case_sensitive: false }
end

View File

@ -0,0 +1,5 @@
class JournalLevelType < WritingJournalCategory
field :title, localize: true
has_and_belongs_to_many :writing_journals
end

View File

@ -0,0 +1,3 @@
class JournalPaperType < WritingJournalCategory
field :title
end

View File

@ -0,0 +1,4 @@
class PersonalJournalIntro < PersonalPluginIntro
end

View File

@ -0,0 +1,126 @@
class WritingJournal
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include OrbitModel::LanguageRestrict
include OrbitModel::Status
include OrbitTag::Taggable
LANGUAGE_TYPES = [ "English", "Chinese" ]
field :paper_title, localize: true
field :journal_title, localize: true
field :authors, localize: true
# has_and_belongs_to_many :tags, :class_name => "PersonalJournalTag"
has_and_belongs_to_many :journal_author_types
has_and_belongs_to_many :journal_level_types
has_and_belongs_to_many :journal_co_authors
has_many :writing_journal_files, :autosave => true, :dependent => :destroy
belongs_to :journal_paper_type
field :year
field :language
field :isbn
field :vol_no
field :issue_no
field :form_to_start
field :form_to_end
field :total_pages
field :keywords
field :abstract
field :publication_date, :type => Date
field :url
field :note
field :create_user_id, :type => BSON::ObjectId
field :update_user_id, :type => BSON::ObjectId
paginates_per 10
accepts_nested_attributes_for :writing_journal_files, :allow_destroy => true
after_save :save_writing_journal_files
before_validation :add_http
validates :paper_title, :at_least_one => true
validates :url, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i, :unless => Proc.new{self.url.blank?}
attr_reader :author_tokens
def author_tokens=(ids)
if new_record?
current_user = create_user_id
else
current_user = update_user_id
end
authors_ids = ids.split(",").map{|id|
begin
JournalCoAuthor.find(id).id
rescue
if id != "0"
new_co_author = JournalCoAuthor.new(:co_author => id)
new_co_author.save
new_co_author.id
else
id
end
end
}
self.journal_co_author_ids = authors_ids
end
def self.search( category_id = nil )
if category_id.to_s.size > 0
find(:all, :conditions => {writing_journal_category_id: category_id}).desc( :is_top, :title )
else
find(:all).desc( :is_top, :title)
end
end
def self.widget_datas
where( :is_hidden => false ).desc(:is_top, :created_at)
end
def save_writing_journal_files
self.writing_journal_files.each do |t|
if t.should_destroy
t.destroy
end
end
end
def create_link
title = []
title << self.authors if self.authors.present?
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_level_types.blank? ? "(#{self.journal_level_types.collect{|x| x.title}.join(', ')})" : nil)
title.join(', ')
end
def new_writing_journal_files=(var)
self.writing_journal_files.new(:file=>var[0])
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_author_type_ids.delete('')
self.journal_level_type_ids.delete('')
end
end

View File

@ -0,0 +1,26 @@
class WritingJournalCategory
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectAuthable
include OrbitCoreLib::ObjectDisable
AfterObjectAuthUrl = '/panel/personal_journal/back_end/writing_journal_categorys'
APP_NAME = 'writing_journal'
# ObjectAuthTitlesOptions = %W{edit}
ObjectAuthTitlesOptions = %W{submit_new fact_check}
field :key
has_many :writing_journals
def pp_object
title
end
def self.from_id(id)
WritingJournalCategory.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,14 @@
class WritingJournalFile
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :file, AssetUploader
field :description, localize: true
field :should_destroy, :type => Boolean
field :title, localize: true
belongs_to :writing_journal
end

0
app/views/.gitkeep Normal file
View File

View File

@ -0,0 +1,44 @@
<% # encoding: utf-8 %>
<%= form_for(:writing_journal_category, :remote => true, :url => @url, :method => @verb, :html => { :id => 'form_writing_journal_category' } ) do |f| %>
<h2><%= (@writing_journal_category.new_record? ? 'Add' : 'Edit') %></h2>
<div id="widget-title">
<%= f.label :key %>
<%= f.text_field :key %>
</div>
<div id="widget-title">
<% if @types.is_localized?(:title) %>
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'input-xxlarge', :value => (@writing_journal_category.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
<% else %>
<div id="widget-title">
<%= f.label :title %>
<%= f.text_field :title %>
</div>
<% end %>
</div>
<div id="widget-title">
<%#= f.label :display %>
<%#= f.radio_button :display, "List" List%>
<%#= f.radio_button :display, "Picture" Picture%>
<%# <br />顯示方式是設定在前台頁面時,資訊所呈現的樣式 %>
</div>
<div class="form-actions">
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
</div>
<% end %>

View File

@ -0,0 +1,28 @@
<% # encoding: utf-8 %>
<div id="qe-basic" class="qe-edit-div">
<div id="widget-title">
<%= f.label :key %>
<%= f.text_field :key %>
</div>
<div id="widget-title">
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'input-xxlarge', :value => (news_bulletin_category.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div id="widget-title">
<%= f.label :display %>
<%= f.radio_button :display, "List" %>List
<%= f.radio_button :display, "Picture" %>Picture
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
</div>
</div>

View File

@ -0,0 +1,23 @@
<tr id="<%= dom_id writing_journal_category %>" class="with_action">
<td>
<%= writing_journal_category.key %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<% if is_admin?%>
<li><%= link_to t('writing_journal_category.edit'),
polymorphic_path([:panel, :personal_journal, :back_end, writing_journal_category], {:action => :edit}), :remote => true %></li>
<li><%= link_to show_toggle_archive_btn(writing_journal_category),
polymorphic_path([:panel, :personal_journal, :back_end, writing_journal_category]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %></li>
<% end %>
</ul>
</div>
</td>
<% if @types.is_localized?(:title) %>
<% @site_in_use_locales.each do |locale| %>
<td><%= writing_journal_category.title_translations[locale] rescue nil %></td>
<% end %>
<% else %>
<td><%= writing_journal_category.title %></td>
<% end %>
</tr>

View File

@ -0,0 +1,2 @@
$('<%= j render :partial => 'writing_journal_category', :collection => [@writing_journal_category] %>').appendTo('#writing_journal_categorys').hide().fadeIn();
$("#form_writing_journal_category")[0].reset();

View File

@ -0,0 +1 @@
$("#<%= dom_id @writing_journal_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@writing_journal_category) %> ");

View File

@ -0,0 +1,7 @@
<h1><%= t('personal_journal.editing_personal_journal_class') %></h1>
<%= form_for @writing_journal_category, :url => panel_personal_journal_back_end_writing_journal_category_path(@writing_journal_category) do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= link_back %>

View File

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

View File

@ -0,0 +1,29 @@
<%= flash_messages %>
<%= @types %>
<table id="writing_journal_categorys" class="table main-list">
<thead>
<tr>
<th class="span1-2"><%= t('writing_journal_category.key') %></th>
<% if @types.is_localized?(:title) %>
<% @site_in_use_locales.each do |locale| %>
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
<% else %>
<th class="span1-2"><%= t('writing_journal_category.title') %></th>
<% end %>
</tr>
</thead>
<tbody>
<%= render :partial => 'writing_journal_category', :collection => @writing_journal_categorys %>
</tbody>
</table>
<div id="form"><%= render :partial => "form" if is_manager? %></div>

View File

@ -0,0 +1,19 @@
<% content_for :secondary do %>
<%= render :partial => '/panel/personal_journal/back_end/personal_journal_secondary' %>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<h1><%= t('writing_journal_category.new_personal_journal_class') %></h1>
<%= form_for @writing_journal_category, :url => panel_personal_journal_back_end_writing_journal_categorys_path do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= link_back %>

View File

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

View File

@ -0,0 +1,4 @@
$("#<%= dom_id @writing_journal_category %>").replaceWith("<%= j render :partial => 'writing_journal_category', :collection => [@writing_journal_category] %>");
<% @writing_journal_category = @types.new(:display => 'List') # reset for new form %>
$("#form_writing_journal_category").replaceWith("<%= j render "form" %>")
$("#form_writing_journal_category")[0].reset();

View File

@ -0,0 +1,34 @@
<% # 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 'writing_journal_category[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,3 @@
<div class="filter-clear">
<%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), panel_personal_journal_back_end_writing_journals_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn js_history" %>
</div>

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,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<% @level_types.each do |category| -%>
<%= link_to category.title, panel_personal_journal_back_end_writing_journals_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %>
<% end -%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>

View File

@ -0,0 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<% @tags.each do |tag| -%>
<%= link_to tag.name, panel_personal_journal_back_end_writing_journals_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('tags', tag.id)}" %>
<% end -%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>

View File

@ -0,0 +1,345 @@
<% # 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" %>
<% end %>
<%= f.error_messages %>
<!-- 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>
<% if show_form_status_field(@writing_journal) %>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
<% end %>
<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((@writing_journal.year ? @writing_journal.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_journal[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, WritingJournal::LANGUAGE_TYPES, :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">
<% @level_types.each do |level_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_journal[journal_level_type_ids][]', level_type.id, @writing_journal.journal_level_type_ids.include?(level_type.id)%>
<%= level_type.title %>
<%= hidden_field_tag 'writing_journal[journal_level_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.paper_type") %></label>
<div class="controls">
<%= f.select :journal_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]}, :class => "span3" %>
</div>
</div>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_journal[journal_author_type_ids][]', author_type.id, @writing_journal.journal_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<%= hidden_field_tag 'writing_journal[journal_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.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</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 -->
<% if show_form_status_field(@writing_journal) %>
<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 @writing_journal.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
<% end %>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<!-- Tag -->
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @writing_journal.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'writing_journal[tag_ids][]', tag.id, @writing_journal.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'writing_journal[tag_ids][]', '' %>
</label>
<% end %>
</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: (@writing_journal.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: (@writing_journal.journal_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- authors-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_journal.authors") %></label>
<div class="controls">
<%= f.fields_for :authors_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_journal.authors"), value: (@writing_journal.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 @writing_journal && !@writing_journal.writing_journal_files.blank? %>
<div class="exist">
<% @writing_journal.writing_journal_files.each_with_index do |writing_journal_file, i| %>
<%= f.fields_for :writing_journal_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', @writing_journal.writing_journal_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.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<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_writing_journal_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, :writing_journal_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>
<% end %>

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.file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.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 :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.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 'writing_journal_category[level_type]', @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="<%= panel_personal_journal_back_end_writing_journal_author_type_quick_edit_path(list_author_type) %>#myModal2" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a>
<%= link_to 'Delete',
polymorphic_path([:panel, :personal_journal, :back_end, list_author_type]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"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="<%= panel_personal_journal_back_end_writing_journal_level_type_quick_edit_path(list_level_type) %>#myModal1" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a>
<%= link_to 'Delete',
polymorphic_path([:panel, :personal_journal, :back_end, list_level_type]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"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="<%= panel_personal_journal_back_end_writing_journal_paper_type_quick_edit_path(list_paper_type) %>#myModal3" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a>
<%= link_to 'Delete',
polymorphic_path([:panel, :personal_journal, :back_end, list_paper_type]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
</td>
</tr>

View File

@ -0,0 +1,11 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_tag_type %>">
<td><%= list_tag_type[I18n.locale] %></td>
<td>
<a href="<%= panel_personal_journal_back_end_writing_journal_level_type_quick_edit_path(list_level_type) %>#myModal1" data-toggle="modal" data-remote="true" class="action">編輯</a>
<%= link_to 'Delete',
polymorphic_path([:panel, :personal_journal, :back_end, list_level_type]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %>
</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,17 @@
<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 , panel_personal_journal_front_end_writing_journal_path(writing_journal) %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<%if at_least_module_manager || writing_journal.writing_journal_category.cur_user_is_sub_manager_of(:edit)%>
<li><%= link_to t('edit'), edit_panel_personal_journal_back_end_writing_journal_path(writing_journal) %></li>
<li><%= link_to t(:delete_), panel_personal_journal_back_end_writing_journal_path(writing_journal), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<% end -%>
</ul>
</div>
</td>
<td class="span1"><%= User.from_id(writing_journal.create_user_id).name rescue ''%></td>
</tr>

View File

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

View File

@ -0,0 +1 @@
$("#myModal2").html("<%= j render "author_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 @writing_journal %>").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), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %>
</div>
<%= form_for @writing_journal, url: panel_personal_journal_back_end_writing_journal_path(@writing_journal), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

@ -0,0 +1,34 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %>
<%= render 'filter' %>
</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'), panel_personal_journal_back_end_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_panel_personal_journal_back_end_writing_journal_path, :class => 'btn btn-primary pull-right' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</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 @@
$("#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), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %>
</div>
<%= form_for @writing_journal, url: panel_personal_journal_back_end_writing_journals_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

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

View File

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

View File

@ -0,0 +1,3 @@
$("#enable_<%= @bulletin.id %>").toggle();
$("#disable_<%= @bulletin.id %>").toggle();
$("#bulletin_<%= @bulletin.id %>").toggleClass('disable');

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,185 @@
<% # 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), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/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="<%= panel_personal_journal_back_end_writing_journal_level_type_quick_add_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 => @level_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="<%= panel_personal_journal_back_end_writing_journal_author_type_quick_add_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="<%= panel_personal_journal_back_end_writing_journal_author_type_quick_add_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 class="item element">
<div class="detail w-a h-a">
<p class="totle">
<button class="btn btn-small btn-primary pull-right" type="button" data-toggle="modal" data-target="#myModal4"><i class="icon-plus"></i> 新增</button>
<span>領域</span>
</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<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 class="table table-striped">
<tbody>
<tr>
<td>Corresponding Author</td>
<td>編輯 刪除</td>
</tr>
<tr>
<td>First Author, Co- Authors</td>
<td>編輯 刪除</td>
</tr>
</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_panel_personal_journal_back_end_writing_journal_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 :partial => "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 :partial => "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 :partial => "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>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "item" %>
<% end %>

View File

@ -0,0 +1,19 @@
<ul class="s_form">
<li class="s_grid_row">
<% if @journal_co_author_relation.new_record? %>
<%= f.text_field :relation, class: "s_grid s_grid_6" %>
<% else %>
<%= f.text_field :relation, class: "s_grid s_grid_4" %>
<% end %>
<!--
<#%= f.fields_for :journal_co_author_relation_translations do |f| %>
<#%= f.text_field locale,
value: (@journal_co_author_relation.co_author_relation_translations[locale] rescue nil) %>
<#% end %>
-->
<%= f.submit t("save"), class: "s_grid ini_input hp hh1 thmtxt thmc2" %>
<% if not @journal_co_author_relation.new_record? %>
<%= submit_tag t("cancel"), :type => "button", class: "bt-cancel-type s_grid ini_input hp hh1 admbg2 admtxt" %>
<% end %>
</li>
</ul>

View File

@ -0,0 +1,3 @@
<%= form_for(@journal_co_author_relation, url: panel_personal_journal_desktop_journal_co_author_relations_path, html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationForm"} ) do |f| %>
<%= render partial: 'form' , locals: {:f => f}%>
<% end %>

View File

@ -0,0 +1,13 @@
<div class="overview" content-layout="datalist" per-column="5" base-width="300" pagination-var="page">
<ul>
<% @journal_co_author_relations.each_with_index do |journal_co_author_relation,i| %>
<li item="true">
<div class="form_space" id="form_space_<%= i.to_s %>"><%= journal_co_author_relation.relation %></div>
<div class="list_item_function">
<%= link_to t('edit'), edit_panel_personal_journal_desktop_journal_co_author_relation_path(journal_co_author_relation), :class => "bt-edit-type admbg2 admtxt", "content-holder"=>"#form_space_"+i.to_s, "ajax-remote"=>"get" %>
<%= link_to t(:delete_), panel_personal_journal_desktop_journal_co_author_relation_path(journal_co_author_relation), "confirm-message"=>t('sure?'), "ajax-remote"=>"delete", :class=>"bt-delete admbg2 admtxt" %>
</div>
</li>
<% end %>
</ul>
</div>

View File

@ -0,0 +1,3 @@
<%= form_for(@journal_co_author_relation, url: panel_personal_journal_desktop_journal_co_author_relation_path(@journal_co_author_relation), html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationEditForm"} ) do |f| %>
<%= render partial: 'form' , locals: {:f => f}%>
<% end %>

View File

@ -0,0 +1,22 @@
<div class="toolbar hh1">
<div class="fn_g hp">
<div class="hh1 sdm">
<div class="sdm_t hp hh1 thmc2 thmtxt"><%= t("add") %></div>
<div class="admbg sdm_o">
<ul>
<li class="vp hp s_form"><%= render 'new' %></li>
</ul>
</div>
</div>
<%= submit_tag t("back"), :type => "button", "ajax-remote" => "get", :href => panel_personal_journal_desktop_journal_co_authors_path, class: "fn_btn ini_input hp hh1 admbg2 admtxt" %>
</div>
</div>
<!-- <div id="co_author_relation_table" class="tinycanvas vp">
<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
<div class="viewport"> -->
<div class="overview" page-name="journal_p_coauthor_relation" content-layout="datalist" per-column="5" base-width="300">
<%= render :partial => 'show_form'%>
</div>
<!-- </div>
-->

View File

@ -0,0 +1,35 @@
<div class="toolbar hh1">
<div class="fn_g hp">
<%= f.submit t("save"), name: "commit", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %>
<%= submit_tag t("back"), :type => "button", "ajax-remote" => "get", :href => panel_personal_journal_desktop_journal_co_authors_path, class: "fn_btn ini_input hp hh1 admbg2 admtxt" %>
</div>
</div>
<div id="new_co_author" class="s_grid_con s_form vp">
<ul>
<li class="s_grid_row">
<%= f.label :co_author, class: "s_grid s_grid_4" %>
<%= f.text_field :co_author, class: "s_grid_8 s_grid"%>
<!--
<%#= f.fields_for :co_author_translations do |f| %>
<%#= f.text_field locale,
class: "s_grid_4 s_grid",
value: (@journal_co_author.co_author_translations[locale] rescue nil) %>
<%# end %>
-->
</li>
<li class="s_grid_row">
<%= f.label :email, class: "s_grid s_grid_4"%>
<%= f.text_field :email, class: "s_grid s_grid_8" %>
</li>
<li class="s_grid_row">
<%= f.label :type, class: "s_grid s_grid_4"%>
<select name="journal_co_author[co_author_relations_id]" id="" class="s_grid s_grid_8">
<%= options_for_select(
@journal_co_author_relations.map do |relation|
[relation.relation, relation.id]
end
)%>
</select>
</li>
</ul>
</div>

View File

@ -0,0 +1,3 @@
<%= form_for @journal_co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: panel_personal_journal_desktop_journal_co_author_path(@journal_co_author) do |f| %>
<%= render partial: 'form', locals: {:f => f} %>
<% end %>

View File

@ -0,0 +1,30 @@
<div class="toolbar hh1">
<div class="fn_g hp">
<%= link_to "New Co-Author", new_panel_personal_journal_desktop_journal_co_author_path, :class=>"bt-co-author fn_btn hp hh1 thmc2 thmtxt", "ajax-remote"=>"get" %>
<%= link_to "New Type", panel_personal_journal_desktop_journal_co_author_relations_path, :class=>"bt-new-type fn_btn hp hh1 thmc2 thmtxt", "ajax-remote"=>"get" %>
</div>
</div>
<!-- <div id="co_author" class="tinycanvas vp">
<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
<div class="viewport"> -->
<div class="overview" page-name="journal_p_coauthor" content-layout="datalist" per-column="4" base-width="300" pagination-var="page">
<ul>
<% @journal_co_authors.each_with_index do |co_author,i| %>
<li class="list_t_item" item="true">
<ul class="info">
<li><div class="list_t_title name"><%= co_author.co_author %></div></li>
<li><div class="email"><i class="icon-envelope"></i> <%= co_author.email %></div></li>
<li><div class="relations"><i class="icon-user"></i> <%= @journal_co_author_relations.find(co_author.journal_co_author_relations_id).relation unless co_author.journal_co_author_relations_id.nil?%></div></li>
</ul>
<div class="list_item_function">
<%= link_to t('edit'), edit_panel_personal_journal_desktop_journal_co_author_path(co_author), :class => "bt-edit admbg2 admtxt", "ajax-remote"=>"get" %>
<%= link_to t(:delete_), panel_personal_journal_desktop_journal_co_author_path(co_author), "ajax-remote"=>"delete", "confirm-message"=>t('sure?'), "callback-method"=>"paperDelete", :class=>"bt-delete admbg2 admtxt" %>
</div>
</li>
<% end %>
</ul>
</div>
<!-- </div>
</div>
-->

View File

@ -0,0 +1,3 @@
<%= form_for @journal_co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: panel_personal_journal_desktop_journal_co_authors_path do |f| %>
<%= render partial: 'form', locals: {:f => f} %>
<% end %>

View File

@ -0,0 +1,221 @@
<div class="toolbar hh1">
<div class="fn_g hp">
<%= f.submit t("save"), name: "commit", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %>
<% if not @writing_journal.new_record? %>
<%= submit_tag t("cancel"), :type => "button", "callback-method"=>"cancelpaper", "ajax-remote" => "get", :href => panel_personal_journal_desktop_journal_pages_path, class: "fn_btn ini_input hp hh1 admbg2 admtxt" %>
<% end %>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1 ">Language</div>
<div class="admbg sdm_o language_select">
<ul>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li><a class="hp hh1 admtxt" href="" data-lang="<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
</div>
</div>
<!-- <div id="paper_add" class="tinycanvas vp">
<div class="scrollbar sb_h vp">
<div class="track">
<div class="thumb thmc2">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport"> -->
<div class="overview" content-layout="simple" base-width="420">
<ul class="s_form" isotope="true">
<li class="s_grid_row" >
<% @site_in_use_locales.each_with_index do |locale, i| %>
<% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
<% data = "data-language=" + locale %>
<div class="form_fix" <%= style %> <%= data %>>
<%= f.fields_for :paper_title_translations do |f| %>
<%= f.text_area locale,
class: "s_grid_12 s_grid s_grid_h_3",
size: "20x4",
placeholder: t("personal_journal.paper_title")+ "("+I18nVariable.from_locale(locale)+")",
value: (@writing_journal.paper_title_translations[locale.to_s] rescue nil) %>
<% end %>
<%= f.fields_for :journal_title_translations do |f| %>
<%= f.text_field locale,
size: "20",
placeholder: t("personal_journal.journal_title")+ "("+I18nVariable.from_locale(locale)+")",
class: "s_grid_12 s_grid",
value: (@writing_journal.journal_title_translations[locale.to_s] rescue nil) %>
<% end %>
</div>
<% end %>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_journal.level_type"), :class => 's_grid s_grid_4') %>
<div class="s_select_g s_grid s_grid_8 s_grid_h_2">
<ul>
<% @level_types.each_with_index do |level_type, i| %>
<li>
<%= check_box_tag "writing_journal[journal_level_type_ids][]",
level_type.id,
@writing_journal.journal_level_type_ids.include?(level_type.id),
id: "field-#{i}"
%><%= label_tag("field-#{i}", level_type.title) %>
</li>
<% end %>
</ul>
</div>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_journal.isbn"), class: "s_grid_4 s_grid") %><%= f.text_field :isbn, size: "20", class: "s_grid_8 s_grid"%>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_journal.vol_no"), class: "s_grid_4 s_grid") %><%= f.text_field :vol_no, size: "20", class: "s_grid_8 s_grid"%>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_journal.issue_no"), class: "s_grid_4 s_grid") %><%= f.text_field :issue_no, size: "20", class: "s_grid_8 s_grid"%>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_journal.total_pages"), class: "s_grid_4 s_grid") %>
<%= f.text_field :form_to_start, size: "10", class: "s_grid_2 s_grid"%>
<%= label_tag("", t("personal_journal.to"), class: "s_grid_1 s_grid") %>
<%= f.text_field :form_to_end, size: "10", class: "s_grid_2 s_grid"%>
<label class="s_grid_1 s_grid" for="">共</label>
<%= f.text_field :total_pages, size: "20", class: "s_grid_2 s_grid"%>
</li>
<li class="s_grid_row">
<%= f.text_area :author_tokens,
class: "s_grid_12 s_grid",
size: "20x2",
placeholder: t("personal_journal.authors"),
"autocomplete" => "/panel/personal_journal/desktop/journal_pages/new.json",
"autocomplete-format" => "--:[text,email]",
"data-pre" => generate_authors_name(@writing_journal.journal_co_author_ids) %>
<%#= f.fields_for :authors_translations do |f| %>
<%#= f.text_area locale,
class: "s_grid_6 s_grid",
size: "20x2",
placeholder: t("personal_journal.authors"),
"autocomplete-list" => "coauthor_autocomplete_list",
value: (@writing_journal.authors_translations[locale.to_s] rescue nil) %>
<%# end %>
</li>
<li class="s_grid_row">
<select name="writing_journal[journal_author_type_ids][]" id="" class="s_grid s_grid_8">
<%= options_for_select(
[t("personal_journal.author_type")] +
@author_types.map do |author_type|
[author_type.title, author_type.id]
end
)%>
</select>
<select name="writing_journal[journal_paper_type_ids][]" id="" class="s_grid s_grid_4">
<%= options_for_select(
[t("personal_journal.level_type")] +
@paper_types.map do |paper_type|
[paper_type.title, paper_type.id]
end
)%>
</select>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_journal.publication_date"), class: "s_grid_4 s_grid") %>
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year] }, {:class => 's_grid_4 s_grid'} %>
<%= f.date_select :publication_date, {:use_month_numbers => true, :order => [:month, :day] }, {:class => 's_grid_2 s_grid'} %>
</li>
<li class="s_grid_row">
<%= f.text_area :keywords, size: "20x3", placeholder: t("personal_journal.keywords"), class: "s_grid_12 s_grid_h_2 s_grid"%>
</li>
<li class="s_grid_row">
<%= f.label :year, t("personal_journal.year"), :class => "s_grid_4 s_grid" %>
<%= select_year((@writing_journal.year ? @writing_journal.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_journal[year]', :class => "s_grid_8 s_grid"} ) %>
</li>
<li class="s_grid_row">
<%= f.label :language, t("personal_journal.language"), :class => "s_grid s_grid_4" %>
<%= f.select :language, WritingJournal::LANGUAGE_TYPES,{} ,{:class => "s_grid s_grid_8"} %>
</li>
<li class="s_grid_row">
<input class="s_grid s_grid_12" type="text" placeholder=<%= t("personal_journal.tags") %>>
</li>
<li class="s_grid_row">
<label for="" class="s_grid s_grid_4">Status</label>
<select name="" id="" class="s_grid s_grid_8">
<option value="">Status</option>
<option value="">Published</option>
<option value="">Pending</option>
<option value="">Writing</option>
</select>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_journal.url"), class: "s_grid_4 s_grid") %><%= f.text_field :url, size: "20", class: "s_grid_8 s_grid"%>
</li>
<li class="s_grid_row">
<table class="s_table">
<thead>
<tr>
<th class="s_grid_2"><%= t("personal_journal.file")%></th>
<th class="s_grid_4"><%= t("personal_journal.file_name")%></th>
<th class="s_grid_4"><%= t("personal_journal.description") %></th>
<th class="s_grid_2"></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="4">
<div id='add_plugin_file' class="info_input plugin_files_block s_action">
<%= hidden_field_tag 'plugin_file_field_count', @writing_journal.writing_journal_files.count %>
<a class="add setting_btn thmc1 thmtxt w1 hh1 hp" href="#"><i class="icon-plus icon-white"></i> add</a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @writing_journal.writing_journal_files.each_with_index do |writing_journal_file, i| %>
<%= f.fields_for :writing_journal_files, writing_journal_file do |f| %>
<%= render :partial => 'form_file', :object => writing_journal_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</li>
<li class="s_grid_row">
<%= f.text_area :note, size: "20x22", placeholder: t("personal_journal.note"), class: "s_grid_12 s_grid s_grid_h_10 s_grid_h_full"%>
</li>
<li class="s_grid_row">
<%= f.text_area :abstract, size: "20x22", placeholder: t("personal_journal.abstract"), class: "s_grid_12 s_grid s_grid_h_10 s_grid_h_full"%>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- </div>
</div>
-->
<script>
var get_html = function(old_id,new_id){
return ("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id);
}
</script>

View File

@ -0,0 +1,50 @@
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class="list_item">
<td>
<div>
<% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %>
<label></label>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
form_file.file.url,
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %>
</div>
</td>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
<% data = "data-language=" + locale %>
<td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale,
class: 's_grid_4 title_field',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %>
</td>
<td <%= style %> <%= data %>>
<%= f.fields_for :file_description_translations do |f| %>
<%= f.text_field locale,
class: 's_grid_4',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_description_translations[locale] rescue nil) %>
<% end %>
</td>
<% end %>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove" style="cursor:pointer;"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record" style="cursor:pointer;"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
<%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %>
</span>
</td>
</tr>

View File

@ -0,0 +1,3 @@
<%= form_for @writing_journal, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_journal_desktop_journal_page_path(@writing_journal) do |f| %>
<%= render partial: 'form', locals: {:f => f} %>
<%end%>

View File

@ -0,0 +1,71 @@
<div class="toolbar hh1">
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-check"></span></div>
<div class="admbg sdm_o">
<ul id="journal_selection_options">
<li><a class="hp hh1 admtxt" href="all" ajax-remote="false" callback-method="allnone">All</a></li>
<li><a class="hp hh1 admtxt" href="none" ajax-remote="false" callback-method="allnone">None</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1">More</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh1 admtxt" href="">Delete</a></li>
<li><a class="hp hh1 admtxt" href="">Tag</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1">Tag</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh1 admtxt" href="">All</a></li>
<li><a class="hp hh1 admtxt" href="">Starred</a></li>
<li><a class="hp hh1 admtxt" href="">MIT</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1">Status</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh1 admtxt" href="">All</a></li>
<li><a class="hp hh1 admtxt" href="">Published</a></li>
<li><a class="hp hh1 admtxt" href="">Pending</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1">View</div>
<div class="admbg sdm_o">
<ul id="journal_view_selection">
<li><%= link_to "Journal", panel_personal_journal_desktop_journal_pages_path + "?view=journal_title", :class => "hp hh1 admtxt", "ajax-remote" => "get" %></li>
<li><%= link_to "Title", panel_personal_journal_desktop_journal_pages_path + "?view=paper_title", :class => "hp hh1 admtxt", "ajax-remote" => "get" %></li>
<li><%= link_to "File", panel_personal_journal_desktop_journal_pages_path + "?view=file", :class => "hp hh1 admtxt", "ajax-remote" => "get" %></li>
<li><%= link_to "Keywords", panel_personal_journal_desktop_journal_pages_path + "?view=keywords", :class => "hp hh1 admtxt", "ajax-remote" => "get" %></li>
<li><%= link_to "Abstract", panel_personal_journal_desktop_journal_pages_path + "?view=abstract", :class => "hp hh1 admtxt", "ajax-remote" => "get" %></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1">Share</div>
<div class="admbg sdm_o share_mode" data-link="<%= data_share_panel_personal_journal_back_end_writing_journals_path %>" data-var="disable" >
<ul>
<li><a class="hp hh1 admtxt" href="" item-class="private" data-mode="true" >Private</a></li>
<li><a class="hp hh1 admtxt" href="" item-class="public" data-mode="false" >Public</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
</div>
</div>
<div class="overview" page-name="journal_p_list" content-layout="simple" base-width="300" per-column="<%= @per_column.to_s %>" pagination-var="view=<%= @view_by %>&page" >
<ul isotope="true">
<% @writing_journals.each do |w| %>
<%= publication_record w, @view_by%>
<% end %>
</ul>
</div>

View File

@ -0,0 +1,32 @@
<div class="toolbar hh1">
<div class="hh1 hp sdm">
<div class="sdm_t hh1">Share</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh1 admtxt" href="">Friends</a></li>
<li><a class="hp hh1 admtxt" href="">Private</a></li>
<li><a class="hp hh1 admtxt" href="">Group</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
</div>
</div>
<div class="overview" page-name="journal_p_journal" content-layout="datalist" base-width="400" per-column="5" pagination-var="page">
<% @journal_lists.each_with_index do |journal_list,i| %>
<div class="g_col">
<ul>
<li class="list_t_item" item="true">
<div class="list_item_action">
<i class="icon-file"></i>
</div>
<% title, level = journal_list %>
<div class="list_t_title"><%= title %></div>
<div class="list_t_desc"><%= level.join(",") %></div>
</li>
</ul>
</div>
<% end %>
</div>

View File

@ -0,0 +1,3 @@
<%= form_for @writing_journal, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_journal_desktop_journal_pages_path do |f| %>
<%= render partial: 'form', locals: {:f => f} %>
<%end%>

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