finished some method of list and journal

This commit is contained in:
Rueshyna committed 2012-11-18 03:07:50 +08:00
1 parent 024b331cf3
commit 26436395f5
20 files changed
+306 -316

No files matched your search

@@ -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