Commit 438ab96ef52421bb2950cd3c2f94d478517ab47c
1 parent
a9b5d881
Exists in
master
and in
28 other branches
ActionItem17: added the form for editing the validation_info and an icon in the …
…control panel to reach the validation area git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1201 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
7 changed files
with
46 additions
and
0 deletions
Show diff stats
app/models/organization.rb
@@ -38,6 +38,10 @@ class Organization < Profile | @@ -38,6 +38,10 @@ class Organization < Profile | ||
38 | CreateEnterprise.processed_for(self, :code => code).first | 38 | CreateEnterprise.processed_for(self, :code => code).first |
39 | end | 39 | end |
40 | 40 | ||
41 | + def is_validation_entity? | ||
42 | + !self.validation_info.nil? | ||
43 | + end | ||
44 | + | ||
41 | def info | 45 | def info |
42 | organization_info | 46 | organization_info |
43 | end | 47 | end |
app/views/enterprise_validation/edit_validation_info.rhtml
0 → 100644
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +<% _('Editing the validation info') %> | ||
2 | + | ||
3 | +<%= error_messages_for :info %> | ||
4 | + | ||
5 | +<% labelled_form_for :info, @info do |f| %> | ||
6 | + <%= f.text_area(:validation_methodology, :cols => 50, :rows => 10) %> | ||
7 | + <%= f.text_area(:restrictions, :cols => 50, :rows => 7) %> | ||
8 | + <% button_bar do %> | ||
9 | + <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %> | ||
10 | + <% end %> | ||
11 | +<% end %> |
app/views/profile_editor/index.rhtml
@@ -21,6 +21,8 @@ | @@ -21,6 +21,8 @@ | ||
21 | 21 | ||
22 | <%= file_manager_button(_('Manage Products'), 'icons-app/products.png', :controller => 'manage_products') if profile.enterprise? %> | 22 | <%= file_manager_button(_('Manage Products'), 'icons-app/products.png', :controller => 'manage_products') if profile.enterprise? %> |
23 | 23 | ||
24 | + <%= file_manager_button(_('Enterprise Validation'), 'icons-app/validation.png', :controller => 'enterprise_validation') if profile.is_validation_entity? %> | ||
25 | + | ||
24 | <% end %> | 26 | <% end %> |
25 | 27 | ||
26 | <% if @profile.person? %> | 28 | <% if @profile.person? %> |
public/images/icons-app/README
@@ -24,6 +24,7 @@ abiword_48.png dlg-neu | @@ -24,6 +24,7 @@ abiword_48.png dlg-neu | ||
24 | gnome-other.png Nuovo | 24 | gnome-other.png Nuovo |
25 | user_icon.png dlg-neu | 25 | user_icon.png dlg-neu |
26 | temp-home.png Nuovo | 26 | temp-home.png Nuovo |
27 | +gtk-yes.png dlg-neu | ||
27 | 28 | ||
28 | Icons rasterization | 29 | Icons rasterization |
29 | =================== | 30 | =================== |
2.69 KB
test/functional/enterprise_validation_test.rb
@@ -92,4 +92,31 @@ class EnterpriseValidationControllerTest < Test::Unit::TestCase | @@ -92,4 +92,31 @@ class EnterpriseValidationControllerTest < Test::Unit::TestCase | ||
92 | assert_same validation, assigns(:processed) | 92 | assert_same validation, assigns(:processed) |
93 | end | 93 | end |
94 | 94 | ||
95 | + should 'display a form for editing the validation info' do | ||
96 | + info = ValidationInfo.new(:validation_methodology => 'none') | ||
97 | + @org.expects(:validation_info).returns(info) | ||
98 | + get :edit_validation_info, :profile => 'myorg' | ||
99 | + assert_response :success | ||
100 | + assert_equal info, assigns(:info) | ||
101 | + end | ||
102 | + | ||
103 | + should 'save an alteration of the validation info' do | ||
104 | + info = ValidationInfo.new(:validation_methodology => 'none') | ||
105 | + @org.expects(:validation_info).returns(info) | ||
106 | + post :edit_validation_info, :profile => 'myorg', :validation_info => {:validatin_methodology => 'new methodaology'} | ||
107 | + | ||
108 | + assert_response :redirect | ||
109 | + assert_redirected_to :action => 'index' | ||
110 | + assert_equal info, assigns(:info) | ||
111 | + end | ||
112 | + | ||
113 | + should 'not save an empaty validation mthodology' do | ||
114 | + info = ValidationInfo.new(:validation_methodology => 'none') | ||
115 | + @org.expects(:validation_info).returns(info) | ||
116 | + post :edit_validation_info, :profile => 'myorg', :info => {:validation_methodology => ''} | ||
117 | + | ||
118 | + assert_response :success | ||
119 | + assert_equal info, assigns(:info) | ||
120 | + end | ||
121 | + | ||
95 | end | 122 | end |