diff --git a/app/assets/javascripts/desktop/journal_pages.js.erb b/app/assets/javascripts/desktop/journal_pages.js.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 321292a2f..2de7da1b3 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -586,7 +586,7 @@ var orbitDesktop = function(dom){ $(this).val(sectionnames[i]); }) bindHandlers(); - }) + }) } diff --git a/app/controllers/desktop/journal_pages_controller.rb b/app/controllers/desktop/journal_pages_controller.rb new file mode 100644 index 000000000..4db1bbdf4 --- /dev/null +++ b/app/controllers/desktop/journal_pages_controller.rb @@ -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 diff --git a/app/controllers/desktop_publications_controller.rb b/app/controllers/desktop_publications_controller.rb index c55f348ef..1eb6b2449 100644 --- a/app/controllers/desktop_publications_controller.rb +++ b/app/controllers/desktop_publications_controller.rb @@ -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 diff --git a/app/views/desktop/journal_p.html.erb b/app/views/desktop/journal_p.html.erb index 07452f20c..868136c43 100644 --- a/app/views/desktop/journal_p.html.erb +++ b/app/views/desktop/journal_p.html.erb @@ -1,33 +1,33 @@
-
- -
- -
-
-
-
-
-
- \ No newline at end of file +
+ +
+ +
+
+
+
+
+ + diff --git a/app/views/desktop/journal_pages/_form.html.erb b/app/views/desktop/journal_pages/_form.html.erb index 53707a6ac..9eecab853 100644 --- a/app/views/desktop/journal_pages/_form.html.erb +++ b/app/views/desktop/journal_pages/_form.html.erb @@ -60,7 +60,7 @@