Commit 4bee61eea82e2060b01e8b18f26938f987cc66d5
Exists in
master
and in
29 other branches
Merge branch 'product-tabs-for-plugins' into 'master'
Product's tabs for plugins Reopened from !21 See merge request !442
Showing
4 changed files
with
37 additions
and
2 deletions
Show diff stats
app/helpers/application_helper.rb
app/views/manage_products/show.html.erb
| ... | ... | @@ -24,6 +24,8 @@ |
| 24 | 24 | <br style='clear: both'/> |
| 25 | 25 | |
| 26 | 26 | <% unless !@allowed_user && (@product.description.blank? && @product.inputs.empty? && !@product.price_described? ) %> |
| 27 | + <% plugins_tabs = plugins_product_tabs %> | |
| 28 | + | |
| 27 | 29 | <div class='ui-tabs' id='product-<%= @product.id %>-tabs'> |
| 28 | 30 | <ul> |
| 29 | 31 | <% if !@product.description.blank? || @allowed_user %> |
| ... | ... | @@ -35,19 +37,32 @@ |
| 35 | 37 | <% if @product.price_described? || @allowed_user %> |
| 36 | 38 | <li class='tab'><a href='#product-price-details'><%= _('Price composition') %></a></li> |
| 37 | 39 | <% end %> |
| 40 | + | |
| 41 | + <% plugins_tabs.each do |tab| %> | |
| 42 | + <li class='tab'><a href='#<%=tab[:id]%>'><%= tab[:title] %></a></li> | |
| 43 | + <% end %> | |
| 44 | + | |
| 38 | 45 | </ul> |
| 46 | + | |
| 39 | 47 | <div id='product-description'> |
| 40 | 48 | <%= render :partial => 'manage_products/display_description' %> |
| 41 | 49 | </div> |
| 50 | + | |
| 42 | 51 | <div id='product-inputs'> |
| 43 | 52 | <%= render :partial => 'manage_products/display_inputs' %> |
| 44 | 53 | </div> |
| 54 | + | |
| 45 | 55 | <% if @product.price_described? || @allowed_user %> |
| 46 | 56 | <div id='product-price-details'> |
| 47 | 57 | <%= render :partial => 'manage_products/display_price_details' %> |
| 48 | 58 | <%= render :partial => 'manage_products/price_details_button' %> |
| 49 | 59 | </div> |
| 50 | 60 | <% end %> |
| 61 | + | |
| 62 | + <% plugins_tabs.each do |tab| %> | |
| 63 | + <div id='<%=tab[:id]%>'><%= raw tab[:content] %></div> | |
| 64 | + <% end %> | |
| 65 | + | |
| 51 | 66 | </div> |
| 52 | 67 | <% end %> |
| 53 | 68 | ... | ... |
lib/noosfero/plugin.rb
| ... | ... | @@ -256,7 +256,16 @@ class Noosfero::Plugin |
| 256 | 256 | nil |
| 257 | 257 | end |
| 258 | 258 | |
| 259 | - # -> Adds content to catalog item | |
| 259 | + # -> Adds tabs to the products | |
| 260 | + # returns = { :title => title, :id => id, :content => content } | |
| 261 | + # title = name that will be displayed. | |
| 262 | + # id = div id. | |
| 263 | + # content = lambda block that creates html code. | |
| 264 | + def product_tabs product | |
| 265 | + nil | |
| 266 | + end | |
| 267 | + | |
| 268 | + # -> Adds content to calalog item | |
| 260 | 269 | # returns = lambda block that creates html code |
| 261 | 270 | def catalog_item_extras(item) |
| 262 | 271 | nil |
| ... | ... | @@ -422,7 +431,7 @@ class Noosfero::Plugin |
| 422 | 431 | def upload_files_extra_fields(article) |
| 423 | 432 | nil |
| 424 | 433 | end |
| 425 | - | |
| 434 | + | |
| 426 | 435 | # -> Adds fields to the signup form |
| 427 | 436 | # returns = proc that creates html code |
| 428 | 437 | def signup_extra_contents | ... | ... |