Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-fluther

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-fluther

  • 0.2.5
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

h1. Fluther Ruby/Rails Client

h2. Introduction

This gem provides an interface to the "Fluther discussion service":http://www.fluther.com/. It is intended to be included into your controller (i.e. FlutherController) and called as a @before_filter@. It handles proxying requests to Fluther and returning the response so that it can be included in your web application.

It's based on the original "Fluther gem":http://github.com/Conceivian/Fluther but modified to not require Warden or Rack-integration.

h2. Installation

  • Add the @simple-fluther@ gem to your application (i.e. in @Gemfile@ or @environment.rb@).

  • Create an initializer (e.g. @config/initializers/fluther.rb@) that sets the following configuration:

class SimpleFluther::Config
  # hostname of the Fluther server for this environment (provided by Fluther)
  fluther_host 'fstage.fluther.com'

  # the route for your app
  prefix '/qna'
	
  # federated API key (provided by Fluther)
  app_key '2b6a0009c414c53e3d4fa8f8c3134d59'

  # what method to call in the controller to get the current user model
  method_to_get_current_user :current_user

  # mapping of attributes in the User model to the Fluther user
  user_fields :id => :id, :name => :name, :email => :email  # (defaults)
end

h2. Rails Integration

In your controller, include the module @Fluther::ControllerMethods@ and add the @make_fluther_request@ @before_filter@ to your target action.

The proxy provides three Rack variables that include the Fluther response: @fluther.header@, @fluther.title@, and @fluther.response@. The first two (may) contain HTML blocks which should be inserted into the page @@ and @@ blocks, respectively, and the third is the HTML for the Fluther widget itself.

To integrate the response into your application, you should add an action which is routed from the same path as the Fluther proxy. For this example, we assume the controller is @MainController@, the action is @fluther@, and as above, it is mounted at @/qna@. Also, we assume that the application layout includes @yield(:head)@ in the @<head>@ block:

# config/routes.rb
map.fluther '/qna/*_', :controller => 'fluther', :action => 'index'

Your controller might look something like this:

# app/controllers/fluther_controller.rb
class FlutherController < ApplicationController
  include SimpleFluther::ControllerMethods
  before_filter :make_fluther_request, :only => :index
  
  def index
  end
end
# app/views/fluther/index.html.erb
<%
  if (header = request.env['fluther.header']).present?
    content_for :head, header
  end
  if (title = request.env['fluther.title']).present?
    content_for :head, content_tag(:title, title)
  end
%>
<%= request.env['fluther.response'] -%>

You should now be able to start your application, navigate to http://localhost:300/qna and see the Fluther page.

h2. Credits

Based on original "Fluther gem":http://github.com/Conceivian/Fluther by Steve Sloan.

FAQs

Package last updated on 23 Nov 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc