Revision 390:5562a95edbf7 vendor
| vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb | ||
|---|---|---|
| 32 | 32 |
end |
| 33 | 33 |
|
| 34 | 34 |
def new |
| 35 |
session[:publication_params] ||= {}
|
|
| 36 | 35 |
@publication = Publication.new |
| 37 | 36 |
@publication.current_step = session[:publication_step] |
| 38 |
|
|
| 39 |
if request.post? |
|
| 40 |
parse_bibtex_text |
|
| 41 |
@publication = Publication.new(params[:publication]) |
|
| 42 |
|
|
| 43 |
if @publication.save |
|
| 44 |
logger.error "GRAVOU XXXdsfgXXX" |
|
| 45 |
else |
|
| 46 |
logger.error "nao gravou" |
|
| 47 |
end |
|
| 48 |
|
|
| 49 |
end |
|
| 50 |
|
|
| 37 |
|
|
| 38 |
logger.error @publication.current_step |
|
| 39 |
|
|
| 40 |
|
|
| 51 | 41 |
end |
| 52 | 42 |
|
| 53 |
def create |
|
| 43 |
def create |
|
| 44 |
@publication = Publication.new(params[:publication]) |
|
| 54 | 45 |
|
| 55 |
logger.error "AAAA create"
|
|
| 46 |
@publication.current_step = session[:publication_step]
|
|
| 56 | 47 |
|
| 57 |
@publication.save |
|
| 48 |
if params[:back_button] |
|
| 49 |
@publication.previous_step |
|
| 50 |
else |
|
| 51 |
@publication.next_step |
|
| 52 |
end |
|
| 53 |
|
|
| 54 |
session[:publication_step] = @publication.current_step |
|
| 55 |
|
|
| 56 |
logger.error "AAAA" |
|
| 57 |
logger.error session[:publication_step] |
|
| 58 |
|
|
| 59 |
|
|
| 60 |
render "new" |
|
| 58 | 61 |
end |
| 59 | 62 |
|
| 60 | 63 |
def index |
| vendor/plugins/redmine_bibliography/app/models/publication.rb | ||
|---|---|---|
| 15 | 15 |
def steps |
| 16 | 16 |
%w[new review] |
| 17 | 17 |
end |
| 18 |
|
|
| 19 |
def next_step |
|
| 20 |
self.current_step = step[steps.index(current_step)+1] |
|
| 21 |
end |
|
| 18 | 22 |
|
| 23 |
def previous_step |
|
| 24 |
self.current_step = step[steps.index(current_step)-1] |
|
| 25 |
end |
|
| 26 |
|
|
| 27 |
def first_step? |
|
| 28 |
current_step == steps.first |
|
| 29 |
end |
|
| 19 | 30 |
|
| 20 | 31 |
end |
| vendor/plugins/redmine_bibliography/app/views/publications/_new_bibtex_step.html.erb | ||
|---|---|---|
| 1 |
<h3>New Bibtex</h3> |
|
| 1 | 2 |
|
| 2 |
<h1>New Bibtex</h1> |
|
| 3 |
<p> |
|
| 4 |
<%= f.label :title %> |
|
| 5 |
<%= f.text_field :title %> |
|
| 6 |
</p> |
|
| 3 |
<p> |
|
| 4 |
<%= f.label :title %> |
|
| 5 |
<%= f.text_field :title %> |
|
| 6 |
</p> |
|
| 7 | 7 |
|
| 8 |
<p>
|
|
| 9 |
<%=label_tag :bibtex_entry %>
|
|
| 10 |
<%=text_area_tag :bibtex_entry%>
|
|
| 11 |
</p>
|
|
| 8 |
<p> |
|
| 9 |
<%=label_tag :bibtex_entry %>
|
|
| 10 |
<%=text_area_tag :bibtex_entry%> |
|
| 11 |
</p> |
|
| 12 | 12 |
|
| 13 | 13 |
|
| vendor/plugins/redmine_bibliography/app/views/publications/_review_bibtex_step.html.erb | ||
|---|---|---|
| 1 |
<h2>Review new entries</h2> |
|
| 2 |
|
|
| vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb | ||
|---|---|---|
| 1 | 1 |
<h1>New Publication</h1> |
| 2 | 2 |
|
| 3 |
<% form_for :publication do |f| %> |
|
| 3 |
<% form_for :publication, :url => { :action => "create" } do |f| %>
|
|
| 4 | 4 |
<% f.error_messages %> |
| 5 | 5 |
|
| 6 |
<% render :partial => "#{@publication.current_step}_bibtex_step", :locals => { :f => f } %>
|
|
| 6 |
<%= render :partial => "#{@publication.current_step}_bibtex_step", :locals => { :f => f } %>
|
|
| 7 | 7 |
|
| 8 |
<%= submit_tag l(:button_submit) %> |
|
| 8 |
<%= f.submit "Continue" %> |
|
| 9 |
<%= f.submit "Back", :name => "back_button" unless @publication.first_step? %> |
|
| 9 | 10 |
|
| 10 | 11 |
<% end %> |
| 11 | 12 |
|
Also available in: Unified diff