diff --git a/controllers/mpog_software_plugin_myprofile_controller.rb b/controllers/mpog_software_plugin_myprofile_controller.rb index 74a06ea..f0af744 100644 --- a/controllers/mpog_software_plugin_myprofile_controller.rb +++ b/controllers/mpog_software_plugin_myprofile_controller.rb @@ -14,50 +14,14 @@ class MpogSoftwarePluginMyprofileController < MyProfileController @community = Community.new(params[:community]) @community.environment = environment @software_info = SoftwareInfo.new(params[:software_info]) - #@list_libraries = LibraryHelper.list_libraries(params[:library]) - #@list_languages = SoftwareLanguageHelper.list_language(params[:language]) - #@list_databases = DatabaseHelper.list_database(params[:database]) - #@software_categories = SoftwareCategories::new params[:software_categories] - #@list_operating_systems = OperatingSystemHelper.list_operating_system(params[:operating_system]) - @license_info = if params[:license_info].nil? + @license_info = if params[:license_info].nil? LicenseInfo::new else LicenseInfo.find(:first, :conditions =>["version = ?","#{params[:license_info][:version]}"]) end - - #if not @list_libraries.nil? - # @list_libraries.each do |library| - # @software_info.libraries << library - # end - #end - - #if not @list_languages.nil? - # @list_languages.each do |language| - # @software_info.software_languages << language - # end - #end - - #if not @list_databases.nil? - # @list_databases.each do |database| - # @software_info.software_databases << database - # end - #end - - #if not @list_operating_systems.nil? - # @list_operating_systems.each do |operating_system| - # @software_info.operating_systems << operating_system - # end - #end - valid_community = request.post? && @community.valid? valid_software_info = request.post? && @software_info.valid? valid_license = (request.post? && @license_info.valid?) - #valid_libraries = @list_libraries.empty? || LibraryHelper.valid_list_libraries?(@list_libraries) - #valid_database = DatabaseHelper.valid_list_database?(@list_databases) - #valid_language = SoftwareLanguageHelper.valid_list_language?(@list_languages) - #valid_operating_system = OperatingSystemHelper.valid_list_operating_system?(@list_operating_systems) - #valid_software_categories = request.post? && @software_categories.valid? - if valid_software_info && valid_license && valid_community @community = Community.create_after_moderation(user, {:environment => environment}.merge(params[:community]), @software_info, @license_info ) redirect_to :controller => 'memberships', :action => 'index' @@ -102,6 +66,42 @@ class MpogSoftwarePluginMyprofileController < MyProfileController end def edit_software + @list_libraries = LibraryHelper.list_libraries(params[:library]) + @list_languages = SoftwareLanguageHelper.list_language(params[:language]) + @list_databases = DatabaseHelper.list_database(params[:database]) + @software_categories = SoftwareCategories::new params[:software_categories] + @list_operating_systems = OperatingSystemHelper.list_operating_system(params[:operating_system]) + + + if not @list_libraries.nil? + @list_libraries.each do |library| + @software_info.libraries << library + end + end + + if not @list_languages.nil? + @list_languages.each do |language| + @software_info.software_languages << language + end + end + + if not @list_databases.nil? + @list_databases.each do |database| + @software_info.software_databases << database + end + end + + if not @list_operating_systems.nil? + @list_operating_systems.each do |operating_system| + @software_info.operating_systems << operating_system + end + end + + valid_libraries = @list_libraries.empty? || LibraryHelper.valid_list_libraries?(@list_libraries) + valid_database = DatabaseHelper.valid_list_database?(@list_databases) + valid_language = SoftwareLanguageHelper.valid_list_language?(@list_languages) + valid_operating_system = OperatingSystemHelper.valid_list_operating_system?(@list_operating_systems) + valid_software_categories = request.post? && @software_categories.valid? end diff --git a/views/_public_software_info.html.erb b/views/_public_software_info.html.erb deleted file mode 100644 index 0acf778..0000000 --- a/views/_public_software_info.html.erb +++ /dev/null @@ -1,137 +0,0 @@ -

<%= _('Edit software') %>

- -
-
- <%= label_tag("acronym" ,_("Acronym"), :class=>"formlabel") %> - <%= text_field_tag(:acronym) %> -
- -
- <%= label_tag _("Adherent to e-PING ?") %> - - <%= label_tag "e_ping_true", "Yes" %> - <%= radio_button_tag(:e_ping,true)%> - <%= label_tag "e_ping_false", "No"%> - <%= radio_button_tag(:e_ping,false)%> -
- -
- <%= label_tag _("Adherent to e-MAG ?") %> - - <%= label_tag "e_mag_true", "Yes"%> - <%= radio_button_tag(:e_mag,true)%> - <%= label_tag "e_mag_false", "No"%> - <%= radio_button_tag(:e_mag,false)%> -
- -
- <%= label_tag _("Adherent to ICP-Brasil ?") %> - - <%= label_tag "icp_brasil_true", "Yes"%> - <%= radio_button_tag(:icp_brasil,true)%> - <%= label_tag "icp_brasil_false", "No"%> - <%= radio_button_tag(:icp_brasil,false)%> -
- -
- <%= label_tag _("Adherent to e-ARQ ?") %> - - <%= label_tag "e_arq_true", "Yes"%> - <%= radio_button_tag(:e_arq,true)%> - <%= label_tag "e_arq_false", "No"%> - <%= radio_button_tag(:e_arq,false)%> -
- -
- <%= label_tag _("Internacionalizable ?") %> - - <%= label_tag "intern_true", "Yes" %> - <%= radio_button_tag(:intern,true)%> - <%= label_tag "intern_false", "No"%> - <%= radio_button_tag(:intern,false)%> -
- <%= label_tag "operating_platform", _("Operating Platform: ") %>
- <%= text_area_tag :operating_platform %> -
- -
- <%= label_tag "objectives", _("Objectives: ")%>
- <%= text_area_tag :objectives %> -
- -
- <%= label_tag "features", _("Features: ")%>
- <%= text_area_tag :features %> -
- - -
-

<%= _("Software Categories:") %>

- - <%= check_box_tag :administration %> - <%= label_tag :administration, _("Administration") %>
- - <%= check_box_tag :agriculture %> - <%= label_tag :agriculture, _("Agriculture") %>
- - <%= check_box_tag :business_and_services %> - <%= label_tag :business_and_services, _("Business_and Services") %>
- - <%= check_box_tag :communication %> - <%= label_tag :communication, _("Communication") %>
- - <%= check_box_tag :culture %> - <%= label_tag :culture, _("Culture") %>
- - <%= check_box_tag :national_defense %> - <%= label_tag :national_defense, _("National Defense") %>
- - <%= check_box_tag :economy_and_finances %> - <%= label_tag :economy_and_finances, _("Economy and Finances") %>
- - <%= check_box_tag :education %> - <%= label_tag :education, _("Education") %>
- - <%= check_box_tag :energy %> - <%= label_tag :energy, _("Energy") %>
- - <%= check_box_tag :sports %> - <%= label_tag :sports, _("Sports") %>
- - <%= check_box_tag :habitation %> - <%= label_tag :habitation, _("Habitation") %>
- - <%= check_box_tag :industry %> - <%= label_tag :industry, _("Industry") %>
- - <%= check_box_tag :environment %> - <%= label_tag :environment, _("Environment") %>
- - <%= check_box_tag :research_and_development %> - <%= label_tag :research_and_development, _("Research and Development") %>
- - <%= check_box_tag :social_security %> - <%= label_tag :social_security, _("Social Security") %>
- - <%= check_box_tag :social_protection %> - <%= label_tag :social_protection, _("Social Protection") %>
- - <%= check_box_tag :sanitation %> - <%= label_tag :sanitation, _("Sanitation") %>
- - <%= check_box_tag :health %> - <%= label_tag :health, _("Health") %>
- - <%= check_box_tag :security_public_order %> - <%= label_tag :security_public_order, _("Security and Public Order") %>
- - <%= check_box_tag :work %> - <%= label_tag :work, _("Work") %>
- - <%= check_box_tag :transportation %> - <%= label_tag :transportation, _("Transportation") %>
- - <%= check_box_tag :urbanism %> - <%= label_tag :urbanism, _("Urbanism") %>
-
-
diff --git a/views/mpog_software_plugin_myprofile/_main_software_editor_extras.html.erb b/views/mpog_software_plugin_myprofile/_main_software_editor_extras.html.erb new file mode 100644 index 0000000..f27f3b5 --- /dev/null +++ b/views/mpog_software_plugin_myprofile/_main_software_editor_extras.html.erb @@ -0,0 +1,32 @@ +

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

+ +<%= label_tag("name", _('Name'), {:class => 'formlabel'}) %> + +
+ <%= @profile.environment.default_hostname %>/ + <%= text_field_tag(:name, @profile.software_info.community.name) %> +
+ +

<%= _("Finality") %>

+
+ <%= text_field_tag(:finality, @profile.software_info.finality) %> +
+ +

<%= _("Licenses") %>

+
+ <%= select_tag(:version, options_for_select(LicenseHelper.getListLicenses.collect{|l| [l.version, l.id]}, :selected => @profile.software_info.license_info.id), :onchange => "get_license_link('version')") %> +
+ +

<%= _("License link") %>

+ <% LicenseHelper.getListLicenses.each do | license | %> + + <% end %> + + <%= @profile.software_info.license_info.link %> +
+ +
+ <%= label_tag "repository_url", _("Link to Repository: ") %> + <%= text_field_tag(:reository_url) %> +
+ diff --git a/views/mpog_software_plugin_myprofile/_public_software_info.html.erb b/views/mpog_software_plugin_myprofile/_public_software_info.html.erb new file mode 100644 index 0000000..7d044d2 --- /dev/null +++ b/views/mpog_software_plugin_myprofile/_public_software_info.html.erb @@ -0,0 +1,176 @@ +

<%= _('Edit software') %>

+ +
+
+ <%= label_tag("acronym" ,_("Acronym"), :class=>"formlabel") %> + <%= text_field_tag(:acronym) %> +
+ +
+ <%= label_tag _("Adherent to e-PING ?") %> + + <%= label_tag "e_ping_true", "Yes" %> + <%= radio_button_tag(:e_ping,true)%> + <%= label_tag "e_ping_false", "No"%> + <%= radio_button_tag(:e_ping,false)%> +
+ +
+ <%= label_tag _("Adherent to e-MAG ?") %> + + <%= label_tag "e_mag_true", "Yes"%> + <%= radio_button_tag(:e_mag,true)%> + <%= label_tag "e_mag_false", "No"%> + <%= radio_button_tag(:e_mag,false)%> +
+ +
+ <%= label_tag _("Adherent to ICP-Brasil ?") %> + + <%= label_tag "icp_brasil_true", "Yes"%> + <%= radio_button_tag(:icp_brasil,true)%> + <%= label_tag "icp_brasil_false", "No"%> + <%= radio_button_tag(:icp_brasil,false)%> +
+ +
+ <%= label_tag _("Adherent to e-ARQ ?") %> + + <%= label_tag "e_arq_true", "Yes"%> + <%= radio_button_tag(:e_arq,true)%> + <%= label_tag "e_arq_false", "No"%> + <%= radio_button_tag(:e_arq,false)%> +
+ +
+ <%= label_tag _("Internacionalizable ?") %> + + <%= label_tag "intern_true", "Yes" %> + <%= radio_button_tag(:intern,true)%> + <%= label_tag "intern_false", "No"%> + <%= radio_button_tag(:intern,false)%> +
+ <%= label_tag "operating_platform", _("Operating Platform: ") %>
+ <%= text_area_tag :operating_platform %> +
+ +
+ <%= label_tag "objectives", _("Objectives: ")%>
+ <%= text_area_tag :objectives %> +
+ +
+ <%= label_tag "features", _("Features: ")%>
+ <%= text_area_tag :features %> +
+ +
+

<%= _("Libraries") %>

+ <% if @list_libraries.blank? %> + <%= LibraryHelper.library_as_tables(nil).call %> + <% else %> + <%= render :partial => 'library_fields', :locals => { :f => f, :object_name => 'community', :profile => @community, :libraries => @list_libraries } %> + <% end %> +
+
+ +
+

<%= _("Operating Systems") %>

+ <% if @list_operating_systems.blank? %> + <%= OperatingSystemHelper.operating_system_as_tables(nil, false).call %> + <% else %> + <%= render :partial => 'operating_system_fields', :locals => {:object_name => 'community', :profile => @community, :operating_systems_fields => @list_operating_systems} %> + <% end %> +
+
+ +
+
+

<%= _("Programming languages") %>

+ <% if @list_languages.blank? %> + <%= SoftwareLanguageHelper.language_as_tables(nil, false).call %> + <% else %> + <%= render :partial => 'language_fields', :locals => { :object_name => 'community', :profile => @community, :languages => @list_languages } %> + <% end %> +
+ +
+
+

<%= _("Databases") %>

+ <% if @list_databases.blank? %> + <%= DatabaseHelper.database_as_tables(nil, true).call %> + <% else %> + <%= render :partial => 'database_fields', :locals => {:object_name => 'community', :profile => @community, :database => @list_databases } %> + <% end %> +
+ +
+

<%= _("Software Categories:") %>

+ + <%= check_box_tag :administration %> + <%= label_tag :administration, _("Administration") %>
+ + <%= check_box_tag :agriculture %> + <%= label_tag :agriculture, _("Agriculture") %>
+ + <%= check_box_tag :business_and_services %> + <%= label_tag :business_and_services, _("Business_and Services") %>
+ + <%= check_box_tag :communication %> + <%= label_tag :communication, _("Communication") %>
+ + <%= check_box_tag :culture %> + <%= label_tag :culture, _("Culture") %>
+ + <%= check_box_tag :national_defense %> + <%= label_tag :national_defense, _("National Defense") %>
+ + <%= check_box_tag :economy_and_finances %> + <%= label_tag :economy_and_finances, _("Economy and Finances") %>
+ + <%= check_box_tag :education %> + <%= label_tag :education, _("Education") %>
+ + <%= check_box_tag :energy %> + <%= label_tag :energy, _("Energy") %>
+ + <%= check_box_tag :sports %> + <%= label_tag :sports, _("Sports") %>
+ + <%= check_box_tag :habitation %> + <%= label_tag :habitation, _("Habitation") %>
+ + <%= check_box_tag :industry %> + <%= label_tag :industry, _("Industry") %>
+ + <%= check_box_tag :environment %> + <%= label_tag :environment, _("Environment") %>
+ + <%= check_box_tag :research_and_development %> + <%= label_tag :research_and_development, _("Research and Development") %>
+ + <%= check_box_tag :social_security %> + <%= label_tag :social_security, _("Social Security") %>
+ + <%= check_box_tag :social_protection %> + <%= label_tag :social_protection, _("Social Protection") %>
+ + <%= check_box_tag :sanitation %> + <%= label_tag :sanitation, _("Sanitation") %>
+ + <%= check_box_tag :health %> + <%= label_tag :health, _("Health") %>
+ + <%= check_box_tag :security_public_order %> + <%= label_tag :security_public_order, _("Security and Public Order") %>
+ + <%= check_box_tag :work %> + <%= label_tag :work, _("Work") %>
+ + <%= check_box_tag :transportation %> + <%= label_tag :transportation, _("Transportation") %>
+ + <%= check_box_tag :urbanism %> + <%= label_tag :urbanism, _("Urbanism") %>
+
+
diff --git a/views/mpog_software_plugin_myprofile/edit_software.html.erb b/views/mpog_software_plugin_myprofile/edit_software.html.erb index 96a413f..5407b7c 100644 --- a/views/mpog_software_plugin_myprofile/edit_software.html.erb +++ b/views/mpog_software_plugin_myprofile/edit_software.html.erb @@ -1 +1,7 @@ - \ No newline at end of file +<%= _("Basic") %> + +<%= render :partial => 'main_software_editor_extras' %> + +<%= _("Especific") %> + +<%= render :partial => 'public_software_info' %> -- libgit2 0.21.2