From 293e444a1d59e496c026430ebea8d5b6eec2ce90 Mon Sep 17 00:00:00 2001 From: David Carlos Date: Mon, 2 Mar 2015 09:51:23 -0300 Subject: [PATCH] Create domain and repository link based on software name. --- public/mpog-software-validations.js | 13 +++++++++++++ views/software_communities_plugin_myprofile/new_software.html.erb | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/public/mpog-software-validations.js b/public/mpog-software-validations.js index f4eef45..001cfc8 100644 --- a/public/mpog-software-validations.js +++ b/public/mpog-software-validations.js @@ -170,6 +170,19 @@ database_autocomplete(); language_autocomplete(); + $("#community_name_id").blur(function(){ + var community_name = $("#community_name_id").val(); + var domain = $("#software-hostname").text(); + + var slug_name = community_name.replace(/\s+/g, '-').toLowerCase(); + + var custom_domain = domain.concat('/'); + custom_domain = domain.concat(slug_name); + + $("#community_name").val(slug_name); + $("#software_info_repository_link").val(custom_domain); + }); + $(".new-dynamic-table").click(function(){ var link = $(this); diff --git a/views/software_communities_plugin_myprofile/new_software.html.erb b/views/software_communities_plugin_myprofile/new_software.html.erb index d5d011f..dfeac85 100644 --- a/views/software_communities_plugin_myprofile/new_software.html.erb +++ b/views/software_communities_plugin_myprofile/new_software.html.erb @@ -37,7 +37,7 @@ <%= required_fields_message %> <%= label("name", _('Name'), {:class => 'formlabel mandatory'}) %> - <%= required text_field(:community, :name, :size => 30, :maxlength => 100, :id => 'name_id') %> + <%= required text_field(:community, :name, :size => 30, :maxlength => 100, :id => 'community_name_id') %>

-- libgit2 0.21.2