Commit 735e9bb01f9f4f871fdd781424aa008f16af14ef

Authored by Luciano Prestes
1 parent ff714819

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,6 +61,7 @@ class SoftwareCommunitiesPluginMyprofileController &lt; MyProfileController
61 session[:notice] = _('Software updated successfully') 61 session[:notice] = _('Software updated successfully')
62 end 62 end
63 rescue ActiveRecord::RecordInvalid => invalid 63 rescue ActiveRecord::RecordInvalid => invalid
  64 + update_new_software_errors
64 session[:notice] = _('Could not update software') 65 session[:notice] = _('Could not update software')
65 end 66 end
66 end 67 end
@@ -76,9 +77,9 @@ class SoftwareCommunitiesPluginMyprofileController &lt; MyProfileController @@ -76,9 +77,9 @@ class SoftwareCommunitiesPluginMyprofileController &lt; MyProfileController
76 77
77 def add_software_erros 78 def add_software_erros
78 @errors = [] 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 end 83 end
83 84
84 def control_software_creation 85 def control_software_creation
@@ -221,18 +222,17 @@ class SoftwareCommunitiesPluginMyprofileController &lt; MyProfileController @@ -221,18 +222,17 @@ class SoftwareCommunitiesPluginMyprofileController &lt; MyProfileController
221 222
222 def update_new_software_errors 223 def update_new_software_errors
223 if request.post? 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 add_software_erros 228 add_software_erros
228 end 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 end 237 end
238 end 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 </div> 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 </div> 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 </div> 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 </div> 23 </div>
19 <div id="profile_change_picture"> 24 <div id="profile_change_picture">
20 <%= f.fields_for :image_builder, @profile.image do |i| %> 25 <%= f.fields_for :image_builder, @profile.image do |i| %>
@@ -22,20 +27,21 @@ @@ -22,20 +27,21 @@
22 <% end %> 27 <% end %>
23 </div> 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 </div> 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 </div> 47 </div>
40 -  
41 -