diff --git a/lib/proposals_discussion_plugin/proposal.rb b/lib/proposals_discussion_plugin/proposal.rb index 5db40b8..a220d65 100644 --- a/lib/proposals_discussion_plugin/proposal.rb +++ b/lib/proposals_discussion_plugin/proposal.rb @@ -5,6 +5,8 @@ class ProposalsDiscussionPlugin::Proposal < TinyMceArticle belongs_to :topic, :foreign_key => :parent_id, :class_name => 'ProposalsDiscussionPlugin::Topic' + has_many :locations, :class_name => 'Region', :through => :article_categorizations, :source => :category + def self.short_description _("Proposal") end diff --git a/public/style.css b/public/style.css index a553ffe..f6dd57e 100644 --- a/public/style.css +++ b/public/style.css @@ -40,6 +40,12 @@ float: left; clear: both; } +.proposals_list .proposal .locations { + float: right; + clear: both; + color: rgb(155, 155, 155); + font-weight: bold; +} .proposal .author { display: table-cell; font-size: 10px; diff --git a/test/unit/proposal_test.rb b/test/unit/proposal_test.rb index 65788de..abf7980 100644 --- a/test/unit/proposal_test.rb +++ b/test/unit/proposal_test.rb @@ -117,4 +117,11 @@ class ProposalTest < ActiveSupport::TestCase assert !proposal.allow_vote? end + should 'set a proposal location' do + location = fast_create(Region) + proposal.save! + proposal.add_category(location) + assert_equal [location], proposal.locations + end + end diff --git a/views/content_viewer/_proposal_card.html.erb b/views/content_viewer/_proposal_card.html.erb index e8ca6ff..a6b1719 100644 --- a/views/content_viewer/_proposal_card.html.erb +++ b/views/content_viewer/_proposal_card.html.erb @@ -27,6 +27,13 @@   <% end %> + <% if proposal_card.locations.present? %> +
+ <% proposal_card.locations.each do |location| %> + <%= location.name %> + <% end %> +
+ <% end %> <% if !proposal_card.tags.empty? %>
<%= proposal_card.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tags', :id => t.name ) }.join("\n") %> -- libgit2 0.21.2