Commit
db32afe21a4ac4439f0f0d25a610d28fd098b347
Exists in
master
and in
29 other branches
add_member_task_reject_details, admin_visible_profile, article-list-template, community_notifications, contact_admin_translation, event_fixes, fix_comments_pagination, fix_rails4_organization_ratings, fix_sign_up_form, follow_step_fix, forum_topic_creation, mirror_block_improvements, multi_env_on_remote_user, new_security, noosfero_spb_ci, organization_ratings_improvements, organization_ratings_link_to_profile_stable-spb-1.3, organization_ratings_translations_fix, profile_api_improvements, ratings_minor_fixes, remote_user_fix, send_email_to_admins, stable-spb-1.3, stable-spb-1.3-fixes, stable-spb-1.4, stable-spb-1.5, suggest_rejected_value, web_steps_improvements, xss_terminate_custom_options
ActionItem: added blocks and visualization of categories
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1021 3f533792-8f58-4932-b0fe-aaf55b0a4547
| @@ -0,0 +1,33 @@ |
| @@ -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 @@ |
| @@ -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 @@ |
| @@ -0,0 +1 @@ |
| |
1
| +<p> <%= _('Limit number of people: ') %> <%= @design_block.limit_number %></p> |
| @@ -0,0 +1,2 @@ |
| @@ -0,0 +1,2 @@ |
| |
1
| +module ConsumedProductsHelper |
| |
2
| +end |
| @@ -0,0 +1,10 @@ |
| @@ -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 @@ |
| @@ -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 @@ |
| @@ -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> |