tb_core 1.1.9 → 1.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTA3MDJkZjAzMWJiZGQ1ODlmYWVhYzJjMTg1N2I5NWJmZGI0YmRiOA==
4
+ ZjBkMzVhN2EyNDg1MmJkZjk1ZDdhOTBhOWUzZWM2Y2FjZGM0ZTY1MQ==
5
5
  data.tar.gz: !binary |-
6
- ZDQ3NGU3Y2E4MDI3MGIyY2VhNmViODRkNzAyNDI5MWJiZGQwYWRhZg==
6
+ MmRiZjAxMjg4ZmNiNDZjNjRmZDEwZTM3ZTJjZDg1ZTk0MWY5OTA4Nw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OGY4MDI5OTVlZjdlNDM5ZGYzMmVhYTA5MTFkMGNiZDkyYTkzMWZkZTI1NmVh
10
- YjFjNjQ1M2Y0Y2FiZWM4YzgxNWU4N2FmYmE4NjU0YjM4ZTAxNDJiZWY1Mjk5
11
- M2RhZjk2N2VkOTAxN2M4YTMyZGJlZTg2MGEyMTAwMTIzOTQ1NzE=
9
+ YjZjZTJjYzMyYWI0ZDU3NjViYzYwOTU0Mjk3MDQxNmMyMGY5NWJkYTU3YjVi
10
+ NTNhYzgwNTJiNDhiNmYwNDEzYjYyZTQxNDRmMDlhMTkyNzUzZGM2OTk5YTgx
11
+ NDExNzg0NDRlMDM2MzI4OGY2MjU0YzBkNzVhMmNmMGEwNDhjNDM=
12
12
  data.tar.gz: !binary |-
13
- YjBmODc4MTRkY2YxYTdhZWI0NWVkOWZkOTAxMTM3YzA5YzFjZTlhZTVlODIx
14
- NDZhN2EwNTMxMjFlYTdhMjYyYzYzNTk5NzE1ODU2MTJhYzM1M2QwMDM2Y2Y0
15
- YjA2ODcwNzMxOWI4ZWYzZWZkOGJkYWFlODg1NDRiM2FmZDJhMWQ=
13
+ NDg0MzgyNzllZjEwZTIzMTdmYjk2OTcwOGM2MGM2OWUxZDVhMDU0M2EzYzFh
14
+ MmJiMTk0NGQ2YmViOWM1Yzk0YTRjY2RkZDIxZGVjYTQ4YWY5MTMwYmQxY2M4
15
+ MTk0MDg1NzIzMTI0ZjZmM2ZlOGI5NzI1NzZhYzUzN2VkZTUyNTE=
data/README.md CHANGED
@@ -28,6 +28,22 @@ The `spud:setup` generator takes care of a few tasks for you. If you missed that
28
28
  2. Your base `application.html.erb` should include a few special head tags (see generator template for example).
29
29
  3. You should copy in the base migrations with `rake railties:install:migrations`.
30
30
 
31
+ Configuration
32
+ -------------
33
+
34
+ The core engine provides various configuration options.
35
+
36
+ Spud::Core.configure do |config|
37
+ config.option = value
38
+ ...
39
+ end
40
+
41
+ - `admin_applications`: Array of custom admin modules. See section below for more info.
42
+ - `site_name`: Controls the site name displayed in the dashboard and `tb_page_title` view helper.
43
+ - `from_address`: Sender address used for password resets and other mailers.
44
+ - `not_found_template`: ERB template used for 404 exceptions. Defaults to `layouts/not_found`.
45
+ - `production_alert_domain`: When set, displays a prominent warning bar in the admin dashboard directing users to the production domain. Intended for staging websites. ex: `www.westlakedesign.com`.
46
+
31
47
  Adding Apps to the Dashboard
32
48
  ----------------------------
33
49
 
@@ -12,7 +12,7 @@ spud.admin.editor = {};
12
12
  ];
13
13
 
14
14
  var registeredButtons = [
15
- ['bold','italic','underline','strikethrough','|','justifyleft','justifycenter','justifyright','justifyfull','|','formatselect','cut','copy','paste','pastetext','|','bullist','numlist','outdent','indent','|','tableDropdown','|','link','unlink','anchor','image','code'],
15
+ ['bold','italic','underline','strikethrough','|','justifyleft','justifycenter','justifyright','justifyfull','|','formatselect','cut','copy','paste', 'pasteword','pastetext','|','bullist','numlist','outdent','indent','|','tableDropdown','|','link','unlink','anchor','image','code'],
16
16
  [],
17
17
  [],
18
18
  []
@@ -49,6 +49,15 @@ a:hover .ui-button-text {
49
49
  color:#eee;
50
50
  font-weight:normal;
51
51
  }
52
+ .production-alert-header{
53
+ padding: 5px 15px;
54
+ background: #FFFF66;
55
+ p{
56
+ font-size: 12px;
57
+ line-height: 16px;
58
+ margin: 0;
59
+ }
60
+ }
52
61
  .greeting {
53
62
  color:#fff;
54
63
  }
@@ -84,7 +84,8 @@ private
84
84
  if request.xhr?
85
85
  render :nothing => true, :status => 404
86
86
  else
87
- render :template => Spud::Core.not_found_template, :layout => nil, :formats => [:html], :status => 404
87
+ template = @exception.template || Spud::Core.not_found_template
88
+ render :template => template, :layout => nil, :formats => [:html], :status => 404
88
89
  end
89
90
  end
90
91
 
@@ -8,13 +8,18 @@
8
8
  <%= yield :head %>
9
9
  </head>
10
10
  <body>
11
+ <% if Spud::Core.production_alert_domain %>
12
+ <div class="production-alert-header">
13
+ <p><strong>Notice:</strong> This is a staging version of your website. To update your live website, please <%= link_to 'log in to production.', "http://#{Spud::Core.production_alert_domain}/admin" %></p>
14
+ </div>
15
+ <% end %>
11
16
  <div id="header" style="<%=header_style%>">
12
17
  <%= link_to '/' do %>
13
18
  <h1><%= Spud::Core.config.site_name %></h1>
14
19
  <% end %>
15
20
  <% if current_user %>
16
21
  <div id="user_meta">
17
- <span class="greeting">Hello <%= @current_user.full_name %></span> |
22
+ <span class="greeting">Hello <%= current_user.full_name %></span> |
18
23
  <%=link_to "Settings", admin_settings_path%> |
19
24
  <%=link_to "Logout",admin_logout_path %>
20
25
  </div>
@@ -7,6 +7,9 @@ class Spud::SetupGenerator < ::Rails::Generators::Base
7
7
  template "application_controller.rb", "app/controllers/application_controller.rb"
8
8
  template 'assets/admin.css.scss', 'app/assets/stylesheets/admin/application.css.scss'
9
9
 
10
+ update_base_stylesheet()
11
+ update_base_javascript()
12
+
10
13
  if defined?(CoffeeScript)
11
14
  template 'assets/admin.coffee.erb', 'app/assets/javascripts/admin/application.js.coffee'
12
15
  else
@@ -15,7 +18,10 @@ class Spud::SetupGenerator < ::Rails::Generators::Base
15
18
 
16
19
  environment(spud_core_configs())
17
20
  rake('railties:install:migrations')
18
- rake('db:migrate')
21
+
22
+ if ask("Migrate the database? [Yn] ") == 'Y'
23
+ rake('db:migrate')
24
+ end
19
25
  end
20
26
 
21
27
  private
@@ -31,6 +37,34 @@ Spud::Core.configure do |config|
31
37
  EOF
32
38
  end
33
39
 
40
+ def update_base_stylesheet()
41
+ extensions = ['css', 'css.scss']
42
+ extensions.each do |ext|
43
+ path = File.join(Rails.root, "app/assets/stylesheets/application.#{ext}")
44
+ if File.exist?(path)
45
+ replace_with_require_directory(path)
46
+ return
47
+ end
48
+ end
49
+ end
50
+
51
+ def update_base_javascript()
52
+ extensions = ['js', 'js.coffee']
53
+ extensions.each do |ext|
54
+ path = File.join(Rails.root, "app/assets/javascripts/application.#{ext}")
55
+ if File.exist?(path)
56
+ replace_with_require_directory(path)
57
+ return
58
+ end
59
+ end
60
+ end
61
+
62
+ def replace_with_require_directory(path)
63
+ text = File.read(path)
64
+ text.gsub!('require_tree', 'require_directory')
65
+ File.open(path, 'w'){ |f| f.puts(text) }
66
+ end
67
+
34
68
  def application_name
35
69
  Rails.application.class.name.split('::').first.underscore
36
70
  end
@@ -1,7 +1,7 @@
1
1
  module Spud
2
2
  module Core
3
3
  include ActiveSupport::Configurable
4
- config_accessor :site_name,:admin_applications,:sitemap_urls,:multisite_mode_enabled,:multisite_config,:from_address,:site_id,:short_name, :javascripts,:stylesheets, :admin_javascripts, :admin_stylesheets, :permissions, :not_found_template
4
+ config_accessor :site_name,:admin_applications,:sitemap_urls,:multisite_mode_enabled,:multisite_config,:from_address,:site_id,:short_name, :javascripts,:stylesheets, :admin_javascripts, :admin_stylesheets, :permissions, :not_found_template, :production_alert_domain
5
5
  self.admin_applications = []
6
6
  self.site_name = "Company Name"
7
7
  self.site_id = 0
@@ -16,6 +16,7 @@ module Spud
16
16
  self.admin_javascripts = ['admin/core/application', 'admin/application']
17
17
  self.admin_stylesheets = ['admin/core/application', 'admin/application']
18
18
  self.not_found_template = 'layouts/not_found'
19
+ self.production_alert_domain = nil
19
20
 
20
21
  def self.site_config_for_host(host)
21
22
  configs = Spud::Core.multisite_config.select{|p| p[:hosts].include?(host)}
@@ -3,11 +3,12 @@ class Spud::AccessDeniedError < StandardError
3
3
  end
4
4
 
5
5
  class Spud::NotFoundError < StandardError
6
-
7
- attr_accessor :request_url, :item
6
+
7
+ attr_accessor :request_url, :item, :template
8
8
 
9
9
  def initialize(opts={})
10
10
  @item = opts[:item] || 'page'
11
+ @template = opts[:template] || nil
11
12
  super("The #{item.downcase} you were looking for could not be found.")
12
13
  end
13
14
 
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Core
3
- VERSION = "1.1.9"
3
+ VERSION = "1.1.10"
4
4
  end
5
5
  end