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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -14
  3. data/Rakefile +24 -15
  4. data/app/assets/javascripts/upmin/application.js +0 -1
  5. data/app/assets/stylesheets/upmin/base.css.scss +4 -0
  6. data/app/assets/stylesheets/upmin/instances.css.scss +11 -1
  7. data/app/controllers/upmin/models_controller.rb +52 -42
  8. data/app/views/layouts/upmin/_navbar.html.haml +3 -3
  9. data/app/views/layouts/upmin/application.html.haml +2 -1
  10. data/app/views/upmin/models/new.html.haml +3 -3
  11. data/app/views/upmin/models/search.html.haml +5 -4
  12. data/app/views/upmin/models/show.html.haml +3 -3
  13. data/app/views/upmin/partials/actions/_action.html.haml +6 -21
  14. data/app/views/upmin/partials/associations/_associations.html.haml +8 -10
  15. data/app/views/upmin/partials/attributes/_boolean.html.haml +8 -6
  16. data/app/views/upmin/partials/attributes/_datetime.html.haml +38 -36
  17. data/app/views/upmin/partials/attributes/_decimal.html.haml +10 -0
  18. data/app/views/upmin/partials/attributes/_float.html.haml +10 -6
  19. data/app/views/upmin/partials/attributes/_integer.html.haml +10 -6
  20. data/app/views/upmin/partials/attributes/_progress_bar.html.haml +1 -0
  21. data/app/views/upmin/partials/attributes/_string.html.haml +17 -6
  22. data/app/views/upmin/partials/attributes/_text.html.haml +8 -6
  23. data/app/views/upmin/partials/attributes/_unknown.html.haml +5 -3
  24. data/app/views/upmin/partials/models/_model.html.haml +18 -46
  25. data/app/views/upmin/partials/models/_new_model.html.haml +9 -31
  26. data/app/views/upmin/partials/parameters/_block_parameter.haml +0 -0
  27. data/app/views/upmin/partials/parameters/_opt_parameter.html.haml +14 -0
  28. data/app/views/upmin/partials/parameters/_req_parameter.html.haml +4 -0
  29. data/app/views/upmin/partials/search_boxes/_ransack_search_box.html.haml +2 -3
  30. data/app/views/upmin/partials/search_results/_results.html.haml +9 -2
  31. data/lib/upmin/action.rb +50 -0
  32. data/lib/upmin/active_record/association.rb +47 -0
  33. data/lib/upmin/active_record/model.rb +54 -0
  34. data/lib/upmin/active_record/query.rb +12 -0
  35. data/lib/upmin/admin.rb +24 -2
  36. data/lib/upmin/association.rb +73 -0
  37. data/lib/upmin/attribute.rb +87 -0
  38. data/lib/upmin/automatic_delegation.rb +76 -0
  39. data/lib/upmin/configuration.rb +103 -0
  40. data/lib/upmin/data_mapper/association.rb +57 -0
  41. data/lib/upmin/data_mapper/model.rb +62 -0
  42. data/lib/upmin/data_mapper/query.rb +57 -0
  43. data/lib/upmin/engine.rb +2 -0
  44. data/lib/upmin/errors.rb +43 -0
  45. data/lib/upmin/model.rb +267 -98
  46. data/lib/upmin/parameter.rb +43 -0
  47. data/lib/upmin/query.rb +51 -0
  48. data/lib/upmin/railtie.rb +11 -1
  49. data/lib/upmin/railties/active_record.rb +5 -50
  50. data/lib/upmin/railties/data_mapper.rb +18 -0
  51. data/lib/upmin/railties/render.rb +34 -98
  52. data/lib/upmin/railties/render_helpers.rb +119 -53
  53. data/lib/upmin/version.rb +1 -1
  54. data/spec/factories/factories.rb +6 -0
  55. data/spec/features/action_spec.rb +39 -46
  56. data/spec/features/edit_model_spec.rb +4 -2
  57. data/spec/features/navbar_spec.rb +48 -0
  58. data/spec/features/new_model_spec.rb +1 -0
  59. data/spec/features/search_spec.rb +7 -4
  60. data/spec/lib/configuration_spec.rb +60 -0
  61. data/spec/spec_helper.rb +14 -8
  62. metadata +25 -7
  63. data/app/assets/javascripts/upmin/moment.js +0 -2856
  64. data/app/helpers/upmin/instances_helper.rb +0 -13
  65. data/app/views/upmin/partials/attributes/_nilable.html.haml +0 -14
  66. data/app/views/upmin/partials/search_results/_result.html.haml +0 -8
  67. data/lib/upmin/klass.rb +0 -170
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43ba30f61892c0d1f5983de9ad8ddc6f09f3b804
4
- data.tar.gz: a3af7bbf0251feec69f0b8c68327bf314a976bfe
3
+ metadata.gz: d17a5316e3ae23cb3bfe9e66d531798356f02ad4
4
+ data.tar.gz: ad0e64565f7304bec6f762db4ea7549dd42cf87b
5
5
  SHA512:
6
- metadata.gz: 329aa9e96c2172c45fc7b130e473d614ccb70452b3f57fb507b5ec231cb3a22528b410dbd6040edb1bff61e62c46f3c9a506a0948966cee5f4abeb0c94f65391
7
- data.tar.gz: d706420835d063d0bac98ca9a3bc7af161a694f23ef6f8b1068d1e416e2cfa4597ad15b9fc9124eb1b8c547901b50738880bc37720165005f46df4d5b217c735
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
- ### Demo Application
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
- Authentication is currently supported with an existing Devise install. Simply use something like this:
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
- authenticate :user, lambda { |u| u.admin? } do
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
- We are currently working on the docs on our [Wiki](https://github.com/upmin/upmin-admin-ruby/wiki), but they are far from complete so if you have any trouble or can't find the documentation to do something please let us know via email - [support@upmin.com](support@upmin.com) or chat with us on [HipChat](http://www.hipchat.com/gvREostp6).
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
- There are a lot of things that need built going forward and we are looking for anyone who wants to get involved. Just hop in our hipchat (link below) or email us (link also below).
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. DataMapper support
60
- 2. Fixing bugs - specifically ones like ActsAsTaggable causing the menu to have far too many models.
61
- 3. Implementing the Dashboard
62
- 4. Adding useful widgets, such as an EasyPost Tracking label widget, a Stripe Card widget, and other commonly used APIs, as well as Map widgets for plotting routes or just showing a location.
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
- The goal of Upmin is to make it easier to build admin pages with minimal effort. With that in mind, we are always looking for feedback and suggestions. You can get in touch several ways.
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
- Email - [support@upmin.com](support@upmin.com)
80
+ GitHub - [Create an Issue](https://github.com/upmin/upmin-admin-ruby/issues)
70
81
 
71
- Chat - [http://www.hipchat.com/gvREostp6](http://www.hipchat.com/gvREostp6)
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
- sh "bundle exec rake railties:install:migrations --quiet"
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
- # Drop and reload spec files
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
- # Drop and reload spec files
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
@@ -13,7 +13,6 @@
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
15
  //= require ./jquery-clockpicker
16
- //= require ./moment
17
16
  //= require ./pikaday
18
17
  //= require ./helpers
19
18
  //= require_tree .
@@ -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 10px 0;
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 :set_method, only: [:action]
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
- instance = @model.instance
30
+ raw_model = @model.model
29
31
 
30
- args = params[@klass.name.underscore]
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 better way to do transforms.
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
- instance.send("#{key}=", nil)
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
- instance.send("#{key}=", value)
44
+ raw_model.send("#{key}=", value)
49
45
  end
50
46
  end
51
47
  end
52
48
 
53
- if instance.save
54
- flash[:notice] = "#{@klass.humanized_name(:singular)} created successfully with id=#{instance.id}."
55
- redirect_to(upmin_model_path(@model.path_hash))
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
- updates.each do |key, value|
70
- # TODO(jon): Figure out a better way to do transforms.
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
- instance.send("#{key}=", nil)
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
- instance.send("#{key}=", value)
73
+ raw_model.send("#{key}=", value)
85
74
  end
86
75
  end
87
76
  end
88
77
 
89
- if instance.save
78
+ if raw_model.save
90
79
  flash[:notice] = "#{@klass.humanized_name(:singular)} updated successfully."
91
- redirect_to(upmin_model_path(@model.path_hash))
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
- # begin
105
- response = @model.perform_action(params[:method], @arguments)
106
- flash[:notice] = "Action successfully performed with a response of: #{response}"
107
- redirect_to(upmin_model_path(@model.path_hash))
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 set_klass
117
- @klass = Upmin::Klass.find(params[:klass])
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.find(params[:id])
124
+ @model = @klass.new(id: params[:id])
123
125
  end
124
126
 
125
- def set_method
126
- @method = params[:method].to_sym
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[@method] || {}
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::Klass.all.each do |m|
12
+ - Upmin::Model.all.each do |m|
13
13
  %li
14
- %a{href: upmin_search_path(klass: m.name)}
15
- = m.name.pluralize
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{:src => "//cdn.jsdelivr.net/bootstrap/3.2.0/js/bootstrap.min.js"}
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.instance.errors.any?
12
+ - if @model.errors.any?
13
13
  %ul
14
- - @model.instance.errors.each do |field, error|
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
- = up_model(@model.instance)
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
- = up_search_results(@q, @results)
6
+ = up_render(@query)
6
7
  %br
7
- = up_paginate(@results)
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
- = up_search_box(@klass)
13
+ = up_render(@klass)
13
14
  .new-button-wrapper
14
- %a.btn.btn-block.btn-success{href: upmin_new_model_path(klass: @klass.name)}
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