Mercurial > hg > soundsoftware-site
diff vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb @ 472:0ce4139187fa feature_36
Add Me as Author: started building the AJAX call to fill the form.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 24 Jun 2011 17:13:29 +0100 |
parents | 49fb7a9ef79c |
children | aeedcec4df5f |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Jun 24 15:11:30 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Jun 24 17:13:29 2011 +0100 @@ -24,9 +24,6 @@ @publication = Publication.new(params[:publication]) @project = Project.find(params[:project_id]) - logger.error { "FIGUEIRA" } - Rails.logger.debug { @project } - @publication.projects << @project if @publication.save @@ -64,6 +61,23 @@ end end + def add_me_as_author + if (request.xhr?) + if User.current.author.nil? + logger.error { "current user has an author" } + @author = Author.new(:user_id => User.current) + else + logger.error { "current user does not have an author" } + @author = User.current.author + end + @authorship = Authorship.create(:author => @author, :publication => @publication) + else + # No? Then render an action. + #render :action => 'view_attribute', :attr => @name + logger.error { "ERROR ADD ME AS AUTHOR" } + end + end + def edit @publication = Publication.find(params[:id])