From d02c2ee7f892e6adf6bb504eab02d313faba11d1 Mon Sep 17 00:00:00 2001 From: Luciano Prestes Cavalcanti Date: Tue, 3 Mar 2015 10:17:31 -0300 Subject: [PATCH] Show the title of steps 1 and 2 on both pages, but by highlighting the active step and the inactive --- lib/ext/profile_editor_controller.rb | 6 ++++++ lib/software_communities_plugin.rb | 8 -------- public/style.css | 5 +++++ views/first_edit_software_community_extras.html.erb | 3 --- views/profile_editor/_first_edit_software_community_extras.html.erb | 9 +++++++++ views/profile_editor/_software_community.html.erb | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ views/profile_editor/edit_software_community.html.erb | 12 +++++++++--- views/software_communities_plugin_myprofile/new_software.html.erb | 17 +++++++---------- 8 files changed, 108 insertions(+), 24 deletions(-) delete mode 100644 views/first_edit_software_community_extras.html.erb create mode 100644 views/profile_editor/_first_edit_software_community_extras.html.erb create mode 100644 views/profile_editor/_software_community.html.erb diff --git a/lib/ext/profile_editor_controller.rb b/lib/ext/profile_editor_controller.rb index 75282e0..3645f1f 100644 --- a/lib/ext/profile_editor_controller.rb +++ b/lib/ext/profile_editor_controller.rb @@ -7,6 +7,12 @@ class ProfileEditorController def edit_software_community @profile_data = profile @possible_domains = profile.possible_domains + @first_edit = profile.software_info.first_edit? + + if @first_edit + profile.software_info.first_edit = false + profile.software_info.save! + end edit if request.post? end diff --git a/lib/software_communities_plugin.rb b/lib/software_communities_plugin.rb index 22a4787..7644a6c 100644 --- a/lib/software_communities_plugin.rb +++ b/lib/software_communities_plugin.rb @@ -38,14 +38,6 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin if profile.person? expanded_template('person_editor_extras.html.erb') - elsif profile.respond_to?(:software_info) && - !profile.software_info.nil? - - if profile.software_info.first_edit? - profile.software_info.first_edit = false - profile.software_info.save! - expanded_template('first_edit_software_community_extras.html.erb') - end end end diff --git a/public/style.css b/public/style.css index 6a207ba..6fb25f7 100644 --- a/public/style.css +++ b/public/style.css @@ -523,3 +523,8 @@ input[type=checkbox] { } /* End software catalog definitions */ + +div.step-explanation { + margin-top: 2px; + margin-bottom: 15px; +} diff --git a/views/first_edit_software_community_extras.html.erb b/views/first_edit_software_community_extras.html.erb deleted file mode 100644 index d62b4c0..0000000 --- a/views/first_edit_software_community_extras.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
-

<%= _("Step 2/2 - Software Community Configuration")%>

-
\ No newline at end of file diff --git a/views/profile_editor/_first_edit_software_community_extras.html.erb b/views/profile_editor/_first_edit_software_community_extras.html.erb new file mode 100644 index 0000000..86ed273 --- /dev/null +++ b/views/profile_editor/_first_edit_software_community_extras.html.erb @@ -0,0 +1,9 @@ +
+
> +

<%= _("Step 1 - Software Creation")%>

+
+ +
> +

<%= _("Step 2 - Community Settings")%>

+
+
diff --git a/views/profile_editor/_software_community.html.erb b/views/profile_editor/_software_community.html.erb new file mode 100644 index 0000000..2c2f548 --- /dev/null +++ b/views/profile_editor/_software_community.html.erb @@ -0,0 +1,72 @@ +

<%= _('General information') %>

+ + <%= 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') %> + +<% end %> + +<% if @environment.enabled?('enable_organization_url_change') %> + + + <%= hidden_field_tag 'old_profile_identifier', @profile.identifier %> +
+ <%= required labelled_form_field( _('Address'), + content_tag('code', + url_for(profile.url).gsub(/#{profile.identifier}$/, '') + + text_field(:profile_data, :identifier, :onchange => "warn_value_change()", :size => 25) + ) + + content_tag('div', + content_tag('strong', _('WARNING!')) + ' ' + + _("You are about to change the address, and this will break external links to the homepage or to content inside it. Do you really want to change?") + + content_tag('div', + button_to_function(:ok, _("Yes"), "confirm_change()") + ' ' + + button_to_function(:cancel, _('No'), 'no_change()') + ), + :id => 'identifier-change-confirmation', + :class => 'change-confirmation', + :style => 'display: none;' + ) + ) + %> +
+<% end %> + +<%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => 'profile_data', :profile => @profile } %> + +<%= labelled_check_box(_('Enable "contact us"'), 'profile_data[enable_contact_us]', "1", @profile.enable_contact_us) if @profile.enterprise? %> + +<%= render :partial => 'moderation', :locals => { :profile => @profile } %> + +<% if profile.enterprise? && profile.environment.enabled?('products_for_enterprises') %> +

<%=_('Products/Services catalog')%>

+ <%= labelled_form_field(_('Number of products/services displayed per page on catalog'), text_field(:profile_data, :products_per_catalog_page, :size => 3)) %> +<% end %> diff --git a/views/profile_editor/edit_software_community.html.erb b/views/profile_editor/edit_software_community.html.erb index 657c447..7d45a2f 100644 --- a/views/profile_editor/edit_software_community.html.erb +++ b/views/profile_editor/edit_software_community.html.erb @@ -1,6 +1,12 @@ -

<%= _('Configure Community') %>

+<%= render :partial => 'first_edit_software_community_extras', :locals => {:class_step_one => "another-step", :class_step_two => "current-step"} if @first_edit %> -
<%= _('Set the basic settings of the software associated community') %>
+

<%= _('Configure Software Community') %>

+ +
+ + <%= _('Set the basic settings of the software associated community') %> + +
<%= javascript_include_tag 'deactivate_profile' %> <%= error_messages_for :profile_data %> @@ -13,7 +19,7 @@ <% end %> - <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %> + <%= render :partial => 'software_community', :locals => { :f => f } %>

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

diff --git a/views/software_communities_plugin_myprofile/new_software.html.erb b/views/software_communities_plugin_myprofile/new_software.html.erb index b8e1512..a7bdc36 100644 --- a/views/software_communities_plugin_myprofile/new_software.html.erb +++ b/views/software_communities_plugin_myprofile/new_software.html.erb @@ -1,19 +1,16 @@ -
-

<%= _("Step 1 - Software Creation")%>

-

<%= _("Step 2 - Edit Community info ")%>

+<%= render :partial => 'profile_editor/first_edit_software_community_extras', :locals => {:class_step_one => "current-step", :class_step_two => "another-step"} %> -

- Enter the basic information about the software.
- You can add the details after you create it. -
-

+

<%= _('Creating new software') %>

+
+ + <%= _('Enter the basic information about the software.
+ You can add the details after you create it.') %> +
-

<%= _('Creating new software') %>

- <% if environment.enabled?('admin_must_approve_new_communities') %>
<%= _("Note that the creation of communities in this environment is restricted. Your request to create this new community will be sent to %{environment} administrators and will be approved or rejected according to their methods and criteria.") % { :environment => environment.name }%> -- libgit2 0.21.2