lib/knitkit/extensions/railties/action_view.rb in knitkit-2.0.0 vs lib/knitkit/extensions/railties/action_view.rb in knitkit-2.0.1

- old
+ new

@@ -4,24 +4,24 @@ "by #{@published_content.content.created_by.username}" rescue '' end def blog_add_comment_form render :partial => 'add_comment' unless current_user.nil? - end + end def blog_topics(css_class='tag_link') html = '' @website_section.get_topics.each do |tag| html += '<div class="'+css_class+'">' - html += link_to(tag.name, main_app.blog_tag_path(@website_section.id, tag.id)) + html += link_to(tag.name, main_app.blog_tag_path(@website_section.id, tag.id)) html += '</div>' end - + raw html end - + def blog_rss_links(link_title='RSS Feed') if params[:action] == 'tag' return link_to link_title, main_app.blog_tag_url(params[:section_id], params[:tag_id], :rss) else return link_to link_title, main_app.blogs_url(params[:section_id], :rss) @@ -31,35 +31,41 @@ def blog_recent_approved_comments if @published_content.content.comments.recent.approved.empty? return 'No Comments' else html = '' - + @published_content.content.comments.recent.approved.each do |comment| html += render :partial => 'comment', :locals => {:comment => comment} end - + return raw html end end def blog_pagination(css_class, params) - return will_paginate @contents, :class => css_class, :params => { + return will_paginate @contents, :class => css_class, :params => { :section_id => params[:section_id], :per_page => params[:per_page], :format => params[:format], :only_path => true, :use_route => params[:use_route], :scope => main_app } end - + # render a piece of content by internal identifier regardless if it belongs to a section or not def render_content(iid) content = Content.find_by_internal_identifier(iid) - content_version = Content.get_published_version(@active_publication, content) - raw content_version.body_html.nil? ? '' : content_version.body_html + content_version = Content.get_published_version(@active_publication, content) unless @active_publication.nil? + content_version = content if @active_publication.nil? or content_version.nil? + + if content_version.nil? + return '' + else + return raw content_version.body_html.nil? ? '' : content_version.body_html + end end def render_content_area(name) html = '' @@ -182,6 +188,12 @@ layout = options[:layout] ? "menus/#{options[:layout]}" : "menus/knitkit/default_sub_section_menu" end render :partial => layout, :locals => locals end + + def tool_tip(message, img_src=nil) + img_src = img_src || '/images/knitkit/tooltip.gif' + raw "<a href='#' class='tooltip'>&nbsp;<img src='#{img_src}' alt='ToolTip' /><span>#{message}</span></a>" + end + end