Commit e2d028611781652605a11f1a9a23292462c9c881

Authored by Gabriela Navarro
Committed by Fabio Teixeira
1 parent 3c3c7e56

Partials and controller for edit software

Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Signed-off-by: Parley Martins <parley@outlook.com>
controllers/mpog_software_plugin_myprofile_controller.rb
@@ -14,50 +14,14 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController @@ -14,50 +14,14 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController
14 @community = Community.new(params[:community]) 14 @community = Community.new(params[:community])
15 @community.environment = environment 15 @community.environment = environment
16 @software_info = SoftwareInfo.new(params[:software_info]) 16 @software_info = SoftwareInfo.new(params[:software_info])
17 - #@list_libraries = LibraryHelper.list_libraries(params[:library])  
18 - #@list_languages = SoftwareLanguageHelper.list_language(params[:language])  
19 - #@list_databases = DatabaseHelper.list_database(params[:database])  
20 - #@software_categories = SoftwareCategories::new params[:software_categories]  
21 - #@list_operating_systems = OperatingSystemHelper.list_operating_system(params[:operating_system])  
22 - @license_info = if params[:license_info].nil? 17 + @license_info = if params[:license_info].nil?
23 LicenseInfo::new 18 LicenseInfo::new
24 else 19 else
25 LicenseInfo.find(:first, :conditions =>["version = ?","#{params[:license_info][:version]}"]) 20 LicenseInfo.find(:first, :conditions =>["version = ?","#{params[:license_info][:version]}"])
26 end 21 end
27 -  
28 - #if not @list_libraries.nil?  
29 - # @list_libraries.each do |library|  
30 - # @software_info.libraries << library  
31 - # end  
32 - #end  
33 -  
34 - #if not @list_languages.nil?  
35 - # @list_languages.each do |language|  
36 - # @software_info.software_languages << language  
37 - # end  
38 - #end  
39 -  
40 - #if not @list_databases.nil?  
41 - # @list_databases.each do |database|  
42 - # @software_info.software_databases << database  
43 - # end  
44 - #end  
45 -  
46 - #if not @list_operating_systems.nil?  
47 - # @list_operating_systems.each do |operating_system|  
48 - # @software_info.operating_systems << operating_system  
49 - # end  
50 - #end  
51 -  
52 valid_community = request.post? && @community.valid? 22 valid_community = request.post? && @community.valid?
53 valid_software_info = request.post? && @software_info.valid? 23 valid_software_info = request.post? && @software_info.valid?
54 valid_license = (request.post? && @license_info.valid?) 24 valid_license = (request.post? && @license_info.valid?)
55 - #valid_libraries = @list_libraries.empty? || LibraryHelper.valid_list_libraries?(@list_libraries)  
56 - #valid_database = DatabaseHelper.valid_list_database?(@list_databases)  
57 - #valid_language = SoftwareLanguageHelper.valid_list_language?(@list_languages)  
58 - #valid_operating_system = OperatingSystemHelper.valid_list_operating_system?(@list_operating_systems)  
59 - #valid_software_categories = request.post? && @software_categories.valid?  
60 -  
61 if valid_software_info && valid_license && valid_community 25 if valid_software_info && valid_license && valid_community
62 @community = Community.create_after_moderation(user, {:environment => environment}.merge(params[:community]), @software_info, @license_info ) 26 @community = Community.create_after_moderation(user, {:environment => environment}.merge(params[:community]), @software_info, @license_info )
63 redirect_to :controller => 'memberships', :action => 'index' 27 redirect_to :controller => 'memberships', :action => 'index'
@@ -102,6 +66,42 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController @@ -102,6 +66,42 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController
102 end 66 end
103 67
104 def edit_software 68 def edit_software
  69 + @list_libraries = LibraryHelper.list_libraries(params[:library])
  70 + @list_languages = SoftwareLanguageHelper.list_language(params[:language])
  71 + @list_databases = DatabaseHelper.list_database(params[:database])
  72 + @software_categories = SoftwareCategories::new params[:software_categories]
  73 + @list_operating_systems = OperatingSystemHelper.list_operating_system(params[:operating_system])
  74 +
  75 +
  76 + if not @list_libraries.nil?
  77 + @list_libraries.each do |library|
  78 + @software_info.libraries << library
  79 + end
  80 + end
  81 +
  82 + if not @list_languages.nil?
  83 + @list_languages.each do |language|
  84 + @software_info.software_languages << language
  85 + end
  86 + end
  87 +
  88 + if not @list_databases.nil?
  89 + @list_databases.each do |database|
  90 + @software_info.software_databases << database
  91 + end
  92 + end
  93 +
  94 + if not @list_operating_systems.nil?
  95 + @list_operating_systems.each do |operating_system|
  96 + @software_info.operating_systems << operating_system
  97 + end
  98 + end
  99 +
  100 + valid_libraries = @list_libraries.empty? || LibraryHelper.valid_list_libraries?(@list_libraries)
  101 + valid_database = DatabaseHelper.valid_list_database?(@list_databases)
  102 + valid_language = SoftwareLanguageHelper.valid_list_language?(@list_languages)
  103 + valid_operating_system = OperatingSystemHelper.valid_list_operating_system?(@list_operating_systems)
  104 + valid_software_categories = request.post? && @software_categories.valid?
105 105
106 end 106 end
107 107
views/_public_software_info.html.erb
@@ -1,137 +0,0 @@ @@ -1,137 +0,0 @@
1 -<h1><%= _('Edit software') %></h1>  
2 -  
3 -<div>  
4 - <div class="formfield type-text">  
5 - <%= label_tag("acronym" ,_("Acronym"), :class=>"formlabel") %>  
6 - <%= text_field_tag(:acronym) %>  
7 - </div>  
8 -  
9 - <div class="formfieldline">  
10 - <%= label_tag _("Adherent to e-PING ?") %>  
11 -  
12 - <%= label_tag "e_ping_true", "Yes" %>  
13 - <%= radio_button_tag(:e_ping,true)%>  
14 - <%= label_tag "e_ping_false", "No"%>  
15 - <%= radio_button_tag(:e_ping,false)%>  
16 - </div>  
17 -  
18 - <div class="formfieldline">  
19 - <%= label_tag _("Adherent to e-MAG ?") %>  
20 -  
21 - <%= label_tag "e_mag_true", "Yes"%>  
22 - <%= radio_button_tag(:e_mag,true)%>  
23 - <%= label_tag "e_mag_false", "No"%>  
24 - <%= radio_button_tag(:e_mag,false)%>  
25 - </div>  
26 -  
27 - <div class="formfieldline">  
28 - <%= label_tag _("Adherent to ICP-Brasil ?") %>  
29 -  
30 - <%= label_tag "icp_brasil_true", "Yes"%>  
31 - <%= radio_button_tag(:icp_brasil,true)%>  
32 - <%= label_tag "icp_brasil_false", "No"%>  
33 - <%= radio_button_tag(:icp_brasil,false)%>  
34 - </div>  
35 -  
36 - <div class="formfieldline">  
37 - <%= label_tag _("Adherent to e-ARQ ?") %>  
38 -  
39 - <%= label_tag "e_arq_true", "Yes"%>  
40 - <%= radio_button_tag(:e_arq,true)%>  
41 - <%= label_tag "e_arq_false", "No"%>  
42 - <%= radio_button_tag(:e_arq,false)%>  
43 - </div>  
44 -  
45 - <div class="formfieldline">  
46 - <%= label_tag _("Internacionalizable ?") %>  
47 -  
48 - <%= label_tag "intern_true", "Yes" %>  
49 - <%= radio_button_tag(:intern,true)%>  
50 - <%= label_tag "intern_false", "No"%>  
51 - <%= radio_button_tag(:intern,false)%>  
52 - <div class="formfieldline">  
53 - <%= label_tag "operating_platform", _("Operating Platform: ") %> <br />  
54 - <%= text_area_tag :operating_platform %>  
55 - </div>  
56 -  
57 - <div class="formfieldline">  
58 - <%= label_tag "objectives", _("Objectives: ")%><br />  
59 - <%= text_area_tag :objectives %>  
60 - </div>  
61 -  
62 - <div class="formfieldline">  
63 - <%= label_tag "features", _("Features: ")%><br />  
64 - <%= text_area_tag :features %>  
65 - </div>  
66 -  
67 -  
68 - <div id="software_categories_fields">  
69 - <h4> <%= _("Software Categories:") %> </h4>  
70 -  
71 - <%= check_box_tag :administration %>  
72 - <%= label_tag :administration, _("Administration") %><br />  
73 -  
74 - <%= check_box_tag :agriculture %>  
75 - <%= label_tag :agriculture, _("Agriculture") %><br />  
76 -  
77 - <%= check_box_tag :business_and_services %>  
78 - <%= label_tag :business_and_services, _("Business_and Services") %><br />  
79 -  
80 - <%= check_box_tag :communication %>  
81 - <%= label_tag :communication, _("Communication") %><br />  
82 -  
83 - <%= check_box_tag :culture %>  
84 - <%= label_tag :culture, _("Culture") %><br />  
85 -  
86 - <%= check_box_tag :national_defense %>  
87 - <%= label_tag :national_defense, _("National Defense") %><br />  
88 -  
89 - <%= check_box_tag :economy_and_finances %>  
90 - <%= label_tag :economy_and_finances, _("Economy and Finances") %><br />  
91 -  
92 - <%= check_box_tag :education %>  
93 - <%= label_tag :education, _("Education") %><br />  
94 -  
95 - <%= check_box_tag :energy %>  
96 - <%= label_tag :energy, _("Energy") %><br />  
97 -  
98 - <%= check_box_tag :sports %>  
99 - <%= label_tag :sports, _("Sports") %><br />  
100 -  
101 - <%= check_box_tag :habitation %>  
102 - <%= label_tag :habitation, _("Habitation") %><br />  
103 -  
104 - <%= check_box_tag :industry %>  
105 - <%= label_tag :industry, _("Industry") %><br />  
106 -  
107 - <%= check_box_tag :environment %>  
108 - <%= label_tag :environment, _("Environment") %><br />  
109 -  
110 - <%= check_box_tag :research_and_development %>  
111 - <%= label_tag :research_and_development, _("Research and Development") %><br />  
112 -  
113 - <%= check_box_tag :social_security %>  
114 - <%= label_tag :social_security, _("Social Security") %><br />  
115 -  
116 - <%= check_box_tag :social_protection %>  
117 - <%= label_tag :social_protection, _("Social Protection") %><br />  
118 -  
119 - <%= check_box_tag :sanitation %>  
120 - <%= label_tag :sanitation, _("Sanitation") %><br />  
121 -  
122 - <%= check_box_tag :health %>  
123 - <%= label_tag :health, _("Health") %><br />  
124 -  
125 - <%= check_box_tag :security_public_order %>  
126 - <%= label_tag :security_public_order, _("Security and Public Order") %><br />  
127 -  
128 - <%= check_box_tag :work %>  
129 - <%= label_tag :work, _("Work") %><br />  
130 -  
131 - <%= check_box_tag :transportation %>  
132 - <%= label_tag :transportation, _("Transportation") %><br />  
133 -  
134 - <%= check_box_tag :urbanism %>  
135 - <%= label_tag :urbanism, _("Urbanism") %><br />  
136 - </div>  
137 -</div>  
views/mpog_software_plugin_myprofile/_main_software_editor_extras.html.erb 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +<h2><%= _('Software Information') %></h2>
  2 +
  3 +<%= label_tag("name", _('Name'), {:class => 'formlabel'}) %>
  4 +
  5 +<div id='software-name-field' class='formfield'>
  6 + <span id='software-hostname'><%= @profile.environment.default_hostname %>/</span>
  7 + <%= text_field_tag(:name, @profile.software_info.community.name) %>
  8 +</div>
  9 +
  10 +<h3> <%= _("Finality") %> </h3>
  11 +<div id="finality">
  12 + <%= text_field_tag(:finality, @profile.software_info.finality) %>
  13 +</div>
  14 +
  15 +<h3> <%= _("Licenses") %> </h3>
  16 +<div id='licenses'>
  17 + <%= 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')") %>
  18 + <br />
  19 +
  20 + <h4> <%= _("License link") %> </h4>
  21 + <% LicenseHelper.getListLicenses.each do | license | %>
  22 + <input type="hidden" id = "version_<%=license.id %>" value = "<%=license.link%>">
  23 + <% end %>
  24 +
  25 + <a id = "version_link" href="<%= @profile.software_info.license_info.link %>" target="BLANK"> <%= @profile.software_info.license_info.link %> </a>
  26 +</div>
  27 +
  28 +<div class="formfieldline formfield type-text">
  29 + <%= label_tag "repository_url", _("Link to Repository: ") %>
  30 + <%= text_field_tag(:reository_url) %>
  31 +</div>
  32 +
views/mpog_software_plugin_myprofile/_public_software_info.html.erb 0 → 100644
@@ -0,0 +1,176 @@ @@ -0,0 +1,176 @@
  1 +<h1><%= _('Edit software') %></h1>
  2 +
  3 +<div>
  4 + <div class="formfield type-text">
  5 + <%= label_tag("acronym" ,_("Acronym"), :class=>"formlabel") %>
  6 + <%= text_field_tag(:acronym) %>
  7 + </div>
  8 +
  9 + <div class="formfieldline">
  10 + <%= label_tag _("Adherent to e-PING ?") %>
  11 +
  12 + <%= label_tag "e_ping_true", "Yes" %>
  13 + <%= radio_button_tag(:e_ping,true)%>
  14 + <%= label_tag "e_ping_false", "No"%>
  15 + <%= radio_button_tag(:e_ping,false)%>
  16 + </div>
  17 +
  18 + <div class="formfieldline">
  19 + <%= label_tag _("Adherent to e-MAG ?") %>
  20 +
  21 + <%= label_tag "e_mag_true", "Yes"%>
  22 + <%= radio_button_tag(:e_mag,true)%>
  23 + <%= label_tag "e_mag_false", "No"%>
  24 + <%= radio_button_tag(:e_mag,false)%>
  25 + </div>
  26 +
  27 + <div class="formfieldline">
  28 + <%= label_tag _("Adherent to ICP-Brasil ?") %>
  29 +
  30 + <%= label_tag "icp_brasil_true", "Yes"%>
  31 + <%= radio_button_tag(:icp_brasil,true)%>
  32 + <%= label_tag "icp_brasil_false", "No"%>
  33 + <%= radio_button_tag(:icp_brasil,false)%>
  34 + </div>
  35 +
  36 + <div class="formfieldline">
  37 + <%= label_tag _("Adherent to e-ARQ ?") %>
  38 +
  39 + <%= label_tag "e_arq_true", "Yes"%>
  40 + <%= radio_button_tag(:e_arq,true)%>
  41 + <%= label_tag "e_arq_false", "No"%>
  42 + <%= radio_button_tag(:e_arq,false)%>
  43 + </div>
  44 +
  45 + <div class="formfieldline">
  46 + <%= label_tag _("Internacionalizable ?") %>
  47 +
  48 + <%= label_tag "intern_true", "Yes" %>
  49 + <%= radio_button_tag(:intern,true)%>
  50 + <%= label_tag "intern_false", "No"%>
  51 + <%= radio_button_tag(:intern,false)%>
  52 + <div class="formfieldline">
  53 + <%= label_tag "operating_platform", _("Operating Platform: ") %> <br />
  54 + <%= text_area_tag :operating_platform %>
  55 + </div>
  56 +
  57 + <div class="formfieldline">
  58 + <%= label_tag "objectives", _("Objectives: ")%><br />
  59 + <%= text_area_tag :objectives %>
  60 + </div>
  61 +
  62 + <div class="formfieldline">
  63 + <%= label_tag "features", _("Features: ")%><br />
  64 + <%= text_area_tag :features %>
  65 + </div>
  66 +
  67 + <div id='libraries_fields'>
  68 + <h4> <%= _("Libraries") %> </h4>
  69 + <% if @list_libraries.blank? %>
  70 + <%= LibraryHelper.library_as_tables(nil).call %>
  71 + <% else %>
  72 + <%= render :partial => 'library_fields', :locals => { :f => f, :object_name => 'community', :profile => @community, :libraries => @list_libraries } %>
  73 + <% end %>
  74 + </div>
  75 + <br />
  76 +
  77 + <div id='operating_system_fields'>
  78 + <h4> <%= _("Operating Systems") %> </h4>
  79 + <% if @list_operating_systems.blank? %>
  80 + <%= OperatingSystemHelper.operating_system_as_tables(nil, false).call %>
  81 + <% else %>
  82 + <%= render :partial => 'operating_system_fields', :locals => {:object_name => 'community', :profile => @community, :operating_systems_fields => @list_operating_systems} %>
  83 + <% end %>
  84 + </div>
  85 + <br />
  86 +
  87 + <br />
  88 + <div id='programming_languages_fields'>
  89 + <h4> <%= _("Programming languages") %> </h4>
  90 + <% if @list_languages.blank? %>
  91 + <%= SoftwareLanguageHelper.language_as_tables(nil, false).call %>
  92 + <% else %>
  93 + <%= render :partial => 'language_fields', :locals => { :object_name => 'community', :profile => @community, :languages => @list_languages } %>
  94 + <% end %>
  95 + </div>
  96 +
  97 + <br />
  98 + <div id='database_fields'>
  99 + <h4> <%= _("Databases") %> </h4>
  100 + <% if @list_databases.blank? %>
  101 + <%= DatabaseHelper.database_as_tables(nil, true).call %>
  102 + <% else %>
  103 + <%= render :partial => 'database_fields', :locals => {:object_name => 'community', :profile => @community, :database => @list_databases } %>
  104 + <% end %>
  105 + </div>
  106 +
  107 + <div id="software_categories_fields">
  108 + <h4> <%= _("Software Categories:") %> </h4>
  109 +
  110 + <%= check_box_tag :administration %>
  111 + <%= label_tag :administration, _("Administration") %><br />
  112 +
  113 + <%= check_box_tag :agriculture %>
  114 + <%= label_tag :agriculture, _("Agriculture") %><br />
  115 +
  116 + <%= check_box_tag :business_and_services %>
  117 + <%= label_tag :business_and_services, _("Business_and Services") %><br />
  118 +
  119 + <%= check_box_tag :communication %>
  120 + <%= label_tag :communication, _("Communication") %><br />
  121 +
  122 + <%= check_box_tag :culture %>
  123 + <%= label_tag :culture, _("Culture") %><br />
  124 +
  125 + <%= check_box_tag :national_defense %>
  126 + <%= label_tag :national_defense, _("National Defense") %><br />
  127 +
  128 + <%= check_box_tag :economy_and_finances %>
  129 + <%= label_tag :economy_and_finances, _("Economy and Finances") %><br />
  130 +
  131 + <%= check_box_tag :education %>
  132 + <%= label_tag :education, _("Education") %><br />
  133 +
  134 + <%= check_box_tag :energy %>
  135 + <%= label_tag :energy, _("Energy") %><br />
  136 +
  137 + <%= check_box_tag :sports %>
  138 + <%= label_tag :sports, _("Sports") %><br />
  139 +
  140 + <%= check_box_tag :habitation %>
  141 + <%= label_tag :habitation, _("Habitation") %><br />
  142 +
  143 + <%= check_box_tag :industry %>
  144 + <%= label_tag :industry, _("Industry") %><br />
  145 +
  146 + <%= check_box_tag :environment %>
  147 + <%= label_tag :environment, _("Environment") %><br />
  148 +
  149 + <%= check_box_tag :research_and_development %>
  150 + <%= label_tag :research_and_development, _("Research and Development") %><br />
  151 +
  152 + <%= check_box_tag :social_security %>
  153 + <%= label_tag :social_security, _("Social Security") %><br />
  154 +
  155 + <%= check_box_tag :social_protection %>
  156 + <%= label_tag :social_protection, _("Social Protection") %><br />
  157 +
  158 + <%= check_box_tag :sanitation %>
  159 + <%= label_tag :sanitation, _("Sanitation") %><br />
  160 +
  161 + <%= check_box_tag :health %>
  162 + <%= label_tag :health, _("Health") %><br />
  163 +
  164 + <%= check_box_tag :security_public_order %>
  165 + <%= label_tag :security_public_order, _("Security and Public Order") %><br />
  166 +
  167 + <%= check_box_tag :work %>
  168 + <%= label_tag :work, _("Work") %><br />
  169 +
  170 + <%= check_box_tag :transportation %>
  171 + <%= label_tag :transportation, _("Transportation") %><br />
  172 +
  173 + <%= check_box_tag :urbanism %>
  174 + <%= label_tag :urbanism, _("Urbanism") %><br />
  175 + </div>
  176 +</div>
views/mpog_software_plugin_myprofile/edit_software.html.erb
1 -<!-- TODO: add partials -->  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +<%= _("Basic") %>
  3 +
  4 +<%= render :partial => 'main_software_editor_extras' %>
  5 +
  6 +<%= _("Especific") %>
  7 +
  8 +<%= render :partial => 'public_software_info' %>