Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Changelog link to Linkset #400

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/linkset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Linkset < ActiveRecord::Base
belongs_to :rubygem
attr_protected :rubygem_id

LINKS = %w(home wiki docs mail code bugs).freeze
LINKS = %w(home wiki docs mail code bugs logs).freeze

LINKS.each do |url|
validates_formatting_of url.to_sym, :using => :url, :allow_nil => true, :allow_blank => true, :message => "does not appear to be a valid URL"
Expand Down
1 change: 1 addition & 0 deletions app/models/rubygem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def payload(version=versions.most_recent, host_with_port=HOST)
'mailing_list_uri' => linkset.try(:mail),
'source_code_uri' => linkset.try(:code),
'bug_tracker_uri' => linkset.try(:bugs),
'changelog_uri' => linkset.try(:logs),
'dependencies' => {
'development' => version.dependencies.development.to_a,
'runtime' => version.dependencies.runtime.to_a
Expand Down
4 changes: 4 additions & 0 deletions app/views/rubygems/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@
<%= form.label :bugs %>
<%= form.text_field :bugs, :size => 25 %>
</div>
<div class="url_field">
<%= form.label :logs %>
<%= form.text_field :logs, :size => 25 %>
</div>
<%= form.submit t('update'), :data => {:disable_with => t('form_disable_with')} %>
<% end %>
1 change: 1 addition & 0 deletions app/views/rubygems/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<%= link_to_page t('.links.wiki'), @rubygem.linkset.wiki %>
<%= link_to_page t('.links.mail'), @rubygem.linkset.mail %>
<%= link_to_page t('.links.bugs'), @rubygem.linkset.bugs %>
<%= link_to_page t('.links.logs'), @rubygem.linkset.logs %>
</div>
<% end %>

Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ en:
wiki: Wiki
mail: Mailing List
bugs: Bug Tracker
logs: Changelog
versions_header: Versions
bundler_header: Gemfile
show_all_versions: "Show all versions (%{count} total)"
Expand Down Expand Up @@ -207,6 +208,7 @@ en:
bugs: Bug Tracker URL
code: Source Code URL
docs: Documentation URL
logs: Changelog URL
mail: Mailing List URL
wiki: Wiki URL
session:
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20120209044039_add_logs_to_linksets.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddLogsToLinksets < ActiveRecord::Migration
def self.up
add_column :linksets, :logs, :string
end

def self.down
remove_column :linksets, :logs
end
end
1 change: 1 addition & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
t.string "bugs"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "logs"
end

add_index "linksets", ["rubygem_id"], :name => "index_linksets_on_rubygem_id"
Expand Down
2 changes: 1 addition & 1 deletion public/stylesheets/screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ table {
.main .info .meta .links a {
display: inline-block;
font-size: 1.3em;
margin: 0 0.7em;
margin: 0 0.4em;
font-weight: 900;
color: #5B7B9C;
text-decoration: underline;
Expand Down
1 change: 1 addition & 0 deletions test/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
mail 'http://example.com'
code 'http://example.com'
bugs 'http://example.com'
logs 'http://example.com'
end

factory :ownership do
Expand Down
1 change: 1 addition & 0 deletions test/functional/rubygems_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class RubygemsControllerTest < ActionController::TestCase
assert page.has_selector?("input#linkset_wiki")
assert page.has_selector?("input#linkset_mail")
assert page.has_selector?("input#linkset_bugs")
assert page.has_selector?("input#linkset_logs")
assert page.has_selector?("input[type='submit']")
end
end
Expand Down
2 changes: 2 additions & 0 deletions test/unit/rubygem_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,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.logs, hash["changelog_uri"]
end

should "return a bunch of XML" do
Expand All @@ -333,6 +334,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.logs, doc.at_css("changelog-uri").content
end
end
end
Expand Down