Commit 6bc02adcb21b59d363c97a731ae0eadd6558ef14

Authored by Parley
Committed by Fabio Teixeira
1 parent a8563d11

License Info added to new software view

Signed-off-by: Parley Martins <parley@utlook.com>
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com>
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
controllers/mpog_software_plugin_myprofile_controller.rb
... ... @@ -19,11 +19,11 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController
19 19 #@list_databases = DatabaseHelper.list_database(params[:database])
20 20 #@software_categories = SoftwareCategories::new params[:software_categories]
21 21 #@list_operating_systems = OperatingSystemHelper.list_operating_system(params[:operating_system])
22   - #@license_info = if params[:license_info].nil?
23   - # LicenseInfo::new
24   - #else
25   - # LicenseInfo.find(:first, :conditions =>["version = ?","#{params[:license_info][:version]}"])
26   - #end
  22 + @license_info = if params[:license_info].nil?
  23 + LicenseInfo::new
  24 + else
  25 + LicenseInfo.find(:first, :conditions =>["version = ?","#{params[:license_info][:version]}"])
  26 + end
27 27  
28 28 #if not @list_libraries.nil?
29 29 # @list_libraries.each do |library|
... ... @@ -90,7 +90,7 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController
90 90  
91 91 @errors |= @community.errors.full_messages
92 92 @errors |= @software_info.errors.full_messages
93   - # @errors |= @license_info.errors.full_messages
  93 + @errors |= @license_info.errors.full_messages
94 94 # @errors |= @software_categories.errors.full_messages
95 95 #end
96 96 end
... ...
views/mpog_software_plugin_myprofile/new_software.html.erb
... ... @@ -33,6 +33,19 @@
33 33 </div>
34 34 <% end %>
35 35  
  36 + <%= fields_for @license_info do |lcv| %>
  37 + <div class="formfieldline">
  38 + <h4> <%= lcv.label _("License Version: ") %> </h4>
  39 + <%= lcv.select(:version, LicenseInfo.all.map {|l| [l.version, l.version]}, {:selected=>1}, :onchange => "get_license_link('license_info_version')") %>
  40 +
  41 + <h4> <%= _("License link") %> </h4>
  42 + <% LicenseHelper.getListLicenses.each do | license | %>
  43 + <input type="hidden" id = "version_<%=license.id %>" value = "<%=license.link%>">
  44 + <% end %>
  45 + <a id = "version_link" href="<%= LicenseInfo.first.link %>" target="_BLANK"> <%=LicenseInfo.first.link %> </a>
  46 +
  47 + </div>
  48 + <% end %>
36 49 <%= template_options(:communities, 'community')%>
37 50  
38 51 <%= hidden_field_tag('back_to', @back_to) %>
... ...