Commit 735e9bb01f9f4f871fdd781424aa008f16af14ef

Authored by Luciano Prestes
1 parent ff714819
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

Format Software tab as in the register

Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
controllers/software_communities_plugin_myprofile_controller.rb
... ... @@ -61,6 +61,7 @@ class SoftwareCommunitiesPluginMyprofileController &lt; MyProfileController
61 61 session[:notice] = _('Software updated successfully')
62 62 end
63 63 rescue ActiveRecord::RecordInvalid => invalid
  64 + update_new_software_errors
64 65 session[:notice] = _('Could not update software')
65 66 end
66 67 end
... ... @@ -76,9 +77,9 @@ class SoftwareCommunitiesPluginMyprofileController &lt; MyProfileController
76 77  
77 78 def add_software_erros
78 79 @errors = []
79   - @errors |= @community.errors.full_messages
80   - @errors |= @software_info.errors.full_messages
81   - @errors |= @license_info.errors.full_messages
  80 + @errors |= @community.errors.full_messages if @community
  81 + @errors |= @software_info.errors.full_messages if @software_info
  82 + @errors |= @license_info.errors.full_messages if @license_info
82 83 end
83 84  
84 85 def control_software_creation
... ... @@ -221,18 +222,17 @@ class SoftwareCommunitiesPluginMyprofileController &lt; MyProfileController
221 222  
222 223 def update_new_software_errors
223 224 if request.post?
224   - @community.valid?
225   - @software_info.valid?
226   - @license_info.valid?
  225 + @community.valid? if @community
  226 + @software_info.valid? if @software_info
  227 + @license_info.valid? if @license_info
227 228 add_software_erros
228 229 end
229 230  
230 231  
231   - @error_community_name = @community.errors.include?(:name) ? "highlight-error" : ""
232   - @error_software_domain = @community.errors.include?(:identifier) ? "highlight-error" : ""
233   - @error_software_finality = @software_info.errors.include?(:finality) ? "highlight-error" : ""
234   - @error_software_license = @license_info.errors.include?(:version) ? "highlight-error" : ""
235   -
236   - puts '='*80, @community.errors.include?(:identifier), '='*80
  232 + @error_community_name = @community.errors.include?(:name) ? "highlight-error" : "" if @community
  233 + @error_software_acronym = @software_info.errors.include?(:acronym) ? "highlight-error" : "" if @software_info
  234 + @error_software_domain = @community.errors.include?(:identifier) ? "highlight-error" : "" if @community
  235 + @error_software_finality = @software_info.errors.include?(:finality) ? "highlight-error" : "" if @software_info
  236 + @error_software_license = @license_info.errors.include?(:version) ? "highlight-error" : "" if @license_info
237 237 end
238 238 end
... ...
views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb
1   -<h3> <%= _("Name") %> </h3>
2   -<div id="name">
3   - <%= text_field_tag("community[name]", @profile.name) %>
  1 +
  2 +<div class= <%= @error_community_name %> >
  3 + <%= label_tag("community[name]", _('Name'), {:class => 'formlabel mandatory'}) %>
  4 + <%= text_field_tag("community[name]", @profile.name, :id => 'community_name_id') %>
4 5 </div>
5 6  
6   -<h3> <%= _("Short Name") %> </h3>
7   -<div id="acronym">
8   - <%= text_field_tag("software[acronym]", @profile.software_info.acronym, :maxlength=>"10") %>
  7 +<div class= <%= @error_software_acronym %> >
  8 + <%= label_tag("software[acronym]", _('Short Name'), {:class => 'formlabel mandatory'}) %>
  9 + <%= text_field_tag("software[acronym]", @profile.software_info.acronym, :id => 'software_acronym_id', :maxlength=>"10") %>
9 10 </div>
10 11  
11   -<h3> <%= _("Finality") %> </h3>
12   -<div id="finality">
13   - <%= text_area_tag "software[finality]", @profile.software_info.finality, :placeholder => _("What is the software for?"), :maxlength => 120 %>
  12 +<div class= <%= @error_software_finality %> >
  13 + <div id="finality" class="formfield type-text">
  14 + <%= label_tag("software[finality]", _('Finality'), {:class => 'formlabel mandatory'}) %>
  15 + <%= text_area_tag "software[finality]", @profile.software_info.finality, :placeholder => _("What is the software for?"), :maxlength => 120 %>
  16 + </div>
14 17 </div>
15 18  
16   -<div id="profile_change_picture_title">
17   - <h3><%= _('Software Logo') %></h3>
  19 +<div id="profile_change_picture_title" class="formlabel">
  20 + <label>
  21 + <%= _('Software Logo') %>
  22 + </label>
18 23 </div>
19 24 <div id="profile_change_picture">
20 25 <%= f.fields_for :image_builder, @profile.image do |i| %>
... ... @@ -22,20 +27,21 @@
22 27 <% end %>
23 28 </div>
24 29  
25   -<h3><%= _("License Version: ") %></h3>
26   -<div id='licenses'>
27   - <%= render :partial => "license_info_fields", :locals => {
28   - :license_version => @license_version,
29   - :license_id => @license_id,
30   - :another_version => @another_license_version,
31   - :another_link => @another_license_link
32   - }
33   - %>
  30 +<div class= <%= @error_software_license %> >
  31 + <div id="profile_change_picture_title" class="formlabel formfieldline">
  32 + <label class="formlabel mandatory">
  33 + <%= _("License Version: ") %>
  34 + </label>
  35 + <%= render :partial => "license_info_fields", :locals => {
  36 + :license_version => @license_version,
  37 + :license_id => @license_id,
  38 + :another_version => @another_license_version,
  39 + :another_link => @another_license_link
  40 + } %>
  41 + </div>
34 42 </div>
35 43  
36   -<h3> <%= _("Link to Repository") %> </h3>
37   -<div id='repository_link'>
38   - <%= text_field_tag("software[repository_link]", @profile.software_info.repository_link, :class => "improve_input_size") %>
  44 +<div class="formfieldline formfield type-text">
  45 + <%= label_tag("software[repository_link]", _('Link to Repository: '), {:class => 'formlabel'}) %>
  46 + <%= text_field_tag("software[repository_link]", @profile.software_info.repository_link, :class => "improve_input_size", :id => "software-info-repository-link") %>
39 47 </div>
40   -
41   -
... ...