mvpkit 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/mvpkit.gemspec +135 -76
- data/project/.gitignore +43 -14
- data/project/Gemfile +7 -3
- data/project/Gemfile.lock +500 -0
- data/project/Procfile +1 -1
- data/project/app/assets/javascripts/application.js +5 -1
- data/project/app/assets/javascripts/cable.js +12 -0
- data/project/app/assets/javascripts/pack-compiled.js +37394 -0
- data/project/app/assets/javascripts/pack-compiled.js.map +1 -0
- data/project/app/assets/stylesheets/application.scss +3 -1
- data/project/app/assets/stylesheets/pack-compiled.css +33946 -0
- data/project/app/assets/stylesheets/pack-compiled.css.map +1 -0
- data/project/app/controllers/application_controller.rb +13 -4
- data/project/app/engines/admin/.gitignore +7 -0
- data/project/app/engines/admin/Gemfile +14 -0
- data/project/app/engines/admin/Gemfile.lock +118 -0
- data/project/app/engines/admin/MIT-LICENSE +20 -0
- data/project/app/engines/admin/README.md +28 -0
- data/project/app/engines/admin/Rakefile +37 -0
- data/project/app/engines/admin/admin.gemspec +22 -0
- data/project/app/engines/admin/app/assets/config/admin_manifest.js +2 -0
- data/project/app/engines/admin/app/assets/images/admin/.keep +0 -0
- data/project/app/engines/admin/app/assets/javascripts/admin/application.js +13 -0
- data/project/app/engines/admin/app/assets/stylesheets/admin/application.css +15 -0
- data/project/app/engines/admin/app/controllers/admin/application_controller.rb +5 -0
- data/project/app/engines/admin/app/controllers/admin/conversions_controller.rb +64 -0
- data/project/app/engines/admin/app/controllers/admin/users_controller.rb +62 -0
- data/project/app/engines/admin/app/helpers/admin/application_helper.rb +4 -0
- data/project/app/engines/admin/app/helpers/admin/conversions_helper.rb +4 -0
- data/project/app/engines/admin/app/helpers/admin/users_helper.rb +4 -0
- data/project/app/engines/admin/app/jobs/admin/application_job.rb +4 -0
- data/project/app/engines/admin/app/mailers/admin/application_mailer.rb +6 -0
- data/project/app/engines/admin/app/models/admin/application_record.rb +5 -0
- data/project/app/engines/admin/app/views/admin/conversions/_form.html.erb +11 -0
- data/project/app/engines/admin/app/views/admin/conversions/edit.html.erb +3 -0
- data/project/app/engines/admin/app/views/admin/conversions/index.html.erb +31 -0
- data/project/app/engines/admin/app/views/admin/conversions/new.html.erb +3 -0
- data/project/app/engines/admin/app/views/admin/conversions/show.html.erb +13 -0
- data/project/app/engines/admin/app/views/admin/users/_form.html.erb +22 -0
- data/project/app/engines/admin/app/views/admin/users/edit.html.erb +6 -0
- data/project/app/engines/admin/app/views/admin/users/index.html.erb +27 -0
- data/project/app/engines/admin/app/views/admin/users/new.html.erb +5 -0
- data/project/app/engines/admin/app/views/admin/users/show.html.erb +9 -0
- data/project/app/engines/admin/app/views/layouts/admin/_header.html.erb +21 -0
- data/project/app/engines/admin/app/views/layouts/admin/application.html.erb +5 -0
- data/project/app/engines/admin/bin/rails +13 -0
- data/project/app/engines/admin/config/routes.rb +6 -0
- data/project/app/engines/admin/lib/admin/engine.rb +5 -0
- data/project/app/engines/admin/lib/admin/version.rb +3 -0
- data/project/app/engines/admin/lib/admin.rb +5 -0
- data/project/app/engines/admin/lib/tasks/admin_tasks.rake +4 -0
- data/project/app/engines/admin/test/admin_test.rb +7 -0
- data/project/app/engines/admin/test/controllers/admin/conversions_controller_test.rb +52 -0
- data/project/app/engines/admin/test/controllers/admin/users_controller_test.rb +52 -0
- data/project/app/engines/admin/test/integration/navigation_test.rb +8 -0
- data/project/app/engines/admin/test/test_helper.rb +20 -0
- data/project/app/models/application_record.rb +3 -0
- data/project/app/models/conversion.rb +1 -2
- data/project/app/models/user.rb +6 -0
- data/project/app/views/layouts/_header.html.erb +17 -20
- data/project/app/views/static/internal_server_error.html.erb +1 -0
- data/project/app/views/static/not_found.html.erb +1 -0
- data/project/app/webpack/javascripts/lib/analytics.js +22 -0
- data/project/app/webpack/javascripts/lib/controllers.js +28 -0
- data/project/app/webpack/javascripts/lib/forms.js +28 -0
- data/project/app/webpack/javascripts/pack.js +11 -8
- data/project/app/webpack/stylesheets/config/variables.scss +1 -1
- data/project/app/webpack/stylesheets/skin/tables.scss +14 -0
- data/project/config/application.rb +2 -2
- data/project/config/initializers/devise.rb +277 -0
- data/project/config/initializers/stripe.rb +0 -7
- data/project/config/locales/devise.en.yml +64 -0
- data/project/config/routes.rb +2 -0
- data/project/db/migrate/2017000000000_add_uuid_pk_by_default.rb +5 -0
- data/project/db/migrate/20170415224839_create_conversions.rb +9 -0
- data/project/db/migrate/20170415225327_devise_create_users.rb +42 -0
- data/project/db/schema.rb +20 -3
- data/project/package.json +7 -7
- metadata +64 -5
- data/project/config/initializers/rails_admin.rb +0 -49
- data/project/db/migrate/20160728235100_create_conversions.rb +0 -9
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"stylesheets/pack-compiled.css","sourceRoot":""}
|
@@ -6,7 +6,9 @@ class ApplicationController < ActionController::Base
|
|
6
6
|
helper MVP::Engine.helpers
|
7
7
|
|
8
8
|
before_action :authenticate_with_http_basic if ENV['HTTP_BASIC_AUTH_USER']
|
9
|
-
|
9
|
+
# before_action :authenticate_user!
|
10
|
+
before_action :configure_permitted_parameters, if: :devise_controller?
|
11
|
+
|
10
12
|
# Prevent CSRF attacks by raising an exception.
|
11
13
|
# For APIs, you may want to use :null_session instead.
|
12
14
|
protect_from_forgery with: :exception
|
@@ -16,17 +18,24 @@ class ApplicationController < ActionController::Base
|
|
16
18
|
if Rails.env.production?
|
17
19
|
rescue_from StandardError do |exception|
|
18
20
|
Rollbar.error(exception)
|
19
|
-
render '
|
21
|
+
render 'static/internal_server_error', layout: false, status: 500
|
20
22
|
end
|
21
23
|
|
22
|
-
rescue_from RecordNotFound,
|
23
|
-
render '
|
24
|
+
rescue_from RecordNotFound, ActiveRecord::RecordNotFound do |exception|
|
25
|
+
render 'static/not_found', layout: false, status: 404
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
29
|
+
private
|
30
|
+
|
27
31
|
def authenticate_with_http_basic
|
28
32
|
authenticate_or_request_with_http_basic do |username, password|
|
29
33
|
username == ENV['HTTP_BASIC_AUTH_USER'] && password == ENV['HTTP_BASIC_AUTH_PASSWORD']
|
30
34
|
end
|
31
35
|
end
|
36
|
+
|
37
|
+
def configure_permitted_parameters
|
38
|
+
devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
|
39
|
+
devise_parameter_sanitizer.permit(:account_update, keys: [:name])
|
40
|
+
end
|
32
41
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in admin.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use a debugger
|
14
|
+
# gem 'byebug', group: [:development, :test]
|
@@ -0,0 +1,118 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
admin (0.1.0)
|
5
|
+
rails (~> 5.0.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (5.0.2)
|
11
|
+
actionpack (= 5.0.2)
|
12
|
+
nio4r (>= 1.2, < 3.0)
|
13
|
+
websocket-driver (~> 0.6.1)
|
14
|
+
actionmailer (5.0.2)
|
15
|
+
actionpack (= 5.0.2)
|
16
|
+
actionview (= 5.0.2)
|
17
|
+
activejob (= 5.0.2)
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
actionpack (5.0.2)
|
21
|
+
actionview (= 5.0.2)
|
22
|
+
activesupport (= 5.0.2)
|
23
|
+
rack (~> 2.0)
|
24
|
+
rack-test (~> 0.6.3)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
+
actionview (5.0.2)
|
28
|
+
activesupport (= 5.0.2)
|
29
|
+
builder (~> 3.1)
|
30
|
+
erubis (~> 2.7.0)
|
31
|
+
rails-dom-testing (~> 2.0)
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
+
activejob (5.0.2)
|
34
|
+
activesupport (= 5.0.2)
|
35
|
+
globalid (>= 0.3.6)
|
36
|
+
activemodel (5.0.2)
|
37
|
+
activesupport (= 5.0.2)
|
38
|
+
activerecord (5.0.2)
|
39
|
+
activemodel (= 5.0.2)
|
40
|
+
activesupport (= 5.0.2)
|
41
|
+
arel (~> 7.0)
|
42
|
+
activesupport (5.0.2)
|
43
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
|
+
i18n (~> 0.7)
|
45
|
+
minitest (~> 5.1)
|
46
|
+
tzinfo (~> 1.1)
|
47
|
+
arel (7.1.4)
|
48
|
+
builder (3.2.3)
|
49
|
+
concurrent-ruby (1.0.5)
|
50
|
+
erubis (2.7.0)
|
51
|
+
globalid (0.3.7)
|
52
|
+
activesupport (>= 4.1.0)
|
53
|
+
i18n (0.8.1)
|
54
|
+
loofah (2.0.3)
|
55
|
+
nokogiri (>= 1.5.9)
|
56
|
+
mail (2.6.4)
|
57
|
+
mime-types (>= 1.16, < 4)
|
58
|
+
method_source (0.8.2)
|
59
|
+
mime-types (3.1)
|
60
|
+
mime-types-data (~> 3.2015)
|
61
|
+
mime-types-data (3.2016.0521)
|
62
|
+
mini_portile2 (2.1.0)
|
63
|
+
minitest (5.10.1)
|
64
|
+
nio4r (2.0.0)
|
65
|
+
nokogiri (1.7.1)
|
66
|
+
mini_portile2 (~> 2.1.0)
|
67
|
+
rack (2.0.1)
|
68
|
+
rack-test (0.6.3)
|
69
|
+
rack (>= 1.0)
|
70
|
+
rails (5.0.2)
|
71
|
+
actioncable (= 5.0.2)
|
72
|
+
actionmailer (= 5.0.2)
|
73
|
+
actionpack (= 5.0.2)
|
74
|
+
actionview (= 5.0.2)
|
75
|
+
activejob (= 5.0.2)
|
76
|
+
activemodel (= 5.0.2)
|
77
|
+
activerecord (= 5.0.2)
|
78
|
+
activesupport (= 5.0.2)
|
79
|
+
bundler (>= 1.3.0, < 2.0)
|
80
|
+
railties (= 5.0.2)
|
81
|
+
sprockets-rails (>= 2.0.0)
|
82
|
+
rails-dom-testing (2.0.2)
|
83
|
+
activesupport (>= 4.2.0, < 6.0)
|
84
|
+
nokogiri (~> 1.6)
|
85
|
+
rails-html-sanitizer (1.0.3)
|
86
|
+
loofah (~> 2.0)
|
87
|
+
railties (5.0.2)
|
88
|
+
actionpack (= 5.0.2)
|
89
|
+
activesupport (= 5.0.2)
|
90
|
+
method_source
|
91
|
+
rake (>= 0.8.7)
|
92
|
+
thor (>= 0.18.1, < 2.0)
|
93
|
+
rake (12.0.0)
|
94
|
+
sprockets (3.7.1)
|
95
|
+
concurrent-ruby (~> 1.0)
|
96
|
+
rack (> 1, < 3)
|
97
|
+
sprockets-rails (3.2.0)
|
98
|
+
actionpack (>= 4.0)
|
99
|
+
activesupport (>= 4.0)
|
100
|
+
sprockets (>= 3.0.0)
|
101
|
+
sqlite3 (1.3.13)
|
102
|
+
thor (0.19.4)
|
103
|
+
thread_safe (0.3.6)
|
104
|
+
tzinfo (1.2.3)
|
105
|
+
thread_safe (~> 0.1)
|
106
|
+
websocket-driver (0.6.5)
|
107
|
+
websocket-extensions (>= 0.1.0)
|
108
|
+
websocket-extensions (0.1.2)
|
109
|
+
|
110
|
+
PLATFORMS
|
111
|
+
ruby
|
112
|
+
|
113
|
+
DEPENDENCIES
|
114
|
+
admin!
|
115
|
+
sqlite3
|
116
|
+
|
117
|
+
BUNDLED WITH
|
118
|
+
1.14.6
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Ian Hunter
|
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.
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Admin
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'admin'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install admin
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -0,0 +1,37 @@
|
|
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 = 'Admin'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "admin/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "admin"
|
9
|
+
s.version = Admin::VERSION
|
10
|
+
s.authors = ["Ian Hunter"]
|
11
|
+
s.email = ["ianhunter@gmail.com"]
|
12
|
+
s.homepage = ""
|
13
|
+
s.summary = "Admin Tools for __PROJECT_NAME__"
|
14
|
+
s.description = ""
|
15
|
+
s.license = "MIT"
|
16
|
+
|
17
|
+
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
|
18
|
+
|
19
|
+
s.add_dependency "rails", "~> 5.0.2"
|
20
|
+
|
21
|
+
s.add_development_dependency "sqlite3"
|
22
|
+
end
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
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 any plugin's vendor/assets/javascripts directory 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. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_dependency "admin/application_controller"
|
2
|
+
|
3
|
+
module Admin
|
4
|
+
class ConversionsController < ApplicationController
|
5
|
+
before_action :set_conversion, only: [:show, :edit, :update, :destroy]
|
6
|
+
|
7
|
+
# GET /conversions
|
8
|
+
def index
|
9
|
+
# @conversions = Conversion.all
|
10
|
+
@q = Conversion.ransack(params[:q])
|
11
|
+
@conversions = @q.result(distinct: true)
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /conversions/1
|
15
|
+
def show
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /conversions/new
|
19
|
+
def new
|
20
|
+
@conversion = Conversion.new
|
21
|
+
end
|
22
|
+
|
23
|
+
# GET /conversions/1/edit
|
24
|
+
def edit
|
25
|
+
end
|
26
|
+
|
27
|
+
# POST /conversions
|
28
|
+
def create
|
29
|
+
@conversion = Conversion.new(conversion_params)
|
30
|
+
|
31
|
+
if @conversion.save
|
32
|
+
redirect_to @conversion, notice: 'Conversion was successfully created.'
|
33
|
+
else
|
34
|
+
render :new
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# PATCH/PUT /conversions/1
|
39
|
+
def update
|
40
|
+
if @conversion.update(conversion_params)
|
41
|
+
redirect_to @conversion, notice: 'Conversion was successfully updated.'
|
42
|
+
else
|
43
|
+
render :edit
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# DELETE /conversions/1
|
48
|
+
def destroy
|
49
|
+
@conversion.destroy
|
50
|
+
redirect_to conversions_url, notice: 'Conversion was successfully destroyed.'
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
# Use callbacks to share common setup or constraints between actions.
|
55
|
+
def set_conversion
|
56
|
+
@conversion = Conversion.find(params[:id])
|
57
|
+
end
|
58
|
+
|
59
|
+
# Only allow a trusted parameter "white list" through.
|
60
|
+
def conversion_params
|
61
|
+
params.require(:conversion).permit(:email)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require_dependency "admin/application_controller"
|
2
|
+
|
3
|
+
module Admin
|
4
|
+
class UsersController < ApplicationController
|
5
|
+
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
6
|
+
|
7
|
+
# GET /users
|
8
|
+
def index
|
9
|
+
@users = User.all
|
10
|
+
end
|
11
|
+
|
12
|
+
# GET /users/1
|
13
|
+
def show
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /users/new
|
17
|
+
def new
|
18
|
+
@user = User.new
|
19
|
+
end
|
20
|
+
|
21
|
+
# GET /users/1/edit
|
22
|
+
def edit
|
23
|
+
end
|
24
|
+
|
25
|
+
# POST /users
|
26
|
+
def create
|
27
|
+
@user = User.new(user_params)
|
28
|
+
|
29
|
+
if @user.save
|
30
|
+
redirect_to @user, notice: 'User was successfully created.'
|
31
|
+
else
|
32
|
+
render :new
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# PATCH/PUT /users/1
|
37
|
+
def update
|
38
|
+
if @user.update(user_params)
|
39
|
+
redirect_to @user, notice: 'User was successfully updated.'
|
40
|
+
else
|
41
|
+
render :edit
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# DELETE /users/1
|
46
|
+
def destroy
|
47
|
+
@user.destroy
|
48
|
+
redirect_to users_url, notice: 'User was successfully destroyed.'
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
53
|
+
def set_user
|
54
|
+
@user = User.find(params[:id])
|
55
|
+
end
|
56
|
+
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
58
|
+
def user_params
|
59
|
+
params.require(:user).permit(:email)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="card">
|
2
|
+
<div class="card-block">
|
3
|
+
<%= simple_form_for(conversion) do |f| %>
|
4
|
+
<%= f.input :email %>
|
5
|
+
<div class="actions">
|
6
|
+
<%= f.submit class: 'btn btn-primary' %>
|
7
|
+
<%= link_to 'Cancel', conversions_path, class: 'btn btn-secondary' %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
</div>
|
11
|
+
</div>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<div class="mt20">
|
2
|
+
<div class="mb20">
|
3
|
+
<%= search_form_for @q, class: 'form-inline pull-right' do |f| %>
|
4
|
+
<%= f.search_field :email_cont, class: 'form-control mr10', placeholder: 'Search ...' %>
|
5
|
+
<%= f.submit class: 'btn btn-primary' %>
|
6
|
+
<% end %>
|
7
|
+
<h4>Conversions</h4>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<%= content_tag :table, class: 'table table-flush' do %>
|
11
|
+
<tr>
|
12
|
+
<th><%= sort_link(@q, :email) %></th>
|
13
|
+
<th><%= sort_link(@q, :created_at) %></th>
|
14
|
+
<th colspan="3"></th>
|
15
|
+
</tr>
|
16
|
+
<% @conversions.each do |conversion| %>
|
17
|
+
<tr>
|
18
|
+
<td><%= conversion.email %></td>
|
19
|
+
<td><%= conversion.created_at %></td>
|
20
|
+
<td class="text-right">
|
21
|
+
<%= link_to edit_conversion_path(conversion), class: 'btn btn-warning btn-sm' do %>
|
22
|
+
<i class="fa fa-edit"></i>
|
23
|
+
<% end %>
|
24
|
+
<%= link_to conversion, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger btn-sm' do %>
|
25
|
+
<i class="fa fa-remove"></i>
|
26
|
+
<% end %>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="card mt20">
|
2
|
+
<div class="card-block">
|
3
|
+
<p>
|
4
|
+
<strong>Email:</strong>
|
5
|
+
<%= @conversion.email %>
|
6
|
+
</p>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="mt30">
|
11
|
+
<%= link_to 'Edit', edit_conversion_path(@conversion), class: 'btn btn-warning' %>
|
12
|
+
<%= link_to 'Back', conversions_path, class: 'btn btn-secondary' %>
|
13
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_for(user) do |f| %>
|
2
|
+
<% if user.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% user.errors.full_messages.each do |message| %>
|
8
|
+
<li><%= message %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :email %>
|
16
|
+
<%= f.text_field :email %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="actions">
|
20
|
+
<%= f.submit %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Users</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Email</th>
|
9
|
+
<th colspan="3"></th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
|
13
|
+
<tbody>
|
14
|
+
<% @users.each do |user| %>
|
15
|
+
<tr>
|
16
|
+
<td><%= user.email %></td>
|
17
|
+
<td><%= link_to 'Show', user %></td>
|
18
|
+
<td><%= link_to 'Edit', edit_user_path(user) %></td>
|
19
|
+
<td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
20
|
+
</tr>
|
21
|
+
<% end %>
|
22
|
+
</tbody>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
<br>
|
26
|
+
|
27
|
+
<%= link_to 'New User', new_user_path %>
|