Permalink
Browse files

Removed /flipper namespace from html stuff.

Now you should be able to mount the app wherever using rack url map or
rack mount or whatever and it will work.
  • Loading branch information...
1 parent db5204a commit 8d5ac89d1d2547e5b00a6a848e36cf1984bc57f5 @jnunemaker committed Feb 20, 2013
View
@@ -14,13 +14,13 @@ end
coffee_options = {
:input => 'lib/flipper/ui/assets/javascripts',
- :output => 'lib/flipper/ui/public/flipper/js',
+ :output => 'lib/flipper/ui/public/js',
:all_on_start => false,
}
guard 'coffeescript', coffee_options
sass_options = {
:input => 'lib/flipper/ui/assets/stylesheets',
- :output => 'lib/flipper/ui/public/flipper/css',
+ :output => 'lib/flipper/ui/public/css',
}
guard 'sass', sass_options
View
@@ -8,5 +8,6 @@ task :default => :spec
desc "Starts a server up"
task :start do
- `bundle exec shotgun examples/basic.ru`
+ puts 'Starting flipper on port 9999'
+ `bundle exec rackup examples/basic.ru -p 9999`
end
View
@@ -1,13 +1,7 @@
#
# Usage:
# bundle exec rackup examples/basic.ru
-# http://localhost:9292/flipper
-#
-# OR, you can use shotgun to get auto-reloading.
-#
-# Shotgun Usage:
-# bundle exec shotgun examples/basic.ru
-# http://localhost:9393/flipper
+# http://localhost:9292/
#
require 'pp'
require 'logger'
@@ -47,8 +41,4 @@ flipper[:secrets].enable flipper.group(:early_access)
flipper[:logging].enable flipper.random(5)
flipper[:new_cache].enable flipper.actors(15)
-use Flipper::UI::Middleware, flipper
-run lambda { |env|
- body = 'Go here for <a href="/flipper">Flipper!</a>'
- [200, {'Content-Type' => 'text/html'}, [body]]
-}
+run Flipper::UI.new(flipper)
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<title>Flipper</title>
- <link rel="stylesheet" type="text/css" href="/flipper/css/application.css">
+ <link rel="stylesheet" type="text/css" href="/css/application.css">
<style type="text/css">
* { margin:0; padding:0; }
body {text-align:center;}
View
@@ -7,6 +7,13 @@ module UI
def self.root
@root ||= Pathname(__FILE__).dirname.expand_path.join('ui')
end
+
+ def self.new(flipper)
+ app = lambda { |env|
+ [200, {'Content-Type' => 'text/html'}, ['']]
+ }
+ Middleware.new(app, flipper)
+ end
end
end
@@ -6,7 +6,7 @@ module UI
module Actions
class Features < UI::Action
- route %r{^/flipper/features/?$}
+ route %r{features/?\Z}
def get
features = flipper.features.map { |feature|
@@ -6,7 +6,7 @@ module UI
module Actions
class File < UI::Action
- route %r{^/flipper/(images|css|js)/.*$}
+ route %r{(images|css|js)/.*\Z}
def get
Rack::File.new(public_path).call(request.env)
@@ -11,7 +11,7 @@ class Gate < UI::Action
# Private: Struct to wrap actors so they can respond to flipper_id.
FakeActor = Struct.new(:flipper_id)
- route %r{^/flipper/features/.*/.*/?$}
+ route %r{features/.*/.*/?\Z}
# Get should run the index route. All the url does is control what is
# opened and closed when the page is loaded.
@@ -6,7 +6,7 @@ module UI
module Actions
class Index < UI::Action
- route %r{^/flipper.*$}
+ route %r{.*}
def get
view_response :index
@@ -1,7 +1,7 @@
class Feature extends Spine.Model
@configure "Feature", "id", "name", "state", "description", "gates"
@extend Spine.Model.Ajax
- @extend url: "/flipper/features"
+ @extend url: "/features"
constructor: ->
super
@@ -23,7 +23,7 @@ class Gate extends Spine.Model
super
url: ->
- "/flipper/features/#{encodeURIComponent @feature_id}/#{encodeURIComponent @name}"
+ "/features/#{encodeURIComponent @feature_id}/#{encodeURIComponent @name}"
disableSetMember: (member) ->
options =
@@ -78,12 +78,12 @@ class App.FeatureList extends Spine.Controller
Feature.fetch()
@routes
- '/flipper/features/:id': (params) ->
+ '/features/:id': (params) ->
if controller = @features[params.id]
controller.edit()
controller.openDefaultGate()
- '/flipper/features/:id/:gate': (params) ->
+ '/features/:id/:gate': (params) ->
if controller = @features[params.id]
controller.edit()
controller.activateGate(params)
@@ -119,10 +119,10 @@ class App.Feature extends Spine.Controller
openFeature: (event) ->
event.preventDefault() if event
- @navigate "/flipper/features/#{@feature.id}"
+ @navigate "/features/#{@feature.id}"
openDefaultGate: ->
- @navigate "/flipper/features/#{@feature.id}/boolean"
+ @navigate "/features/#{@feature.id}/boolean"
template: (feature) ->
source = $("#feature-template").html()
@@ -133,7 +133,7 @@ class App.Feature extends Spine.Controller
event.preventDefault()
tab = $(event.currentTarget)
name = tab.attr('data-tab')
- @navigate "/flipper/features/#{@feature.id}/#{name}"
+ @navigate "/features/#{@feature.id}/#{name}"
activateGate: (params) ->
name = params.gate
@@ -148,7 +148,7 @@ class App.Feature extends Spine.Controller
hide: (event) ->
event.preventDefault() if event
@dom_feature.removeClass('settings')
- @navigate '/flipper'
+ @navigate '/'
class App.Gate extends Spine.Controller
constructor: ->
@@ -68,7 +68,7 @@ body {
width: 75px;
height: 42px;
text-indent: -9999px;
- background: url(/flipper/images/logo.png) 0 0 no-repeat;
+ background: url(/images/logo.png) 0 0 no-repeat;
}
div.feature {
@@ -63,7 +63,7 @@ body {
width: 75px;
height: 42px;
text-indent: -9999px;
- background: url(/flipper/images/logo.png) 0 0 no-repeat; }
+ background: url(/images/logo.png) 0 0 no-repeat; }
div.feature {
float: left;
Oops, something went wrong.
@@ -2,16 +2,16 @@
<html lang="en">
<head>
<title>Flipper</title>
- <link rel="stylesheet" type="text/css" href="/flipper/css/application.css">
- <script src="/flipper/js/jquery.min.js"></script>
+ <link rel="stylesheet" type="text/css" href="/css/application.css">
+ <script src="/js/jquery.min.js"></script>
- <script src="/flipper/js/handlebars.js"></script>
- <script src="/flipper/js/spine/spine.js"></script>
- <script src="/flipper/js/spine/ajax.js"></script>
- <script src="/flipper/js/spine/route.js"></script>
- <script src="/flipper/js/spine/manager.js"></script>
+ <script src="/js/handlebars.js"></script>
+ <script src="/js/spine/spine.js"></script>
+ <script src="/js/spine/ajax.js"></script>
+ <script src="/js/spine/route.js"></script>
+ <script src="/js/spine/manager.js"></script>
- <script src="/flipper/js/application.js"></script>
+ <script src="/js/application.js"></script>
</head>
<body>
<div id="app">
@@ -66,7 +66,7 @@
</script>
<script id="gate-boolean-template" type="text/x-handlebars-template">
- <form action="/flipper/features/{{feature_id}}/boolean" method="POST">
+ <form action="/features/{{feature_id}}/boolean" method="POST">
<input type="radio" name="value" value="true" {{#value}}checked="checked"{{/value}} /> On
<input type="radio" name="value" value="false" {{^value}}checked="checked"{{/value}} /> Off
<button>Save Settings</button>
@@ -91,7 +91,7 @@
{{/each}}
</ul>
- <form action="/flipper/features/{{feature_id}}/group" method="POST">
+ <form action="/features/{{feature_id}}/group" method="POST">
<input type="hidden" name="operation" value="enable" />
<label>
Group Name
@@ -111,7 +111,7 @@
{{/each}}
</ul>
- <form action="/flipper/features/{{feature_id}}/actor" method="POST">
+ <form action="/features/{{feature_id}}/actor" method="POST">
<input type="hidden" name="operation" value="enable" />
<label>
Flipper Id
@@ -122,7 +122,7 @@
</script>
<script id="gate-percentage-of-actors-template" type="text/x-handlebars-template">
- <form action="/flipper/features/{{feature_id}}/percentage_of_actors" method="POST">
+ <form action="/features/{{feature_id}}/percentage_of_actors" method="POST">
<label>
Percentage
<input type="text" name="value" value="{{value}}" />
@@ -132,7 +132,7 @@
</script>
<script id="gate-percentage-of-random-template" type="text/x-handlebars-template">
- <form action="/flipper/features/{{feature_id}}/percentage_of_random" method="POST">
+ <form action="/features/{{feature_id}}/percentage_of_random" method="POST">
<label>
Percentage
<input type="text" name="value" value="{{value}}" />
Oops, something went wrong.

0 comments on commit 8d5ac89

Please sign in to comment.