kuhsaft 0.3.1 → 0.3.2

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.
Files changed (32) hide show
  1. data/CHANGELOG.md +60 -2
  2. data/README.md +0 -5
  3. data/app/assets/stylesheets/kuhsaft/cms/partials/_generic.sass +18 -14
  4. data/app/assets/stylesheets/kuhsaft/cms/partials/_simple_form.sass +2 -2
  5. data/app/controllers/kuhsaft/pages_controller.rb +9 -1
  6. data/app/helpers/cms_helper.rb +10 -0
  7. data/app/views/kuhsaft/cms/pages/new.html.haml +4 -0
  8. data/app/views/layouts/kuhsaft/admin.html.haml +1 -0
  9. data/config/initializers/page_parts.rb +1 -0
  10. data/config/locales/kuhsaft.en.yml +3 -0
  11. data/kuhsaft.gemspec +9 -11
  12. data/lib/kuhsaft/version.rb +1 -1
  13. data/spec/controllers/pages_controller_spec.rb +10 -3
  14. data/spec/dummy/app/assets/images/rails.png +0 -0
  15. data/spec/dummy/app/assets/images/spec-image.png +0 -0
  16. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  17. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  18. data/spec/dummy/app/views/layouts/application.html.erb +3 -2
  19. data/spec/dummy/config/application.rb +14 -11
  20. data/spec/dummy/config/boot.rb +2 -3
  21. data/spec/dummy/config/environments/development.rb +7 -3
  22. data/spec/dummy/config/environments/production.rb +23 -12
  23. data/spec/dummy/config/environments/test.rb +8 -1
  24. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  25. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  26. data/spec/dummy/lib/assets/.gitkeep +0 -0
  27. data/spec/dummy/lib/tasks/.gitkeep +0 -0
  28. data/spec/dummy/log/.gitkeep +0 -0
  29. data/spec/factories.rb +1 -1
  30. data/spec/helpers/cms_helper_spec.rb +22 -0
  31. data/spec/models/asset_spec.rb +1 -1
  32. metadata +68 -81
@@ -1,4 +1,4 @@
1
- ## Master
1
+ ## master
2
2
 
3
3
  ### Bug fixes
4
4
 
@@ -6,13 +6,71 @@
6
6
 
7
7
  ### New features
8
8
 
9
+ ## 0.3.2 - September 15, 2011
10
+
11
+ *Development of Kuhsaft for Rails 3.1 moved to master, rails30 will
12
+ maintain rails 3.0 compatibility*
13
+
14
+ ### Bug fixes
15
+
16
+ - fix asset pipeline compatibility when in production ([@effkay][])
17
+
18
+ ### Improvements
19
+
20
+ - fix README on how to integrate devise ([@effkay][])
21
+
22
+
23
+ ## 0.2.5 - August 29, 2011
24
+
25
+ ### Bug fixes
26
+
27
+ - fix a bug where virtual page tree wasn't available ([@manufaktor][])
28
+
29
+ ## 0.2.4 - August 29, 2011
30
+
31
+ ### Improvements
32
+
33
+ - handle 404s with an ActionController::RoutingError, controllers can optionally implement a `handle_404` method to change behavior ([@manufaktor][])
34
+ - Backend now shows the hierarchy breadcrumb when creating a new page ([@manufaktor][])
35
+
36
+ ## 0.2.3 - August 19, 2011
37
+
38
+ ### Bug fixes
39
+
40
+ - update gem versions of dependencies, because some contain bugfixes (linecache, carrierwave) ([@manufaktor][])
41
+
42
+ ## 0.3.1 - August 9, 2011
43
+
44
+ ### Bug fixes
45
+
46
+ - fix image paths and update readme concerning asset pipeline ([@effkay][])
47
+
48
+ ### Improvements
49
+
50
+ - we have a changelog now! ([@effkay][])
51
+
9
52
  ## 0.3.0 - August 8, 2011
10
53
 
11
54
  ### Improvements
12
55
 
13
- - moved assets to a rails 3.1 compatible location. ([@effkay][])
56
+ - moved assets to a rails 3.1 compatible location ([@effkay][])
57
+
58
+ ## 0.2.2 - August 5, 2011
59
+
60
+ ### Bug fixes
61
+
62
+ - `params[:locale]` is now recognized by the PagesController ([@manufaktor][])
63
+
64
+ ### Improvements
65
+
66
+ - Lots of styling improvements for the backend ([@iphilgood][] & [melinda][])
67
+ - Formatted Text textareas now resize smartly according to its content ([@iphilgood][] & [melinda][])
68
+ - Added specific delete messages for pages and assets ([@manufaktor][])
69
+ - Updated to latest UJS Jquery ([@manufaktor][])
70
+ - Backend recognizes a current_user and will display a logout possibility ([@iphilgood][])
14
71
 
15
72
  [@manufaktor]: https://github.com/manufaktor
16
73
  [@effkay]: https://github.com/effkay
17
74
  [@iphilgood]: https://github.com/iphilgood
75
+ [@tscholz]: https://github.com/tscholz
18
76
  [melinda]: http://www.melinda-lini.de/
data/README.md CHANGED
@@ -43,11 +43,6 @@ If you are upgrading, run those installers again and hopefully we will generate
43
43
 
44
44
  (NOTE: Steps below should hopefully not be necessary in future versions:)
45
45
 
46
- In order to load the engine's assets you need to require them in your
47
- application.css:
48
-
49
- //= require kuhsaft
50
-
51
46
  Finally, you need to add a before filter to the application controller (for now...)
52
47
 
53
48
  ApplicationController < ActionController::Base
@@ -11,7 +11,7 @@ body
11
11
  background: #cccccb
12
12
 
13
13
  #kuhsaft-wrapper
14
- //background: #e9e9e9 url(/assets/kuhsaft/wrapper-bg.png) repeat-x left 100px
14
+ //background: #e9e9e9 image_url('kuhsaft/wrapper-bg.png') repeat-x left 100px
15
15
  width: 960px
16
16
  margin: 0 auto
17
17
 
@@ -19,7 +19,7 @@ body
19
19
  display: none
20
20
 
21
21
  .cms-header
22
- background: url(/assets/kuhsaft/header-bg.jpg)
22
+ background: image_url('kuhsaft/header-bg.jpg')
23
23
  border-bottom: 1px solid #cccccb
24
24
  +min-height(150px)
25
25
 
@@ -34,11 +34,11 @@ body
34
34
 
35
35
  .page-tree-breadcrumb
36
36
  margin-bottom: 20px
37
- background: url(/assets/kuhsaft/pages-breadcrumb-icon.png) no-repeat left 5px
37
+ background: image_url('kuhsaft/pages-breadcrumb-icon.png') no-repeat left 5px
38
38
  padding-left: 18px
39
39
 
40
40
  a
41
- background: url(/assets/kuhsaft/page-tree-breadcrumb-arrow.png) no-repeat right center
41
+ background: image_url('kuhsaft/page-tree-breadcrumb-arrow.png') no-repeat right center
42
42
  padding-right: 15px
43
43
 
44
44
  a:last-child
@@ -65,7 +65,7 @@ body
65
65
  li.current
66
66
  border-left: 1px solid #7c7a7f
67
67
  a
68
- background: #cccccb url(/assets/kuhsaft/module-nav-tab-bg.png) repeat-x
68
+ background: #cccccb image_url('kuhsaft/module-nav-tab-bg.png') repeat-x
69
69
  border-left: 1px solid #e6e6e6
70
70
  +text-shadow(#efefef, 0px, 1px, 0px)
71
71
  +link-colors($color1, $color2, $color1, $color1, $color1)
@@ -76,7 +76,7 @@ body
76
76
  .language-tabs
77
77
  border:
78
78
  bottom: 1px solid #cfcfcf
79
- background: #e3e3e3 url(/assets/kuhsaft/tab-bg.png) repeat-x
79
+ background: #e3e3e3 image_url('kuhsaft/tab-bg.png') repeat-x
80
80
  height: 40px
81
81
 
82
82
  li
@@ -130,6 +130,10 @@ body
130
130
 
131
131
  .colored-box
132
132
  background: $color3
133
+ border:
134
+ left: 1px solid $color3
135
+ right: 1px solid $color3
136
+ bottom: 1px solid $color3
133
137
  @extend .box
134
138
 
135
139
  .draggable-box
@@ -147,10 +151,10 @@ h1
147
151
  color: #858592
148
152
 
149
153
  .new-page
150
- background: url(/assets/kuhsaft/page-new-icon.png) no-repeat left 3px
154
+ background: image_url('kuhsaft/page-new-icon.png') no-repeat left 3px
151
155
 
152
156
  .edit-page
153
- background: url(/assets/kuhsaft/page-edit-icon.png) no-repeat left 7px
157
+ background: image_url('kuhsaft/page-edit-icon.png') no-repeat left 7px
154
158
 
155
159
  a
156
160
  text-decoration: none
@@ -289,12 +293,12 @@ ul.pages-root
289
293
  left: 1px solid #b2b2b2
290
294
 
291
295
  .icon.add-child-page
292
- background: url(/assets/kuhsaft/add-child-page.png) no-repeat center center
296
+ background: image_url('kuhsaft/add-child-page.png') no-repeat center center
293
297
  width: 28px
294
298
  border-right: 0px
295
299
 
296
300
  .icon.delete
297
- background: url(/assets/kuhsaft/delete.png) no-repeat center center
301
+ background: image_url('kuhsaft/delete.png') no-repeat center center
298
302
  width: 22px
299
303
  border-left: 0px
300
304
 
@@ -307,14 +311,14 @@ ul.pages-root
307
311
  +float_right
308
312
 
309
313
  .drag-handler
310
- background: $color3 url(/assets/kuhsaft/page-part-draggable-area.png) no-repeat top right
314
+ background: $color3 image_url('kuhsaft/page-part-draggable-area.png') no-repeat top right
311
315
  width: 91px
312
316
  height: 22px
313
317
  margin: 0px 7px 0px 0px
314
318
  float: right
315
- cursor: url(/assets/kuhsaft/openhand.cur), default !important
319
+ cursor: image_url('kuhsaft/openhand.cur'), default !important
316
320
  &:active
317
- cursor: url(/assets/kuhsaft/closedhand.cur), default !important
321
+ cursor: image_url('kuhsaft/closedhand.cur'), default !important
318
322
 
319
323
  .destroy-handler
320
324
  text-align: right
@@ -324,7 +328,7 @@ ul.pages-root
324
328
  +float_right
325
329
 
326
330
  .will-drag
327
- border: 1px solid #666
331
+ border: 1px solid #666 !important
328
332
  +single-box-shadow(rgba(0,0,0,0.2), 0px, 5px, 20px)
329
333
 
330
334
  .container
@@ -44,10 +44,10 @@ select
44
44
  .toggle
45
45
  color: $color1
46
46
  padding-left: 20px
47
- background: url(/assets/kuhsaft/toggle-arrow-open.png) no-repeat left center
47
+ background: image_url('kuhsaft/toggle-arrow-open.png') no-repeat left center
48
48
 
49
49
  .toggle.closed
50
- background: url(/assets/kuhsaft/toggle-arrow-closed.png) no-repeat left center
50
+ background: image_url('kuhsaft/toggle-arrow-closed.png') no-repeat left center
51
51
 
52
52
  #kuhsaft_page_page_part_type
53
53
  +float_left
@@ -6,7 +6,15 @@ module Kuhsaft
6
6
 
7
7
  def show
8
8
  @page = Kuhsaft::Page.find_by_url(params[:url])
9
- respond_with @page
9
+ if @page.present?
10
+ respond_with @page
11
+ else
12
+ if respond_to?(:handle_404)
13
+ handle_404
14
+ else
15
+ raise ActionController::RoutingError.new('Not Found')
16
+ end
17
+ end
10
18
  end
11
19
 
12
20
  private
@@ -2,4 +2,14 @@ module CmsHelper
2
2
  def admin_tab title, path
3
3
  content_tag :li, link_to(title, path), :class => (:current if request.path.include?(path))
4
4
  end
5
+
6
+ def available_parent_pages
7
+ pages = []
8
+ pages << { :title => t('kuhsaft.cms.pages.new.pages'), :link => cms_pages_path(:locale => :en) }
9
+ if params[:parent_id].present?
10
+ parent_page = Kuhsaft::Page.find(params[:parent_id])
11
+ pages += parent_page.parent_pages
12
+ end
13
+ pages << { :title => t('kuhsaft.cms.pages.new.new_page'), :link => '#' }
14
+ end
5
15
  end
@@ -2,5 +2,9 @@
2
2
  - Kuhsaft::Page.translation_locales.each do |locale|
3
3
  %li{ :class => (:current if params[:locale] == locale.to_s) }= link_to locale.to_s, new_cms_page_path(:locale => locale)
4
4
 
5
+ .page-tree-breadcrumb
6
+ - available_parent_pages.each do |parent_page|
7
+ = link_to((parent_page[:title].presence || parent_page.title), parent_page[:link].presence || edit_cms_page_path(parent_page))
8
+
5
9
  .box-container
6
10
  = render :partial => 'form', :locals => { :url => cms_pages_path, :page_title => t('.new') }
@@ -2,6 +2,7 @@
2
2
  %html
3
3
  %head
4
4
  = stylesheet_link_tag 'kuhsaft/cms/screen.css', :media => 'screen, projection'
5
+ = stylesheet_link_tag 'cms/application.css', :media => 'screen, projection'
5
6
  = javascript_include_tag 'kuhsaft/cms/jquery.min.js'
6
7
  = javascript_include_tag 'kuhsaft/cms/jquery-ui-1.8.12.custom.min.js'
7
8
  = javascript_include_tag 'kuhsaft/cms/jquery_ujs.js'
@@ -1,6 +1,7 @@
1
1
  Dir.glob("#{Kuhsaft::Engine.root}/app/models/kuhsaft/page_part/*.rb").sort.each { |file| require file }
2
2
 
3
3
  # https://rails.lighthouseapp.com/projects/8994/tickets/6306-collection-associations-build-method-not-supported-for-sti
4
+ # updated: https://github.com/rails/rails/issues/815
4
5
 
5
6
  class ActiveRecord::Reflection::AssociationReflection
6
7
  def build_association(*opts)
@@ -1,4 +1,5 @@
1
1
  en:
2
+ 404: '404, Page not found'
2
3
  layouts:
3
4
  kuhsaft:
4
5
  admin:
@@ -13,8 +14,10 @@ en:
13
14
  create: 'Create new page'
14
15
  new:
15
16
  new: 'Creating new page'
17
+ pages: 'Pages'
16
18
  edit:
17
19
  edit_html: 'Editing page: <span>%{title}</span>'
20
+ pages: 'Pages'
18
21
  branch:
19
22
  add: 'Add page'
20
23
  create: 'Create new page'
@@ -18,24 +18,22 @@ Gem::Specification.new do |s|
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
-
22
- s.add_development_dependency 'rspec-rails'
21
+
22
+ s.add_development_dependency 'rspec-rails', '>= 2.6'
23
23
  s.add_development_dependency 'factory_girl_rails'
24
24
  s.add_development_dependency 'capybara', '>= 0.4.0'
25
- s.add_development_dependency 'ruby-debug'
26
- s.add_development_dependency 'sqlite3-ruby', '1.2.5'
27
- s.add_development_dependency 'guard'
25
+ s.add_development_dependency 'sqlite3'
26
+ s.add_development_dependency 'guard', '>= 0.6'
28
27
  s.add_development_dependency 'guard-spork'
29
28
  s.add_development_dependency 'guard-rspec'
30
29
  s.add_development_dependency 'growl'
31
- s.add_development_dependency 'linecache', '0.42'
32
30
 
33
- s.add_dependency 'rails', '~>3.0'
31
+ s.add_dependency 'rails', '~>3.1'
34
32
  s.add_dependency 'haml', '~> 3.1'
35
33
  s.add_dependency 'compass', '>= 0.11.1'
36
- s.add_dependency 'simple_form'
37
- s.add_dependency 'carrierwave', '0.5.2'
34
+ s.add_dependency 'simple_form', '>= 1.4'
35
+ s.add_dependency 'carrierwave', '>= 0.5.7'
38
36
  s.add_dependency 'rmagick', '2.12.2'
39
- s.add_dependency 'rdiscount'
40
- s.add_dependency 'acts-as-taggable-on', '2.0.6'
37
+ s.add_dependency 'rdiscount', '>= 1.6'
38
+ s.add_dependency 'acts-as-taggable-on', '>= 2.0.6'
41
39
  end
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -5,8 +5,8 @@ describe Kuhsaft::PagesController do
5
5
 
6
6
  before do
7
7
  set_lang :en
8
- # create page with slug=english-title
9
- @page = Factory.create :page
8
+ # create page with slug=english-title-1
9
+ @page = Factory(:page)
10
10
  end
11
11
 
12
12
  after do
@@ -16,8 +16,15 @@ describe Kuhsaft::PagesController do
16
16
 
17
17
  describe 'should render successfully' do
18
18
  it '#show' do
19
- get :show, :locale => 'en', :url => '/english-title'
19
+ get :show, :locale => 'en', :url => 'english-title-1'
20
+ response.response_code.should eq(200)
20
21
  response.should be_success
21
22
  end
22
23
  end
24
+
25
+ describe 'should render 404' do
26
+ it 'should raise RoutingError by default' do
27
+ expect{ get :show, :locale => 'en', :url => '/i-dont-know' }.to raise_error(ActionController::RoutingError)
28
+ end
29
+ end
23
30
  end
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_tree .
@@ -0,0 +1,7 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree .
7
+ */
@@ -2,8 +2,9 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Dummy</title>
5
- <%= stylesheet_link_tag :all %>
6
- <%= csrf_meta_tag %>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
7
8
  </head>
8
9
  <body>
9
10
 
@@ -1,13 +1,13 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require "active_model/railtie"
4
- require "active_record/railtie"
5
- require "action_controller/railtie"
6
- require "action_view/railtie"
7
- require "action_mailer/railtie"
3
+ require 'rails/all'
8
4
 
9
- Bundler.require
10
- require "kuhsaft"
5
+ if defined?(Bundler)
6
+ # If you precompile assets before deploying to production, use this line
7
+ Bundler.require *Rails.groups(:assets => %w(development test))
8
+ # If you want your assets lazily compiled in production, use this line
9
+ # Bundler.require(:default, :assets, Rails.env)
10
+ end
11
11
 
12
12
  module Dummy
13
13
  class Application < Rails::Application
@@ -33,13 +33,16 @@ module Dummy
33
33
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
34
  # config.i18n.default_locale = :de
35
35
 
36
- # JavaScript files you want as :defaults (application.js is always included).
37
- # config.action_view.javascript_expansions[:defaults] = %w()
38
-
39
36
  # Configure the default encoding used in templates for Ruby 1.9.
40
37
  config.encoding = "utf-8"
41
38
 
42
39
  # Configure sensitive parameters which will be filtered from the log file.
43
40
  config.filter_parameters += [:password]
41
+
42
+ # Enable the asset pipeline
43
+ config.assets.enabled = true
44
+
45
+ # Version of your assets, change this if you want to expire all your assets
46
+ config.assets.version = '1.0'
44
47
  end
45
- end
48
+ end
@@ -3,8 +3,7 @@ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
3
 
4
4
  if File.exist?(gemfile)
5
5
  ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
6
+ require 'bundler/setup'
8
7
  end
9
8
 
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
9
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -3,7 +3,7 @@ Dummy::Application.configure do
3
3
 
4
4
  # In the development environment your application's code is reloaded on
5
5
  # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the webserver when you make code changes.
6
+ # since you don't have to restart the web server when you make code changes.
7
7
  config.cache_classes = false
8
8
 
9
9
  # Log error messages when you accidentally call methods on nil.
@@ -11,7 +11,6 @@ Dummy::Application.configure do
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
14
- config.action_view.debug_rjs = true
15
14
  config.action_controller.perform_caching = false
16
15
 
17
16
  # Don't care if the mailer can't send
@@ -22,5 +21,10 @@ Dummy::Application.configure do
22
21
 
23
22
  # Only use best-standards-support built into browsers
24
23
  config.action_dispatch.best_standards_support = :builtin
25
- end
26
24
 
25
+ # Do not compress assets
26
+ config.assets.compress = false
27
+
28
+ # Expands the lines which load the assets
29
+ config.assets.debug = true
30
+ end
@@ -1,7 +1,6 @@
1
1
  Dummy::Application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
- # The production environment is meant for finished, "live" apps.
5
4
  # Code is not reloaded between requests
6
5
  config.cache_classes = true
7
6
 
@@ -9,14 +8,27 @@ Dummy::Application.configure do
9
8
  config.consider_all_requests_local = false
10
9
  config.action_controller.perform_caching = true
11
10
 
12
- # Specifies the header that your server uses for sending files
13
- config.action_dispatch.x_sendfile_header = "X-Sendfile"
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
14
22
 
15
- # For nginx:
16
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
23
+ # Defaults to Rails.root.join("public/assets")
24
+ # config.assets.manifest = YOUR_PATH
17
25
 
18
- # If you have no front-end server that supports something like X-Sendfile,
19
- # just comment this out and Rails will serve the files
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
20
32
 
21
33
  # See everything in the log (default is :info)
22
34
  # config.log_level = :debug
@@ -27,13 +39,12 @@ Dummy::Application.configure do
27
39
  # Use a different cache store in production
28
40
  # config.cache_store = :mem_cache_store
29
41
 
30
- # Disable Rails's static asset server
31
- # In production, Apache or nginx will already do this
32
- config.serve_static_assets = false
33
-
34
- # Enable serving of images, stylesheets, and javascripts from an asset server
42
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
35
43
  # config.action_controller.asset_host = "http://assets.example.com"
36
44
 
45
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46
+ # config.assets.precompile += %w( search.js )
47
+
37
48
  # Disable delivery errors, bad email addresses will be ignored
38
49
  # config.action_mailer.raise_delivery_errors = false
39
50
 
@@ -7,7 +7,11 @@ Dummy::Application.configure do
7
7
  # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
- # Log error messages when you accidentally call methods on nil.
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
11
15
  config.whiny_nils = true
12
16
 
13
17
  # Show full error reports and disable caching
@@ -32,4 +36,7 @@ Dummy::Application.configure do
32
36
 
33
37
  # Print deprecation notices to the stderr
34
38
  config.active_support.deprecation = :stderr
39
+
40
+ # Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
41
+ config.assets.allow_debugging = true
35
42
  end
@@ -4,4 +4,4 @@
4
4
  # If you change this key, all old signed cookies will become invalid!
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = 'e858af03f4de97209019c290429a4521b2cdd2ad0468f2fb3a89f8dca4be149148701c4a297af75a580b05b0102270b2a80874ddc62302bc06058f46ad822b66'
7
+ Dummy::Application.config.secret_token = '0d5c3beaf628d165c2d8241c7a09690eb1a25e5d03829f090b43a23783ea0c7596b6aed009f996a37911532f60831363719babc47ffdf3cc2632784879f9164b'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters :format => [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
File without changes
File without changes
File without changes
@@ -15,7 +15,7 @@ Factory.define :page, :class => Kuhsaft::Page do |p|
15
15
  end
16
16
 
17
17
  Factory.define :asset, :class => Kuhsaft::Asset do |a|
18
- a.file File.open("#{Kuhsaft::Engine.root}/spec/dummy/public/images/spec-image.png")
18
+ a.file File.open("#{Kuhsaft::Engine.root}/spec/dummy/app/assets/images/spec-image.png")
19
19
  end
20
20
 
21
21
  Factory.sequence(:title) { |n| n }
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe CmsHelper do
4
+ context 'when the user creates a toplevel page' do
5
+ describe '#available_parent_pages' do
6
+ it 'should return the 2 pages' do
7
+ helper.available_parent_pages.should have(2).pages
8
+ end
9
+ end
10
+ end
11
+
12
+ describe '#available_parent_pages' do
13
+ before do
14
+ page1, page2, page3 = create_page_tree
15
+ helper.stub!(:params).and_return(:parent_id => page3.id)
16
+ end
17
+
18
+ it 'should return the parent pages' do
19
+ helper.available_parent_pages.should have_at_least(3).pages
20
+ end
21
+ end
22
+ end
@@ -5,7 +5,7 @@ describe Kuhsaft::Asset do
5
5
  Kuhsaft::AssetUploader.enable_processing = true
6
6
  @asset = Factory(:asset)
7
7
  @uploader = Kuhsaft::AssetUploader.new(@asset, :file)
8
- @uploader.store!(File.open(File.join(Kuhsaft::Engine.root, 'spec', 'dummy', 'public', 'images', 'spec-image.png')))
8
+ @uploader.store!(File.open(File.join(Kuhsaft::Engine.root, 'spec', 'dummy', 'app', 'assets', 'images', 'spec-image.png')))
9
9
  end
10
10
 
11
11
  after do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuhsaft
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Immanuel H\xC3\xA4ussermann"
@@ -17,8 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-08-09 00:00:00 +02:00
21
- default_executable:
20
+ date: 2011-09-15 00:00:00 Z
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
24
23
  name: rspec-rails
@@ -28,10 +27,11 @@ dependencies:
28
27
  requirements:
29
28
  - - ">="
30
29
  - !ruby/object:Gem::Version
31
- hash: 3
30
+ hash: 15
32
31
  segments:
33
- - 0
34
- version: "0"
32
+ - 2
33
+ - 6
34
+ version: "2.6"
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
@@ -65,7 +65,7 @@ dependencies:
65
65
  type: :development
66
66
  version_requirements: *id003
67
67
  - !ruby/object:Gem::Dependency
68
- name: ruby-debug
68
+ name: sqlite3
69
69
  prerelease: false
70
70
  requirement: &id004 !ruby/object:Gem::Requirement
71
71
  none: false
@@ -79,23 +79,22 @@ dependencies:
79
79
  type: :development
80
80
  version_requirements: *id004
81
81
  - !ruby/object:Gem::Dependency
82
- name: sqlite3-ruby
82
+ name: guard
83
83
  prerelease: false
84
84
  requirement: &id005 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
- - - "="
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- hash: 21
89
+ hash: 7
90
90
  segments:
91
- - 1
92
- - 2
93
- - 5
94
- version: 1.2.5
91
+ - 0
92
+ - 6
93
+ version: "0.6"
95
94
  type: :development
96
95
  version_requirements: *id005
97
96
  - !ruby/object:Gem::Dependency
98
- name: guard
97
+ name: guard-spork
99
98
  prerelease: false
100
99
  requirement: &id006 !ruby/object:Gem::Requirement
101
100
  none: false
@@ -109,7 +108,7 @@ dependencies:
109
108
  type: :development
110
109
  version_requirements: *id006
111
110
  - !ruby/object:Gem::Dependency
112
- name: guard-spork
111
+ name: guard-rspec
113
112
  prerelease: false
114
113
  requirement: &id007 !ruby/object:Gem::Requirement
115
114
  none: false
@@ -123,7 +122,7 @@ dependencies:
123
122
  type: :development
124
123
  version_requirements: *id007
125
124
  - !ruby/object:Gem::Dependency
126
- name: guard-rspec
125
+ name: growl
127
126
  prerelease: false
128
127
  requirement: &id008 !ruby/object:Gem::Requirement
129
128
  none: false
@@ -136,54 +135,25 @@ dependencies:
136
135
  version: "0"
137
136
  type: :development
138
137
  version_requirements: *id008
139
- - !ruby/object:Gem::Dependency
140
- name: growl
141
- prerelease: false
142
- requirement: &id009 !ruby/object:Gem::Requirement
143
- none: false
144
- requirements:
145
- - - ">="
146
- - !ruby/object:Gem::Version
147
- hash: 3
148
- segments:
149
- - 0
150
- version: "0"
151
- type: :development
152
- version_requirements: *id009
153
- - !ruby/object:Gem::Dependency
154
- name: linecache
155
- prerelease: false
156
- requirement: &id010 !ruby/object:Gem::Requirement
157
- none: false
158
- requirements:
159
- - - "="
160
- - !ruby/object:Gem::Version
161
- hash: 95
162
- segments:
163
- - 0
164
- - 42
165
- version: "0.42"
166
- type: :development
167
- version_requirements: *id010
168
138
  - !ruby/object:Gem::Dependency
169
139
  name: rails
170
140
  prerelease: false
171
- requirement: &id011 !ruby/object:Gem::Requirement
141
+ requirement: &id009 !ruby/object:Gem::Requirement
172
142
  none: false
173
143
  requirements:
174
144
  - - ~>
175
145
  - !ruby/object:Gem::Version
176
- hash: 7
146
+ hash: 5
177
147
  segments:
178
148
  - 3
179
- - 0
180
- version: "3.0"
149
+ - 1
150
+ version: "3.1"
181
151
  type: :runtime
182
- version_requirements: *id011
152
+ version_requirements: *id009
183
153
  - !ruby/object:Gem::Dependency
184
154
  name: haml
185
155
  prerelease: false
186
- requirement: &id012 !ruby/object:Gem::Requirement
156
+ requirement: &id010 !ruby/object:Gem::Requirement
187
157
  none: false
188
158
  requirements:
189
159
  - - ~>
@@ -194,11 +164,11 @@ dependencies:
194
164
  - 1
195
165
  version: "3.1"
196
166
  type: :runtime
197
- version_requirements: *id012
167
+ version_requirements: *id010
198
168
  - !ruby/object:Gem::Dependency
199
169
  name: compass
200
170
  prerelease: false
201
- requirement: &id013 !ruby/object:Gem::Requirement
171
+ requirement: &id011 !ruby/object:Gem::Requirement
202
172
  none: false
203
173
  requirements:
204
174
  - - ">="
@@ -210,41 +180,42 @@ dependencies:
210
180
  - 1
211
181
  version: 0.11.1
212
182
  type: :runtime
213
- version_requirements: *id013
183
+ version_requirements: *id011
214
184
  - !ruby/object:Gem::Dependency
215
185
  name: simple_form
216
186
  prerelease: false
217
- requirement: &id014 !ruby/object:Gem::Requirement
187
+ requirement: &id012 !ruby/object:Gem::Requirement
218
188
  none: false
219
189
  requirements:
220
190
  - - ">="
221
191
  - !ruby/object:Gem::Version
222
- hash: 3
192
+ hash: 7
223
193
  segments:
224
- - 0
225
- version: "0"
194
+ - 1
195
+ - 4
196
+ version: "1.4"
226
197
  type: :runtime
227
- version_requirements: *id014
198
+ version_requirements: *id012
228
199
  - !ruby/object:Gem::Dependency
229
200
  name: carrierwave
230
201
  prerelease: false
231
- requirement: &id015 !ruby/object:Gem::Requirement
202
+ requirement: &id013 !ruby/object:Gem::Requirement
232
203
  none: false
233
204
  requirements:
234
- - - "="
205
+ - - ">="
235
206
  - !ruby/object:Gem::Version
236
- hash: 15
207
+ hash: 5
237
208
  segments:
238
209
  - 0
239
210
  - 5
240
- - 2
241
- version: 0.5.2
211
+ - 7
212
+ version: 0.5.7
242
213
  type: :runtime
243
- version_requirements: *id015
214
+ version_requirements: *id013
244
215
  - !ruby/object:Gem::Dependency
245
216
  name: rmagick
246
217
  prerelease: false
247
- requirement: &id016 !ruby/object:Gem::Requirement
218
+ requirement: &id014 !ruby/object:Gem::Requirement
248
219
  none: false
249
220
  requirements:
250
221
  - - "="
@@ -256,28 +227,29 @@ dependencies:
256
227
  - 2
257
228
  version: 2.12.2
258
229
  type: :runtime
259
- version_requirements: *id016
230
+ version_requirements: *id014
260
231
  - !ruby/object:Gem::Dependency
261
232
  name: rdiscount
262
233
  prerelease: false
263
- requirement: &id017 !ruby/object:Gem::Requirement
234
+ requirement: &id015 !ruby/object:Gem::Requirement
264
235
  none: false
265
236
  requirements:
266
237
  - - ">="
267
238
  - !ruby/object:Gem::Version
268
239
  hash: 3
269
240
  segments:
270
- - 0
271
- version: "0"
241
+ - 1
242
+ - 6
243
+ version: "1.6"
272
244
  type: :runtime
273
- version_requirements: *id017
245
+ version_requirements: *id015
274
246
  - !ruby/object:Gem::Dependency
275
247
  name: acts-as-taggable-on
276
248
  prerelease: false
277
- requirement: &id018 !ruby/object:Gem::Requirement
249
+ requirement: &id016 !ruby/object:Gem::Requirement
278
250
  none: false
279
251
  requirements:
280
- - - "="
252
+ - - ">="
281
253
  - !ruby/object:Gem::Version
282
254
  hash: 3
283
255
  segments:
@@ -286,7 +258,7 @@ dependencies:
286
258
  - 6
287
259
  version: 2.0.6
288
260
  type: :runtime
289
- version_requirements: *id018
261
+ version_requirements: *id016
290
262
  description: Kuhsaft is a Rails engine that offers a simple CMS.
291
263
  email: developers@screenconcept.ch
292
264
  executables: []
@@ -396,6 +368,10 @@ files:
396
368
  - spec/controllers/page_parts_controller_spec.rb
397
369
  - spec/controllers/pages_controller_spec.rb
398
370
  - spec/dummy/Rakefile
371
+ - spec/dummy/app/assets/images/rails.png
372
+ - spec/dummy/app/assets/images/spec-image.png
373
+ - spec/dummy/app/assets/javascripts/application.js
374
+ - spec/dummy/app/assets/stylesheets/application.css
399
375
  - spec/dummy/app/controllers/application_controller.rb
400
376
  - spec/dummy/app/helpers/application_helper.rb
401
377
  - spec/dummy/app/views/layouts/application.html.erb
@@ -412,17 +388,21 @@ files:
412
388
  - spec/dummy/config/initializers/mime_types.rb
413
389
  - spec/dummy/config/initializers/secret_token.rb
414
390
  - spec/dummy/config/initializers/session_store.rb
391
+ - spec/dummy/config/initializers/wrap_parameters.rb
415
392
  - spec/dummy/config/locales/en.yml
416
393
  - spec/dummy/config/routes.rb
417
394
  - spec/dummy/db/migrate/.gitkeep
395
+ - spec/dummy/lib/assets/.gitkeep
396
+ - spec/dummy/lib/tasks/.gitkeep
397
+ - spec/dummy/log/.gitkeep
418
398
  - spec/dummy/public/404.html
419
399
  - spec/dummy/public/422.html
420
400
  - spec/dummy/public/500.html
421
401
  - spec/dummy/public/favicon.ico
422
- - spec/dummy/public/images/spec-image.png
423
402
  - spec/dummy/public/stylesheets/.gitkeep
424
403
  - spec/dummy/script/rails
425
404
  - spec/factories.rb
405
+ - spec/helpers/cms_helper_spec.rb
426
406
  - spec/helpers/pages_helper_spec.rb
427
407
  - spec/integration/navigation_spec.rb
428
408
  - spec/kuhsaft_spec.rb
@@ -438,7 +418,6 @@ files:
438
418
  - spec/routing/pages_routing_spec.rb
439
419
  - spec/spec_helper.rb
440
420
  - spec/support/kuhsaft_spec_helper.rb
441
- has_rdoc: true
442
421
  homepage: http://github.com/screenconcept/kuhsaft
443
422
  licenses: []
444
423
 
@@ -468,7 +447,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
468
447
  requirements: []
469
448
 
470
449
  rubyforge_project: kuhsaft
471
- rubygems_version: 1.6.1
450
+ rubygems_version: 1.8.10
472
451
  signing_key:
473
452
  specification_version: 3
474
453
  summary: A tool that helps you to manage your content within your app.
@@ -478,6 +457,10 @@ test_files:
478
457
  - spec/controllers/page_parts_controller_spec.rb
479
458
  - spec/controllers/pages_controller_spec.rb
480
459
  - spec/dummy/Rakefile
460
+ - spec/dummy/app/assets/images/rails.png
461
+ - spec/dummy/app/assets/images/spec-image.png
462
+ - spec/dummy/app/assets/javascripts/application.js
463
+ - spec/dummy/app/assets/stylesheets/application.css
481
464
  - spec/dummy/app/controllers/application_controller.rb
482
465
  - spec/dummy/app/helpers/application_helper.rb
483
466
  - spec/dummy/app/views/layouts/application.html.erb
@@ -494,17 +477,21 @@ test_files:
494
477
  - spec/dummy/config/initializers/mime_types.rb
495
478
  - spec/dummy/config/initializers/secret_token.rb
496
479
  - spec/dummy/config/initializers/session_store.rb
480
+ - spec/dummy/config/initializers/wrap_parameters.rb
497
481
  - spec/dummy/config/locales/en.yml
498
482
  - spec/dummy/config/routes.rb
499
483
  - spec/dummy/db/migrate/.gitkeep
484
+ - spec/dummy/lib/assets/.gitkeep
485
+ - spec/dummy/lib/tasks/.gitkeep
486
+ - spec/dummy/log/.gitkeep
500
487
  - spec/dummy/public/404.html
501
488
  - spec/dummy/public/422.html
502
489
  - spec/dummy/public/500.html
503
490
  - spec/dummy/public/favicon.ico
504
- - spec/dummy/public/images/spec-image.png
505
491
  - spec/dummy/public/stylesheets/.gitkeep
506
492
  - spec/dummy/script/rails
507
493
  - spec/factories.rb
494
+ - spec/helpers/cms_helper_spec.rb
508
495
  - spec/helpers/pages_helper_spec.rb
509
496
  - spec/integration/navigation_spec.rb
510
497
  - spec/kuhsaft_spec.rb