Permalink
Browse files

add suport for slim templates in consumer

  • Loading branch information...
pelle committed Sep 24, 2013
1 parent e1f6619 commit 51c7dffb3bdc915c5a17cdbf59e659b38f1d31bd
View
@@ -1,3 +1,6 @@
+0.5.1
+ - Support slim templates for consumer [pelle]
+ - Add via argument to match routes to support 4.0 [pelle]
0.5.0
- Make compatible with Rails 4 [tomhughes]
- Added support for RefreshTokens [RubenHoms]
@@ -19,7 +19,7 @@ def manifest
m.template 'controller.rb',File.join('app/controllers',"oauth_consumers_controller.rb")
m.route_entry "map.resources :oauth_consumers,:member=>{:callback=>:get}"
- @template_extension= options[:haml] ? "haml" : "erb"
+ @template_extension= options[:haml] ? "haml" : ( options[:slim] ? "slim": "erb")
m.template "show.html.#{@template_extension}", File.join('app/views', 'oauth_consumers', "show.html.#{@template_extension}")
m.template "index.html.#{@template_extension}", File.join('app/views', 'oauth_consumers', "index.html.#{@template_extension}")
@@ -46,5 +46,7 @@ def add_options!(opt)
# "Generate the Test::Unit compatible tests instead of RSpec") { |v| options[:test_unit] = v }
opt.on("--haml",
"Templates use haml") { |v| options[:haml] = v }
+ opt.on("--slim",
+ "Templates use slim") { |v| options[:slim] = v }
end
end
@@ -0,0 +1,15 @@
+h1 Services
+
+-if @consumer_tokens.empty?
+ p You are currently not connected to any external services.
+-else
+ p You are connected to the following services:
+ ul
+ -@consumer_tokens.each do |token|
+ li = link_to token.class.service_name.to_s.humanize, oauth_consumer_path(token.class.service_name)
+
+-unless @services.empty?
+ h3 You can connect to the following services:
+ ul
+ -@services.each do |service|
+ li = link_to service.to_s.humanize,oauth_consumer_path(service)
@@ -0,0 +1,8 @@
+h1
+ | You are already Connected to
+ = params[:id].humanize
+- form_tag oauth_consumer_path(params[:id]),:method=>:delete do
+ = submit_tag "Disconnect"
+ | or
+ = submit_tag "Reconnect"
+ |if you experienced a problem.
@@ -22,7 +22,7 @@ def add_route
member do
get :callback
get :callback2
- match 'client/*endpoint' => 'oauth_consumers#client'
+ match 'client/*endpoint' => 'oauth_consumers#client', :via => [:get, :post, :put, :delete]
end
end
ROUTE
@@ -0,0 +1,21 @@
+require 'rails/generators/erb/controller/controller_generator'
+
+module Slim
+ module Generators
+ class OauthConsumerGenerator < Erb::Generators::Base
+ source_root File.expand_path('../oauth_consumer_templates', __FILE__)
+
+ argument :name, :type => :string, :default => 'Oauth'
+
+ def copy_view_files
+ template 'index.html.slim', File.join('app/views', class_path, 'oauth_consumers', 'index.html.slim')
+ template 'show.html.slim', File.join('app/views', class_path, 'oauth_consumers', 'show.html.slim')
+ end
+
+ protected
+ def handler
+ :slim
+ end
+ end
+ end
+end
@@ -0,0 +1,15 @@
+h1 Services
+
+-if @consumer_tokens.empty?
+ p You are currently not connected to any external services.
+-else
+ p You are connected to the following services:
+ ul
+ -@consumer_tokens.each do |token|
+ li = link_to token.class.service_name.to_s.humanize, oauth_consumer_path(token.class.service_name)
+
+-unless @services.empty?
+ h3 You can connect to the following services:
+ ul
+ -@services.each do |service|
+ li = link_to service.to_s.humanize,oauth_consumer_path(service)
@@ -0,0 +1,8 @@
+h1
+ | You are already Connected to
+ = params[:id].humanize
+- form_tag oauth_consumer_path(params[:id]),:method=>:delete do
+ = submit_tag "Disconnect"
+ | or
+ = submit_tag "Reconnect"
+ |if you experienced a problem.
@@ -1,5 +1,5 @@
module Oauth
module Plugin
- VERSION = "0.5.0"
+ VERSION = "0.5.1"
end
end

0 comments on commit 51c7dff

Please sign in to comment.