Commit db32afe21a4ac4439f0f0d25a610d28fd098b347
1 parent
eadb109d
Exists in
master
and in
29 other branches
ActionItem: added blocks and visualization of categories
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1021 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
7 changed files
with
83 additions
and
0 deletions
Show diff stats
app/controllers/my_profile/consumed_products_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,33 @@ |
1 | +class ConsumedProductsController < ApplicationController | |
2 | + needs_profile | |
3 | + | |
4 | +# protect 'manage_products', :profile | |
5 | + | |
6 | + def index | |
7 | + @consumptions = @profile.consumptions | |
8 | + @product_categories = @profile.consumed_product_categories | |
9 | + end | |
10 | + | |
11 | + def new | |
12 | + @consumption = @profile.consumptions.build(params[:consumption]) | |
13 | + if request.post? | |
14 | + if @consumption.save | |
15 | + flash[:notice] = _('Product succesfully created') | |
16 | + redirect_to :action => 'index' | |
17 | + else | |
18 | + flash[:notice] = _('Could not create the product') | |
19 | + end | |
20 | + end | |
21 | + end | |
22 | + | |
23 | + def destroy | |
24 | + @consumption = @profile.consumptions.find(params[:id]) | |
25 | + if @consumption.destroy | |
26 | + flash[:notice] = _('Product succesfully removed') | |
27 | + else | |
28 | + flash[:notice] = _('Could not remove the product') | |
29 | + end | |
30 | + redirect_back_or_default :action => 'index' | |
31 | + end | |
32 | + | |
33 | +end | ... | ... |
... | ... | @@ -0,0 +1,15 @@ |
1 | +<h2> <%= _('Editing list of people') %> </h2> | |
2 | + | |
3 | +<% design_form_remote_tag( :url => {:action => 'save'}) do %> | |
4 | + <p> | |
5 | + <label for="design_block_title"> <%= _("Title") %> </label> | |
6 | + <%= text_field 'design_block', 'title'%> | |
7 | + </p> | |
8 | + | |
9 | + <p> | |
10 | + <label for="design_block_limit_number"> <%= _("Max number of people") %> </label> | |
11 | + <%= text_field 'design_block', 'limit_number'%> | |
12 | + </p> | |
13 | + | |
14 | + <%= submit_tag _('Save') %> | |
15 | +<% end %> | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +<p> <%= _('Limit number of people: ') %> <%= @design_block.limit_number %></p> | ... | ... |
... | ... | @@ -0,0 +1,10 @@ |
1 | +<%# FIXME %> | |
2 | +<p> | |
3 | +This page will list everything (articles, documents, photos, etc) that is | |
4 | +related to <%= @category.full_name %>. Actually generating this content is not | |
5 | +implement yet, though. | |
6 | +</p> | |
7 | + | |
8 | +<p> | |
9 | +And yes, this placeholder text is not translated. | |
10 | +</p> | ... | ... |
... | ... | @@ -0,0 +1,11 @@ |
1 | +<%= @products.size.to_s + " products in this category" %> | |
2 | +<%= @enterprises.size.to_s + " enterprises sells products in this category" %> | |
3 | + | |
4 | +<ul> | |
5 | + <% @products.each do |p| %> | |
6 | + <li> | |
7 | + <%= image_tag p.image.public_filename(:thumb) if p.image%> <%= link_to_product(p) %> <br/> | |
8 | + <% _('Price:') %> <% p.price %> <%= _('Enterprise:') %> <%= link_to_homepage p.enterprise.name, p.enterprise.identifier %> <br/><br/> | |
9 | + </li> | |
10 | + <% end %> | |
11 | +</ul> | ... | ... |
... | ... | @@ -0,0 +1,11 @@ |
1 | +<%# FIXME add photo if available %> | |
2 | +<%# FIXME add more information %> | |
3 | + | |
4 | +<div> | |
5 | + <%= icon('product') %> | |
6 | + <div class='search-result-text'> | |
7 | + <strong> | |
8 | + <%= link_to( hit.name, :profile => hit.enterprise.identifier, :controller => 'catalog', :action => 'show', :id => hit) %> | |
9 | + </strong> | |
10 | + </div> | |
11 | +</div> | ... | ... |