Commit 899e050f7eb8cc767df5f173b0b89b821a34004c
1 parent
77aa69cd
Exists in
master
and in
29 other branches
Add product_tabs hotspot
Showing
4 changed files
with
37 additions
and
2 deletions
Show diff stats
app/helpers/application_helper.rb
| @@ -46,6 +46,8 @@ module ApplicationHelper | @@ -46,6 +46,8 @@ module ApplicationHelper | ||
| 46 | 46 | ||
| 47 | include CatalogHelper | 47 | include CatalogHelper |
| 48 | 48 | ||
| 49 | + include PluginsHelper | ||
| 50 | + | ||
| 49 | def locale | 51 | def locale |
| 50 | (@page && !@page.language.blank?) ? @page.language : FastGettext.locale | 52 | (@page && !@page.language.blank?) ? @page.language : FastGettext.locale |
| 51 | end | 53 | end |
app/views/manage_products/show.html.erb
| @@ -24,6 +24,8 @@ | @@ -24,6 +24,8 @@ | ||
| 24 | <br style='clear: both'/> | 24 | <br style='clear: both'/> |
| 25 | 25 | ||
| 26 | <% unless !@allowed_user && (@product.description.blank? && @product.inputs.empty? && !@product.price_described? ) %> | 26 | <% unless !@allowed_user && (@product.description.blank? && @product.inputs.empty? && !@product.price_described? ) %> |
| 27 | + <% plugins_tabs = plugins_product_tabs %> | ||
| 28 | + | ||
| 27 | <div class='ui-tabs' id='product-<%= @product.id %>-tabs'> | 29 | <div class='ui-tabs' id='product-<%= @product.id %>-tabs'> |
| 28 | <ul> | 30 | <ul> |
| 29 | <% if !@product.description.blank? || @allowed_user %> | 31 | <% if !@product.description.blank? || @allowed_user %> |
| @@ -35,19 +37,32 @@ | @@ -35,19 +37,32 @@ | ||
| 35 | <% if @product.price_described? || @allowed_user %> | 37 | <% if @product.price_described? || @allowed_user %> |
| 36 | <li class='tab'><a href='#product-price-details'><%= _('Price composition') %></a></li> | 38 | <li class='tab'><a href='#product-price-details'><%= _('Price composition') %></a></li> |
| 37 | <% end %> | 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 | </ul> | 45 | </ul> |
| 46 | + | ||
| 39 | <div id='product-description'> | 47 | <div id='product-description'> |
| 40 | <%= render :partial => 'manage_products/display_description' %> | 48 | <%= render :partial => 'manage_products/display_description' %> |
| 41 | </div> | 49 | </div> |
| 50 | + | ||
| 42 | <div id='product-inputs'> | 51 | <div id='product-inputs'> |
| 43 | <%= render :partial => 'manage_products/display_inputs' %> | 52 | <%= render :partial => 'manage_products/display_inputs' %> |
| 44 | </div> | 53 | </div> |
| 54 | + | ||
| 45 | <% if @product.price_described? || @allowed_user %> | 55 | <% if @product.price_described? || @allowed_user %> |
| 46 | <div id='product-price-details'> | 56 | <div id='product-price-details'> |
| 47 | <%= render :partial => 'manage_products/display_price_details' %> | 57 | <%= render :partial => 'manage_products/display_price_details' %> |
| 48 | <%= render :partial => 'manage_products/price_details_button' %> | 58 | <%= render :partial => 'manage_products/price_details_button' %> |
| 49 | </div> | 59 | </div> |
| 50 | <% end %> | 60 | <% end %> |
| 61 | + | ||
| 62 | + <% plugins_tabs.each do |tab| %> | ||
| 63 | + <div id='<%=tab[:id]%>'><%= raw tab[:content] %></div> | ||
| 64 | + <% end %> | ||
| 65 | + | ||
| 51 | </div> | 66 | </div> |
| 52 | <% end %> | 67 | <% end %> |
| 53 | 68 |
lib/noosfero/plugin.rb
| @@ -256,7 +256,16 @@ class Noosfero::Plugin | @@ -256,7 +256,16 @@ class Noosfero::Plugin | ||
| 256 | nil | 256 | nil |
| 257 | end | 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 | # returns = lambda block that creates html code | 269 | # returns = lambda block that creates html code |
| 261 | def catalog_item_extras(item) | 270 | def catalog_item_extras(item) |
| 262 | nil | 271 | nil |
| @@ -422,7 +431,7 @@ class Noosfero::Plugin | @@ -422,7 +431,7 @@ class Noosfero::Plugin | ||
| 422 | def upload_files_extra_fields(article) | 431 | def upload_files_extra_fields(article) |
| 423 | nil | 432 | nil |
| 424 | end | 433 | end |
| 425 | - | 434 | + |
| 426 | # -> Adds fields to the signup form | 435 | # -> Adds fields to the signup form |
| 427 | # returns = proc that creates html code | 436 | # returns = proc that creates html code |
| 428 | def signup_extra_contents | 437 | def signup_extra_contents |