changeset 549:a1e091bee818 cannam_integration

Merge from branch "feature_36"
author Chris Cannam
date Fri, 29 Jul 2011 21:40:48 +0100
parents 168714032c7e (current diff) 56ad0c490f5e (diff)
children 61e0de6cc1bb
files vendor/plugins/redmine_bibliography/app/views/publications/_edit.html.erb
diffstat 20 files changed, 284 insertions(+), 137 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Fri Jul 29 21:40:48 2011 +0100
@@ -3,33 +3,29 @@
 class PublicationsController < ApplicationController
   unloadable
   
-  # before_filter :find_project_by_project_id, :except => [:autocomplete_for_project, :add_author, :sort_authors, :autocomplete_for_author]
+  # before_filter :find_project, :except => [:autocomplete_for_project, :add_author, :sort_authors, :autocomplete_for_author]
     
   def new
-    @publication = Publication.new      
+    find_project_by_project_id
+    @publication = Publication.new
     
     # we'll always want a new publication to have its bibtex entry
-    # @publication.build_bibtex_entry
+    @publication.build_bibtex_entry
     
     # and at least one author
     # @publication.authorships.build.build_author
     
     @project_id = params[:project_id]
-    @current_user = User.current
+    @current_user = User.current    
   end
 
 
-  def create
+  def create    
+    find_project_by_project_id
+    
     @publication = Publication.new(params[:publication])
-    
-    logger.error { "PUBLICATION CREATE ACTION" }
-    logger.error { params[:publication]  }
-        
-    @project = Project.find(params[:project_id])
 
-    logger.error { "PARAMS publication" }
-    logger.error { params[:publication] }
-    
+    # @project = Project.find(params[:project_id])
     @publication.projects << @project
     
     if @publication.save 
@@ -41,8 +37,13 @@
   end
 
   def index
-    @project = Project.find(params[:project_id])
-    @publications = Publication.find :all, :joins => :projects, :conditions => ["project_id = ?", @project.id]
+    if !params[:project_id].nil?
+      find_project_by_project_id
+      @project = Project.find(params[:project_id])
+      @publications = Publication.find :all, :joins => :projects, :conditions => ["project_id = ?", @project.id]
+    else
+      @publications = Publication.find :all
+    end
   end
 
   def new_from_bibfile
@@ -67,15 +68,26 @@
     end
   end
 
-  def edit    
+  def edit   
+    find_project_by_project_id unless params[:project_id].nil?
+     
     @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."
-      redirect_to @publication
+
+      if !params[:project_id].nil?
+        redirect_to :action => :show, :id => @publication, :project_id => params[:project_id]
+      else
+        redirect_to :action => :show, :id => @publication
+      end
     else
       render :action => 'edit'
     end   
@@ -85,18 +97,13 @@
     find_project_by_project_id unless params[:project_id].nil?
     
     @publication = Publication.find(params[:id])
-
+    
     if @publication.nil?
         @publications = Publication.all
-        render "index", :alert => 'Your Publications was not found!'
+        render "index", :alert => 'The publication was not found!'
     else
       @authors = @publication.authors
       @bibtext_entry = @publication.bibtex_entry
-    
-      respond_to do |format|
-        format.html
-        format.xml {render :xml => @publication}
-      end
     end
   end
 
@@ -230,18 +237,6 @@
     
   end
 
+  private
 
-  
-  private
-   
-  # TODO: luisf. - only here for debugging purposes 
-  # Find project of id params[:project_id]
-   def find_project_by_project_id
-     
-     logger.error { "FIND PROJECT BY PROJECT ID" }
-     
-     @project = Project.find(params[:project_id])
-   rescue ActiveRecord::RecordNotFound
-     render_404
-   end
 end
--- a/vendor/plugins/redmine_bibliography/app/helpers/authors_helper.rb	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/authors_helper.rb	Fri Jul 29 21:40:48 2011 +0100
@@ -1,2 +1,20 @@
 module AuthorsHelper
+  unloadable
+  
+  def render_author_publications(author)
+    s = ""
+    pubs = []
+
+    author.publications.each do |pub|
+     pubs << link_to(pub.title, pub)
+    end
+
+    if pubs.size < 3
+      s << '<nobr>' << pubs.join(', ') << '</nobr>'
+    else
+      s << pubs.join(', ')
+    end
+    s    
+  end
+  
 end
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Fri Jul 29 21:40:48 2011 +0100
@@ -61,6 +61,38 @@
     str = "#{sanitized_object_name(object_name.to_s)}_#{sanitized_method_name(method_name.to_s)}"
     str.to_sym
   end
+  
+  def render_projects_list(publication)
+    s = ""
+    projs = []
+    
+    publication.projects.each do |proj|
+      projs << link_to_project(proj)
+    end
+    
+    if projs.size < 3
+      s << '<nobr>' << projs.join(', ') << '</nobr>'
+    else
+      s << projs.join(', ')
+    end
+    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	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/models/bibtex_entry.rb	Fri Jul 29 21:40:48 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb	Fri Jul 29 21:40:48 2011 +0100
@@ -0,0 +1,2 @@
+class BibtexEntryType < ActiveRecord::Base
+end
--- a/vendor/plugins/redmine_bibliography/app/views/authors/index.html.erb	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/authors/index.html.erb	Fri Jul 29 21:40:48 2011 +0100
@@ -1,5 +1,26 @@
 <h2>Authors#index</h2>
 
-<% @authors.each do |author| %>
-	<p><%= author.name %> - <%= author.publications.first.title%></p>
-<% end %>
\ No newline at end of file
+<table class="list authors">		
+	<thead><tr>
+	<th><%=l(:field_author_name)%></th>
+	<th><%=l(:field_author_username)%></th>
+	<th><%=l(:field_author_publications)%></th>
+	</tr></thead>
+	<tbody>
+	  	
+  <% @authors.each do |author|%>    
+	<tr id="author-<%= author.id %>" class="<%= cycle('odd', 'even') %>">
+		<td class="title">
+			<%= h author.name %>
+		</td>
+    <td class="username ">
+      <%= link_to author.user unless author.user.nil? %>
+    </td>
+    <td class="project">             
+      <%= render_author_publications(author) %>	
+    </td>
+	</tr>
+	<% end %>
+	</tbody>
+</table>
+
--- a/vendor/plugins/redmine_bibliography/app/views/projects/show.rhtml	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/projects/show.rhtml	Fri Jul 29 21:40:48 2011 +0100
@@ -2,6 +2,9 @@
 	<% if User.current.allowed_to?(:add_subprojects, @project) %>
 		<%= link_to l(:label_subproject_new), {:controller => 'projects', :action => 'new', :parent_id => @project}, :class => 'icon icon-add' %>
 	<% end %>
+	
+	<%= link_to l(:label_add_publication_to_project), {:controller => 'publications', :action => 'new', :project_id => @project}, :class => 'icon icon-add' %>
+	
 </div>
 
 <h2><%=l(:label_overview)%></h2> 
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Fri Jul 29 21:40:48 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	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb	Fri Jul 29 21:40:48 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	Wed Jul 27 12:23:57 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-<% content_for :header_tags do %>
-    <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %>
-<% end %>
-
-<% form_for @publication, :url => { :project_id  => @project_id, :action => :create } do |f| -%>
-  <%= f.error_messages %>  
-  <p>
-    <%= f.label :title, l(:title) %><br />
-    <%= f.text_field :title %>
-  </p>
-
-  <h3><%= l(:authors) %></h3>    
-  <% f.fields_for :authorships do |builder| %>
-    <%= render "authorship_fields", :f => builder %>
-  <% end %>
-
-  <p><%= link_to_add_fields l(:label_add_another_author), f, :authorships %></p>
-      
-  <h3>Other Details</h3>
-  <% f.fields_for :bibtex_entry do |builder| -%>
-    <%= render :partial => 'bibtex_fields', :locals => { :f => builder}  %>
-  <%- end -%>
-
-  <%= f.submit %>
-<% end -%>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb	Fri Jul 29 21:40:48 2011 +0100
@@ -0,0 +1,30 @@
+
+<div class="splitcontentleft">
+    <%= f.error_messages %>  
+    <p>
+      <%= f.text_field :title, :required => true, :size => 60 %>
+    </p>
+
+    <h3><%= l(:authors) %></h3>    
+    <% f.fields_for :authorships do |builder| %>
+      <%= render "authorship_fields", :f => builder %>
+    <% end %>
+
+    <p><%= link_to_add_fields l(:label_add_another_author), f, :authorships %></p>
+
+</div>
+
+<div class="splitcontentright">      
+  <h3>Other Details</h3>
+  <% f.fields_for :bibtex_entry do |builder| -%>
+    <%= render :partial => 'bibtex_fields', :locals => { :f => builder}  %>
+  <%- end -%>
+</div>
+
+<% content_for :sidebar do %>
+
+  placeholder
+
+<% end %>
+
+
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_list_projects.html.erb	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_list_projects.html.erb	Fri Jul 29 21:40:48 2011 +0100
@@ -1,3 +1,1 @@
-<% @publication.projects.each do |proj| %>
-  <%= link_to_project proj %>
-<% end %>
\ No newline at end of file
+<%= render_projects_list(@publication) %>
\ No newline at end of file
--- a/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb	Fri Jul 29 21:40:48 2011 +0100
@@ -1,8 +1,15 @@
-<h2>Publications#edit</h2>
+<% content_for :header_tags do %>
+    <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %>
+<% end %>
 
-<%= render :partial => 'edit' %>
+<h2><%=l(:label_publication_show)%></h2>
 
+<% form_for @publication, :url => { :project_id  => @project_id, :action => :update }, :builder => TabularFormBuilder do |f| -%>
+  <%= render :partial => 'form', :locals => { :f => f }  %>
+  
+  <%= f.submit %>
+<% end %>
 <p>
-  <%= link_to "Show", @publication %> |
-  <%= link_to "View All", publications_path %>
+  <%= link_to l(:label_publication_show), { :controller => "publications", :action => "show", :id => @publication, :project_id => @project } %> |
+  <%= link_to l(:label_publication_index), { :controller => "publications", :action => "index", :project_id => @project } %>
 </p>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb	Fri Jul 29 21:40:48 2011 +0100
@@ -1,9 +1,10 @@
-<h1>New Publication</h1>
+<% content_for :header_tags do %>
+    <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %>
+<% end %>
 
-<div class="splitcontentleft">
-  <%= render :partial => 'edit' %>
-</div>
+<h2><%=l(:label_publication_new)%></h2>
 
-<div class="splitcontentright">
-
-</div>
\ No newline at end of file
+<% form_for @publication, :url => { :project_id  => @project_id, :action => :create }, :builder => TabularFormBuilder do |f| -%>
+  <%= render :partial => 'form', :locals => { :f => f }  %>
+  <%= f.submit %>
+<% end %>
\ No newline at end of file
--- a/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb	Fri Jul 29 21:40:48 2011 +0100
@@ -1,4 +1,4 @@
-<h2>Publication Details</h2>
+<h2><%=l(:label_publication_show)%></h2>
 
 <div class="splitcontentleft">
 <h4>Title</h4>
@@ -18,17 +18,11 @@
 <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>
-  <%= link_to "Edit", edit_publication_path(@publication) %> |
+  <%= link_to l(:label_publication_edit), { :controller => "publications", :action => "edit", :id => @publication, :project_id => @project } %> |
   <%= link_to "Destroy", @publication, :confirm => 'Are you sure?', :method => :delete %> |
   <%= link_to "View All", publications_path %>
 </p>
@@ -38,13 +32,10 @@
 <% projects = Project.active.find(:all, :limit => 100, :order => 'name ASC') - @publication.projects %>
 
 <div class="splitcontentright">
-
-
-  <h4>List of Projects</h4>
+  
+  <h4><%=l(:label_publication_project_index)%></h4>
   <p id="list_projects">
     <%= render :partial => 'list_projects' %>
   </p>
-
-  <%= render :partial => 'add_project_form' %>
-    
+    <%= render :partial => 'add_project_form' %>    
 </div>
\ No newline at end of file
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml	Fri Jul 29 21:40:48 2011 +0100
@@ -9,7 +9,13 @@
   
   field_publication_title: Title
   field_publication_authors: Authors
-  field_publication_projects: "Associated Projects" 
+  field_publication_projects: "Associated Projects"
+  field_author_name: Author
+  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"
@@ -17,46 +23,52 @@
   remove_author: "Remove this author"
   
   label_publications_plural: "Publications"
-  label_publication_new: "Add Publication"
+  label_publication_new: "Create New Publication"
+  label_add_publication_to_project: "Add Publication to this project"
+  label_publication_edit: "Edit Publication"
+  label_publication_show: "Publication Details"
   label_add_project_to_publication: "Add Project to Publication"
   label_project_search: "Search by name: "
+  label_publication_project_index: "Projects associated with this publication"
+  label_publication_index: "View all publications"
   
   text_author_email: "Author's email address as on the paper."
   text_author_institution: "Author's institution name as on paper."
   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"
   
   
   
--- a/vendor/plugins/redmine_bibliography/db/migrate/004_create_bibtex_entries.rb	Wed Jul 27 12:23:57 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/db/migrate/004_create_bibtex_entries.rb	Fri Jul 29 21:40:48 2011 +0100
@@ -2,7 +2,7 @@
   def self.up
     create_table :bibtex_entries do |t|
       t.column :publication_id, :integer
-      t.column :entry_type, :string
+      t.column :entry_type, :integer
       t.column :address, :string
       t.column :annote, :string
       t.column :booktitle, :string
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/db/migrate/006_create_bibtex_entry_types.rb	Fri Jul 29 21:40:48 2011 +0100
@@ -0,0 +1,13 @@
+class CreateBibtexEntryTypes < ActiveRecord::Migration
+  def self.up
+    create_table :bibtex_entry_types do |t|
+      t.string :name
+
+      t.timestamps
+    end
+  end
+
+  def self.down
+    drop_table :bibtex_entry_types
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/db/seed_data/bibtex_entry_types_list.txt	Fri Jul 29 21:40:48 2011 +0100
@@ -0,0 +1,14 @@
+article
+book
+booklet
+conference
+inbook
+incollection
+inproceedings
+manual
+masterthesis
+misc
+phdthesis
+proceedings
+techreport
+unpublished
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/lib/tasks/seed_bibtex_entry_types.rake	Fri Jul 29 21:40:48 2011 +0100
@@ -0,0 +1,20 @@
+namespace :redmine do
+  namespace :plugins do
+    namespace :redmine_bibliography do
+
+      task :seed_bibtex_entry_types  => :environment do    
+        desc "Seeds the Bibtex Entry Types Table"
+  
+        quoted = ActiveRecord::Base.connection.quote_table_name('bibtex_entry_types')
+        ActiveRecord::Base.connection.execute("TRUNCATE #{quoted}")
+
+        open(File.dirname(__FILE__) + "/../../db/seed_data/bibtex_entry_types_list.txt") do |bibtex_entry_types|
+          bibtex_entry_types.read.each_line do |bibtex_entry_type|
+            BibtexEntryType.create(:name => bibtex_entry_type.chomp)
+          end
+        end
+      end 
+
+    end 
+  end
+end