diff --git a/controllers/software_communities_plugin_myprofile_controller.rb b/controllers/software_communities_plugin_myprofile_controller.rb index 30af8d8..ea6a6af 100644 --- a/controllers/software_communities_plugin_myprofile_controller.rb +++ b/controllers/software_communities_plugin_myprofile_controller.rb @@ -61,6 +61,7 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController session[:notice] = _('Software updated successfully') end rescue ActiveRecord::RecordInvalid => invalid + update_new_software_errors session[:notice] = _('Could not update software') end end @@ -76,9 +77,9 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController def add_software_erros @errors = [] - @errors |= @community.errors.full_messages - @errors |= @software_info.errors.full_messages - @errors |= @license_info.errors.full_messages + @errors |= @community.errors.full_messages if @community + @errors |= @software_info.errors.full_messages if @software_info + @errors |= @license_info.errors.full_messages if @license_info end def control_software_creation @@ -221,18 +222,17 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController def update_new_software_errors if request.post? - @community.valid? - @software_info.valid? - @license_info.valid? + @community.valid? if @community + @software_info.valid? if @software_info + @license_info.valid? if @license_info add_software_erros end - @error_community_name = @community.errors.include?(:name) ? "highlight-error" : "" - @error_software_domain = @community.errors.include?(:identifier) ? "highlight-error" : "" - @error_software_finality = @software_info.errors.include?(:finality) ? "highlight-error" : "" - @error_software_license = @license_info.errors.include?(:version) ? "highlight-error" : "" - - puts '='*80, @community.errors.include?(:identifier), '='*80 + @error_community_name = @community.errors.include?(:name) ? "highlight-error" : "" if @community + @error_software_acronym = @software_info.errors.include?(:acronym) ? "highlight-error" : "" if @software_info + @error_software_domain = @community.errors.include?(:identifier) ? "highlight-error" : "" if @community + @error_software_finality = @software_info.errors.include?(:finality) ? "highlight-error" : "" if @software_info + @error_software_license = @license_info.errors.include?(:version) ? "highlight-error" : "" if @license_info end end diff --git a/views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb b/views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb index ab7f1b9..a40b62d 100644 --- a/views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb +++ b/views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb @@ -1,20 +1,25 @@ -

<%= _("Name") %>

-
- <%= text_field_tag("community[name]", @profile.name) %> + +
> + <%= label_tag("community[name]", _('Name'), {:class => 'formlabel mandatory'}) %> + <%= text_field_tag("community[name]", @profile.name, :id => 'community_name_id') %>
-

<%= _("Short Name") %>

-
- <%= text_field_tag("software[acronym]", @profile.software_info.acronym, :maxlength=>"10") %> +
> + <%= label_tag("software[acronym]", _('Short Name'), {:class => 'formlabel mandatory'}) %> + <%= text_field_tag("software[acronym]", @profile.software_info.acronym, :id => 'software_acronym_id', :maxlength=>"10") %>
-

<%= _("Finality") %>

-
- <%= text_area_tag "software[finality]", @profile.software_info.finality, :placeholder => _("What is the software for?"), :maxlength => 120 %> +
> +
+ <%= label_tag("software[finality]", _('Finality'), {:class => 'formlabel mandatory'}) %> + <%= text_area_tag "software[finality]", @profile.software_info.finality, :placeholder => _("What is the software for?"), :maxlength => 120 %> +
-
-

<%= _('Software Logo') %>

+
+
<%= f.fields_for :image_builder, @profile.image do |i| %> @@ -22,20 +27,21 @@ <% end %>
-

<%= _("License Version: ") %>

-
- <%= render :partial => "license_info_fields", :locals => { - :license_version => @license_version, - :license_id => @license_id, - :another_version => @another_license_version, - :another_link => @another_license_link - } - %> +
> +
+ + <%= render :partial => "license_info_fields", :locals => { + :license_version => @license_version, + :license_id => @license_id, + :another_version => @another_license_version, + :another_link => @another_license_link + } %> +
-

<%= _("Link to Repository") %>

-