diff --git a/controllers/software_communities_plugin_myprofile_controller.rb b/controllers/software_communities_plugin_myprofile_controller.rb index 2aae091..b4a3124 100644 --- a/controllers/software_communities_plugin_myprofile_controller.rb +++ b/controllers/software_communities_plugin_myprofile_controller.rb @@ -27,6 +27,7 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController end control_software_creation + update_new_software_errors end def search_offerers @@ -217,4 +218,18 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController end end end + + def update_new_software_errors + if request.post? + @community.valid? + @software_info.valid? + @license_info.valid? + add_software_erros + end + + @error_community_name = @community.errors.include?(:name) ? "highlight-error" : "" + @error_software_domain = @software_info.errors.include?(:domain) ? "highlight-error" : "" + @error_software_finality = @software_info.errors.include?(:finality) ? "highlight-error" : "" + @error_software_license = @license_info.errors.include?(:version) ? "highlight-error" : "" + end end diff --git a/public/style.css b/public/style.css index 77e1ce4..88ee0ae 100644 --- a/public/style.css +++ b/public/style.css @@ -533,3 +533,7 @@ div#finality textarea { resize: none; height: 100px; } + +.highlight-error { + background-color: #FF0000; +} \ No newline at end of file diff --git a/views/software_communities_plugin_myprofile/new_software.html.erb b/views/software_communities_plugin_myprofile/new_software.html.erb index 5827de6..ca35dd1 100644 --- a/views/software_communities_plugin_myprofile/new_software.html.erb +++ b/views/software_communities_plugin_myprofile/new_software.html.erb @@ -33,25 +33,31 @@ <%= required_fields_message %> - <%= label("name", _('Name'), {:class => 'formlabel mandatory'}) %> - <%= required text_field(:community, :name, :size => 30, :maxlength => 100, :id => 'community_name_id') %> +