55 lines
1.4 KiB
Ruby
55 lines
1.4 KiB
Ruby
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
|