diff --git a/app/controllers/rubygems_controller.rb b/app/controllers/rubygems_controller.rb
index 8a92cae92b4..71a920e8317 100644
--- a/app/controllers/rubygems_controller.rb
+++ b/app/controllers/rubygems_controller.rb
@@ -48,6 +48,6 @@ def load_gem
private
def params_linkset
- params.require(:linkset).permit(:code, :docs, :wiki, :mail, :bugs)
+ params.require(:linkset).permit(:code, :docs, :wiki, :mail, :bugs, :changelog)
end
end
diff --git a/app/models/linkset.rb b/app/models/linkset.rb
index 54946354d4f..dd2bcc16b91 100644
--- a/app/models/linkset.rb
+++ b/app/models/linkset.rb
@@ -1,7 +1,7 @@
class Linkset < ActiveRecord::Base
belongs_to :rubygem
- LINKS = %w(home wiki docs mail code bugs).freeze
+ LINKS = %w(home wiki docs mail code bugs changelog).freeze
LINKS.each do |url|
validates_formatting_of url.to_sym,
diff --git a/app/models/rubygem.rb b/app/models/rubygem.rb
index 7bab400a80f..3bf16df2b4f 100644
--- a/app/models/rubygem.rb
+++ b/app/models/rubygem.rb
@@ -168,6 +168,7 @@ def payload(version = versions.most_recent, protocol = Gemcutter::PROTOCOL,
'mailing_list_uri' => linkset.try(:mail),
'source_code_uri' => linkset.try(:code),
'bug_tracker_uri' => linkset.try(:bugs),
+ 'changelog_uri' => linkset.try(:changelog),
'dependencies' => {
'development' => version.dependencies.development.to_a,
'runtime' => version.dependencies.runtime.to_a
diff --git a/app/views/rubygems/edit.html.erb b/app/views/rubygems/edit.html.erb
index 800066571bd..0f076f92d62 100644
--- a/app/views/rubygems/edit.html.erb
+++ b/app/views/rubygems/edit.html.erb
@@ -27,5 +27,9 @@
<%= form.label :bugs, :class => 'form__label' %>
<%= form.text_field :bugs, :class => 'form__input' %>
+
+ <%= form.label :changelog, class: 'form__label' %>
+ <%= form.text_field :changelog, class: 'form__input' %>
+
<%= form.submit t('update'), :data => {:disable_with => t('form_disable_with')}, :class => 'form__submit' %>
<% end %>
diff --git a/app/views/rubygems/show.html.erb b/app/views/rubygems/show.html.erb
index df38d7fc7ed..b0c88057331 100644
--- a/app/views/rubygems/show.html.erb
+++ b/app/views/rubygems/show.html.erb
@@ -149,7 +149,7 @@
<% if @latest_version.indexed %>
<% if @rubygem.linkset.present? %>
- <%- %i{home code docs wiki mail bugs}.each do |link| %>
+ <%- %i{home code docs wiki mail bugs changelog}.each do |link| %>
<%= link_to_page t("rubygems.show.links.#{link}"), @rubygem.linkset.public_send(link) %>
<%- end %>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8e4438f2cbd..29fafcc947f 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -108,6 +108,7 @@ en:
wiki: Wiki
mail: Mailing List
bugs: Bug Tracker
+ changelog: Change Log
versions_header: Versions
bundler_header: Gemfile
show_all_versions: "Show all versions (%{count} total)"
@@ -149,6 +150,7 @@ en:
password: Password
linkset:
bugs: Bug Tracker URL
+ changelog: Change Log URL
code: Source Code URL
docs: Documentation URL
mail: Mailing List URL
diff --git a/db/migrate/20150821091456_add_changelog_to_linksets.rb b/db/migrate/20150821091456_add_changelog_to_linksets.rb
new file mode 100644
index 00000000000..a5752b5fc34
--- /dev/null
+++ b/db/migrate/20150821091456_add_changelog_to_linksets.rb
@@ -0,0 +1,5 @@
+class AddChangelogToLinksets < ActiveRecord::Migration
+ def change
+ add_column :linksets, :changelog, :string
+ end
+end
\ No newline at end of file
diff --git a/db/schema.rb b/db/schema.rb
index 422aad14e22..cdbad376344 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,8 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20150407012331) do
+ActiveRecord::Schema.define(version: 20150821091456) do
+
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "hstore"
@@ -71,6 +72,7 @@
t.string "bugs"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "changelog"
end
add_index "linksets", ["rubygem_id"], name: "index_linksets_on_rubygem_id", using: :btree
@@ -185,4 +187,5 @@
t.datetime "updated_at"
t.integer "rubygem_id"
end
+
end
diff --git a/test/factories.rb b/test/factories.rb
index 9e93a7c5032..b26fa63e035 100644
--- a/test/factories.rb
+++ b/test/factories.rb
@@ -38,6 +38,7 @@
mail 'http://example.com'
code 'http://example.com'
bugs 'http://example.com'
+ changelog 'http://example.com'
end
factory :ownership do
diff --git a/test/unit/rubygem_test.rb b/test/unit/rubygem_test.rb
index 48e5bc0b67a..89486c2e444 100644
--- a/test/unit/rubygem_test.rb
+++ b/test/unit/rubygem_test.rb
@@ -435,6 +435,7 @@ class RubygemTest < ActiveSupport::TestCase
assert_equal @rubygem.linkset.mail, hash["mailing_list_uri"]
assert_equal @rubygem.linkset.code, hash["source_code_uri"]
assert_equal @rubygem.linkset.bugs, hash["bug_tracker_uri"]
+ assert_equal @rubygem.linkset.changelog, hash["changelog_uri"]
end
should "return version documentation url if linkset docs is empty" do
@@ -454,6 +455,7 @@ class RubygemTest < ActiveSupport::TestCase
assert_equal @rubygem.linkset.mail, doc.at_css("mailing-list-uri").content
assert_equal @rubygem.linkset.code, doc.at_css("source-code-uri").content
assert_equal @rubygem.linkset.bugs, doc.at_css("bug-tracker-uri").content
+ assert_equal @rubygem.linkset.changelog, doc.at_css("changelog-uri").content
end
end
end