diff --git a/controllers/software_communities_plugin_myprofile_controller.rb b/controllers/software_communities_plugin_myprofile_controller.rb index 1e6a4c5..06ec4bb 100644 --- a/controllers/software_communities_plugin_myprofile_controller.rb +++ b/controllers/software_communities_plugin_myprofile_controller.rb @@ -40,6 +40,7 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController update_software_atributes return unless request.post? + @software_info = constroy_software software_info_insert_models.call(@list_libraries, 'libraries') software_info_insert_models.call(@list_languages, 'software_languages') @@ -48,6 +49,10 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController begin @software_info.save! + + @community = @software_info.community + @community.update_attributes!(params[:community]) + if params[:commit] == _('Save and Configure Community') redirect_to :controller => 'profile_editor', :action => 'edit' else @@ -155,6 +160,8 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController params[:software_info].merge({ :environment => environment, :name => params[:community][:name], + :identifier => params[:community][:identifier], + :image_builder => params[:community][:image_builder], :license_info => @license_info, :another_license_version => another_license_version, :another_license_link => another_license_link })) diff --git a/features/public_software_validation.feature b/features/public_software_validation.feature index d4d675d..26565df 100644 --- a/features/public_software_validation.feature +++ b/features/public_software_validation.feature @@ -16,7 +16,7 @@ Feature: edit adherent fields And I press "Save changes" And I go to /myprofile/mpog-admin And I follow "Create a new software" - And I fill in "community_name" with "basic software" + And I fill in "community_name_id" with "basic software" And I fill in "software_info_finality" with "basic software finality" And I press "Create" diff --git a/features/software_registration.feature b/features/software_registration.feature index bc37372..61cbcfc 100644 --- a/features/software_registration.feature +++ b/features/software_registration.feature @@ -12,7 +12,7 @@ Feature: edit public software information And I press "Save changes" And I go to /myprofile/mpog-admin And I follow "Create a new software" - And I fill in "community_name" with "basic software" + And I fill in "community_name_id" with "basic software" And I fill in "software_info_finality" with "basic software finality" And I type in "gp" in autocomplete list "#license_info_version" and I choose "GPL-2" And I press "Create" diff --git a/features/step_definitions/software_communities_steps.rb b/features/step_definitions/software_communities_steps.rb index cf1002c..168ed32 100644 --- a/features/step_definitions/software_communities_steps.rb +++ b/features/step_definitions/software_communities_steps.rb @@ -131,6 +131,8 @@ Given /^the following softwares$/ do |table| software_info.community = Community.create(:name=>item[:name]) software_info.acronym = item[:acronym] if item[:acronym] + software_info.finality = item[:finality] if item[:finality] + software_info.finality ||= "something" software_info.operating_platform = item[:operating_platform] if item[:operating_platform] software_info.objectives = item[:objectives] if item[:objectives] software_info.features = item[:features] if item[:features] diff --git a/lib/software_info.rb b/lib/software_info.rb index 0937f7b..0d3993a 100644 --- a/lib/software_info.rb +++ b/lib/software_info.rb @@ -159,6 +159,8 @@ class SoftwareInfo < ActiveRecord::Base def self.create_after_moderation(requestor, attributes = {}) environment = attributes.delete(:environment) name = attributes.delete(:name) + identifier = attributes.delete(:identifier) + image_builder = attributes.delete(:image_builder) license_info = attributes.delete(:license_info) another_license_version = attributes.delete(:another_license_version) another_license_link = attributes.delete(:another_license_link) @@ -175,7 +177,12 @@ class SoftwareInfo < ActiveRecord::Base ) else software_template = Community["software"] - community = Community.new(:name => name) + + community_hash = {:name => name} + community_hash[:identifier] = identifier + community_hash[:image_builder] = image_builder if image_builder + + community = Community.new(community_hash) community.environment = environment if (!software_template.blank? && software_template.is_template) diff --git a/public/style.css b/public/style.css index 6fb25f7..77e1ce4 100644 --- a/public/style.css +++ b/public/style.css @@ -528,3 +528,8 @@ div.step-explanation { margin-top: 2px; margin-bottom: 15px; } + +div#finality textarea { + resize: none; + height: 100px; +} diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index 4bc694d..5487a6f 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -119,7 +119,7 @@ class ProfileEditorControllerTest < ActionController::TestCase community end - def create_software_info name, finality = "", acronym = "" + def create_software_info name, finality = "something", acronym = "" community = create_community(name) software_info = SoftwareInfo.new software_info.community = community diff --git a/test/functional/software_communities_plugin_myprofile_controller_test.rb b/test/functional/software_communities_plugin_myprofile_controller_test.rb index a8586ba..43f33e9 100644 --- a/test/functional/software_communities_plugin_myprofile_controller_test.rb +++ b/test/functional/software_communities_plugin_myprofile_controller_test.rb @@ -225,8 +225,8 @@ class SoftwareCommunitiesPluginMyprofileControllerTest < ActionController::TestC post( :new_software, - :community => {:name =>"New Software"}, - :software_info => {:finality => "", :repository_link => ""}, + :community => {:name =>"New Software", :identifier => "new-software"}, + :software_info => {:finality => "something", :repository_link => ""}, :license =>{:license_infos_id => LicenseInfo.last.id}, :profile => @person.identifier ) @@ -243,8 +243,8 @@ class SoftwareCommunitiesPluginMyprofileControllerTest < ActionController::TestC post( :new_software, - :community => { :name =>"New Software" }, - :software_info => { :finality => "", :repository_link => "" }, + :community => { :name => "New Software", :identifier => "new-software" }, + :software_info => { :finality => "something", :repository_link => "" }, :license => { :license_infos_id => license_another.id, :version => another_license_version, :link=> another_license_link diff --git a/test/helpers/plugin_test_helper.rb b/test/helpers/plugin_test_helper.rb index 5dba34a..415eb49 100644 --- a/test/helpers/plugin_test_helper.rb +++ b/test/helpers/plugin_test_helper.rb @@ -13,14 +13,15 @@ module PluginTestHelper community end - def create_software_info name, finality = "", acronym = "" + def create_software_info name, finality = "something", acronym = "" community = create_community(name) software_info = SoftwareInfo.new software_info.community = community software_info.finality = finality software_info.acronym = acronym software_info.public_software = true - software_info.save + software_info.save! + software_info end diff --git a/test/unit/software_info_validation_test.rb b/test/unit/software_info_validation_test.rb index f0317a3..e42bf9b 100644 --- a/test/unit/software_info_validation_test.rb +++ b/test/unit/software_info_validation_test.rb @@ -40,7 +40,8 @@ class SoftwareInfoValidationTest < ActiveSupport::TestCase :e_arq => true, :operating_platform => true, :objectives => "", - :features => "" + :features => "", + :finality => "something" ) @software_info.software_languages << @software_language @software_info.software_databases << @software_database diff --git a/test/unit/software_registration_test.rb b/test/unit/software_registration_test.rb index b050606..397adf7 100644 --- a/test/unit/software_registration_test.rb +++ b/test/unit/software_registration_test.rb @@ -30,7 +30,8 @@ class SoftwareRegistrationTest < ActiveSupport::TestCase task = CreateSoftware.create!( :name => "Teste Two", :requestor => person, - :environment => @environment + :environment => @environment, + :finality => "something" ) software_count = SoftwareInfo.count diff --git a/views/profile_editor/_software_community.html.erb b/views/profile_editor/_software_community.html.erb index 2c2f548..f4d0281 100644 --- a/views/profile_editor/_software_community.html.erb +++ b/views/profile_editor/_software_community.html.erb @@ -2,8 +2,6 @@ <%= required_fields_message %> - <%= required f.text_field(:name) %> - <%= @plugins.dispatch(:profile_info_extra_contents).collect { |content| instance_exec(&content) }.join("") %> <% if @environment.enabled?('enable_organization_url_change') %> diff --git a/views/profile_editor/edit_software_community.html.erb b/views/profile_editor/edit_software_community.html.erb index 7d45a2f..78627aa 100644 --- a/views/profile_editor/edit_software_community.html.erb +++ b/views/profile_editor/edit_software_community.html.erb @@ -21,16 +21,6 @@ <%= render :partial => 'software_community', :locals => { :f => f } %> -
-

<%= _('Change picture') %>

- <%= unchangeable_privacy_field @profile %> -
-
- <%= f.fields_for :image_builder, @profile.image do |i| %> - <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> - <% end %> -
-

<%= _('Privacy options') %>

<% if profile.person? %> diff --git a/views/software_communities_plugin_myprofile/_license_info_fields.html.erb b/views/software_communities_plugin_myprofile/_license_info_fields.html.erb index 84b71e7..3cde616 100644 --- a/views/software_communities_plugin_myprofile/_license_info_fields.html.erb +++ b/views/software_communities_plugin_myprofile/_license_info_fields.html.erb @@ -2,7 +2,6 @@ <% end %> -

<%= _("License Version: ") %>

<%= text_field_tag "license_info[version]", license_version, :id=>"license_info_version", :class=>"license_info_version", :placeholder=>_('Autocomplete field, type some license') %> <%= hidden_field_tag "license[license_infos_id]", license_id, :id=>"license_info_id", :class=>"license_info_id", :data => {:label=>license_version} %> diff --git a/views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb b/views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb index 3f0c2bf..9bacd0a 100644 --- a/views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb +++ b/views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb @@ -1,5 +1,10 @@

<%= @profile.software_info.name + _(' Information') %>

+

<%= _("Name") %>

+
+ <%= text_field_tag("community[name]", @profile.name) %> +
+

<%= _("Acronym") %>

<%= text_field_tag("software[acronym]", @profile.software_info.acronym, :maxlength=>"10") %> @@ -7,9 +12,19 @@

<%= _("Finality") %>

- <%= text_area_tag "software[finality]", @profile.software_info.finality, :placeholder => _("It is a software of..."), :cols => 40, :rows => 5, :maxlength => 140%> + <%= text_area_tag "software[finality]", @profile.software_info.finality, :placeholder => _("What is the software for?"), :maxlength => 120 %> +
+ +
+

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

+
+
+ <%= f.fields_for :image_builder, @profile.image do |i| %> + <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> + <% end %>
+

<%= _("License Version: ") %>

<%= render :partial => "license_info_fields", :locals => { :license_version => @license_version, @@ -25,3 +40,4 @@ <%= text_field_tag("software[repository_link]", @profile.software_info.repository_link, :class => "improve_input_size") %>
+ diff --git a/views/software_communities_plugin_myprofile/edit_software.html.erb b/views/software_communities_plugin_myprofile/edit_software.html.erb index 581f2bc..f16d230 100644 --- a/views/software_communities_plugin_myprofile/edit_software.html.erb +++ b/views/software_communities_plugin_myprofile/edit_software.html.erb @@ -1,20 +1,20 @@ <% tabs = [] %> -<%= error_messages_for :software_info %> +<%= error_messages_for :software_info, :community %> -<%= labelled_form_for :software_communities_plugin_myprofile, :html => { :multipart => true, :id => 'edit-form' } do |f| %> +<%= labelled_form_for :community, :html => { :multipart => true, :id => 'edit-form' } do |f| %> -<% tabs << {:title => _("Software"), :id => 'basic-info', - :content => (render :partial => 'main_software_editor_extras')} %> + <% tabs << {:title => _("Software"), :id => 'basic-info', + :content => (render :partial => 'main_software_editor_extras', :locals => {:f => f})} %> -<% tabs << {:title => _("Specifications"), :id => 'especific-info', - :content => (render :partial => 'public_software_info')} %> + <% tabs << {:title => _("Specifications"), :id => 'especific-info', + :content => (render :partial => 'public_software_info')} %> -<%= render_tabs(tabs) %> + <%= render_tabs(tabs) %> -<% button_bar do %> + <% button_bar do %> <%= submit_button(:save, _('Save')) %> <%= submit_button(:save, _('Save and Configure Community')) %> <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> -<% end %> + <% end %> <% end %> diff --git a/views/software_communities_plugin_myprofile/new_software.html.erb b/views/software_communities_plugin_myprofile/new_software.html.erb index a7bdc36..b8d6de0 100644 --- a/views/software_communities_plugin_myprofile/new_software.html.erb +++ b/views/software_communities_plugin_myprofile/new_software.html.erb @@ -43,23 +43,37 @@
<%= environment.default_hostname %>/ - <%= required text_field(:community, :name, :size => 30, :maxlength => 100) %> + <%= required text_field(:community, :identifier, :size => 30, :maxlength => 100) %>
<%= fields_for @software_info do |swf| %> -
+
<%= swf.label("finality" ,_("Finality"), :class=>"formlabel") %> - <%= required swf.text_area(:finality, :placeholder => _("What is the software?"), :cols => 40, :rows => 5, :maxlength => 140) %> + <%= required swf.text_area(:finality, :placeholder => _("What is the software for?"), :maxlength => 120) %>
<% end %> -
- <%= render :partial => "license_info_fields", :locals => { - :license_version => "", - :license_id => "", - :another_version=>"", - :another_link=>"" - } %> +
+ +
+
+ <%= f.fields_for :image_builder, @community.image do |i| %> + <%= file_field_or_thumbnail(_('Image:'), @community.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> + <% end %> +
+ +
+ + <%= render :partial => "license_info_fields", :locals => { + :license_version => "", + :license_id => "", + :another_version=>"", + :another_link=>"" + } %>
<%= fields_for @software_info do |swf| %> -- libgit2 0.21.2