Mercurial > hg > soundsoftware-site
changeset 544:f05f3a9ef569 feature_36
Closes Feature #237. Minor changes to the form's layout (using TabularFormBuilder).
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 29 Jul 2011 17:51:45 +0100 |
parents | 85dd79181088 |
children | a2c2b9f8380b |
files | vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb vendor/plugins/redmine_bibliography/app/models/bibtex_entry.rb vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb vendor/plugins/redmine_bibliography/app/views/publications/_edit.html.erb vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb vendor/plugins/redmine_bibliography/config/locales/en.yml |
diffstat | 8 files changed, 80 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Jul 29 15:14:01 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Jul 29 17:51:45 2011 +0100 @@ -70,11 +70,14 @@ def edit @publication = Publication.find(params[:id]) + @selected_bibtex_entry_type_id = @publication.bibtex_entry.entry_type end def update @publication = Publication.find(params[:id]) + logger.error { "INSIDE THE UPDATE ACTION IN THE PUBLICATION CONTROLLER" } + if @publication.update_attributes(params[:publication]) flash[:notice] = "Successfully updated Publication."
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Fri Jul 29 15:14:01 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Fri Jul 29 17:51:45 2011 +0100 @@ -78,6 +78,21 @@ s end + def show_bibtex_fields(bibtex_entry) + s = "" + bibtex_entry.attributes.each do |field| + if field[1] != nil + s << "<h4>" + field[0].titleize + "</h4>" + + if field[0] == "entry_type" + s << bibtex_entry.entry_type_name.capitalize + else + s << bibtex_entry.attributes[field[0]].to_s + end + end + end + s + end end
--- a/vendor/plugins/redmine_bibliography/app/models/bibtex_entry.rb Fri Jul 29 15:14:01 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/models/bibtex_entry.rb Fri Jul 29 17:51:45 2011 +0100 @@ -1,4 +1,14 @@ class BibtexEntry < ActiveRecord::Base + unloadable + belongs_to :publication + validates_presence_of :entry_type + + def entry_type_name + entry_type = self.entry_type + BibtexEntryType.find(entry_type).name + end + + end
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml Fri Jul 29 15:14:01 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml Fri Jul 29 17:51:45 2011 +0100 @@ -1,6 +1,5 @@ <div id="authors" class="fields"> <p> - <%= f.label :name_on_paper, l("name") %> <%= f.text_field :name_on_paper %><br /> <em><%= h l("text_author_name_on_paper") %></em><br /> @@ -15,12 +14,10 @@ <% end %> </div> - <%= f.label :institution, l("institution") %> - <%= f.text_field :institution %><br /> + <%= f.text_field :institution, :size => 60 %><br /> <em><%= h l("text_author_institution") %></em><br /> - <%= f.label :email, l("email") %> - <%= f.text_field :email %><br /> + <%= f.text_field :email, :size => 60 %><br /> <em><%= h l("text_author_email") %></em><br /> <%= f.hidden_field :user_id %>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb Fri Jul 29 15:14:01 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb Fri Jul 29 17:51:45 2011 +0100 @@ -1,18 +1,26 @@ +<div class="box"> + + +<p><label for="bibtex_entry_type"><%=l("field_entry_type")%> <span class="required">*</span></label> + <%= f.collection_select(:entry_type, BibtexEntryType.find(:all), :id, :name, {:selected => @selected_bibtex_entry_type_id, :prompt => true}) %> + </p> <p> - <%= f.label :year, l(:year) %> <%= f.text_field :year %> + <%= f.text_field :year, :size => 60 %> </p> <p> - <%= f.label :chapter, l(:chapter) %> <%= f.text_field :chapter %> + <%= f.text_field :chapter, :size => 60 %> </p> <p> - <%= f.label :editor, l(:editor) %> <%= f.text_field :editor %> + <%= f.text_field :editor, :size => 60 %> </p> <p> - <%= f.label :booktitle, l(:booktitle) %> <%= f.text_field :booktitle %> + <%= f.text_field :booktitle,:size => 60 %> </p> <p> - <%= f.label :publisher, l(:publisher) %> <%= f.text_field :publisher %> + <%= f.text_field :publisher,:size => 60 %> </p> <p> - <%= f.label :pages, l(:pages) %> <%= f.text_field :pages %> + <%= f.text_field :pages, :size => 60 %> </p> + +</div> \ No newline at end of file
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_edit.html.erb Fri Jul 29 15:14:01 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_edit.html.erb Fri Jul 29 17:51:45 2011 +0100 @@ -3,11 +3,10 @@ <% end %> <div class="splitcontentleft"> - <% form_for @publication, :url => { :project_id => @project_id, :action => :create } do |f| -%> + <% form_for @publication, :url => { :project_id => @project_id, :action => :create }, :builder => TabularFormBuilder do |f| -%> <%= f.error_messages %> <p> - <%= f.label :title, l(:title) %><br /> - <%= f.text_field :title %> + <%= f.text_field :title, :required => true, :size => 60 %> </p> <h3><%= l(:authors) %></h3>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Fri Jul 29 15:14:01 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Fri Jul 29 17:51:45 2011 +0100 @@ -18,13 +18,7 @@ <br /> <%- if @publication.bibtex_entry != nil -%> -<% @publication.bibtex_entry.attributes.each do |field| %> - <% if field[1] != nil %> - <h4><%= field[0] %></h4> - <%= @publication.bibtex_entry.attributes[field[0]] unless field[1] == nil %> - <br /> - <%- end -%> -<%- end -%> + <%= show_bibtex_fields(@publication.bibtex_entry) %> <%- end -%> <p>
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Jul 29 15:14:01 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Jul 29 17:51:45 2011 +0100 @@ -14,6 +14,9 @@ field_author_username: "Associated User" field_author_publications: "Publications by this Author" + bibtex_entry: + entry_type: "Bibtex Entry Type" + label_add_me_as_author: "Add me as an author" label_add_another_author: "Add another author" @@ -29,37 +32,38 @@ text_author_name_on_paper: "Name of the author as it appears on paper. (In case it applies, please use the autocomplete suggestions.)" # authorships model - institution: "Institution" - name_on_paper: "Name" - email: "Email Address" + field_institution: "Institution" + field_name_on_paper: "Name" + field_email: "Email Address" # bibtex_entries model - id: "id" - publication_id: "Publication_id" - entry_type: "Entry Type" - address: "Address" - annote: "Annote" - booktitle: "Book Title" - chapter: "Chapter" - crossref: "Cross Reference" - edition: "Edition" - editor: "Editor" - eprint: "eprint" - howpublished: "How was it Published" - journal: "Journal" - key: "Key" - month: "Month" - note: "Note" - number: "Number" - organization: "Organization" - pages: "Pages" - publisher: "Publisher" - school: "School" - series: "Series" - type: "Type" - url: "URL" - volume: "Volume" - year: "Year" + field_entry_type: "Entry Type" + field_id: "id" + field_publication_id: "Publication_id" + field_entry_type: "Entry Type" + field_address: "Address" + field_annote: "Annote" + field_booktitle: "Book Title" + field_chapter: "Chapter" + field_crossref: "Cross Reference" + field_edition: "Edition" + field_editor: "Editor" + field_eprint: "eprint" + field_howpublished: "How was it Published" + field_journal: "Journal" + field_key: "Key" + field_month: "Month" + field_note: "Note" + field_number: "Number" + field_organization: "Organization" + field_pages: "Pages" + field_publisher: "Publisher" + field_school: "School" + field_series: "Series" + field_type: "Type" + field_url: "URL" + field_volume: "Volume" + field_year: "Year"