add journal_list. now, those pair, (journal_title, journal_levels), is uniq

This commit is contained in:
Rueshyna 2012-11-30 23:50:46 +08:00
parent ccacef6d9e
commit cc6339d59b
5 changed files with 52 additions and 27 deletions

View File

@ -233,9 +233,20 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
})
}
bindHandlers();
}
this.initializeJournalPapers.journal = function(){ // to open add pages in journal papers page
var bindHandlers = function(){ // to bind handlers for add page
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
}
bindHandlers();
}
this.initializeJournalPapers.coAuthorformCallback = function(data){
if(data.success){
o.notify(data.msg,"success");
@ -244,7 +255,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
o.notify(data.msg,"alert");
}
}
this.initializeJournalPapers.coauthor = function(){ // to open add pages in journal papers page
this.initializeJournalPapers.coauthor = function(){ // to open add pages in coauthor page
var bindHandlers = function(){ // to bind handlers for add page
o.simple_drop_down();

View File

@ -2,14 +2,23 @@ class Desktop::JournalListsController < ApplicationController
# GET /desktop/journal_lists
# GET /desktop/journal_lists.json
def index
@desktop_journal_lists = Desktop::JournalList.all
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.join(",")
].join(" -- ")
end
@journal_lists = all_journal_lists.uniq
respond_to do |format|
format.html # index.html.erb
format.json { render json: @desktop_journal_lists }
format.html { render :layout => false}
end
end
=begin
# GET /desktop/journal_lists/1
# GET /desktop/journal_lists/1.json
def show
@ -80,4 +89,5 @@ class Desktop::JournalListsController < ApplicationController
format.json { head :ok }
end
end
=end
end

View File

@ -1,21 +1,24 @@
<h1>Listing desktop_journal_lists</h1>
<h1>journal_title -- journal_level</h1>
<table>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
<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 class="s_grid_con s_form">
<% @desktop_journal_lists.each do |desktop_journal_list| %>
<tr>
<td><%= link_to 'Show', desktop_journal_list %></td>
<td><%= link_to 'Edit', edit_desktop_journal_list_path(desktop_journal_list) %></td>
<td><%= link_to 'Destroy', desktop_journal_list, confirm: 'Are you sure?', method: :delete %></td>
</tr>
<% end %>
</table>
<% @journal_lists.each_with_index do |journal_list,i| %>
<% if ( i % 5 ) == 0 %>
<div class="s_grid_con s_form">
<ul>
<% end %>
<li class="s_grid_row">
<%= journal_list %>
</li>
<% if ( i % 5 ) == 4 %>
</ul>
</div>
<% end %>
<% end %>
<br />
<%= link_to 'New Journal list', new_desktop_journal_list_path %>
</div>
</div>
</div>

View File

@ -14,8 +14,8 @@
<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 %>" custom-load="addpaper" callback-method="addpaper" custom-load="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="<%= 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="<%= new_desktop_co_author_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>

View File

@ -182,6 +182,7 @@ Orbit::Application.routes.draw do
match '/temp_func/'=>'desktop#temp_func'
resources :journal_pages
resources :journal_lists
resources :co_authors
end