finished some method of list and journal
This commit is contained in:
parent
7e9b60a527
commit
5eb8cc4063
|
@ -586,7 +586,7 @@ var orbitDesktop = function(dom){
|
|||
$(this).val(sectionnames[i]);
|
||||
})
|
||||
bindHandlers();
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
class Desktop::JournalPagesController < ApplicationController
|
||||
def index
|
||||
@writing_journal = WritingJournal.where(create_user_id: current_user.id)
|
||||
@level_types = JournalLevelType.all
|
||||
|
||||
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
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false}
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def create
|
||||
if params[:commit].eql?"Save"
|
||||
if not params[:writing_journal][:publication_date].nil?
|
||||
params[:writing_journal][:publication_date] = \
|
||||
Date.new *(params[:writing_journal][:publication_date].split("/").map{|s| s.to_i})
|
||||
end
|
||||
|
||||
params[:writing_journal][:create_user_id] = current_user.id
|
||||
|
||||
@writing_journal = WritingJournal.new(params[:writing_journal])
|
||||
if @writing_journal.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to desktop_journal_pages_url, :layout => false, notice: 'User was successfully created.'}
|
||||
# format.json { render json: @writing_journal, status: :created, location: @writing_journal}
|
||||
# format.js
|
||||
end
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:commit].eql?"Edit"
|
||||
params[:writing_journal][:update_user_id] = current_user.id
|
||||
end
|
||||
end
|
||||
end
|
|
@ -4,21 +4,29 @@ class DesktopPublicationsController< ApplicationController
|
|||
def journal_p
|
||||
render "desktop/journal_p", :layout => false
|
||||
end
|
||||
#
|
||||
# def journal_p_list
|
||||
# render "desktop/journal_pages/list", :layout => false
|
||||
# end
|
||||
|
||||
def journal_p_list
|
||||
render "desktop/journal_pages/list", :layout => false
|
||||
end
|
||||
|
||||
def journal_p_add
|
||||
@writing_journal = WritingJournal.new
|
||||
@level_types = JournalLevelType.all
|
||||
|
||||
# def journal_p_add
|
||||
# @writing_journal = WritingJournal.new
|
||||
# @level_types = JournalLevelType.all
|
||||
#
|
||||
# respond_to do |format|
|
||||
# format.html # new.html.erb
|
||||
# format.xml { render :xml => @writing_journal }
|
||||
# format.html { render "desktop/journal_pages/add", :layout => false}
|
||||
# end
|
||||
render "desktop/journal_pages/add", :layout => false
|
||||
end
|
||||
# end
|
||||
#
|
||||
# def journal_p_create
|
||||
# @writing_journal = WritingJournal.all.first
|
||||
# @level_types = JournalLevelType.all
|
||||
# respond_to do |format|
|
||||
# format.html { render "desktop/journal_pages/list", :layout => false}
|
||||
# #format.js
|
||||
# end
|
||||
#
|
||||
# end
|
||||
|
||||
def books
|
||||
render "desktop/books", :layout => false
|
||||
|
@ -75,8 +83,6 @@ class DesktopPublicationsController< ApplicationController
|
|||
|
||||
def getjournals
|
||||
publications = WritingJournal.where(create_user_id: current_user.id)
|
||||
p current_user.id
|
||||
p "======="
|
||||
|
||||
sort_publications= Hash.new
|
||||
data = Array.new
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
<div id="journal_p">
|
||||
<div id="content">
|
||||
<div id="header" class="hh3">
|
||||
<div class="dtitle w2 hh3 hp">
|
||||
<span class="thmtxth">Journal Papers</span>
|
||||
</div>
|
||||
<div id="search_app" class="hfn w2 hh2 hp thmc3">
|
||||
<input type="text" class="ini_input form" value="Search" id="searchbox" />
|
||||
<input type="submit" class="ini_input submit thmc1" value="Submit"/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="holder">
|
||||
<div id="panel_l" class="ph">
|
||||
<div class="s_menu sm_v">
|
||||
<ul id='setting_left_nav'>
|
||||
<li><a href="<%= desktop_publications_journal_p_list_path %>" data-method="list" class="hh2 w2 hp active thmc1 thmtxt xx" onclick='return false;'>List</a></li>
|
||||
<li><a href="<%= desktop_publications_journal_p_add_path %>" data-method="addpaper" class="admtxt hh2 w2 hp xx" onclick='return false;'>Add/Edit</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Journals</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags & Keywords</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Analysis</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Import</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Export</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="panel_r" class="ph pw admbg hp">
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="header" class="hh3">
|
||||
<div class="dtitle w2 hh3 hp">
|
||||
<span class="thmtxth">Journal Papers</span>
|
||||
</div>
|
||||
<div id="search_app" class="hfn w2 hh2 hp thmc3">
|
||||
<input type="text" class="ini_input form" value="Search" id="searchbox" />
|
||||
<input type="submit" class="ini_input submit thmc1" value="Submit"/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="holder">
|
||||
<div id="panel_l" class="ph">
|
||||
<div class="s_menu sm_v">
|
||||
<ul id='setting_left_nav'>
|
||||
<li><a href="<%= desktop_journal_pages_path %>" data-method="list" class="hh2 w2 hp active thmc1 thmtxt xx" onclick='return false;'>List</a></li>
|
||||
<li><a href="<%= new_desktop_journal_page_path %>" data-method="addpaper" class="admtxt hh2 w2 hp xx" onclick='return false;'>Add/Edit</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Journals</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags & Keywords</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Analysis</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Import</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Export</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="panel_r" class="ph pw admbg hp">
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<ul>
|
||||
<% @level_types.each_with_index do |level_type, i| %>
|
||||
<li>
|
||||
<%= check_box_tag "field-#{i}",
|
||||
<%= check_box_tag "writing_journal[journal_level_type_ids][]",
|
||||
level_type.id,
|
||||
@writing_journal.journal_level_type_ids.include?(level_type.id)
|
||||
%><%= label_tag("field-#{i}", level_type.title) %>
|
||||
|
@ -117,22 +117,22 @@
|
|||
</li>
|
||||
<li class="s_grid_row">
|
||||
|
||||
<select name="" id="" class="s_grid s_grid_4">
|
||||
<%= options_for_select([["Author Type", 1],
|
||||
["First Author", 2],
|
||||
["Corresponding Author", 3],
|
||||
["Second Author", 4],
|
||||
["Third Author", 5],
|
||||
["Fourth Author", 6]], 1)
|
||||
<select name="writing_journal[journal_author_type_ids][]" id="" class="s_grid s_grid_4">
|
||||
<%= options_for_select(
|
||||
@author_types.map do |author_type|
|
||||
[author_type.title, author_type.id]
|
||||
end
|
||||
)
|
||||
%>
|
||||
</select>
|
||||
|
||||
<select name="" id="" class="s_grid s_grid_2">
|
||||
<%= options_for_select([['Status', 1],
|
||||
['Published', 2],
|
||||
['Pending', 3],
|
||||
['Writing', 4]], 1)
|
||||
%>
|
||||
<select name="writing_journal[journal_paper_type_ids][]" id="" class="s_grid s_grid_2">
|
||||
<%= options_for_select(
|
||||
@paper_types.map do |paper_type|
|
||||
[paper_type.title, paper_type.id]
|
||||
end
|
||||
)
|
||||
%>
|
||||
</select>
|
||||
</li>
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<%= form_for @writing_journal, url: desktop_publications_journal_p_add_path do |f| %>
|
||||
<%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %>
|
||||
<%end%>
|
|
@ -0,0 +1,2 @@
|
|||
<h1>Desktop::JournalPages#edit</h1>
|
||||
<p>Find me in app/views/desktop/journal_pages/edit.html.erb</p>
|
|
@ -0,0 +1,88 @@
|
|||
<div class="toolbar hh2">
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2"><span class="icon-check"></span></div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul id="journal_selection_options">
|
||||
<li><a class="hp hh2 admtxt" href="all">All</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="none">None</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">More</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt" href="">Delete</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Tag</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">Tag</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt" href="">All</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Starred</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">MIT</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">Status</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt" href="">All</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Published</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Pending</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">View</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul id="journal_view_selection">
|
||||
<li><a class="hp hh2 admtxt" href="journal">Journal</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="title">Title</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="file">File</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="keywords">Keywords</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="abstract">Abstract</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">Share</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt" href="">Full</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Abstract</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Friends</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Private</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Group</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2" id='ns'>New Share</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt remote_url" href="<%= panel_personal_journal_plugin_writing_journals_path %>">Full</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Abstract</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Friends</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Private</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Group</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2"><span class="icon-question-sign"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="paper_list" 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">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
<div class="toolbar hh2">
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2"><span class="icon-check"></span></div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul id="journal_selection_options">
|
||||
<li><a class="hp hh2 admtxt" href="all">All</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="none">None</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">More</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt" href="">Delete</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Tag</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">Tag</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt" href="">All</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Starred</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">MIT</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">Status</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt" href="">All</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Published</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Pending</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">View</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul id="journal_view_selection">
|
||||
<li><a class="hp hh2 admtxt" href="journal">Journal</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="title">Title</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="file">File</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="keywords">Keywords</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="abstract">Abstract</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">Share</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt" href="">Full</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Abstract</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Friends</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Private</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Group</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2" id='ns'>New Share</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt remote_url" href="<%= panel_personal_journal_plugin_writing_journals_path %>">Full</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Abstract</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Friends</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Private</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Group</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2"><span class="icon-question-sign"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="paper_list" 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">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
<%= form_for @writing_journal, url: desktop_journal_pages_path do |f| %>
|
||||
<%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %>
|
||||
<%end%>
|
|
@ -0,0 +1,2 @@
|
|||
<h1>Desktop::JournalPages#show</h1>
|
||||
<p>Find me in app/views/desktop/journal_pages/show.html.erb</p>
|
127
config/routes.rb
127
config/routes.rb
|
@ -2,7 +2,7 @@ Orbit::Application.routes.draw do
|
|||
|
||||
devise_for :users
|
||||
mount Resque::Server, :at => "/admin/resque"
|
||||
|
||||
|
||||
# routes for sinatra app
|
||||
match '/site/set_registered', :to => CentralServerExchangeApp
|
||||
match '/site/public_key', :to => CentralServerExchangeApp
|
||||
|
@ -28,7 +28,7 @@ Orbit::Application.routes.draw do
|
|||
match 'new_interface' => "object_auths_new_interface#setting" ,:as => :ob_auth,:via => :get
|
||||
match 'new_interface' => "object_auths_new_interface#update_setting" ,:as => :ob_auth,:via => :post
|
||||
match 'new_interface' => "object_auths_new_interface#user_list" ,:as => :ob_auth_show,:via => :put
|
||||
|
||||
|
||||
collection do
|
||||
match 'new/:type/:obj_id',:action => 'new',:via => "get",:as => :init
|
||||
end
|
||||
|
@ -43,11 +43,11 @@ Orbit::Application.routes.draw do
|
|||
match 'ad_banners/:id/rename' => 'ad_banners#rename',:as => :rename_ad_banner,:via => :post
|
||||
|
||||
resources :ad_banners do
|
||||
collection do
|
||||
match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get
|
||||
match 'new_ad_image' => 'ad_images#create',:as => :create_ad_image,:via => :post
|
||||
end
|
||||
resources :ad_images ,:except => [:show,:index]
|
||||
collection do
|
||||
match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get
|
||||
match 'new_ad_image' => 'ad_images#create',:as => :create_ad_image,:via => :post
|
||||
end
|
||||
resources :ad_images ,:except => [:show,:index]
|
||||
end
|
||||
resources :dashboards
|
||||
resources :designs do
|
||||
|
@ -87,7 +87,7 @@ Orbit::Application.routes.draw do
|
|||
match 'remove/:type/:target_id' ,:action=> 'remove',:via => "delete",:as =>:remove
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
member do
|
||||
match 'assign_manager' ,:action=> 'assign_manager',:via => "post",:as =>:assign_manager
|
||||
match 'assign_sub_manager' ,:action=> 'assign_sub_manager',:via => "post",:as =>:assign_sub_manager
|
||||
|
@ -136,78 +136,47 @@ Orbit::Application.routes.draw do
|
|||
|
||||
end
|
||||
# end admin
|
||||
|
||||
|
||||
namespace :panel do
|
||||
resources :users
|
||||
end
|
||||
|
||||
resources :desktop_widgets do
|
||||
collection do
|
||||
get 'upload'
|
||||
get 'delete'
|
||||
post 'upload'
|
||||
get 'upload'
|
||||
get 'delete'
|
||||
post 'upload'
|
||||
end
|
||||
end
|
||||
|
||||
namespace :desktop do
|
||||
|
||||
match "/"=>"desktop#index"
|
||||
namespace :desktop do
|
||||
|
||||
# Sinatra Routes start
|
||||
match "/" => "desktop#index"
|
||||
|
||||
# match '/desktop/desktop', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/app_manager', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/sections', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/settings', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/get_desktop_settings/', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/save_desktop_settings/', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/getgroups/', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/getsectionlist/', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/settingthemes/', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/settingsections/', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/getapplist/', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/newpositions/', :to => Desktopapp::DesktopApp
|
||||
# match '/desktop/settingconnection/', :to => Desktopapp::DesktopApp
|
||||
match '/desktop'=>'desktop#desktop'
|
||||
match '/app_manager'=>'desktop#app_manager'
|
||||
match '/sections'=>'desktop#sections'
|
||||
match '/settings'=>'desktop#settings'
|
||||
match '/get_desktop_settings/'=>'desktop#get_desktop_settings'
|
||||
match '/save_desktop_settings/'=>'desktop#save_desktop_settings'
|
||||
match '/getgroups/'=>'desktop#getgroups'
|
||||
match '/getsectionlist/'=>'desktop#getsectionlist'
|
||||
match '/themes/'=>'desktop#themes'
|
||||
match '/sections/'=>'desktop#sections'
|
||||
match '/getapplist/'=>'desktop#getapplist'
|
||||
match '/newpositions/'=>'desktop#newpositions'
|
||||
match '/connections/'=>'desktop#connections'
|
||||
match '/widget_layout' => 'desktop#widget_layout'
|
||||
|
||||
# match '/desktop/journal_p/', :to => Desktopapp::DesktopAppPublications
|
||||
# match '/desktop/journal_p_list/', :to => Desktopapp::DesktopAppPublications
|
||||
# match '/desktop/journal_p_add/', :to => Desktopapp::DesktopAppPublications
|
||||
# match '/desktop_publications/getjournals', :to => Desktopapp::DesktopAppPublications
|
||||
match '/temp_func/'=>'desktop#temp_func'
|
||||
resources :journal_pages
|
||||
end
|
||||
|
||||
# match '/desktop/twitter/', :to => Desktopapp::Otheraccounts
|
||||
# match '/desktop/forgmail/', :to => Desktopapp::Otheraccounts
|
||||
# match '/desktop/getaccounts', :to => Desktopapp::Otheraccounts
|
||||
# match '/desktop/save_account_info/', :to => Desktopapp::Otheraccounts
|
||||
|
||||
# match '/desktop_appstore/appstore', :to => Desktopapp::DesktopAppAppstore
|
||||
# match '/desktop_appstore/widgets', :to => Desktopapp::DesktopAppAppstore
|
||||
# match '/desktop_appstore/getuserwidgets', :to => Desktopapp::DesktopAppAppstore
|
||||
# match '/desktop_appstore/widgets_settings', :to => Desktopapp::DesktopAppAppstore
|
||||
|
||||
# Sinatra Routes end
|
||||
|
||||
match '/desktop'=>'desktop#desktop'
|
||||
match '/app_manager'=>'desktop#app_manager'
|
||||
match '/sections'=>'desktop#sections'
|
||||
match '/settings'=>'desktop#settings'
|
||||
match '/get_desktop_settings/'=>'desktop#get_desktop_settings'
|
||||
match '/save_desktop_settings/'=>'desktop#save_desktop_settings'
|
||||
match '/getgroups/'=>'desktop#getgroups'
|
||||
match '/getsectionlist/'=>'desktop#getsectionlist'
|
||||
match '/themes/'=>'desktop#themes'
|
||||
match '/sections/'=>'desktop#sections'
|
||||
match '/getapplist/'=>'desktop#getapplist'
|
||||
match '/newpositions/'=>'desktop#newpositions'
|
||||
match '/connections/'=>'desktop#connections'
|
||||
match '/widget_layout' => 'desktop#widget_layout'
|
||||
|
||||
match '/temp_func/'=>'desktop#temp_func'
|
||||
end
|
||||
|
||||
# namespace :desktop_publications do
|
||||
match 'desktop_publications/journal_p'=>'desktop_publications#journal_p'
|
||||
match 'desktop_publications/journal_p_list'=>'desktop_publications#journal_p_list'
|
||||
match 'desktop_publications/journal_p_add'=>'desktop_publications#journal_p_add'
|
||||
# namespace :desktop_publications do
|
||||
match 'desktop_publications/journal_p'=>'desktop_publications#journal_p'
|
||||
# match 'desktop_publications/journal_p_list'=>'desktop_publications#journal_p_list'
|
||||
# match 'desktop_publications/journal_p_add'=>'desktop_publications#journal_p_add'
|
||||
# match 'desktop_publications/journal_p_create'=>'desktop_publications#journal_p_create' , :via => :post
|
||||
match 'desktop_publications/books' => 'desktop_publications#books'
|
||||
match 'desktop_publications/books_list'=>'desktop_publications#books_list'
|
||||
match 'desktop_publications/books_add'=>'desktop_publications#books_add'
|
||||
|
@ -216,9 +185,9 @@ end
|
|||
match 'desktop_publications/seminar_p_list/'=>'desktop_publications#seminar_p_list'
|
||||
match 'desktop_publications/seminar_p_add/'=>'desktop_publications#seminar_p_add'
|
||||
match 'desktop_publications/getjournals' => 'desktop_publications#getjournals'
|
||||
# end
|
||||
# end
|
||||
|
||||
# namespace :desktop_research do
|
||||
# namespace :desktop_research do
|
||||
match 'desktop_research/research_d' => 'desktop_research#research_d'
|
||||
match 'desktop_research/research_d_list/' => 'desktop_research#research_d_list'
|
||||
match 'desktop_research/research_d_add' => 'desktop_research#research_d_add'
|
||||
|
@ -226,7 +195,7 @@ end
|
|||
match 'desktop_research/research_p' => 'desktop_research#research_p'
|
||||
match 'desktop_research/research_p_list/' => 'desktop_research#research_p_list'
|
||||
match 'desktop_research/research_p_add' => 'desktop_research#research_p_add'
|
||||
# end
|
||||
# end
|
||||
|
||||
match '/twitter/'=>'otheraccounts#twitter'
|
||||
match '/forgmail/'=>'otheraccounts#gmail'
|
||||
|
@ -243,36 +212,36 @@ end
|
|||
|
||||
match '/desktop_orbit/eventajaxload'=> 'desktop_orbit#eventajaxload'
|
||||
match '/desktop_orbit/gettimelinespan' => 'desktop_orbit#gettimelinespan'
|
||||
|
||||
|
||||
#match '/desktop_orbit/eventajaxload' => 'desktop_publications#create_journal'
|
||||
|
||||
#match '/desktop_orbit/eventajaxload' => 'desktop_publications#create_journal'
|
||||
#match '/desktop_orbit/eventajaxload' => 'desktop_publications#delete_journal'
|
||||
# match '/desktop_orbit/eventajaxload' => 'desktop_publications#update_journal'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
match '/panel/:app_name/front_end/:app_action/:id(/:controller_action)' => 'pages#show_from_link', :constraints => lambda { |request|
|
||||
!request.query_string.include?("inner=true")
|
||||
}
|
||||
|
||||
|
||||
match '/panel/:app_name/front_end/:app_action' => 'pages#index_from_link', :constraints => lambda { |request|
|
||||
!request.query_string.include?("inner=true")
|
||||
}
|
||||
|
||||
match '/share/:model/:id' => 'application#render_share'
|
||||
|
||||
|
||||
# routes for gridfs files
|
||||
match "/gridfs/*path" => "gridfs#serve"
|
||||
|
||||
# match "/images/*path" => "gridfs#serve_images"
|
||||
# match "/admin/pages/images/*path" => "gridfs#serve_images"
|
||||
|
||||
|
||||
# routes for pages to generate
|
||||
match '*page_name' => 'pages#show', :as => :page, :constraints => lambda{|request|
|
||||
!request.path.starts_with?("/panel")
|
||||
}
|
||||
|
||||
|
||||
root :to => 'pages#index'
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class JournalAuthorType < WritingJournalCategory
|
||||
|
||||
field :title, localize: true
|
||||
|
||||
has_and_belongs_to_many :writing_journals
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class JournalLevelType < WritingJournalCategory
|
||||
|
||||
field :title, localize: true
|
||||
|
||||
has_and_belongs_to_many :writing_journals
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class JournalPaperType < WritingJournalCategory
|
||||
|
||||
field :title
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
class PersonalJournalTag < Tag
|
||||
|
||||
has_and_belongs_to_many :writing_journals
|
||||
|
||||
def get_visible_links(sort = :title)
|
||||
self.writing_journals.where(:is_hidden => false).desc(:is_top, sort)
|
||||
end
|
||||
|
||||
end
|
||||
def get_visible_links(sort = :title)
|
||||
self.writing_journals.where(:is_hidden => false).desc(:is_top, sort)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,26 +1,20 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class WritingJournal
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
||||
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
|
||||
|
||||
|
||||
belongs_to :journal_paper_type
|
||||
|
||||
|
||||
field :year
|
||||
field :language
|
||||
field :isbn
|
||||
|
@ -36,54 +30,36 @@ class WritingJournal
|
|||
field :note
|
||||
field :create_user_id, :type => BSON::ObjectId
|
||||
field :update_user_id, :type => BSON::ObjectId
|
||||
|
||||
# field :is_top, :type => Boolean, :default => false
|
||||
# field :is_hot, :type => Boolean, :default => false
|
||||
# field :is_hidden, :type => Boolean, :default => false
|
||||
|
||||
|
||||
has_many :writing_journal_files, :autosave => true, :dependent => :destroy
|
||||
|
||||
|
||||
accepts_nested_attributes_for :writing_journal_files, :allow_destroy => true
|
||||
|
||||
# before_save :update_avliable_language, :clean_checkboxs
|
||||
|
||||
validates :paper_title, :at_least_one => true
|
||||
|
||||
before_validation :add_http
|
||||
|
||||
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}(([0-9]{1,5})?\/.*)?$/ix, :unless => Proc.new{self.url.blank?}
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
where( :is_hidden => false ).desc(:is_top, :created_at)
|
||||
end
|
||||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
tags.order_by(I18n.locale, :asc)
|
||||
end
|
||||
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
@ -93,22 +69,21 @@ class WritingJournal
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def save_writing_journal_files
|
||||
self.writing_journal_files.each do |t|
|
||||
if t.should_destroy
|
||||
t.destroy
|
||||
end
|
||||
self.writing_journal_files.each do |t|
|
||||
if t.should_destroy
|
||||
t.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def create_link
|
||||
|
||||
title = ["\"#{self.paper_title}\""]
|
||||
title << self.journal_title
|
||||
title.join(', ')
|
||||
title << ( !self.journal_level_types.blank? ? "(#{self.journal_level_types.collect{|x| x.title}.join(', ')})" : nil)
|
||||
title.join(', ')
|
||||
title = ["\"#{self.paper_title}\""]
|
||||
title << self.journal_title
|
||||
title.join(', ')
|
||||
title << ( !self.journal_level_types.blank? ? "(#{self.journal_level_types.collect{|x| x.title}.join(', ')})" : nil)
|
||||
title.join(', ')
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -124,5 +99,4 @@ class WritingJournal
|
|||
self.journal_author_type_ids.delete('')
|
||||
self.journal_level_type_ids.delete('')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,30 +1,26 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class WritingJournalCategory
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitCoreLib::ObjectAuthable
|
||||
include OrbitCoreLib::ObjectDisable
|
||||
# include Mongoid::MultiParameterAttributes
|
||||
|
||||
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?
|
||||
self.fields[field_name.to_s].localized?
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,9 +6,9 @@ class WritingJournalFile
|
|||
mount_uploader :file, AssetUploader
|
||||
|
||||
# field :description, localize: true
|
||||
field :should_destroy, :type => Boolean
|
||||
field :should_destroy, :type => Boolean
|
||||
field :title, localize: true
|
||||
|
||||
|
||||
belongs_to :writing_journal
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue