Commit 438ab96ef52421bb2950cd3c2f94d478517ab47c
1 parent
a9b5d881
Exists in
master
and in
29 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
app/views/enterprise_validation/edit_validation_info.rhtml
0 → 100644
... | ... | @@ -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 | 21 | |
22 | 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 | 26 | <% end %> |
25 | 27 | |
26 | 28 | <% if @profile.person? %> | ... | ... |
public/images/icons-app/README
2.69 KB
test/functional/enterprise_validation_test.rb
... | ... | @@ -92,4 +92,31 @@ class EnterpriseValidationControllerTest < Test::Unit::TestCase |
92 | 92 | assert_same validation, assigns(:processed) |
93 | 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 | 122 | end | ... | ... |