Revision 445:77f88379115a vendor/plugins/redmine_bibliography/app/controllers
| vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb | ||
|---|---|---|
| 6 | 6 |
|
| 7 | 7 |
def new |
| 8 | 8 |
@publication = Publication.new |
| 9 |
|
|
| 9 |
|
|
| 10 |
# we'll always want a new publication to have its bibtex entry |
|
| 11 |
@publication.build_bibtex_entry |
|
| 12 |
|
|
| 10 | 13 |
# the step we're at in the form |
| 11 | 14 |
@publication.current_step = session[:publication_step] |
| 12 | 15 |
|
| ... | ... | |
| 16 | 19 |
|
| 17 | 20 |
def create |
| 18 | 21 |
@publication = Publication.new(params[:publication]) |
| 22 |
|
|
| 23 |
if @publication.save |
|
| 24 |
flash[:notice] = "Successfully created publication." |
|
| 25 |
redirect_to @publication |
|
| 26 |
else |
|
| 27 |
render :action => 'new' |
|
| 28 |
end |
|
| 29 |
end |
|
| 30 |
|
|
| 31 |
def index |
|
| 32 |
@publications = Publication.find(:all) |
|
| 33 |
end |
|
| 34 |
|
|
| 35 |
def new_from_bibfile |
|
| 19 | 36 |
@publication.current_step = session[:publication_step] |
| 20 | 37 |
|
| 21 | 38 |
# contents of the paste text area |
| ... | ... | |
| 36 | 53 |
end |
| 37 | 54 |
|
| 38 | 55 |
session[:publication_step] = @publication.current_step |
| 39 |
|
|
| 40 |
if @publication.new_record? |
|
| 41 |
render "new" |
|
| 42 |
else |
|
| 43 |
session[:publication_step] = session[:publication_params] = nil |
|
| 44 |
flash[:notice] = "New publication saved!" |
|
| 45 |
redirect_to @publication |
|
| 46 |
end |
|
| 47 |
end |
|
| 48 |
|
|
| 49 |
def index |
|
| 50 |
@publications = Publication.find(:all) |
|
| 51 |
end |
|
| 52 |
|
|
| 53 |
def edit |
|
| 54 |
|
|
| 55 |
@publication = Publication.find(params[:id]) |
|
| 56 | 56 |
|
| 57 | 57 |
end |
| 58 | 58 |
|
| 59 |
def update |
|
| 59 |
|
|
| 60 |
def edit |
|
| 60 | 61 |
@publication = Publication.find(params[:id]) |
| 62 |
end |
|
| 63 |
|
|
| 64 |
def update |
|
| 65 |
@publication = Publication.find(params[:id]) |
|
| 66 |
|
|
| 61 | 67 |
if @publication.update_attributes(params[:publication]) |
| 62 | 68 |
flash[:notice] = "Successfully updated Publication." |
| 63 |
redirect_to @publication |
|
| 64 | 69 |
else |
| 65 |
render :action => 'edit'
|
|
| 70 |
flash[:notice] = "Could not Update Publication."
|
|
| 66 | 71 |
end |
| 72 |
|
|
| 67 | 73 |
end |
| 68 | 74 |
|
| 69 | 75 |
def show |
| 76 |
logger.error "-------> No Show" |
|
| 77 |
|
|
| 70 | 78 |
@publication = Publication.find(params[:id]) |
| 71 | 79 |
|
| 72 | 80 |
if @publication.nil? |
Also available in: Unified diff