sunrise-cms 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/app/controllers/sunrise/manager_controller.rb +4 -4
  2. data/app/helpers/sunrise/structure_helper.rb +1 -1
  3. data/lib/sunrise/abstract_model.rb +2 -3
  4. data/lib/sunrise/config/association.rb +4 -0
  5. data/lib/sunrise/config/model.rb +0 -1
  6. data/lib/sunrise/version.rb +1 -1
  7. data/spec/dummy/log/test.log +2629 -0
  8. data/spec/models/sunrise/abstract_model_spec.rb +1 -1
  9. data/spec/tmp/app/models/defaults/ability.rb +18 -0
  10. data/spec/tmp/app/models/defaults/asset.rb +7 -0
  11. data/spec/tmp/app/models/defaults/attachment_file.rb +5 -0
  12. data/spec/tmp/app/models/defaults/avatar.rb +7 -0
  13. data/spec/tmp/app/models/defaults/picture.rb +7 -0
  14. data/spec/tmp/app/models/defaults/position_type.rb +7 -0
  15. data/spec/tmp/app/models/defaults/role_type.rb +8 -0
  16. data/spec/tmp/app/models/defaults/settings.rb +3 -0
  17. data/spec/tmp/app/models/defaults/structure.rb +9 -0
  18. data/spec/tmp/app/models/defaults/structure_type.rb +9 -0
  19. data/spec/tmp/app/models/defaults/user.rb +13 -0
  20. data/spec/tmp/app/models/sunrise/sunrise_navigation.rb +14 -0
  21. data/spec/tmp/app/models/sunrise/sunrise_page.rb +10 -0
  22. data/spec/tmp/app/models/sunrise/sunrise_structure.rb +35 -0
  23. data/spec/tmp/app/models/sunrise/sunrise_user.rb +50 -0
  24. data/spec/tmp/app/uploaders/attachment_file_uploader.rb +5 -0
  25. data/spec/tmp/app/uploaders/avatar_uploader.rb +15 -0
  26. data/spec/tmp/app/uploaders/picture_uploader.rb +15 -0
  27. data/spec/tmp/app/views/layouts/application.html.erb +22 -0
  28. data/spec/tmp/app/views/pages/show.html.erb +2 -0
  29. data/spec/tmp/app/views/shared/_notice.html.erb +17 -0
  30. data/spec/tmp/config/application.rb +63 -0
  31. data/spec/tmp/config/database.yml.sample +34 -0
  32. data/spec/tmp/config/initializers/sunrise.rb +18 -0
  33. data/spec/tmp/config/logrotate-config.sample +9 -0
  34. data/spec/tmp/config/nginx-config.sample +99 -0
  35. data/spec/tmp/config/routes.rb +9 -0
  36. data/spec/tmp/db/seeds.rb +31 -0
  37. data/spec/tmp/spec/controllers/pages_controller_spec.rb +22 -0
  38. data/spec/tmp/spec/controllers/welcome_controller_spec.rb +18 -0
  39. data/spec/tmp/spec/factories/structure_factory.rb +22 -0
  40. data/spec/tmp/spec/factories/user_factory.rb +61 -0
  41. data/spec/tmp/spec/spec_helper.rb +37 -0
  42. data/spec/tmp/spec/support/helpers/controller_macros.rb +52 -0
  43. metadata +69 -1
@@ -115,7 +115,7 @@ module Sunrise
115
115
  templates << [path, scope, action] if scope
116
116
 
117
117
  if Sunrise::Config.scoped_views?
118
- templates << [path, abstract_model.scoped_path, scope, action]
118
+ templates << [path, abstract_model.plural, scope, action]
119
119
  end
120
120
 
121
121
  templates.reverse.each do |keys|
@@ -129,8 +129,8 @@ module Sunrise
129
129
  templates << [ path, abstract_model.current_list, scope ]
130
130
 
131
131
  if Sunrise::Config.scoped_views?
132
- templates << [ path, abstract_model.scoped_path, scope ]
133
- templates << [ path, abstract_model.scoped_path, abstract_model.current_list, scope ]
132
+ templates << [ path, abstract_model.plural, scope ]
133
+ templates << [ path, abstract_model.plural, abstract_model.current_list, scope ]
134
134
  end
135
135
 
136
136
  templates.reverse.each do |keys|
@@ -155,7 +155,7 @@ module Sunrise
155
155
 
156
156
  def redirect_after_update
157
157
  if abstract_model.without_list?
158
- index_path(:model_name => abstract_model.scoped_path)
158
+ index_path(:model_name => abstract_model.plural)
159
159
  else
160
160
  scoped_index_path
161
161
  end
@@ -12,7 +12,7 @@ module Sunrise
12
12
  end
13
13
 
14
14
  def show_model_path(abstract_model, record)
15
- model_name = abstract_model.scoped_path
15
+ model_name = abstract_model.plural
16
16
 
17
17
  case model_name
18
18
  when :some_collection then index_path(:model_name => :stores, :parent_type => :some_collection, :parent_id => record.id)
@@ -44,7 +44,7 @@ module Sunrise
44
44
  end
45
45
  end
46
46
 
47
- attr_accessor :model_name, :current_list, :sort_column, :scoped_path, :available_list_view
47
+ attr_accessor :model_name, :current_list, :sort_column, :available_list_view
48
48
 
49
49
  delegate :config, :model, :to => 'self.class'
50
50
  delegate :label, :to => 'self.class.config'
@@ -55,7 +55,6 @@ module Sunrise
55
55
  @current_list = config.default_list_view
56
56
  @available_list_view = config.available_list_view
57
57
  @sort_column = config.sort_column
58
- @scoped_path = @model_name.plural
59
58
  @request_params = params.symbolize_keys
60
59
  self.current_list = params[:view]
61
60
  end
@@ -190,7 +189,7 @@ module Sunrise
190
189
 
191
190
  def association_scope
192
191
  if parent_record
193
- parent_record.send(@scoped_path).scoped
192
+ parent_record.send(parent_association.relation_name).scoped
194
193
  end
195
194
  end
196
195
 
@@ -16,6 +16,10 @@ module Sunrise
16
16
  def is_this?(model_type)
17
17
  name.to_s.downcase == model_type.to_s.downcase
18
18
  end
19
+
20
+ def relation_name
21
+ @relation_name ||= (@config_options[:relation_name] || abstract_model.model.model_name.plural)
22
+ end
19
23
  end
20
24
  end
21
25
  end
@@ -10,7 +10,6 @@ module Sunrise
10
10
  class Model < Base
11
11
  attr_reader :sections
12
12
 
13
-
14
13
  def initialize(abstract_model, parent = nil, options = nil)
15
14
  super
16
15
  @sections ||= {}
@@ -1,3 +1,3 @@
1
1
  module Sunrise
2
- VERSION = "0.5.1".freeze
2
+ VERSION = "0.5.2".freeze
3
3
  end