I'm using the Refinery content management system with a the Portfolio plugin see http://github.com/resolve/refinerycms
I wanted to create a title and description for images uploaded to Refinery using Refinerycms-Portfolio so far I have done the following; added the columns to the images table;
$script/generate migration AddTi开发者_如何学JAVAtleToImages title:string
$script/generate migration AddBodyToImages body:text
$rake db:migrate
modified the field div in this file, * highlighted
vendor/plugins/images/app/views/admin/images/_form.html.erb
<div class='field'>
<%= f.label :uploaded_data, 'Image' %>
<% if params[:action] =~ /(edit)|(update)/ %>
Use current image
<em>or</em>, replace it with this one...
<% end %>
<%= f.file_field :uploaded_data %>
***** <%= f.label :title, 'Title' %>
***** <%= f.text_field :title %>
***** <%= f.label :body, 'Description' %>
***** <%= f.text_area :body, :class => "wymeditor", :rows => 7 %>
</div>
Added these lines to the main image partial in vendor/plugins/refinerycms-portolio/app/views/portfolio/ _main_image.html.erb
<h2><%= @image.title %></h2>
<p><%= @image.body %><p>
This works in the back-end except for a few visual bugs. The problem with this is when i click through the thumbnails in the front-end the titles and descriptions keep stacking on top of the previous titles and descriptions. The main image changes fine, but instead of refreshing the title and description, it adds the new one above the previous titles and descriptions.
How can i stop this repetition so that only one title and description will show at a time? I'm new to Rails and I am using Rails-2.3.5 and I suspect this can be solved using Java Script
any help will be greatly appreciated,
John
You will need to edit the portfolio.js file in the /public/javascripts directory to show/hide the correct titles and descriptions on the portfolio page. This file handles all the AJAX features for the front end of the portfolio plugin.
Best of luck!
精彩评论