flipper-ui 0.2.0.beta2 → 0.2.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +12 -11
- data/README.md +5 -7
- data/examples/basic.ru +27 -26
- data/flipper-ui.gemspec +5 -3
- data/lib/flipper-ui.rb +1 -0
- data/lib/flipper/ui.rb +11 -2
- data/lib/flipper/ui/action.rb +45 -4
- data/lib/flipper/ui/actions/actors_gate.rb +48 -0
- data/lib/flipper/ui/actions/add_feature.rb +20 -0
- data/lib/flipper/ui/actions/boolean_gate.rb +26 -0
- data/lib/flipper/ui/actions/feature.rb +32 -0
- data/lib/flipper/ui/actions/features.rb +23 -3
- data/lib/flipper/ui/actions/file.rb +1 -1
- data/lib/flipper/ui/actions/gate.rb +11 -117
- data/lib/flipper/ui/actions/groups_gate.rb +43 -0
- data/lib/flipper/ui/actions/{index.rb → home.rb} +3 -3
- data/lib/flipper/ui/actions/percentage_of_actors_gate.rb +27 -0
- data/lib/flipper/ui/actions/percentage_of_time_gate.rb +27 -0
- data/lib/flipper/ui/actor.rb +13 -0
- data/lib/flipper/ui/assets/javascripts/application.coffee +0 -305
- data/lib/flipper/ui/assets/stylesheets/_bootstrap-compass.scss +9 -0
- data/lib/flipper/ui/assets/stylesheets/_bootstrap-mincer.scss +19 -0
- data/lib/flipper/ui/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
- data/lib/flipper/ui/assets/stylesheets/_bootstrap.scss +50 -0
- data/lib/flipper/ui/assets/stylesheets/application.scss +33 -216
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_alerts.scss +73 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_badges.scss +68 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_button-groups.scss +243 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_buttons.scss +160 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_carousel.scss +269 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_close.scss +36 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_code.scss +69 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_component-animations.scss +37 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_dropdowns.scss +214 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_forms.scss +578 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_glyphicons.scss +305 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_grid.scss +84 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_input-groups.scss +166 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_jumbotron.scss +50 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_labels.scss +66 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_list-group.scss +124 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_media.scss +61 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_mixins.scss +39 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_modals.scss +150 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_navbar.scss +662 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_navs.scss +242 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_normalize.scss +427 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_pager.scss +54 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_pagination.scss +88 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_panels.scss +265 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_popovers.scss +135 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_print.scss +107 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_responsive-utilities.scss +177 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_scaffolding.scss +162 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_tables.scss +234 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_theme.scss +273 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_tooltip.scss +102 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_type.scss +298 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_utilities.scss +55 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_variables.scss +866 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_wells.scss +29 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
- data/lib/flipper/ui/assets/stylesheets/primer/.scss-lint.yml +446 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_alerts.scss +106 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_avatars.scss +36 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_base.scss +40 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_blankslate.scss +96 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_buttons.scss +404 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_counter.scss +10 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_filter-list.scss +68 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_flex-table.scss +20 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_forms.scss +756 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_layout.scss +69 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_menu.scss +113 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_mixins.scss +53 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_normalize.scss +425 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_states.scss +32 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_tabnav.scss +65 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_tooltips.scss +255 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_truncate.scss +27 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_type.scss +92 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_utility.scss +73 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_variables.scss +34 -0
- data/lib/flipper/ui/assets/stylesheets/primer/primer.scss +39 -0
- data/lib/flipper/ui/decorators/feature.rb +37 -4
- data/lib/flipper/ui/middleware.rb +12 -3
- data/lib/flipper/ui/public/css/application.css +2563 -144
- data/lib/flipper/ui/public/css/primer.css +1 -0
- data/lib/flipper/ui/public/css/primer/primer.css +1933 -0
- data/lib/flipper/ui/public/css/scss/primer.css +1933 -0
- data/lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
- data/lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
- data/lib/flipper/ui/public/js/application.js +0 -539
- data/lib/flipper/ui/public/js/bootstrap-sprockets.js +12 -0
- data/lib/flipper/ui/public/js/bootstrap.js +2317 -0
- data/lib/flipper/ui/public/js/bootstrap.min.js +7 -0
- data/lib/flipper/ui/public/js/bootstrap/affix.js +162 -0
- data/lib/flipper/ui/public/js/bootstrap/alert.js +94 -0
- data/lib/flipper/ui/public/js/bootstrap/button.js +116 -0
- data/lib/flipper/ui/public/js/bootstrap/carousel.js +237 -0
- data/lib/flipper/ui/public/js/bootstrap/collapse.js +211 -0
- data/lib/flipper/ui/public/js/bootstrap/dropdown.js +161 -0
- data/lib/flipper/ui/public/js/bootstrap/modal.js +339 -0
- data/lib/flipper/ui/public/js/bootstrap/popover.js +108 -0
- data/lib/flipper/ui/public/js/bootstrap/scrollspy.js +172 -0
- data/lib/flipper/ui/public/js/bootstrap/tab.js +153 -0
- data/lib/flipper/ui/public/js/bootstrap/tooltip.js +476 -0
- data/lib/flipper/ui/public/js/bootstrap/transition.js +59 -0
- data/lib/flipper/ui/public/octicons/LICENSE.txt +9 -0
- data/lib/flipper/ui/public/octicons/README.md +1 -0
- data/lib/flipper/ui/public/octicons/octicons-local.ttf +0 -0
- data/lib/flipper/ui/public/octicons/octicons.css +236 -0
- data/lib/flipper/ui/public/octicons/octicons.eot +0 -0
- data/lib/flipper/ui/public/octicons/octicons.less +235 -0
- data/lib/flipper/ui/public/octicons/octicons.svg +200 -0
- data/lib/flipper/ui/public/octicons/octicons.ttf +0 -0
- data/lib/flipper/ui/public/octicons/octicons.woff +0 -0
- data/lib/flipper/ui/public/octicons/sprockets-octicons.scss +232 -0
- data/lib/flipper/ui/util.rb +4 -0
- data/lib/flipper/ui/version.rb +1 -1
- data/lib/flipper/ui/views/add_actor.erb +22 -0
- data/lib/flipper/ui/views/add_feature.erb +18 -0
- data/lib/flipper/ui/views/add_group.erb +31 -0
- data/lib/flipper/ui/views/feature.erb +209 -0
- data/lib/flipper/ui/views/features.erb +46 -0
- data/lib/flipper/ui/views/layout.erb +31 -149
- data/script/release +15 -0
- data/spec/flipper/ui/actions/actors_gate_spec.rb +68 -0
- data/spec/flipper/ui/actions/add_feature_spec.rb +17 -0
- data/spec/flipper/ui/actions/boolean_gate_spec.rb +41 -0
- data/spec/flipper/ui/actions/feature_spec.rb +59 -0
- data/spec/flipper/ui/actions/features_spec.rb +37 -0
- data/spec/flipper/ui/actions/file_spec.rb +43 -0
- data/spec/flipper/ui/actions/gate_spec.rb +24 -0
- data/spec/flipper/ui/actions/groups_gate_spec.rb +80 -0
- data/spec/flipper/ui/actions/home_spec.rb +16 -0
- data/spec/flipper/ui/actions/percentage_of_actors_gate_spec.rb +40 -0
- data/spec/flipper/ui/actions/percentage_of_time_gate_spec.rb +39 -0
- data/spec/flipper/ui/decorators/feature_spec.rb +38 -1
- data/spec/flipper/ui/decorators/gate_spec.rb +1 -1
- data/spec/flipper/ui_spec.rb +18 -441
- data/spec/helper.rb +22 -7
- metadata +199 -52
- data/examples/flipper.html +0 -14
- data/examples/flipper.png +0 -0
- data/lib/flipper/ui/assets/javascripts/spine/ajax.coffee +0 -223
- data/lib/flipper/ui/assets/javascripts/spine/list.coffee +0 -43
- data/lib/flipper/ui/assets/javascripts/spine/local.coffee +0 -16
- data/lib/flipper/ui/assets/javascripts/spine/manager.coffee +0 -83
- data/lib/flipper/ui/assets/javascripts/spine/relation.coffee +0 -148
- data/lib/flipper/ui/assets/javascripts/spine/route.coffee +0 -146
- data/lib/flipper/ui/assets/javascripts/spine/spine.coffee +0 -542
- data/lib/flipper/ui/assets/javascripts/spine/version +0 -1
- data/lib/flipper/ui/public/css/images/animated-overlay.gif +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-icons_222222_256x240.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-icons_228ef1_256x240.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-icons_ef8c08_256x240.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-icons_ffd27a_256x240.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-icons_ffffff_256x240.png +0 -0
- data/lib/flipper/ui/public/css/jquery-ui-1.10.3.slider.min.css +0 -5
- data/lib/flipper/ui/public/js/handlebars.js +0 -1992
- data/lib/flipper/ui/public/js/jquery-ui-1.10.3.slider.min.js +0 -6
- data/lib/flipper/ui/public/js/jquery.js +0 -9555
- data/lib/flipper/ui/public/js/jquery.min.js +0 -4
- data/lib/flipper/ui/public/js/jquery.min.map +0 -1
- data/lib/flipper/ui/public/js/spine/ajax.js +0 -320
- data/lib/flipper/ui/public/js/spine/list.js +0 -72
- data/lib/flipper/ui/public/js/spine/local.js +0 -29
- data/lib/flipper/ui/public/js/spine/manager.js +0 -157
- data/lib/flipper/ui/public/js/spine/relation.js +0 -260
- data/lib/flipper/ui/public/js/spine/route.js +0 -223
- data/lib/flipper/ui/public/js/spine/spine.js +0 -927
- data/lib/flipper/ui/views/index.erb +0 -9
data/spec/helper.rb
CHANGED
@@ -5,8 +5,9 @@ require 'bundler'
|
|
5
5
|
Bundler.setup :default
|
6
6
|
|
7
7
|
require 'flipper-ui'
|
8
|
-
|
9
8
|
require 'flipper/instrumentation/log_subscriber'
|
9
|
+
require 'flipper/adapters/memory'
|
10
|
+
require 'rack/test'
|
10
11
|
require 'logger'
|
11
12
|
require 'json'
|
12
13
|
|
@@ -18,18 +19,32 @@ logger = Logger.new(log_path.join('test.log'))
|
|
18
19
|
logger.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
|
19
20
|
Flipper::Instrumentation::LogSubscriber.logger = logger
|
20
21
|
|
21
|
-
module
|
22
|
+
module SpecHelpers
|
23
|
+
def self.included(base)
|
24
|
+
base.let(:flipper) { build_flipper }
|
25
|
+
base.let(:app) { build_app(flipper) }
|
26
|
+
end
|
27
|
+
|
28
|
+
def build_app(flipper)
|
29
|
+
Flipper::UI.app(flipper, secret: "test")
|
30
|
+
end
|
31
|
+
|
32
|
+
def build_flipper(adapter = build_memory_adapter)
|
33
|
+
Flipper.new(adapter)
|
34
|
+
end
|
35
|
+
|
36
|
+
def build_memory_adapter
|
37
|
+
Flipper::Adapters::Memory.new
|
38
|
+
end
|
39
|
+
|
22
40
|
def json_response
|
23
41
|
JSON.load(last_response.body)
|
24
42
|
end
|
25
43
|
end
|
26
44
|
|
27
45
|
RSpec.configure do |config|
|
28
|
-
config.filter_run :focused => true
|
29
|
-
config.alias_example_to :fit, :focused => true
|
30
|
-
config.alias_example_to :xit, :pending => true
|
31
|
-
config.run_all_when_everything_filtered = true
|
32
46
|
config.fail_fast = true
|
33
47
|
|
34
|
-
config.include
|
48
|
+
config.include Rack::Test::Methods
|
49
|
+
config.include SpecHelpers
|
35
50
|
end
|
metadata
CHANGED
@@ -1,29 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
22
|
+
version: '1.7'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
29
|
+
version: '1.5'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.7'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rack-protection
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 1.5.3
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.5.3
|
27
47
|
- !ruby/object:Gem::Dependency
|
28
48
|
name: flipper
|
29
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,17 +62,18 @@ dependencies:
|
|
42
62
|
name: erubis
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|
44
64
|
requirements:
|
45
|
-
- - "
|
65
|
+
- - "~>"
|
46
66
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
67
|
+
version: 2.7.0
|
48
68
|
type: :runtime
|
49
69
|
prerelease: false
|
50
70
|
version_requirements: !ruby/object:Gem::Requirement
|
51
71
|
requirements:
|
52
|
-
- - "
|
72
|
+
- - "~>"
|
53
73
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
description:
|
74
|
+
version: 2.7.0
|
75
|
+
description: Rack middleware that provides a fully featured web interface for the
|
76
|
+
flipper gem.
|
56
77
|
email:
|
57
78
|
- nunemaker@gmail.com
|
58
79
|
executables: []
|
@@ -67,78 +88,193 @@ files:
|
|
67
88
|
- README.md
|
68
89
|
- Rakefile
|
69
90
|
- examples/basic.ru
|
70
|
-
- examples/flipper.html
|
71
|
-
- examples/flipper.png
|
72
91
|
- flipper-ui.gemspec
|
73
92
|
- lib/flipper-ui.rb
|
74
93
|
- lib/flipper/ui.rb
|
75
94
|
- lib/flipper/ui/action.rb
|
76
95
|
- lib/flipper/ui/action_collection.rb
|
96
|
+
- lib/flipper/ui/actions/actors_gate.rb
|
97
|
+
- lib/flipper/ui/actions/add_feature.rb
|
98
|
+
- lib/flipper/ui/actions/boolean_gate.rb
|
99
|
+
- lib/flipper/ui/actions/feature.rb
|
77
100
|
- lib/flipper/ui/actions/features.rb
|
78
101
|
- lib/flipper/ui/actions/file.rb
|
79
102
|
- lib/flipper/ui/actions/gate.rb
|
80
|
-
- lib/flipper/ui/actions/
|
103
|
+
- lib/flipper/ui/actions/groups_gate.rb
|
104
|
+
- lib/flipper/ui/actions/home.rb
|
105
|
+
- lib/flipper/ui/actions/percentage_of_actors_gate.rb
|
106
|
+
- lib/flipper/ui/actions/percentage_of_time_gate.rb
|
107
|
+
- lib/flipper/ui/actor.rb
|
81
108
|
- lib/flipper/ui/assets/javascripts/application.coffee
|
82
|
-
- lib/flipper/ui/assets/
|
83
|
-
- lib/flipper/ui/assets/
|
84
|
-
- lib/flipper/ui/assets/
|
85
|
-
- lib/flipper/ui/assets/
|
86
|
-
- lib/flipper/ui/assets/javascripts/spine/relation.coffee
|
87
|
-
- lib/flipper/ui/assets/javascripts/spine/route.coffee
|
88
|
-
- lib/flipper/ui/assets/javascripts/spine/spine.coffee
|
89
|
-
- lib/flipper/ui/assets/javascripts/spine/version
|
109
|
+
- lib/flipper/ui/assets/stylesheets/_bootstrap-compass.scss
|
110
|
+
- lib/flipper/ui/assets/stylesheets/_bootstrap-mincer.scss
|
111
|
+
- lib/flipper/ui/assets/stylesheets/_bootstrap-sprockets.scss
|
112
|
+
- lib/flipper/ui/assets/stylesheets/_bootstrap.scss
|
90
113
|
- lib/flipper/ui/assets/stylesheets/application.scss
|
114
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_alerts.scss
|
115
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_badges.scss
|
116
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_breadcrumbs.scss
|
117
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_button-groups.scss
|
118
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_buttons.scss
|
119
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_carousel.scss
|
120
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_close.scss
|
121
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_code.scss
|
122
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_component-animations.scss
|
123
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_dropdowns.scss
|
124
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_forms.scss
|
125
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_glyphicons.scss
|
126
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_grid.scss
|
127
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_input-groups.scss
|
128
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_jumbotron.scss
|
129
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_labels.scss
|
130
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_list-group.scss
|
131
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_media.scss
|
132
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_mixins.scss
|
133
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_modals.scss
|
134
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_navbar.scss
|
135
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_navs.scss
|
136
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_normalize.scss
|
137
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_pager.scss
|
138
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_pagination.scss
|
139
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_panels.scss
|
140
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_popovers.scss
|
141
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_print.scss
|
142
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_progress-bars.scss
|
143
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_responsive-embed.scss
|
144
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_responsive-utilities.scss
|
145
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_scaffolding.scss
|
146
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_tables.scss
|
147
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_theme.scss
|
148
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_thumbnails.scss
|
149
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_tooltip.scss
|
150
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_type.scss
|
151
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_utilities.scss
|
152
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_variables.scss
|
153
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/_wells.scss
|
154
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_alerts.scss
|
155
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_background-variant.scss
|
156
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_border-radius.scss
|
157
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_buttons.scss
|
158
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_center-block.scss
|
159
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_clearfix.scss
|
160
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_forms.scss
|
161
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_gradients.scss
|
162
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_grid-framework.scss
|
163
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_grid.scss
|
164
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_hide-text.scss
|
165
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_image.scss
|
166
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_labels.scss
|
167
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_list-group.scss
|
168
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_nav-divider.scss
|
169
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss
|
170
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_opacity.scss
|
171
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_pagination.scss
|
172
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_panels.scss
|
173
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_progress-bar.scss
|
174
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_reset-filter.scss
|
175
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_resize.scss
|
176
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss
|
177
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_size.scss
|
178
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_tab-focus.scss
|
179
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_table-row.scss
|
180
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss
|
181
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_text-overflow.scss
|
182
|
+
- lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss
|
183
|
+
- lib/flipper/ui/assets/stylesheets/primer/.scss-lint.yml
|
184
|
+
- lib/flipper/ui/assets/stylesheets/primer/_alerts.scss
|
185
|
+
- lib/flipper/ui/assets/stylesheets/primer/_avatars.scss
|
186
|
+
- lib/flipper/ui/assets/stylesheets/primer/_base.scss
|
187
|
+
- lib/flipper/ui/assets/stylesheets/primer/_blankslate.scss
|
188
|
+
- lib/flipper/ui/assets/stylesheets/primer/_buttons.scss
|
189
|
+
- lib/flipper/ui/assets/stylesheets/primer/_counter.scss
|
190
|
+
- lib/flipper/ui/assets/stylesheets/primer/_filter-list.scss
|
191
|
+
- lib/flipper/ui/assets/stylesheets/primer/_flex-table.scss
|
192
|
+
- lib/flipper/ui/assets/stylesheets/primer/_forms.scss
|
193
|
+
- lib/flipper/ui/assets/stylesheets/primer/_layout.scss
|
194
|
+
- lib/flipper/ui/assets/stylesheets/primer/_menu.scss
|
195
|
+
- lib/flipper/ui/assets/stylesheets/primer/_mixins.scss
|
196
|
+
- lib/flipper/ui/assets/stylesheets/primer/_normalize.scss
|
197
|
+
- lib/flipper/ui/assets/stylesheets/primer/_states.scss
|
198
|
+
- lib/flipper/ui/assets/stylesheets/primer/_tabnav.scss
|
199
|
+
- lib/flipper/ui/assets/stylesheets/primer/_tooltips.scss
|
200
|
+
- lib/flipper/ui/assets/stylesheets/primer/_truncate.scss
|
201
|
+
- lib/flipper/ui/assets/stylesheets/primer/_type.scss
|
202
|
+
- lib/flipper/ui/assets/stylesheets/primer/_utility.scss
|
203
|
+
- lib/flipper/ui/assets/stylesheets/primer/_variables.scss
|
204
|
+
- lib/flipper/ui/assets/stylesheets/primer/primer.scss
|
91
205
|
- lib/flipper/ui/decorators/feature.rb
|
92
206
|
- lib/flipper/ui/decorators/gate.rb
|
93
207
|
- lib/flipper/ui/error.rb
|
94
208
|
- lib/flipper/ui/eruby.rb
|
95
209
|
- lib/flipper/ui/middleware.rb
|
96
210
|
- lib/flipper/ui/public/css/application.css
|
97
|
-
- lib/flipper/ui/public/css/
|
98
|
-
- lib/flipper/ui/public/css/
|
99
|
-
- lib/flipper/ui/public/css/
|
100
|
-
- lib/flipper/ui/public/
|
101
|
-
- lib/flipper/ui/public/
|
102
|
-
- lib/flipper/ui/public/
|
103
|
-
- lib/flipper/ui/public/
|
104
|
-
- lib/flipper/ui/public/
|
105
|
-
- lib/flipper/ui/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
|
106
|
-
- lib/flipper/ui/public/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
|
107
|
-
- lib/flipper/ui/public/css/images/ui-icons_222222_256x240.png
|
108
|
-
- lib/flipper/ui/public/css/images/ui-icons_228ef1_256x240.png
|
109
|
-
- lib/flipper/ui/public/css/images/ui-icons_ef8c08_256x240.png
|
110
|
-
- lib/flipper/ui/public/css/images/ui-icons_ffd27a_256x240.png
|
111
|
-
- lib/flipper/ui/public/css/images/ui-icons_ffffff_256x240.png
|
112
|
-
- lib/flipper/ui/public/css/jquery-ui-1.10.3.slider.min.css
|
211
|
+
- lib/flipper/ui/public/css/primer.css
|
212
|
+
- lib/flipper/ui/public/css/primer/primer.css
|
213
|
+
- lib/flipper/ui/public/css/scss/primer.css
|
214
|
+
- lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.eot
|
215
|
+
- lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.svg
|
216
|
+
- lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.ttf
|
217
|
+
- lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.woff
|
218
|
+
- lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.woff2
|
113
219
|
- lib/flipper/ui/public/images/logo.png
|
114
220
|
- lib/flipper/ui/public/images/remove.png
|
115
221
|
- lib/flipper/ui/public/js/application.js
|
116
|
-
- lib/flipper/ui/public/js/
|
117
|
-
- lib/flipper/ui/public/js/
|
118
|
-
- lib/flipper/ui/public/js/
|
119
|
-
- lib/flipper/ui/public/js/
|
120
|
-
- lib/flipper/ui/public/js/
|
121
|
-
- lib/flipper/ui/public/js/
|
122
|
-
- lib/flipper/ui/public/js/
|
123
|
-
- lib/flipper/ui/public/js/
|
124
|
-
- lib/flipper/ui/public/js/
|
125
|
-
- lib/flipper/ui/public/js/
|
126
|
-
- lib/flipper/ui/public/js/
|
127
|
-
- lib/flipper/ui/public/js/
|
222
|
+
- lib/flipper/ui/public/js/bootstrap-sprockets.js
|
223
|
+
- lib/flipper/ui/public/js/bootstrap.js
|
224
|
+
- lib/flipper/ui/public/js/bootstrap.min.js
|
225
|
+
- lib/flipper/ui/public/js/bootstrap/affix.js
|
226
|
+
- lib/flipper/ui/public/js/bootstrap/alert.js
|
227
|
+
- lib/flipper/ui/public/js/bootstrap/button.js
|
228
|
+
- lib/flipper/ui/public/js/bootstrap/carousel.js
|
229
|
+
- lib/flipper/ui/public/js/bootstrap/collapse.js
|
230
|
+
- lib/flipper/ui/public/js/bootstrap/dropdown.js
|
231
|
+
- lib/flipper/ui/public/js/bootstrap/modal.js
|
232
|
+
- lib/flipper/ui/public/js/bootstrap/popover.js
|
233
|
+
- lib/flipper/ui/public/js/bootstrap/scrollspy.js
|
234
|
+
- lib/flipper/ui/public/js/bootstrap/tab.js
|
235
|
+
- lib/flipper/ui/public/js/bootstrap/tooltip.js
|
236
|
+
- lib/flipper/ui/public/js/bootstrap/transition.js
|
237
|
+
- lib/flipper/ui/public/octicons/LICENSE.txt
|
238
|
+
- lib/flipper/ui/public/octicons/README.md
|
239
|
+
- lib/flipper/ui/public/octicons/octicons-local.ttf
|
240
|
+
- lib/flipper/ui/public/octicons/octicons.css
|
241
|
+
- lib/flipper/ui/public/octicons/octicons.eot
|
242
|
+
- lib/flipper/ui/public/octicons/octicons.less
|
243
|
+
- lib/flipper/ui/public/octicons/octicons.svg
|
244
|
+
- lib/flipper/ui/public/octicons/octicons.ttf
|
245
|
+
- lib/flipper/ui/public/octicons/octicons.woff
|
246
|
+
- lib/flipper/ui/public/octicons/sprockets-octicons.scss
|
128
247
|
- lib/flipper/ui/util.rb
|
129
248
|
- lib/flipper/ui/version.rb
|
130
|
-
- lib/flipper/ui/views/
|
249
|
+
- lib/flipper/ui/views/add_actor.erb
|
250
|
+
- lib/flipper/ui/views/add_feature.erb
|
251
|
+
- lib/flipper/ui/views/add_group.erb
|
252
|
+
- lib/flipper/ui/views/feature.erb
|
253
|
+
- lib/flipper/ui/views/features.erb
|
131
254
|
- lib/flipper/ui/views/layout.erb
|
132
255
|
- script/bootstrap
|
256
|
+
- script/release
|
133
257
|
- script/server
|
134
258
|
- script/test
|
259
|
+
- spec/flipper/ui/actions/actors_gate_spec.rb
|
260
|
+
- spec/flipper/ui/actions/add_feature_spec.rb
|
261
|
+
- spec/flipper/ui/actions/boolean_gate_spec.rb
|
262
|
+
- spec/flipper/ui/actions/feature_spec.rb
|
263
|
+
- spec/flipper/ui/actions/features_spec.rb
|
264
|
+
- spec/flipper/ui/actions/file_spec.rb
|
265
|
+
- spec/flipper/ui/actions/gate_spec.rb
|
266
|
+
- spec/flipper/ui/actions/groups_gate_spec.rb
|
267
|
+
- spec/flipper/ui/actions/home_spec.rb
|
268
|
+
- spec/flipper/ui/actions/percentage_of_actors_gate_spec.rb
|
269
|
+
- spec/flipper/ui/actions/percentage_of_time_gate_spec.rb
|
135
270
|
- spec/flipper/ui/decorators/feature_spec.rb
|
136
271
|
- spec/flipper/ui/decorators/gate_spec.rb
|
137
272
|
- spec/flipper/ui/util_spec.rb
|
138
273
|
- spec/flipper/ui_spec.rb
|
139
274
|
- spec/helper.rb
|
140
275
|
homepage: https://github.com/jnunemaker/flipper-ui
|
141
|
-
licenses:
|
276
|
+
licenses:
|
277
|
+
- MIT
|
142
278
|
metadata: {}
|
143
279
|
post_install_message:
|
144
280
|
rdoc_options: []
|
@@ -161,6 +297,17 @@ signing_key:
|
|
161
297
|
specification_version: 4
|
162
298
|
summary: UI for the Flipper gem
|
163
299
|
test_files:
|
300
|
+
- spec/flipper/ui/actions/actors_gate_spec.rb
|
301
|
+
- spec/flipper/ui/actions/add_feature_spec.rb
|
302
|
+
- spec/flipper/ui/actions/boolean_gate_spec.rb
|
303
|
+
- spec/flipper/ui/actions/feature_spec.rb
|
304
|
+
- spec/flipper/ui/actions/features_spec.rb
|
305
|
+
- spec/flipper/ui/actions/file_spec.rb
|
306
|
+
- spec/flipper/ui/actions/gate_spec.rb
|
307
|
+
- spec/flipper/ui/actions/groups_gate_spec.rb
|
308
|
+
- spec/flipper/ui/actions/home_spec.rb
|
309
|
+
- spec/flipper/ui/actions/percentage_of_actors_gate_spec.rb
|
310
|
+
- spec/flipper/ui/actions/percentage_of_time_gate_spec.rb
|
164
311
|
- spec/flipper/ui/decorators/feature_spec.rb
|
165
312
|
- spec/flipper/ui/decorators/gate_spec.rb
|
166
313
|
- spec/flipper/ui/util_spec.rb
|
data/examples/flipper.html
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<title>Flipper</title>
|
5
|
-
<link rel="stylesheet" type="text/css" href="/css/application.css">
|
6
|
-
<style type="text/css">
|
7
|
-
* { margin:0; padding:0; }
|
8
|
-
body {text-align:center;}
|
9
|
-
</style>
|
10
|
-
</head>
|
11
|
-
<body>
|
12
|
-
<img src="flipper.png" />
|
13
|
-
</body>
|
14
|
-
</html>
|
data/examples/flipper.png
DELETED
Binary file
|
@@ -1,223 +0,0 @@
|
|
1
|
-
Spine = @Spine or require('spine')
|
2
|
-
$ = Spine.$
|
3
|
-
Model = Spine.Model
|
4
|
-
Queue = $({})
|
5
|
-
|
6
|
-
Ajax =
|
7
|
-
getURL: (object) ->
|
8
|
-
object and object.url?() or object.url
|
9
|
-
|
10
|
-
enabled: true
|
11
|
-
|
12
|
-
disable: (callback) ->
|
13
|
-
if @enabled
|
14
|
-
@enabled = false
|
15
|
-
try
|
16
|
-
do callback
|
17
|
-
catch e
|
18
|
-
throw e
|
19
|
-
finally
|
20
|
-
@enabled = true
|
21
|
-
else
|
22
|
-
do callback
|
23
|
-
|
24
|
-
queue: (request) ->
|
25
|
-
if request then Queue.queue(request) else Queue.queue()
|
26
|
-
|
27
|
-
clearQueue: ->
|
28
|
-
@queue []
|
29
|
-
|
30
|
-
class Base
|
31
|
-
defaults:
|
32
|
-
contentType: 'application/json'
|
33
|
-
dataType: 'json'
|
34
|
-
processData: false
|
35
|
-
headers: {'X-Requested-With': 'XMLHttpRequest'}
|
36
|
-
|
37
|
-
queue: Ajax.queue
|
38
|
-
|
39
|
-
ajax: (params, defaults) ->
|
40
|
-
$.ajax @ajaxSettings(params, defaults)
|
41
|
-
|
42
|
-
ajaxQueue: (params, defaults) ->
|
43
|
-
jqXHR = null
|
44
|
-
deferred = $.Deferred()
|
45
|
-
|
46
|
-
promise = deferred.promise()
|
47
|
-
return promise unless Ajax.enabled
|
48
|
-
|
49
|
-
settings = @ajaxSettings(params, defaults)
|
50
|
-
|
51
|
-
request = (next) ->
|
52
|
-
jqXHR = $.ajax(settings)
|
53
|
-
.done(deferred.resolve)
|
54
|
-
.fail(deferred.reject)
|
55
|
-
.then(next, next)
|
56
|
-
|
57
|
-
promise.abort = (statusText) ->
|
58
|
-
return jqXHR.abort(statusText) if jqXHR
|
59
|
-
index = $.inArray(request, @queue())
|
60
|
-
@queue().splice(index, 1) if index > -1
|
61
|
-
|
62
|
-
deferred.rejectWith(
|
63
|
-
settings.context or settings,
|
64
|
-
[promise, statusText, '']
|
65
|
-
)
|
66
|
-
promise
|
67
|
-
|
68
|
-
@queue request
|
69
|
-
promise
|
70
|
-
|
71
|
-
ajaxSettings: (params, defaults) ->
|
72
|
-
$.extend({}, @defaults, defaults, params)
|
73
|
-
|
74
|
-
class Collection extends Base
|
75
|
-
constructor: (@model) ->
|
76
|
-
|
77
|
-
find: (id, params) ->
|
78
|
-
record = new @model(id: id)
|
79
|
-
@ajaxQueue(
|
80
|
-
params,
|
81
|
-
type: 'GET',
|
82
|
-
url: Ajax.getURL(record)
|
83
|
-
).done(@recordsResponse)
|
84
|
-
.fail(@failResponse)
|
85
|
-
|
86
|
-
all: (params) ->
|
87
|
-
@ajaxQueue(
|
88
|
-
params,
|
89
|
-
type: 'GET',
|
90
|
-
url: Ajax.getURL(@model)
|
91
|
-
).done(@recordsResponse)
|
92
|
-
.fail(@failResponse)
|
93
|
-
|
94
|
-
fetch: (params = {}, options = {}) ->
|
95
|
-
if id = params.id
|
96
|
-
delete params.id
|
97
|
-
@find(id, params).done (record) =>
|
98
|
-
@model.refresh(record, options)
|
99
|
-
else
|
100
|
-
@all(params).done (records) =>
|
101
|
-
@model.refresh(records, options)
|
102
|
-
|
103
|
-
# Private
|
104
|
-
|
105
|
-
recordsResponse: (data, status, xhr) =>
|
106
|
-
@model.trigger('ajaxSuccess', null, status, xhr)
|
107
|
-
|
108
|
-
failResponse: (xhr, statusText, error) =>
|
109
|
-
@model.trigger('ajaxError', null, xhr, statusText, error)
|
110
|
-
|
111
|
-
class Singleton extends Base
|
112
|
-
constructor: (@record) ->
|
113
|
-
@model = @record.constructor
|
114
|
-
|
115
|
-
reload: (params, options) ->
|
116
|
-
@ajaxQueue(
|
117
|
-
params,
|
118
|
-
type: 'GET'
|
119
|
-
url: Ajax.getURL(@record)
|
120
|
-
).done(@recordResponse(options))
|
121
|
-
.fail(@failResponse(options))
|
122
|
-
|
123
|
-
create: (params, options) ->
|
124
|
-
@ajaxQueue(
|
125
|
-
params,
|
126
|
-
type: 'POST'
|
127
|
-
data: JSON.stringify(@record)
|
128
|
-
url: Ajax.getURL(@model)
|
129
|
-
).done(@recordResponse(options))
|
130
|
-
.fail(@failResponse(options))
|
131
|
-
|
132
|
-
update: (params, options) ->
|
133
|
-
@ajaxQueue(
|
134
|
-
params,
|
135
|
-
type: 'PUT'
|
136
|
-
data: JSON.stringify(@record)
|
137
|
-
url: Ajax.getURL(@record)
|
138
|
-
).done(@recordResponse(options))
|
139
|
-
.fail(@failResponse(options))
|
140
|
-
|
141
|
-
destroy: (params, options) ->
|
142
|
-
@ajaxQueue(
|
143
|
-
params,
|
144
|
-
type: 'DELETE'
|
145
|
-
url: Ajax.getURL(@record)
|
146
|
-
).done(@recordResponse(options))
|
147
|
-
.fail(@failResponse(options))
|
148
|
-
|
149
|
-
# Private
|
150
|
-
|
151
|
-
recordResponse: (options = {}) =>
|
152
|
-
(data, status, xhr) =>
|
153
|
-
if Spine.isBlank(data) or @record.destroyed
|
154
|
-
data = false
|
155
|
-
else
|
156
|
-
data = @model.fromJSON(data)
|
157
|
-
|
158
|
-
Ajax.disable =>
|
159
|
-
if data
|
160
|
-
# ID change, need to do some shifting
|
161
|
-
if data.id and @record.id isnt data.id
|
162
|
-
@record.changeID(data.id)
|
163
|
-
|
164
|
-
# Update with latest data
|
165
|
-
@record.updateAttributes(data.attributes())
|
166
|
-
|
167
|
-
@record.trigger('ajaxSuccess', data, status, xhr)
|
168
|
-
options.success?.apply(@record) # Deprecated
|
169
|
-
options.done?.apply(@record)
|
170
|
-
|
171
|
-
failResponse: (options = {}) =>
|
172
|
-
(xhr, statusText, error) =>
|
173
|
-
@record.trigger('ajaxError', xhr, statusText, error)
|
174
|
-
options.error?.apply(@record) # Deprecated
|
175
|
-
options.fail?.apply(@record)
|
176
|
-
|
177
|
-
# Ajax endpoint
|
178
|
-
Model.host = ''
|
179
|
-
|
180
|
-
Include =
|
181
|
-
ajax: -> new Singleton(this)
|
182
|
-
|
183
|
-
url: (args...) ->
|
184
|
-
url = Ajax.getURL(@constructor)
|
185
|
-
url += '/' unless url.charAt(url.length - 1) is '/'
|
186
|
-
url += encodeURIComponent(@id)
|
187
|
-
args.unshift(url)
|
188
|
-
args.join('/')
|
189
|
-
|
190
|
-
Extend =
|
191
|
-
ajax: -> new Collection(this)
|
192
|
-
|
193
|
-
url: (args...) ->
|
194
|
-
args.unshift(@className.toLowerCase() + 's')
|
195
|
-
args.unshift(Model.host)
|
196
|
-
args.join('/')
|
197
|
-
|
198
|
-
Model.Ajax =
|
199
|
-
extended: ->
|
200
|
-
@fetch @ajaxFetch
|
201
|
-
@change @ajaxChange
|
202
|
-
|
203
|
-
@extend Extend
|
204
|
-
@include Include
|
205
|
-
|
206
|
-
# Private
|
207
|
-
|
208
|
-
ajaxFetch: ->
|
209
|
-
@ajax().fetch(arguments...)
|
210
|
-
|
211
|
-
ajaxChange: (record, type, options = {}) ->
|
212
|
-
return if options.ajax is false
|
213
|
-
record.ajax()[type](options.ajax, options)
|
214
|
-
|
215
|
-
Model.Ajax.Methods =
|
216
|
-
extended: ->
|
217
|
-
@extend Extend
|
218
|
-
@include Include
|
219
|
-
|
220
|
-
# Globals
|
221
|
-
Ajax.defaults = Base::defaults
|
222
|
-
Spine.Ajax = Ajax
|
223
|
-
module?.exports = Ajax
|