From d88eca5a71f34283a90b003e4906f3c601f6d007 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Fri, 3 Oct 2014 14:09:27 -0300 Subject: [PATCH] proposals_discussion: added topic title in proposal form --- lib/proposals_discussion_plugin/topic_helper.rb | 8 ++++++++ views/cms/proposals_discussion_plugin/_proposal.html.erb | 7 +++++++ views/content_viewer/topic.html.erb | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 lib/proposals_discussion_plugin/topic_helper.rb diff --git a/lib/proposals_discussion_plugin/topic_helper.rb b/lib/proposals_discussion_plugin/topic_helper.rb new file mode 100644 index 0000000..e1d96d5 --- /dev/null +++ b/lib/proposals_discussion_plugin/topic_helper.rb @@ -0,0 +1,8 @@ +module ProposalsDiscussionPlugin::TopicHelper + + def topic_title(topic) + content_tag(:div, '', :class=>'topic-color', :style => "background-color: #{topic.color};") + + content_tag(:h2, link_to(topic.title, topic.view_url)) + end + +end diff --git a/views/cms/proposals_discussion_plugin/_proposal.html.erb b/views/cms/proposals_discussion_plugin/_proposal.html.erb index 51d9918..b71dbb6 100644 --- a/views/cms/proposals_discussion_plugin/_proposal.html.erb +++ b/views/cms/proposals_discussion_plugin/_proposal.html.erb @@ -5,7 +5,14 @@ <% title_limit = 70 %> <% abstract_limit = 140 %> +<% extend ProposalsDiscussionPlugin::TopicHelper %> +
+ +
+ <%= topic_title @article.topic %> +
+
<%= required labelled_form_field _('Title'), limited_text_area(:article, :name, title_limit, 'title_textarea', :rows => 1) %>
diff --git a/views/content_viewer/topic.html.erb b/views/content_viewer/topic.html.erb index 29f62df..d9fbaa1 100644 --- a/views/content_viewer/topic.html.erb +++ b/views/content_viewer/topic.html.erb @@ -4,8 +4,8 @@ <%= javascript_include_tag 'plugins/proposals_discussion/proposals_list.js' %> <% end %> -
-

<%= link_to topic.title, topic.view_url %>

+<% extend ProposalsDiscussionPlugin::TopicHelper %> +<%= topic_title topic %>
-- libgit2 0.21.2