modularized personal journal

This commit is contained in:
Rueshyna authored and chris committed 2013-01-14 17:54:52 +08:00
1 parent 758cab5ecd
commit bf31d0c3dd
20 files changed
+185 -174

No files matched your search

@@ -50,7 +50,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
return false;
})
}
var bindSecondaryHandlers = function(){
$("#journal_p div#paper_list a.icon-check-empty").click(function(){
if($(this).hasClass("icon-check-empty")){
@@ -177,7 +177,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
}
var getData = function(){
$.getJSON("/desktop/journal_pages/get_journals_json",function(journals){
$.getJSON("/panel/personal_journal/desktop/get_journals_json",function(journals){
journalData = eval(journals);
journalview();
bindHandlers();
@@ -1,4 +1,4 @@
class Desktop::CoAuthorRelationsController < ApplicationController
class Panel::PersonalJournal::Desktop::CoAuthorRelationsController < ApplicationController
def index
@co_author_relations = CoAuthorRelation.all
new
@@ -1,4 +1,4 @@
class Desktop::CoAuthorsController < ApplicationController
class Panel::PersonalJournal::Desktop::CoAuthorsController < ApplicationController
def index
nils, not_nils = CoAuthor.where(name_id: current_user.id)\
.asc(:co_author).partition{|p| p.email.nil?}
@@ -1,18 +1,2 @@
class Desktop::JournalListsController < ApplicationController
def index
level_types = JournalLevelType.all
all_journal_lists = WritingJournal.where(create_user_id: current_user.id)
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.uniq
respond_to do |format|
format.html { render :layout => false}
end
end
class Panel::PersonalJournal::Desktop::JournalListsController < ApplicationController
end
@@ -0,0 +1,5 @@
class Panel::PersonalJournal::Desktop::JournalPController < ApplicationController
def journal_p
render panel_personal_journal_desktop_journal_p_path, :layout => false
end
end
@@ -1,4 +1,4 @@
class Desktop::JournalPagesController < ApplicationController
class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationController
def index
@writing_journal = WritingJournal.where(create_user_id: current_user.id)
@level_types = JournalLevelType.all
@@ -89,8 +89,8 @@ class Desktop::JournalPagesController < ApplicationController
abstract: publication.abstract,
coauthors: publication.authors,
year: publication.year,
url_edit: edit_desktop_journal_page_path(publication),
url_delete: desktop_journal_page_path(publication),
url_edit: edit_panel_personal_journal_desktop_journal_page_path(publication),
url_delete: panel_personal_journal_desktop_journal_page_path(publication),
files: publication.writing_journal_files.collect{|file|
{title: file.title, url: file.file.url, icon: check_file_type(file.file.url)}
}
@@ -104,4 +104,20 @@ class Desktop::JournalPagesController < ApplicationController
render json: JSON.pretty_generate(data)
end
def journal_type
level_types = JournalLevelType.all
all_journal_lists = WritingJournal.where(create_user_id: current_user.id)
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.uniq
respond_to do |format|
format.html { render :layout => false}
end
end
end
@@ -1,3 +1,3 @@
<%= form_for(@co_author_relation, url: desktop_co_author_relations_path, html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationForm"} ) do |f| %>
<%= render partial: 'desktop/co_author_relations/form' , locals: {:f => f}%>
<%= form_for(@co_author_relation, url: panel_personal_journal_desktop_co_author_relations_path, html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationForm"} ) do |f| %>
<%= render partial: 'panel/personal_journal/desktop/co_author_relations/form' , locals: {:f => f}%>
<% end %>
@@ -2,16 +2,16 @@
<% if ( i % 6 ) == 0 %>
<div class="s_grid_con s_form">
<ul>
<% end %>
<li class="s_grid_row">
<div class="form_space" id="form_space_<%= i.to_s %>"><%= co_author_relation.relation %></div>
<div class="list_item_function">
<%= link_to 'Edit', edit_desktop_co_author_relation_path(co_author_relation), :class => "bt-edit-type admbg2 admtxt", "content-holder"=>"#form_space_"+i.to_s, "ajax-remote"=>"get" %>
<%= link_to 'Destroy', desktop_co_author_relation_path(co_author_relation), "confirm-message"=>'Are you sure?', "ajax-remote"=>"delete", :class=>"bt-delete admbg2 admtxt" %>
</div>
</li>
<% if ( i % 6 ) == 5 %>
</ul>
<% end %>
<li class="s_grid_row">
<div class="form_space" id="form_space_<%= i.to_s %>"><%= co_author_relation.relation %></div>
<div class="list_item_function">
<%= link_to 'Edit', edit_panel_personal_journal_desktop_co_author_relation_path(co_author_relation), :class => "bt-edit-type admbg2 admtxt", "content-holder"=>"#form_space_"+i.to_s, "ajax-remote"=>"get" %>
<%= link_to 'Destroy', panel_personal_journal_desktop_co_author_relation_path(co_author_relation), "confirm-message"=>'Are you sure?', "ajax-remote"=>"delete", :class=>"bt-delete admbg2 admtxt" %>
</div>
</li>
<% if ( i % 6 ) == 5 %>
</ul>
</div>
<% end %>
<% end %>
<% end %>
@@ -1,3 +1,3 @@
<%= form_for(@co_author_relation, url: desktop_co_author_relation_path(@co_author_relation), html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationEditForm"} ) do |f| %>
<%= render partial: 'desktop/co_author_relations/form' , locals: {:f => f}%>
<%= form_for(@co_author_relation, url: panel_personal_journal_desktop_co_author_relation_path(@co_author_relation), html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationEditForm"} ) do |f| %>
<%= render partial: 'panel/personal_journal/desktop/co_author_relations/form' , locals: {:f => f}%>
<% end %>
@@ -1,3 +1,3 @@
<%= form_for @co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: desktop_co_author_path(@co_author) do |f| %>
<%= render partial: 'desktop/co_authors/form', locals: {:f => f} %>
<%= form_for @co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: panel_personal_journal_desktop_co_author_path(@co_author) do |f| %>
<%= render partial: 'panel/personal_journal/desktop/co_authors/form', locals: {:f => f} %>
<% end %>
@@ -1,7 +1,7 @@
<div class="toolbar hh2">
<div class="fn_g hp">
<%= link_to "New Co-Author", new_desktop_co_author_path, :class=>"bt-co-author fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %>
<%= link_to "New Type", desktop_co_author_relations_path, :class=>"bt-new-type fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %>
<%= link_to "New Co-Author", new_panel_personal_journal_desktop_co_author_path, :class=>"bt-co-author fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %>
<%= link_to "New Type", panel_personal_journal_desktop_co_author_relations_path, :class=>"bt-new-type fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %>
</div>
</div>
<div id="co_author" class="tinycanvas vp">
@@ -20,8 +20,8 @@
<li><div class="relations"><i class="icon-user"></i> <%= @co_author_relations.find(co_author.co_author_relations_id).relation unless co_author.co_author_relations_id.nil?%></div></li>
</ul>
<div class="list_item_function">
<%= link_to 'Edit', edit_desktop_co_author_path(co_author), :class => "bt-edit admbg2 admtxt", "ajax-remote"=>"get" %>
<%= link_to 'Destroy', desktop_co_author_path(co_author), "ajax-remote"=>"delete", "confirm-message"=>'Are you sure?', "callback-method"=>"paperDelete", :class=>"bt-delete admbg2 admtxt" %>
<%= link_to 'Edit', edit_panel_personal_journal_desktop_co_author_path(co_author), :class => "bt-edit admbg2 admtxt", "ajax-remote"=>"get" %>
<%= link_to 'Destroy', panel_personal_journal_desktop_co_author_path(co_author), "ajax-remote"=>"delete", "confirm-message"=>'Are you sure?', "callback-method"=>"paperDelete", :class=>"bt-delete admbg2 admtxt" %>
</div>
</li>
<% if ( i % 4 ) == 3 %>
@@ -1,3 +1,3 @@
<%= form_for @co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: desktop_co_authors_path do |f| %>
<%= render partial: 'desktop/co_authors/form', locals: {:f => f} %>
<%= form_for @co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: panel_personal_journal_desktop_co_authors_path do |f| %>
<%= render partial: 'panel/personal_journal/desktop/co_authors/form', locals: {:f => f} %>
<% end %>
@@ -13,10 +13,10 @@
<div id="panel_l" class="ph">
<div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'>
<li><a href="<%= desktop_journal_pages_path %>" callback-method="list" load="true" class="hh2 w2 hp thmc1 thmtxt xx" onclick='return false;'>List</a></li>
<li><a href="<%= new_desktop_journal_page_path %>" callback-method="addpaper" custom-load="addpaper" class="admtxt hh2 w2 hp xx" onclick='return false;'>Add/Edit</a></li>
<li><a href="<%= desktop_journal_lists_path %>" callback-method="journal" class="admtxt hh2 w2 hp" onclick='return false;'>Journals</a></li>
<li><a href="<%= desktop_co_authors_path %>" class="admtxt hh2 w2 hp" callback-method="coauthor" custom-load="coauthor" onclick='return false;'>Co-Authors</a></li>
<li><a href="<%= panel_personal_journal_desktop_journal_pages_path %>" callback-method="list" load="true" class="hh2 w2 hp thmc1 thmtxt xx" onclick='return false;'>List</a></li>
<li><a href="<%= new_panel_personal_journal_desktop_journal_page_path %>" callback-method="addpaper" custom-load="addpaper" class="admtxt hh2 w2 hp xx" onclick='return false;'>Add/Edit</a></li>
<li><a href="" callback-method="journal" class="admtxt hh2 w2 hp" onclick='return false;'>Journals</a></li>
<li><a href="<%= panel_personal_journal_desktop_co_authors_path %>" class="admtxt hh2 w2 hp" callback-method="coauthor" custom-load="coauthor" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; 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>
@@ -1,3 +1,3 @@
<%= form_for @writing_journal, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: desktop_journal_page_path(@writing_journal) do |f| %>
<%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %>
<%= 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: 'panel/personal_journal/desktop/journal_pages/form', locals: {:f => f} %>
<%end%>
@@ -1,3 +1,3 @@
<%= form_for @writing_journal, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: desktop_journal_pages_path do |f| %>
<%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %>
<%= 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: 'panel/personal_journal/desktop/journal_pages/form', locals: {:f => f} %>
<%end%>
@@ -1,2 +0,0 @@
<h1>Desktop::JournalPages#show</h1>
<p>Find me in app/views/desktop/journal_pages/show.html.erb</p>
+19 -13
View File
@@ -1,40 +1,46 @@
Rails.application.routes.draw do
namespace :panel do
namespace :personal_journal do
namespace :desktop do
match 'journal_p'=>'journal_p#journal_p'
match 'get_journals_json' => 'journal_pages#get_journals_json'
resources :journal_pages, except: :show
resources :journal_lists, only: :index
resources :co_authors, except: :show
resources :co_author_relations, except: :show
end
namespace :back_end do
match 'writing_journal_setting' => "writing_journals#writing_journal_setting" ,:as => :writing_journal_setting
resources :writing_journals do
collection do
get 'delete'
end
match "level_type_quick_add" => "writing_journals#level_type_quick_add" ,:as => :level_type_quick_add
match "level_type_quick_edit" => "writing_journals#level_type_quick_edit" ,:as => :level_type_quick_edit
match "author_type_quick_add" => "writing_journals#author_type_quick_add" ,:as => :author_type_quick_add
match "author_type_quick_edit" => "writing_journals#author_type_quick_edit" ,:as => :author_type_quick_edit
match "paper_type_quick_add" => "writing_journals#paper_type_quick_add" ,:as => :paper_type_quick_add
match "paper_type_quick_edit" => "writing_journals#paper_type_quick_edit" ,:as => :paper_type_quick_edit
match "tag_quick_add" => "writing_journals#tag_quick_add" ,:as => :tag_quick_add
match "tag_quick_edit" => "writing_journals#tag_quick_edit" ,:as => :tag_quick_edit
end
resources :journal_paper_types
resources :journal_author_types
resources :journal_level_types
resources :journal_paper_types
resources :journal_author_types
resources :journal_level_types
resources :tags
end
namespace :front_end do
resources :writing_journals
end
namespace :plugin do
resources :writing_journals
end
namespace :widget do
match "writing_journals" => "writing_journals#index"
match "home_list" => "writing_journals#home_list"
@@ -42,6 +48,6 @@ Rails.application.routes.draw do
end
end
end
match "/appfront/*path" => redirect("/panel/*path")
match "/appfront/*path" => redirect("/panel/*path")
end