config_manager 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/config_manager/application.js +15 -0
- data/app/assets/stylesheets/config_manager/_reset.css.scss +74 -0
- data/app/assets/stylesheets/config_manager/application.css +5 -0
- data/app/assets/stylesheets/config_manager/generic.css.scss +19 -0
- data/app/controllers/config_manager/admins_controller.rb +59 -0
- data/app/controllers/config_manager/application_controller.rb +12 -0
- data/app/controllers/config_manager/sessions_controller.rb +5 -0
- data/app/controllers/config_manager/toggles_controller.rb +57 -0
- data/app/helpers/config_manager/application_helper.rb +11 -0
- data/app/helpers/config_manager/toggles_helper.rb +7 -0
- data/app/models/config_manager/admin.rb +18 -0
- data/app/views/config_manager/admins/_errors.html.slim +7 -0
- data/app/views/config_manager/admins/_form.html.slim +10 -0
- data/app/views/config_manager/admins/edit.html.slim +13 -0
- data/app/views/config_manager/admins/index.html.slim +28 -0
- data/app/views/config_manager/admins/new.html.slim +10 -0
- data/app/views/config_manager/sessions/new.html.slim +23 -0
- data/app/views/config_manager/toggles/_form.html.slim +12 -0
- data/app/views/config_manager/toggles/index.html.slim +45 -0
- data/app/views/layouts/config_manager/application.html.slim +54 -0
- data/config/initializers/devise.rb +258 -0
- data/config/locales/devise.en.yml +59 -0
- data/config/routes.rb +17 -0
- data/db/migrate/20140725161636_create_config_manager_admins.rb +41 -0
- data/lib/config_manager.rb +6 -0
- data/lib/config_manager/engine.rb +20 -0
- data/lib/config_manager/toggle.rb +66 -0
- data/lib/config_manager/toggles/boolean.rb +21 -0
- data/lib/config_manager/toggles/definition.rb +103 -0
- data/lib/config_manager/toggles/null.rb +18 -0
- data/lib/config_manager/toggles/set.rb +21 -0
- data/lib/config_manager/version.rb +3 -0
- data/lib/tasks/config_manager_tasks.rake +4 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/dummy_controller.rb +4 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/bad_toggles.yml +8 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/config_manager_toggles.yml +7 -0
- data/spec/dummy/config/database.yml +21 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/redis.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/redis.yml +8 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config/toggles.yml +8 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +31 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +9283 -0
- data/spec/dummy/log/test.log +557 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/assets/development/sass/786e38d79a0d3df53e8917152c8f9ebd061f1eac/_reset.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sass/786e38d79a0d3df53e8917152c8f9ebd061f1eac/generic.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1d468d61d8002d0709400b7ab8112441 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/259bf4d13dff689b9dbca70a598c3755 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4c700e6b525103954790256e74000237 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/53db5a69412d8243c467b6af17d2f483 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/550cbb5bc745772776097bec6b7ee6db +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6159fbf8e1fca57907de03eef7ed9cdb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/69d29900d66ffd35bf01cae75f4e0fe6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6d3f4fe92dd890a8bbdaf3f21eae0615 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b248de24a4d5454a0dcf2490dc088b8e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/bfdd9543b7b28b65c9d760f854cc387c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c5471c9026b426e70abbb969df7ba671 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c69bf92b5432ae5a1c2044ebc2923c71 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/dbbeb33ef5af4bd661989cf666fde840 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e808c4872b8e90c978084811080405ee +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ecd5a5f69d121045c4fc39b914215798 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f0bf3eb5da8250b91d2179600efef783 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f318cd7091c78a646f7e5bed19e774bf +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f33a897212fccae3670eab346f4e193e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/pids/server.pid +1 -0
- data/spec/dummy/tmp/test.yml +7 -0
- data/spec/integration/navigation_test.rb +10 -0
- data/spec/lib/config_manager/toggle_spec.rb +110 -0
- data/spec/lib/config_manager/toggles/boolean_spec.rb +34 -0
- data/spec/lib/config_manager/toggles/definition_spec.rb +130 -0
- data/spec/lib/config_manager/toggles/set_spec.rb +34 -0
- data/spec/rails_helper.rb +48 -0
- data/spec/spec_helper.rb +78 -0
- data/spec/support/rspec_redis_helper.rb +28 -0
- data/spec/test_helper.rb +15 -0
- metadata +486 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 78d7d226df2cc5a78795305b3809bd6e544f7979
|
|
4
|
+
data.tar.gz: 88e04bb8e5888fe459de87bf7e500ec6bfd65fba
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6a3dfebfb4f9ed988430e4045b57ae81e01e21161df7cfe4d50bf7d3048f0fa3035dc64b289e68b13a2b8946798f9d8238e1cfc7acda4589f2955a9224e85928
|
|
7
|
+
data.tar.gz: c4fecad6310f2af0569d3fa4cb67ef6596ddebcc5ed418e368d7543bc96f14b2b6d639a946f892147459505e45d126d8692b9732e64b8ec70a9e5fe6daef957d
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2014 YOURNAME
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
require 'rdoc/task'
|
|
8
|
+
|
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
11
|
+
rdoc.title = 'ConfigManager'
|
|
12
|
+
rdoc.options << '--line-numbers'
|
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
|
18
|
+
load 'rails/tasks/engine.rake'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
Bundler::GemHelper.install_tasks
|
|
23
|
+
|
|
24
|
+
require 'rake/testtask'
|
|
25
|
+
|
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
|
27
|
+
t.libs << 'lib'
|
|
28
|
+
t.libs << 'test'
|
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
|
30
|
+
t.verbose = false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
task default: :test
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require_tree .
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains reset styles as obtained from Eric Meyer's Reset CSS.
|
|
3
|
+
* Please see http://cssreset.com for more information.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
html, body, div, span, applet, object, iframe,
|
|
7
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
|
8
|
+
a, abbr, acronym, address, big, cite, code,
|
|
9
|
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
|
10
|
+
small, strike, strong, sub, sup, tt, var,
|
|
11
|
+
b, u, i, center,
|
|
12
|
+
dl, dt, dd, ol, ul, li,
|
|
13
|
+
fieldset, form, label, legend,
|
|
14
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
|
15
|
+
article, aside, canvas, details, embed,
|
|
16
|
+
figure, figcaption, footer, header, hgroup,
|
|
17
|
+
menu, nav, output, ruby, section, summary,
|
|
18
|
+
time, mark, audio, video, button {
|
|
19
|
+
margin: 0;
|
|
20
|
+
padding: 0;
|
|
21
|
+
border: 0;
|
|
22
|
+
font-size: 100%;
|
|
23
|
+
font: inherit;
|
|
24
|
+
vertical-align: baseline;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* HTML5 display-role reset for older browsers */
|
|
28
|
+
article, aside, details, figcaption, figure,
|
|
29
|
+
footer, header, hgroup, menu, nav, section {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
body {
|
|
34
|
+
line-height: 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
a {
|
|
38
|
+
outline: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
ol, ul {
|
|
42
|
+
list-style: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
blockquote, q {
|
|
46
|
+
quotes: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
blockquote:before, blockquote:after,
|
|
50
|
+
q:before, q:after {
|
|
51
|
+
content: '';
|
|
52
|
+
content: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
table {
|
|
56
|
+
border-collapse: collapse;
|
|
57
|
+
border-spacing: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
textarea {
|
|
61
|
+
overflow: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.hasLayout, .clearfix {
|
|
65
|
+
*zoom:1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.clearfix:after {
|
|
69
|
+
content:".";
|
|
70
|
+
display:block;
|
|
71
|
+
height:0;
|
|
72
|
+
clear:both;
|
|
73
|
+
visibility:hidden;
|
|
74
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
th { font-weight: bold; }
|
|
2
|
+
.narrow { width: 50%; }
|
|
3
|
+
|
|
4
|
+
.alert, .notice, .error {
|
|
5
|
+
padding: 0.8em;
|
|
6
|
+
margin: 0.5em 0;
|
|
7
|
+
border-width: 2px;
|
|
8
|
+
border-style: solid;
|
|
9
|
+
}
|
|
10
|
+
.alert, .notice {
|
|
11
|
+
border-color: whitesmoke;
|
|
12
|
+
color: green;
|
|
13
|
+
background-color: #e6efc2;
|
|
14
|
+
}
|
|
15
|
+
.error {
|
|
16
|
+
border-color: #830000;
|
|
17
|
+
color: #830000;
|
|
18
|
+
background-color: #f7c0c0;
|
|
19
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module ConfigManager
|
|
2
|
+
class AdminsController < ApplicationController
|
|
3
|
+
# GET /admins
|
|
4
|
+
def index
|
|
5
|
+
page = params[:page] || 1
|
|
6
|
+
per_page = params[:page] ? (params[:per_page] || PER_PAGE) : nil
|
|
7
|
+
@admins = Admin.page(page).per(per_page)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# GET /admins/new
|
|
11
|
+
def new
|
|
12
|
+
@admin = Admin.new admin_params
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# GET /admin/:id/edit
|
|
16
|
+
def edit
|
|
17
|
+
@admin = Admin.find(params[:id])
|
|
18
|
+
rescue ActiveRecord::RecordNotFound
|
|
19
|
+
flash[:error] = "Admin with id=#{params[:id]} couldn't be found"
|
|
20
|
+
redirect_to admins_path
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# POST /admins
|
|
24
|
+
def create
|
|
25
|
+
@admin = Admin.new admin_params
|
|
26
|
+
if @admin.save
|
|
27
|
+
flash[:notice] = "New admin user #{@admin.email} successfully created"
|
|
28
|
+
redirect_to admins_path
|
|
29
|
+
else
|
|
30
|
+
render "new"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# DELETE /admin/:id
|
|
35
|
+
def destroy
|
|
36
|
+
@admin = Admin.find(params[:id])
|
|
37
|
+
@admin.destroy
|
|
38
|
+
redirect_to admins_path
|
|
39
|
+
rescue ActiveRecord::RecordNotFound
|
|
40
|
+
flash[:error] = "Admin with id=#{params[:id]} couldn't be found"
|
|
41
|
+
redirect_to admins_path
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
def admin_params
|
|
46
|
+
if strong_parameters?
|
|
47
|
+
params[:admin] && params[:admin].permit(:email,
|
|
48
|
+
:password,
|
|
49
|
+
:password_confirmation)
|
|
50
|
+
else
|
|
51
|
+
params[:admin]
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def strong_parameters?
|
|
56
|
+
Rails::VERSION::MAJOR >= 4
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module ConfigManager
|
|
2
|
+
class ApplicationController < ActionController::Base
|
|
3
|
+
layout "config_manager/application"
|
|
4
|
+
|
|
5
|
+
before_filter :authenticate_admin
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
def authenticate_admin
|
|
9
|
+
redirect_to new_admin_session_path unless admin_signed_in?
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module ConfigManager
|
|
2
|
+
class TogglesController < ApplicationController
|
|
3
|
+
# GET /toggles
|
|
4
|
+
def index
|
|
5
|
+
@toggles = Toggle.toggles
|
|
6
|
+
@toggle = Toggles::Definition.new(params[:toggle_name])
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# POST /toggles
|
|
10
|
+
def create
|
|
11
|
+
@toggle = Toggle.create(params[:toggle])
|
|
12
|
+
if @toggle.valid?
|
|
13
|
+
flash[:notice] = "Toggle successfully created/updated"
|
|
14
|
+
else
|
|
15
|
+
flash[:error] = "Failed to create/update toggle: #{@toggle.message}"
|
|
16
|
+
end
|
|
17
|
+
redirect_to toggles_url
|
|
18
|
+
|
|
19
|
+
rescue
|
|
20
|
+
Rails.logger.error "Error raised trying to create/update toggle. #{$!}. #{$!.backtrace.take(3)}"
|
|
21
|
+
flash[:error] = "Error raised trying to create/update toggle: #{$!}"
|
|
22
|
+
redirect_to toggles_url
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# DELETE /toggles/:id
|
|
26
|
+
def destroy
|
|
27
|
+
Toggle.delete(params[:id])
|
|
28
|
+
flash[:notice] = "#{params[:id]} has been deleted!"
|
|
29
|
+
|
|
30
|
+
redirect_to toggles_url
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# POST /toggles/load_default
|
|
34
|
+
def load_default
|
|
35
|
+
loads, failures = Toggle.from_yaml(Rails.root.join('config/config_manager_toggles.yml'))
|
|
36
|
+
flash[:notice] = "#{loads} toggles have been loaded from the yaml file." if loads > 0
|
|
37
|
+
flash[:error] = "#{failures} toggles failed to be loaded from the yaml file" if failures > 0
|
|
38
|
+
|
|
39
|
+
redirect_to toggles_url
|
|
40
|
+
|
|
41
|
+
rescue Errno::ENOENT
|
|
42
|
+
flash[:error] = "Couldn't load toggles. config_manager_toggles.yml not found in config directory."
|
|
43
|
+
redirect_to toggles_url
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# POST /toggles/dump
|
|
47
|
+
def dump
|
|
48
|
+
path = Rails.root.join('config/config_manager_toggles.yml')
|
|
49
|
+
Toggle.to_yaml(path)
|
|
50
|
+
flash[:notice] = "Toggles dumped to #{path}"
|
|
51
|
+
rescue
|
|
52
|
+
flash[:error] = "Failed to dump toggles to #{path}"
|
|
53
|
+
ensure
|
|
54
|
+
redirect_to toggles_url
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module ConfigManager
|
|
2
|
+
class Admin < ActiveRecord::Base
|
|
3
|
+
devise :database_authenticatable,
|
|
4
|
+
:rememberable,
|
|
5
|
+
:registerable,
|
|
6
|
+
:trackable,
|
|
7
|
+
:validatable
|
|
8
|
+
|
|
9
|
+
def self.needs_attr_accessible?
|
|
10
|
+
Rails::VERSION::MAJOR == 3
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
attr_accessible :email,
|
|
14
|
+
:password,
|
|
15
|
+
:password_confirmation,
|
|
16
|
+
:remember_created_at if needs_attr_accessible?
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
= render "errors"
|
|
2
|
+
div.form-group
|
|
3
|
+
= form.label :email, "Email:"
|
|
4
|
+
= form.email_field :email, :class => 'form-control'
|
|
5
|
+
div.form-group
|
|
6
|
+
= form.label :password, "Password:"
|
|
7
|
+
= form.password_field :password, :class => 'form-control'
|
|
8
|
+
div.form-group
|
|
9
|
+
= form.label :password, "Password Confirmation:"
|
|
10
|
+
= form.password_field :password_confirmation, :class => 'form-control'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
h3 Edit Admin #{@admin.email}
|
|
2
|
+
section.clearfix
|
|
3
|
+
div.col.col-sm-3
|
|
4
|
+
div.col.col-sm-6
|
|
5
|
+
= form_for :admin,
|
|
6
|
+
:url => admin_path(@admin),
|
|
7
|
+
:method => :put,
|
|
8
|
+
:html => {:role => 'form'} do |form|
|
|
9
|
+
= render 'form', :form => form
|
|
10
|
+
div.buttons.text-center
|
|
11
|
+
= link_to "Cancel", admins_path, :class => 'btn btn-link'
|
|
12
|
+
= form.submit "Update", :class => 'btn btn-primary'
|
|
13
|
+
div.col.col-sm-3
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
section.clearfix
|
|
2
|
+
div
|
|
3
|
+
h3 Admins
|
|
4
|
+
= link_to raw("Create New Admin »"), new_admin_path
|
|
5
|
+
= paginate @admins
|
|
6
|
+
div.table-responsive
|
|
7
|
+
table.admins.table.table-striped.table-hover.table-condensed
|
|
8
|
+
thead
|
|
9
|
+
tr
|
|
10
|
+
th Email
|
|
11
|
+
th Created At
|
|
12
|
+
th Sign In Count
|
|
13
|
+
th Actions
|
|
14
|
+
tbody
|
|
15
|
+
- @admins.each do |admin|
|
|
16
|
+
tr
|
|
17
|
+
td = link_to admin.email, edit_admin_path(admin)
|
|
18
|
+
td = admin.created_at
|
|
19
|
+
td = admin.sign_in_count
|
|
20
|
+
td
|
|
21
|
+
= link_to "Edit", edit_admin_path(admin)
|
|
22
|
+
' |
|
|
23
|
+
= link_to "Delete",
|
|
24
|
+
admin_path(admin),
|
|
25
|
+
:method => :delete,
|
|
26
|
+
:confirm => 'Are you sure?',
|
|
27
|
+
:data => {:confirm => "Are you sure?"}
|
|
28
|
+
= paginate @admins
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
h3 Create New Admin
|
|
2
|
+
section.clearfix
|
|
3
|
+
div.col.col-sm-3
|
|
4
|
+
div.col.col-sm-6
|
|
5
|
+
= form_for :admin, :url => admins_path, :html => {:role => 'form'} do |form|
|
|
6
|
+
= render 'form', :form => form
|
|
7
|
+
div.buttons.text-center
|
|
8
|
+
= link_to "Cancel", admins_path, :class => 'btn btn-link'
|
|
9
|
+
= form.submit "Create", :class => 'btn btn-primary'
|
|
10
|
+
div.col.col-sm-3
|