upmin-admin 0.0.39 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -14
- data/Rakefile +24 -15
- data/app/assets/javascripts/upmin/application.js +0 -1
- data/app/assets/stylesheets/upmin/base.css.scss +4 -0
- data/app/assets/stylesheets/upmin/instances.css.scss +11 -1
- data/app/controllers/upmin/models_controller.rb +52 -42
- data/app/views/layouts/upmin/_navbar.html.haml +3 -3
- data/app/views/layouts/upmin/application.html.haml +2 -1
- data/app/views/upmin/models/new.html.haml +3 -3
- data/app/views/upmin/models/search.html.haml +5 -4
- data/app/views/upmin/models/show.html.haml +3 -3
- data/app/views/upmin/partials/actions/_action.html.haml +6 -21
- data/app/views/upmin/partials/associations/_associations.html.haml +8 -10
- data/app/views/upmin/partials/attributes/_boolean.html.haml +8 -6
- data/app/views/upmin/partials/attributes/_datetime.html.haml +38 -36
- data/app/views/upmin/partials/attributes/_decimal.html.haml +10 -0
- data/app/views/upmin/partials/attributes/_float.html.haml +10 -6
- data/app/views/upmin/partials/attributes/_integer.html.haml +10 -6
- data/app/views/upmin/partials/attributes/_progress_bar.html.haml +1 -0
- data/app/views/upmin/partials/attributes/_string.html.haml +17 -6
- data/app/views/upmin/partials/attributes/_text.html.haml +8 -6
- data/app/views/upmin/partials/attributes/_unknown.html.haml +5 -3
- data/app/views/upmin/partials/models/_model.html.haml +18 -46
- data/app/views/upmin/partials/models/_new_model.html.haml +9 -31
- data/app/views/upmin/partials/parameters/_block_parameter.haml +0 -0
- data/app/views/upmin/partials/parameters/_opt_parameter.html.haml +14 -0
- data/app/views/upmin/partials/parameters/_req_parameter.html.haml +4 -0
- data/app/views/upmin/partials/search_boxes/_ransack_search_box.html.haml +2 -3
- data/app/views/upmin/partials/search_results/_results.html.haml +9 -2
- data/lib/upmin/action.rb +50 -0
- data/lib/upmin/active_record/association.rb +47 -0
- data/lib/upmin/active_record/model.rb +54 -0
- data/lib/upmin/active_record/query.rb +12 -0
- data/lib/upmin/admin.rb +24 -2
- data/lib/upmin/association.rb +73 -0
- data/lib/upmin/attribute.rb +87 -0
- data/lib/upmin/automatic_delegation.rb +76 -0
- data/lib/upmin/configuration.rb +103 -0
- data/lib/upmin/data_mapper/association.rb +57 -0
- data/lib/upmin/data_mapper/model.rb +62 -0
- data/lib/upmin/data_mapper/query.rb +57 -0
- data/lib/upmin/engine.rb +2 -0
- data/lib/upmin/errors.rb +43 -0
- data/lib/upmin/model.rb +267 -98
- data/lib/upmin/parameter.rb +43 -0
- data/lib/upmin/query.rb +51 -0
- data/lib/upmin/railtie.rb +11 -1
- data/lib/upmin/railties/active_record.rb +5 -50
- data/lib/upmin/railties/data_mapper.rb +18 -0
- data/lib/upmin/railties/render.rb +34 -98
- data/lib/upmin/railties/render_helpers.rb +119 -53
- data/lib/upmin/version.rb +1 -1
- data/spec/factories/factories.rb +6 -0
- data/spec/features/action_spec.rb +39 -46
- data/spec/features/edit_model_spec.rb +4 -2
- data/spec/features/navbar_spec.rb +48 -0
- data/spec/features/new_model_spec.rb +1 -0
- data/spec/features/search_spec.rb +7 -4
- data/spec/lib/configuration_spec.rb +60 -0
- data/spec/spec_helper.rb +14 -8
- metadata +25 -7
- data/app/assets/javascripts/upmin/moment.js +0 -2856
- data/app/helpers/upmin/instances_helper.rb +0 -13
- data/app/views/upmin/partials/attributes/_nilable.html.haml +0 -14
- data/app/views/upmin/partials/search_results/_result.html.haml +0 -8
- data/lib/upmin/klass.rb +0 -170
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d17a5316e3ae23cb3bfe9e66d531798356f02ad4
|
4
|
+
data.tar.gz: ad0e64565f7304bec6f762db4ea7549dd42cf87b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0605a9cd8ef301ec6ce36a51f0ce5d2349f084bab91b878b14f58fca4cf52975db25db4f38235a8aeed95e7b10ad8dd407c557b936a38bce2d5b34bdf1180b24
|
7
|
+
data.tar.gz: 6a9d6a9607628fad7263dd7513e5fd193725c4048b8e5d90dc53fb0fa728631eee4ced49c9ef2404b4439d6bfcadbb7ae42ffd43607a6fb073a09ba305d3bd42
|
data/README.md
CHANGED
@@ -2,16 +2,21 @@
|
|
2
2
|
|
3
3
|
Upmin Admin is a framework for creating powerful admin backends with minimal effort.
|
4
4
|
|
5
|
+
|
5
6
|
## Demo Videos
|
6
7
|
|
8
|
+
**NOTE** - The videos are currently outdated, and are only relevant for versions below `0.1.0`. Please refer to the docs for recent releases until we get them updated.
|
9
|
+
|
7
10
|
To see videos showing how to install and giving a pretty good overview of the main features of upmin-admin go to [https://www.upmin.com/admin-rails](https://www.upmin.com/admin-rails).
|
8
11
|
|
9
|
-
|
12
|
+
## Demo Applications
|
10
13
|
|
11
14
|
There is also a demo application you can test out here: [store_demo](https://github.com/upmin/store_demo). The repository is maintained and updated by [Upmin](https://www.upmin.com), but you are welcome to contribute to it.
|
12
15
|
|
13
16
|
If you do choose to use the [store_demo](https://github.com/upmin/store_demo), please follow the directions in the [README](https://github.com/upmin/store_demo/blob/master/README.md) to ensure you have seed data to work with.
|
14
17
|
|
18
|
+
You can also generate a starter application using [Rails Composer](http://www.railscomposer.com/) that sets up Devise, role-based authorization, and upmin-admin. See [Upmin Admin Interface in Rails Composer](http://blog.railsapps.org/post/97584175990/upmin-admin-interface-in-rails-composer).
|
19
|
+
|
15
20
|
|
16
21
|
## Installation
|
17
22
|
|
@@ -27,14 +32,15 @@ And then mount the engine in your `routes.rb` file:
|
|
27
32
|
mount Upmin::Engine => '/admin'
|
28
33
|
```
|
29
34
|
|
30
|
-
|
35
|
+
If you already have routes pointing to `/admin` you can use any path you want, for example you could use the following instead:
|
31
36
|
|
32
37
|
```ruby
|
33
|
-
|
34
|
-
mount Upmin::Engine => '/admin'
|
35
|
-
end
|
38
|
+
mount Upmin::Engine => '/ice-ice-baby'
|
36
39
|
```
|
37
40
|
|
41
|
+
And you would access your admin page at `localhost:3000/ice-ice-baby` or `yoursite.com/ice-ice-baby`.
|
42
|
+
|
43
|
+
|
38
44
|
### Rails 4.2
|
39
45
|
|
40
46
|
Add the following to your gemfile:
|
@@ -45,27 +51,32 @@ gem 'ransack', github: 'activerecord-hackery/ransack', branch: 'rails-4.2'
|
|
45
51
|
|
46
52
|
`upmin-admin` currently depends on ransack, and you need to use the 4.2 branch of ransack due to changes in ActiveRecord.
|
47
53
|
|
54
|
+
|
48
55
|
## Documentation
|
49
56
|
|
50
|
-
|
57
|
+
For further documentation, please visit our [Wiki](https://github.com/upmin/upmin-admin-ruby/wiki). The docs there are far from complete, but we are actively updating them. If you have any trouble or can't find the documentation to do something please [create an issue](https://github.com/upmin/upmin-admin-ruby/issues) and contribute to the docs where you can.
|
51
58
|
|
52
59
|
|
53
60
|
## Going Forward
|
54
61
|
|
55
|
-
|
62
|
+
Upmin Admin is new. It has been live for less than a few months, so there are going to be things missing. If you want to make it better, get involved and [create issues](https://github.com/upmin/upmin-admin-ruby/issues) when you find bugs or want new features, and contribute with pull requests.
|
56
63
|
|
57
64
|
The major features that are being worked on now are:
|
58
65
|
|
59
|
-
1.
|
60
|
-
2. Fixing bugs
|
61
|
-
3.
|
62
|
-
4.
|
66
|
+
1. Mongoid support
|
67
|
+
2. Fixing bugs as we find them
|
68
|
+
3. Adding widgets
|
69
|
+
4. Implementing the dashboard
|
63
70
|
|
64
71
|
|
65
72
|
## Support & Feedback
|
66
73
|
|
67
|
-
|
74
|
+
We are always looking for feedback and suggestions. We prefer that you create a GitHub issue, but you can use any of the following to contact us:
|
75
|
+
|
76
|
+
Email - [support+admin@upmin.com](support+admin@upmin.com)
|
77
|
+
|
78
|
+
Twitter - [@UpminSupport](https://twitter.com/upminsupport)
|
68
79
|
|
69
|
-
|
80
|
+
GitHub - [Create an Issue](https://github.com/upmin/upmin-admin-ruby/issues)
|
70
81
|
|
71
|
-
|
82
|
+
Please note that this is an open source project, and we can't always respond immediately, but we do try to respond to all inquiries within 24 hours and are usually much faster to respond.
|
data/Rakefile
CHANGED
@@ -13,9 +13,21 @@ end
|
|
13
13
|
|
14
14
|
task :default => "spec:all"
|
15
15
|
|
16
|
+
def update_files
|
17
|
+
# Drop and reload spec files
|
18
|
+
sh "rm -rf spec/"
|
19
|
+
sh "cp -R ../../spec spec"
|
20
|
+
sh "cp ../../.rspec .rspec"
|
21
|
+
|
22
|
+
# Drop and reload Upmin::Model files
|
23
|
+
sh "rm -rf app/upmin/"
|
24
|
+
sh "cp -R ../../test_app_upmin app/upmin"
|
25
|
+
end
|
26
|
+
|
16
27
|
namespace :spec do
|
28
|
+
|
17
29
|
# Full bundle install & test.
|
18
|
-
%w(active_record_32 active_record_40 active_record_41 active_record_42 will_paginate).each do |gemfile|
|
30
|
+
%w(active_record_32 active_record_40 active_record_41 active_record_42 will_paginate data_mapper).each do |gemfile|
|
19
31
|
desc "Run Tests against #{gemfile}"
|
20
32
|
task "#{gemfile}" do
|
21
33
|
Dir.chdir("test_apps/#{gemfile}")
|
@@ -25,18 +37,18 @@ namespace :spec do
|
|
25
37
|
|
26
38
|
# Drop migrations and recreate
|
27
39
|
sh "rm -rf db/migrate/*"
|
28
|
-
|
40
|
+
|
41
|
+
if gemfile != "data_mapper"
|
42
|
+
sh "bundle exec rake railties:install:migrations > /dev/null"
|
43
|
+
end
|
29
44
|
|
30
45
|
if gemfile == "active_record_32"
|
31
|
-
sh "bundle exec rake db:drop db:create db:migrate --quiet"
|
46
|
+
sh "bundle exec rake db:drop db:create db:migrate --quiet > /dev/null"
|
32
47
|
end
|
33
48
|
|
34
|
-
sh "RAILS_ENV=test bundle exec rake db:drop db:create db:migrate --quiet"
|
49
|
+
sh "RAILS_ENV=test bundle exec rake db:drop db:create db:migrate --quiet > /dev/null"
|
35
50
|
|
36
|
-
|
37
|
-
sh "rm -rf spec/"
|
38
|
-
sh "cp -R ../../spec spec"
|
39
|
-
sh "cp ../../.rspec .rspec"
|
51
|
+
update_files
|
40
52
|
|
41
53
|
# Run tests
|
42
54
|
sh "bundle exec rake"
|
@@ -44,16 +56,13 @@ namespace :spec do
|
|
44
56
|
end
|
45
57
|
|
46
58
|
# Use existing models & install and just rake.
|
47
|
-
%w(active_record_32 active_record_40 active_record_41 active_record_42 will_paginate).each do |gemfile|
|
59
|
+
%w(active_record_32 active_record_40 active_record_41 active_record_42 will_paginate data_mapper).each do |gemfile|
|
48
60
|
desc "Run Tests against #{gemfile}"
|
49
61
|
task "#{gemfile}_quick" do
|
50
62
|
Dir.chdir("test_apps/#{gemfile}")
|
51
63
|
puts "Re-testing in #{`pwd`}. Bundle install and migration updates will NOT happen!"
|
52
64
|
|
53
|
-
|
54
|
-
sh "rm -rf spec/"
|
55
|
-
sh "cp -R ../../spec spec"
|
56
|
-
sh "cp ../../.rspec .rspec"
|
65
|
+
update_files
|
57
66
|
|
58
67
|
# Run tests
|
59
68
|
sh "bundle exec rake"
|
@@ -62,14 +71,14 @@ namespace :spec do
|
|
62
71
|
|
63
72
|
desc "Run Tests against all ORMs"
|
64
73
|
task :all do
|
65
|
-
%w(active_record_32 active_record_40 active_record_41 active_record_42 will_paginate).each do |gemfile|
|
74
|
+
%w(active_record_32 active_record_40 active_record_41 active_record_42 will_paginate data_mapper).each do |gemfile|
|
66
75
|
sh "rake spec:#{gemfile}"
|
67
76
|
end
|
68
77
|
end
|
69
78
|
|
70
79
|
desc "Run Tests against all ORMs"
|
71
80
|
task :all_quick do
|
72
|
-
%w(active_record_32 active_record_40 active_record_41 active_record_42 will_paginate).each do |gemfile|
|
81
|
+
%w(active_record_32 active_record_40 active_record_41 active_record_42 will_paginate data_mapper).each do |gemfile|
|
73
82
|
sh "rake spec:#{gemfile}_quick"
|
74
83
|
end
|
75
84
|
end
|
@@ -52,6 +52,10 @@ body {
|
|
52
52
|
padding-top: 8px;
|
53
53
|
}
|
54
54
|
|
55
|
+
.pagination:first-of-type {
|
56
|
+
margin-bottom: 0px;
|
57
|
+
}
|
58
|
+
|
55
59
|
|
56
60
|
.wizard span {padding: 12px 12px 10px 12px; margin-right:5px; background:#efefef; position:relative; display:inline-block; }
|
57
61
|
.wizard span:before {width:0px; height:0px; border-top: 20px inset transparent; border-bottom: 20px inset transparent; border-left: 20px solid #fff; position: absolute; content: ""; top: 0; left: 0;}
|
@@ -1,8 +1,14 @@
|
|
1
1
|
@import "colors";
|
2
2
|
|
3
|
+
.search-result-link {
|
4
|
+
.upmin-model {
|
5
|
+
margin-bottom: 10px;
|
6
|
+
}
|
7
|
+
}
|
8
|
+
|
3
9
|
.upmin-model {
|
4
10
|
padding: 20px;
|
5
|
-
margin: 10px 0px
|
11
|
+
margin: 10px 0px 250px 0;
|
6
12
|
border: 1px solid #eee;
|
7
13
|
border-left-width: 5px;
|
8
14
|
border-radius: 3px;
|
@@ -65,6 +71,10 @@
|
|
65
71
|
padding: 9px;
|
66
72
|
margin-bottom: 0;
|
67
73
|
min-height: 40px;
|
74
|
+
|
75
|
+
&.action-well {
|
76
|
+
margin-bottom: 32px;
|
77
|
+
}
|
68
78
|
}
|
69
79
|
|
70
80
|
a.active-tag-link {
|
@@ -6,8 +6,10 @@ module Upmin
|
|
6
6
|
before_filter :set_model, only: [:show, :update, :action]
|
7
7
|
|
8
8
|
before_filter :set_page, only: [:search]
|
9
|
+
before_filter :set_query, only: [:search]
|
10
|
+
before_filter :set_q_for_form_values, only: [:search]
|
9
11
|
|
10
|
-
before_filter :
|
12
|
+
before_filter :set_action, only: [:action]
|
11
13
|
before_filter :set_arguments, only: [:action]
|
12
14
|
|
13
15
|
def dashboard
|
@@ -25,34 +27,28 @@ module Upmin
|
|
25
27
|
# POST /:model_name
|
26
28
|
def create
|
27
29
|
@model = @klass.new
|
28
|
-
|
30
|
+
raw_model = @model.model
|
29
31
|
|
30
|
-
args = params[@klass.
|
31
|
-
transforms = args.delete(:transforms) || {}
|
32
|
+
args = params[@klass.underscore_name]
|
32
33
|
|
33
34
|
args.each do |key, value|
|
34
|
-
# TODO(jon): Figure out a
|
35
|
-
# This could cause issues and is exploitable, but it
|
36
|
-
# should be fine for now since this is only on admin pages
|
37
|
-
if transforms[key] and not value.blank?
|
38
|
-
value = transform(transforms, key, value)
|
39
|
-
end
|
35
|
+
# TODO(jon): Figure out a way to do transforms.
|
40
36
|
|
41
37
|
# TODO(jon): Remove duplicate code between update and create
|
42
38
|
if args["#{key}_is_nil"] == "1"
|
43
|
-
|
39
|
+
raw_model.send("#{key}=", nil)
|
44
40
|
else
|
45
41
|
if key.ends_with?("_is_nil")
|
46
42
|
# Skip this, since we use the non _is_nil arg.
|
47
43
|
else
|
48
|
-
|
44
|
+
raw_model.send("#{key}=", value)
|
49
45
|
end
|
50
46
|
end
|
51
47
|
end
|
52
48
|
|
53
|
-
if
|
54
|
-
flash[:notice] = "#{@klass.humanized_name(:singular)} created successfully with id=#{
|
55
|
-
redirect_to(
|
49
|
+
if raw_model.save
|
50
|
+
flash[:notice] = "#{@klass.humanized_name(:singular)} created successfully with id=#{raw_model.id}."
|
51
|
+
redirect_to(@model.path)
|
56
52
|
else
|
57
53
|
flash.now[:alert] = "#{@klass.humanized_name(:singular)} was NOT created."
|
58
54
|
render(:new)
|
@@ -62,33 +58,26 @@ module Upmin
|
|
62
58
|
|
63
59
|
# PUT /:model_name/:id
|
64
60
|
def update
|
65
|
-
instance = @model.instance
|
66
|
-
updates = params[@klass.name.underscore]
|
67
|
-
transforms = updates.delete(:transforms) || {}
|
68
61
|
|
69
|
-
|
70
|
-
|
71
|
-
# This could cause issues and is exploitable, but it
|
72
|
-
# should be fine for now since this is only on admin pages
|
73
|
-
if transforms[key] and not value.blank?
|
74
|
-
value = transform(transforms, key, value)
|
75
|
-
end
|
62
|
+
raw_model = @model.model
|
63
|
+
updates = params[@klass.underscore_name]
|
76
64
|
|
65
|
+
updates.each do |key, value|
|
77
66
|
# TODO(jon): Remove duplicate code between update and create
|
78
67
|
if updates["#{key}_is_nil"] == "1"
|
79
|
-
|
68
|
+
raw_model.send("#{key}=", nil)
|
80
69
|
else
|
81
70
|
if key.ends_with?("_is_nil")
|
82
71
|
# Skip this, since we use the non _is_nil arg.
|
83
72
|
else
|
84
|
-
|
73
|
+
raw_model.send("#{key}=", value)
|
85
74
|
end
|
86
75
|
end
|
87
76
|
end
|
88
77
|
|
89
|
-
if
|
78
|
+
if raw_model.save
|
90
79
|
flash[:notice] = "#{@klass.humanized_name(:singular)} updated successfully."
|
91
|
-
redirect_to(
|
80
|
+
redirect_to(@model.path)
|
92
81
|
else
|
93
82
|
flash.now[:alert] = "#{@klass.humanized_name(:singular)} was NOT updated."
|
94
83
|
render(:show)
|
@@ -96,15 +85,15 @@ module Upmin
|
|
96
85
|
end
|
97
86
|
|
98
87
|
def search
|
99
|
-
@q = @klass.ransack(params[:q])
|
100
|
-
@results = Upmin::Paginator.paginate(@q.result(distinct: true), @page, 30)
|
88
|
+
# @q = @klass.ransack(params[:q])
|
89
|
+
# @results = Upmin::Paginator.paginate(@q.result(distinct: true), @page, 30)
|
101
90
|
end
|
102
91
|
|
103
92
|
def action
|
104
|
-
|
105
|
-
|
106
|
-
flash[:notice] = "Action successfully performed with a response of: #{response}"
|
107
|
-
|
93
|
+
@response = @action.perform(@arguments)
|
94
|
+
|
95
|
+
flash[:notice] = "Action successfully performed with a response of: #{@response}"
|
96
|
+
redirect_to(@model.path)
|
108
97
|
# rescue Exception => e
|
109
98
|
# flash.now[:alert] = "Action failed with the error message: #{e.message}"
|
110
99
|
# render(:show)
|
@@ -112,22 +101,42 @@ module Upmin
|
|
112
101
|
end
|
113
102
|
|
114
103
|
private
|
104
|
+
# TODO(jon): Make the search form fill better than openstruct impl.
|
105
|
+
# Temporarily preserve most search form values. This will break if
|
106
|
+
# someone wants to search for "2014-09-05" as a string :(
|
107
|
+
def set_q_for_form_values
|
108
|
+
if params[:q]
|
109
|
+
q_hash = params[:q].dup
|
110
|
+
q_hash.each do |key, value|
|
111
|
+
if value.to_s.match(/[0-9]{4}\-[0-9]{2}\-[0-9]{2}/)
|
112
|
+
q_hash[key] = DateTime.parse(value)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
@q = OpenStruct.new(q_hash)
|
116
|
+
end
|
117
|
+
end
|
115
118
|
|
116
|
-
def
|
117
|
-
@
|
118
|
-
raise "Invalid klass name" if @klass.nil?
|
119
|
+
def set_query
|
120
|
+
@query = Upmin::Query.new(@klass, params[:q], page: @page, per_page: 30)
|
119
121
|
end
|
120
122
|
|
121
123
|
def set_model
|
122
|
-
@model = @klass.
|
124
|
+
@model = @klass.new(id: params[:id])
|
123
125
|
end
|
124
126
|
|
125
|
-
def
|
126
|
-
@
|
127
|
+
def set_klass
|
128
|
+
@klass = Upmin::Model.find_class(params[:klass])
|
129
|
+
end
|
130
|
+
|
131
|
+
def set_action
|
132
|
+
action_name = params[:method].to_sym
|
133
|
+
@action = @model.actions.select{ |action| action.name == action_name }.first
|
134
|
+
|
135
|
+
raise Upmin::InvalidAction.new(params[:method]) unless @action
|
127
136
|
end
|
128
137
|
|
129
138
|
def set_arguments
|
130
|
-
arguments = params[@
|
139
|
+
arguments = params[@action.name] || {}
|
131
140
|
@arguments = {}
|
132
141
|
arguments.each do |k, v|
|
133
142
|
unless k.ends_with?("_is_nil")
|
@@ -136,6 +145,7 @@ module Upmin
|
|
136
145
|
end
|
137
146
|
end
|
138
147
|
end
|
148
|
+
@arguments = ActiveSupport::HashWithIndifferentAccess.new(@arguments)
|
139
149
|
end
|
140
150
|
|
141
151
|
def set_page
|
@@ -9,7 +9,7 @@
|
|
9
9
|
%span.icon-bar
|
10
10
|
#navbar-main.navbar-collapse.collapse
|
11
11
|
%ul.nav.navbar-nav
|
12
|
-
- Upmin::
|
12
|
+
- Upmin::Model.all.each do |m|
|
13
13
|
%li
|
14
|
-
%a{href:
|
15
|
-
= m.
|
14
|
+
%a{href: m.search_path}
|
15
|
+
= m.humanized_name(:plural)
|
@@ -9,7 +9,8 @@
|
|
9
9
|
|
10
10
|
%link{href: "//cdn.jsdelivr.net/bootstrap/3.2.0/css/bootstrap.min.css", rel: "stylesheet", type: "text/css"}
|
11
11
|
%link{href: "//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css", rel: "stylesheet"}
|
12
|
-
%script{:
|
12
|
+
%script{src: "//cdn.jsdelivr.net/bootstrap/3.2.0/js/bootstrap.min.js"}
|
13
|
+
%script{src: "//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.3/moment.min.js"}
|
13
14
|
|
14
15
|
- if content_for?(:head)
|
15
16
|
= yield(:head)
|
@@ -9,13 +9,13 @@
|
|
9
9
|
%button.close{"data-dismiss" => "alert", type: "button"}
|
10
10
|
%span{"aria-hidden" => "true"} ×
|
11
11
|
= alert
|
12
|
-
- if @model.
|
12
|
+
- if @model.errors.any?
|
13
13
|
%ul
|
14
|
-
- @model.
|
14
|
+
- @model.errors.each do |field, error|
|
15
15
|
%li
|
16
16
|
%b
|
17
17
|
= field
|
18
18
|
= error
|
19
19
|
.row
|
20
20
|
.col-sm-12
|
21
|
-
=
|
21
|
+
= up_render(@model)
|
@@ -1,17 +1,18 @@
|
|
1
1
|
.container
|
2
2
|
.row
|
3
3
|
.col-md-8
|
4
|
+
= up_paginate(@query.paginated_results)
|
4
5
|
-# TODO(jon): Add pagination w/ search results
|
5
|
-
=
|
6
|
+
= up_render(@query)
|
6
7
|
%br
|
7
|
-
= up_paginate(@
|
8
|
+
= up_paginate(@query.paginated_results)
|
8
9
|
%br
|
9
10
|
%br
|
10
11
|
.col-md-4
|
11
12
|
-# TODO(jon): Implement up_search_box
|
12
|
-
=
|
13
|
+
= up_render(@klass)
|
13
14
|
.new-button-wrapper
|
14
|
-
%a.btn.btn-block.btn-success{href: upmin_new_model_path(klass: @klass.
|
15
|
+
%a.btn.btn-block.btn-success{href: upmin_new_model_path(klass: @klass.model_class_name)}
|
15
16
|
Create a new
|
16
17
|
= @klass.humanized_name(:singular)
|
17
18
|
%br
|