radiant 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of radiant might be problematic. Click here for more details.

Files changed (208) hide show
  1. data/CHANGELOG +15 -0
  2. data/CONTRIBUTORS +8 -0
  3. data/app/controllers/admin/page_controller.rb +1 -11
  4. data/app/controllers/admin/welcome_controller.rb +5 -6
  5. data/app/controllers/application.rb +2 -0
  6. data/app/controllers/site_controller.rb +1 -0
  7. data/app/helpers/admin/page_helper.rb +36 -0
  8. data/app/helpers/admin/regions_helper.rb +28 -0
  9. data/app/helpers/admin/user_helper.rb +6 -0
  10. data/app/helpers/application_helper.rb +2 -1
  11. data/app/models/user.rb +7 -8
  12. data/app/views/admin/extension/index.html.haml +28 -0
  13. data/app/views/admin/layout/edit.html.haml +44 -0
  14. data/app/views/admin/layout/index.html.haml +25 -0
  15. data/app/views/admin/layout/remove.html.haml +16 -0
  16. data/app/views/admin/page/_meta_row.html.haml +6 -0
  17. data/app/views/admin/page/_node.html.haml +25 -0
  18. data/app/views/admin/page/_part.html.haml +17 -0
  19. data/app/views/admin/page/_tag_reference.html.haml +3 -0
  20. data/app/views/admin/page/children.html.haml +2 -0
  21. data/app/views/admin/page/edit.html.haml +114 -0
  22. data/app/views/admin/page/index.html.haml +28 -0
  23. data/app/views/admin/page/remove.html.haml +20 -0
  24. data/app/views/admin/snippet/edit.html.haml +36 -0
  25. data/app/views/admin/snippet/index.html.haml +20 -0
  26. data/app/views/admin/snippet/remove.html.haml +19 -0
  27. data/app/views/admin/user/edit.html.haml +80 -0
  28. data/app/views/admin/user/index.html.haml +23 -0
  29. data/app/views/admin/user/preferences.html.haml +28 -0
  30. data/app/views/admin/user/remove.html.haml +18 -0
  31. data/app/views/admin/welcome/login.html.haml +44 -0
  32. data/app/views/layouts/application.html.haml +54 -0
  33. data/app/views/site/not_found.html.haml +3 -0
  34. data/db/migrate/019_add_salt_to_users.rb +11 -0
  35. data/db/schema.rb +2 -1
  36. data/lib/login_system.rb +1 -0
  37. data/lib/radiant.rb +1 -1
  38. data/lib/radiant/admin_ui.rb +65 -0
  39. data/lib/radiant/admin_ui/region_partials.rb +18 -0
  40. data/lib/radiant/admin_ui/region_set.rb +35 -0
  41. data/lib/tasks/extensions.rake +33 -0
  42. data/public/javascripts/admin/admin.js +8 -2
  43. data/public/javascripts/admin/sitemap.js +2 -1
  44. data/public/stylesheets/admin/main.css +4 -0
  45. data/spec/controllers/admin/abstract_model_controller_spec.rb +2 -0
  46. data/spec/controllers/admin/page_controller_spec.rb +3 -28
  47. data/spec/controllers/admin/user_controller_spec.rb +1 -1
  48. data/spec/controllers/admin/welcome_controller_spec.rb +26 -0
  49. data/spec/helpers/admin/page_helper_spec.rb +4 -0
  50. data/spec/helpers/admin/regions_helper_spec.rb +47 -0
  51. data/spec/helpers/admin/user_helper_spec.rb +7 -0
  52. data/spec/helpers/application_helper_spec.rb +7 -3
  53. data/spec/lib/login_system_spec.rb +5 -0
  54. data/spec/lib/radiant/admin_ui/region_partials_spec.rb +35 -0
  55. data/spec/lib/radiant/admin_ui/region_set_spec.rb +61 -0
  56. data/spec/lib/radiant/admin_ui_spec.rb +74 -18
  57. data/spec/models/user_spec.rb +11 -4
  58. data/spec/scenarios/users_scenario.rb +2 -2
  59. data/vendor/plugins/haml/MIT-LICENSE +20 -0
  60. data/vendor/plugins/haml/README.rdoc +319 -0
  61. data/vendor/plugins/haml/Rakefile +158 -0
  62. data/vendor/plugins/haml/TODO +9 -0
  63. data/vendor/plugins/haml/VERSION +1 -0
  64. data/vendor/plugins/haml/bin/css2sass +7 -0
  65. data/vendor/plugins/haml/bin/haml +8 -0
  66. data/vendor/plugins/haml/bin/html2haml +7 -0
  67. data/vendor/plugins/haml/bin/sass +8 -0
  68. data/vendor/plugins/haml/extra/haml-mode.el +328 -0
  69. data/vendor/plugins/haml/extra/sass-mode.el +88 -0
  70. data/vendor/plugins/haml/init.rb +2 -0
  71. data/vendor/plugins/haml/lib/haml.rb +977 -0
  72. data/vendor/plugins/haml/lib/haml/buffer.rb +229 -0
  73. data/vendor/plugins/haml/lib/haml/engine.rb +274 -0
  74. data/vendor/plugins/haml/lib/haml/error.rb +23 -0
  75. data/vendor/plugins/haml/lib/haml/exec.rb +347 -0
  76. data/vendor/plugins/haml/lib/haml/filters.rb +249 -0
  77. data/vendor/plugins/haml/lib/haml/helpers.rb +413 -0
  78. data/vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb +45 -0
  79. data/vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb +122 -0
  80. data/vendor/plugins/haml/lib/haml/html.rb +188 -0
  81. data/vendor/plugins/haml/lib/haml/precompiler.rb +757 -0
  82. data/vendor/plugins/haml/lib/haml/template.rb +43 -0
  83. data/vendor/plugins/haml/lib/haml/template/patch.rb +58 -0
  84. data/vendor/plugins/haml/lib/haml/template/plugin.rb +72 -0
  85. data/vendor/plugins/haml/lib/sass.rb +833 -0
  86. data/vendor/plugins/haml/lib/sass/constant.rb +245 -0
  87. data/vendor/plugins/haml/lib/sass/constant/color.rb +101 -0
  88. data/vendor/plugins/haml/lib/sass/constant/literal.rb +53 -0
  89. data/vendor/plugins/haml/lib/sass/constant/number.rb +87 -0
  90. data/vendor/plugins/haml/lib/sass/constant/operation.rb +30 -0
  91. data/vendor/plugins/haml/lib/sass/constant/string.rb +22 -0
  92. data/vendor/plugins/haml/lib/sass/css.rb +378 -0
  93. data/vendor/plugins/haml/lib/sass/engine.rb +459 -0
  94. data/vendor/plugins/haml/lib/sass/error.rb +35 -0
  95. data/vendor/plugins/haml/lib/sass/plugin.rb +165 -0
  96. data/vendor/plugins/haml/lib/sass/plugin/merb.rb +56 -0
  97. data/vendor/plugins/haml/lib/sass/plugin/rails.rb +24 -0
  98. data/vendor/plugins/haml/lib/sass/tree/attr_node.rb +53 -0
  99. data/vendor/plugins/haml/lib/sass/tree/comment_node.rb +20 -0
  100. data/vendor/plugins/haml/lib/sass/tree/directive_node.rb +46 -0
  101. data/vendor/plugins/haml/lib/sass/tree/node.rb +42 -0
  102. data/vendor/plugins/haml/lib/sass/tree/rule_node.rb +89 -0
  103. data/vendor/plugins/haml/lib/sass/tree/value_node.rb +16 -0
  104. data/vendor/plugins/haml/test/benchmark.rb +82 -0
  105. data/vendor/plugins/haml/test/haml/engine_test.rb +587 -0
  106. data/vendor/plugins/haml/test/haml/helper_test.rb +187 -0
  107. data/vendor/plugins/haml/test/haml/html2haml_test.rb +60 -0
  108. data/vendor/plugins/haml/test/haml/markaby/standard.mab +52 -0
  109. data/vendor/plugins/haml/test/haml/mocks/article.rb +6 -0
  110. data/vendor/plugins/haml/test/haml/results/content_for_layout.xhtml +16 -0
  111. data/vendor/plugins/haml/test/haml/results/eval_suppressed.xhtml +11 -0
  112. data/vendor/plugins/haml/test/haml/results/filters.xhtml +82 -0
  113. data/vendor/plugins/haml/test/haml/results/helpers.xhtml +94 -0
  114. data/vendor/plugins/haml/test/haml/results/helpful.xhtml +10 -0
  115. data/vendor/plugins/haml/test/haml/results/just_stuff.xhtml +64 -0
  116. data/vendor/plugins/haml/test/haml/results/list.xhtml +12 -0
  117. data/vendor/plugins/haml/test/haml/results/original_engine.xhtml +22 -0
  118. data/vendor/plugins/haml/test/haml/results/partials.xhtml +21 -0
  119. data/vendor/plugins/haml/test/haml/results/silent_script.xhtml +74 -0
  120. data/vendor/plugins/haml/test/haml/results/standard.xhtml +42 -0
  121. data/vendor/plugins/haml/test/haml/results/tag_parsing.xhtml +28 -0
  122. data/vendor/plugins/haml/test/haml/results/very_basic.xhtml +7 -0
  123. data/vendor/plugins/haml/test/haml/results/whitespace_handling.xhtml +94 -0
  124. data/vendor/plugins/haml/test/haml/rhtml/_av_partial_1.rhtml +12 -0
  125. data/vendor/plugins/haml/test/haml/rhtml/_av_partial_2.rhtml +8 -0
  126. data/vendor/plugins/haml/test/haml/rhtml/action_view.rhtml +62 -0
  127. data/vendor/plugins/haml/test/haml/rhtml/standard.rhtml +54 -0
  128. data/vendor/plugins/haml/test/haml/template_test.rb +168 -0
  129. data/vendor/plugins/haml/test/haml/templates/_av_partial_1.haml +9 -0
  130. data/vendor/plugins/haml/test/haml/templates/_av_partial_2.haml +5 -0
  131. data/vendor/plugins/haml/test/haml/templates/_partial.haml +8 -0
  132. data/vendor/plugins/haml/test/haml/templates/_text_area.haml +3 -0
  133. data/vendor/plugins/haml/test/haml/templates/action_view.haml +47 -0
  134. data/vendor/plugins/haml/test/haml/templates/breakage.haml +8 -0
  135. data/vendor/plugins/haml/test/haml/templates/content_for_layout.haml +10 -0
  136. data/vendor/plugins/haml/test/haml/templates/eval_suppressed.haml +11 -0
  137. data/vendor/plugins/haml/test/haml/templates/filters.haml +81 -0
  138. data/vendor/plugins/haml/test/haml/templates/helpers.haml +69 -0
  139. data/vendor/plugins/haml/test/haml/templates/helpful.haml +11 -0
  140. data/vendor/plugins/haml/test/haml/templates/just_stuff.haml +77 -0
  141. data/vendor/plugins/haml/test/haml/templates/list.haml +12 -0
  142. data/vendor/plugins/haml/test/haml/templates/original_engine.haml +17 -0
  143. data/vendor/plugins/haml/test/haml/templates/partialize.haml +1 -0
  144. data/vendor/plugins/haml/test/haml/templates/partials.haml +12 -0
  145. data/vendor/plugins/haml/test/haml/templates/silent_script.haml +40 -0
  146. data/vendor/plugins/haml/test/haml/templates/standard.haml +42 -0
  147. data/vendor/plugins/haml/test/haml/templates/tag_parsing.haml +24 -0
  148. data/vendor/plugins/haml/test/haml/templates/very_basic.haml +4 -0
  149. data/vendor/plugins/haml/test/haml/templates/whitespace_handling.haml +87 -0
  150. data/vendor/plugins/haml/test/haml/test_helper.rb +15 -0
  151. data/vendor/plugins/haml/test/profile.rb +65 -0
  152. data/vendor/plugins/haml/test/sass/engine_test.rb +276 -0
  153. data/vendor/plugins/haml/test/sass/plugin_test.rb +159 -0
  154. data/vendor/plugins/haml/test/sass/results/alt.css +4 -0
  155. data/vendor/plugins/haml/test/sass/results/basic.css +9 -0
  156. data/vendor/plugins/haml/test/sass/results/compact.css +5 -0
  157. data/vendor/plugins/haml/test/sass/results/complex.css +87 -0
  158. data/vendor/plugins/haml/test/sass/results/compressed.css +1 -0
  159. data/vendor/plugins/haml/test/sass/results/constants.css +14 -0
  160. data/vendor/plugins/haml/test/sass/results/expanded.css +19 -0
  161. data/vendor/plugins/haml/test/sass/results/import.css +29 -0
  162. data/vendor/plugins/haml/test/sass/results/mixins.css +95 -0
  163. data/vendor/plugins/haml/test/sass/results/multiline.css +24 -0
  164. data/vendor/plugins/haml/test/sass/results/nested.css +22 -0
  165. data/vendor/plugins/haml/test/sass/results/parent_ref.css +13 -0
  166. data/vendor/plugins/haml/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
  167. data/vendor/plugins/haml/test/sass/results/subdir/subdir.css +1 -0
  168. data/vendor/plugins/haml/test/sass/templates/_partial.sass +2 -0
  169. data/vendor/plugins/haml/test/sass/templates/alt.sass +16 -0
  170. data/vendor/plugins/haml/test/sass/templates/basic.sass +23 -0
  171. data/vendor/plugins/haml/test/sass/templates/bork.sass +2 -0
  172. data/vendor/plugins/haml/test/sass/templates/bork2.sass +2 -0
  173. data/vendor/plugins/haml/test/sass/templates/compact.sass +17 -0
  174. data/vendor/plugins/haml/test/sass/templates/complex.sass +310 -0
  175. data/vendor/plugins/haml/test/sass/templates/compressed.sass +15 -0
  176. data/vendor/plugins/haml/test/sass/templates/constants.sass +97 -0
  177. data/vendor/plugins/haml/test/sass/templates/expanded.sass +17 -0
  178. data/vendor/plugins/haml/test/sass/templates/import.sass +11 -0
  179. data/vendor/plugins/haml/test/sass/templates/importee.sass +14 -0
  180. data/vendor/plugins/haml/test/sass/templates/mixins.sass +76 -0
  181. data/vendor/plugins/haml/test/sass/templates/multiline.sass +20 -0
  182. data/vendor/plugins/haml/test/sass/templates/nested.sass +25 -0
  183. data/vendor/plugins/haml/test/sass/templates/parent_ref.sass +25 -0
  184. data/vendor/plugins/haml/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
  185. data/vendor/plugins/haml/test/sass/templates/subdir/subdir.sass +6 -0
  186. metadata +185 -24
  187. data/app/views/admin/extension/index.html.erb +0 -40
  188. data/app/views/admin/layout/edit.html.erb +0 -39
  189. data/app/views/admin/layout/index.html.erb +0 -38
  190. data/app/views/admin/layout/remove.html.erb +0 -17
  191. data/app/views/admin/page/_meta_row.html.erb +0 -4
  192. data/app/views/admin/page/_node.html.erb +0 -28
  193. data/app/views/admin/page/_part.html.erb +0 -13
  194. data/app/views/admin/page/_tag_reference.html.erb +0 -4
  195. data/app/views/admin/page/children.html.erb +0 -4
  196. data/app/views/admin/page/edit.html.erb +0 -140
  197. data/app/views/admin/page/index.html.erb +0 -31
  198. data/app/views/admin/page/remove.html.erb +0 -14
  199. data/app/views/admin/snippet/edit.html.erb +0 -29
  200. data/app/views/admin/snippet/index.html.erb +0 -36
  201. data/app/views/admin/snippet/remove.html.erb +0 -16
  202. data/app/views/admin/user/edit.html.erb +0 -54
  203. data/app/views/admin/user/index.html.erb +0 -43
  204. data/app/views/admin/user/preferences.html.erb +0 -29
  205. data/app/views/admin/user/remove.html.erb +0 -16
  206. data/app/views/admin/welcome/login.html.erb +0 -51
  207. data/app/views/layouts/application.html.erb +0 -83
  208. data/app/views/site/not_found.html.erb +0 -3
data/CHANGELOG CHANGED
@@ -1,5 +1,20 @@
1
1
  == Change Log
2
2
 
3
+ === Edge
4
+ * Fix Haml rendering errors. [Thomas Watson Steen]
5
+
6
+ === 0.6.7 Mordant
7
+ * Integrate shards extension into core. [Sean Cribbs]
8
+ * Convert all views to Haml. [Sean Cribbs, John Long]
9
+ * Avoid authenticity check when listing page children. [Sean Cribbs]
10
+ * Add radiant:extensions:update_all task. [Josh French]
11
+ * Tweak LoginSystem to allow attempted URL redirection after login and
12
+ auto-redirect from login URL if logged in. [Josh French]
13
+ * Add per-user salting to password encryption. [Sean Cribbs]
14
+ * Address CSRF vulnerabilities in forms. [Sean Cribbs]
15
+ * Remove clear cache action, always clear cache after saving a page. [Sean
16
+ Cribbs]
17
+
3
18
  === 0.6.6 Chiseled
4
19
  * Make sure extension view paths override Radiant view paths. [Josh French]
5
20
  * Fix problem in framework.rake when public/javascripts/admin doesn't exist.
@@ -4,6 +4,14 @@
4
4
  The following people have submitted changes which have been applied to the
5
5
  core:
6
6
 
7
+ === Edge
8
+ * Thomas Watson Steen
9
+
10
+ === 0.6.7 Mordant
11
+ * John Long
12
+ * Josh French
13
+ * Sean Cribbs
14
+
7
15
  === 0.6.6 Chiseled
8
16
  * Josh French
9
17
  * Sean Cribbs
@@ -35,16 +35,6 @@ class Admin::PageController < Admin::AbstractModelController
35
35
  end
36
36
  end
37
37
 
38
- def clear_cache
39
- if request.post?
40
- @cache.clear
41
- announce_cache_cleared
42
- redirect_to page_index_url
43
- else
44
- render :text => 'Do not access this URL directly.'
45
- end
46
- end
47
-
48
38
  def add_part
49
39
  part = PagePart.new(params[:part])
50
40
  @index = params[:index].to_i if params[:index]
@@ -120,6 +110,6 @@ class Admin::PageController < Admin::AbstractModelController
120
110
  end
121
111
 
122
112
  def clear_model_cache
123
- @cache.expire_response(@old_page_url || @page.url)
113
+ @cache.clear
124
114
  end
125
115
  end
@@ -9,12 +9,11 @@ class Admin::WelcomeController < ApplicationController
9
9
  if request.post?
10
10
  login = params[:user][:login]
11
11
  password = params[:user][:password]
12
- self.current_user = User.authenticate(login, password)
13
- if current_user
14
- redirect_to welcome_url
15
- else
16
- announce_invalid_user
17
- end
12
+ announce_invalid_user unless self.current_user = User.authenticate(login, password)
13
+ end
14
+ if current_user
15
+ redirect_to (session[:return_to] || welcome_url)
16
+ session[:return_to] = nil
18
17
  end
19
18
  end
20
19
 
@@ -5,6 +5,8 @@ class ApplicationController < ActionController::Base
5
5
 
6
6
  filter_parameter_logging :password, :password_confirmation
7
7
 
8
+ protect_from_forgery :secret => "sweet-harmonious-biscuits"
9
+
8
10
  before_filter :set_current_user
9
11
  before_filter :set_javascripts_and_stylesheets
10
12
 
@@ -1,5 +1,6 @@
1
1
  class SiteController < ApplicationController
2
2
  session :off
3
+ skip_before_filter :verify_authenticity_token
3
4
 
4
5
  no_login_required
5
6
 
@@ -30,4 +30,40 @@ module Admin::PageHelper
30
30
  def homepage
31
31
  @homepage ||= Page.find_by_parent_id(nil)
32
32
  end
33
+
34
+ def page_edit_javascripts
35
+ <<-CODE
36
+ var last_type = "#{@page.class_name}";
37
+ function load_tag_reference(part) {
38
+ page_type = $F('page_class_name');
39
+ popup = $('tag-reference-popup');
40
+ if(last_type != page_type) {
41
+ url = "#{tag_reference_url}";
42
+ params = "class_name=" + page_type;
43
+ new Effect.Highlight('tag-reference-link-'+ part);
44
+ req = new Ajax.Request(url, { method: 'get', parameters: params, evalScripts: true });
45
+ } else {
46
+ center(popup);
47
+ Element.toggle(popup);
48
+ }
49
+ return false;
50
+ }
51
+ var last_filter = "#{default_filter_name}";
52
+ function load_filter_reference(part) {
53
+ filter_type = $F("part_" + part + "_filter_id");
54
+ popup = $('filter-reference-popup');
55
+ if(last_filter != filter_type) {
56
+ url = "#{filter_reference_url}";
57
+ params = "filter_name=" + filter_type;
58
+ new Effect.Highlight('filter-reference-link-'+ part);
59
+ req = new Ajax.Request(url, { method: 'get', parameters: params, evalScripts: true });
60
+ } else {
61
+ center(popup);
62
+ Element.toggle(popup);
63
+ }
64
+ return false;
65
+ }
66
+
67
+ CODE
68
+ end
33
69
  end
@@ -0,0 +1,28 @@
1
+ module Admin::RegionsHelper
2
+ def render_region(region, options={}, &block)
3
+ lazy_initialize_region_set
4
+ default_partials = Radiant::AdminUI::RegionPartials.new(@template)
5
+ if block_given?
6
+ junk = capture(default_partials, &block)
7
+ (options[:locals] ||= {}).merge!(:defaults => default_partials)
8
+ end
9
+ output = @region_set[region].compact.map do |partial|
10
+ begin
11
+ render options.merge(:partial => partial)
12
+ rescue ::ActionView::TemplateError => e # error in template
13
+ raise e
14
+ rescue ::ActionView::ActionViewError # couldn't find template
15
+ default_partials[partial]
16
+ end
17
+ end.join
18
+ block_given? ? concat(output, block.binding) : output
19
+ end
20
+
21
+ def lazy_initialize_region_set
22
+ unless @region_set
23
+ @controller_name ||= @controller.controller_name
24
+ @template_name ||= File.basename(@first_render).split(".").last
25
+ @region_set = admin.send(@controller_name).send(@template_name)
26
+ end
27
+ end
28
+ end
@@ -1,2 +1,8 @@
1
1
  module Admin::UserHelper
2
+ def roles(user)
3
+ roles = []
4
+ roles << 'Administrator' if user.admin?
5
+ roles << 'Developer' if user.developer?
6
+ roles.join(', ')
7
+ end
2
8
  end
@@ -1,5 +1,6 @@
1
1
  module ApplicationHelper
2
2
  include LocalTime
3
+ include Admin::RegionsHelper
3
4
 
4
5
  def config
5
6
  Radiant::Config
@@ -121,7 +122,7 @@ module ApplicationHelper
121
122
  when :meta, :meta_less
122
123
  meta_errors?
123
124
  end
124
- ' style="display: none"' unless v
125
+ v ? {} : {:style => "display:none"}
125
126
  end
126
127
 
127
128
  def meta_errors?
@@ -25,18 +25,16 @@ class User < ActiveRecord::Base
25
25
  validates_length_of :email, :maximum => 255, :allow_nil => true, :message => '%d-character limit'
26
26
 
27
27
  validates_numericality_of :id, :only_integer => true, :allow_nil => true, :message => 'must be a number'
28
-
29
- cattr_accessor :salt
30
- @@salt = 'sweet harmonious biscuits' # historic value
31
-
28
+
32
29
  attr_writer :confirm_password
33
30
 
34
- def self.sha1(phrase)
35
- Digest::SHA1.hexdigest("--#{@@salt}--#{phrase}--")
31
+ def sha1(phrase)
32
+ Digest::SHA1.hexdigest("--#{salt}--#{phrase}--")
36
33
  end
37
34
 
38
35
  def self.authenticate(login, password)
39
- find_by_login_and_password(login, sha1(password))
36
+ user = find_by_login(login)
37
+ user if user && user.password == user.sha1(password)
40
38
  end
41
39
 
42
40
  def after_initialize
@@ -55,7 +53,8 @@ class User < ActiveRecord::Base
55
53
 
56
54
  before_create :encrypt_password
57
55
  def encrypt_password
58
- self.password = self.class.sha1(password)
56
+ self.salt = Digest::SHA1.hexdigest("--#{Time.now}--#{login}--sweet harmonious biscuits--")
57
+ self.password = sha1(password)
59
58
  end
60
59
 
61
60
  before_update :encrypt_password_unless_empty_or_unchanged
@@ -0,0 +1,28 @@
1
+ - content_for :page_css do
2
+ :sass
3
+ table.index
4
+ h4
5
+ font-size: 110%
6
+ margin-top: .5em
7
+ margin-bottom: .25em
8
+ p
9
+ margin-top: .25em
10
+ margin-bottom: .5em
11
+
12
+ %h1 Extensions
13
+
14
+ %table#extensions.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0"}
15
+ %thead
16
+ %tr
17
+ %th.extension Extension
18
+ %th.website Website
19
+ %th.version Version
20
+ %tbody
21
+ - @extensions.each do |extension|
22
+ %tr.node.level-1
23
+ %td.extension
24
+ %h4= h extension.extension_name
25
+ %p= h extension.description
26
+ %td.website
27
+ = extension.url.nil? || extension.url.empty? ? "" : link_to("Website", extension.url, :target => "_blank")
28
+ %td.version= h extension.version
@@ -0,0 +1,44 @@
1
+ - render_region :main do |main|
2
+ - main.edit_header do
3
+ - if @layout.new_record?
4
+ %h1 New Layout
5
+ - else
6
+ %h1 Edit Layout
7
+ - main.edit_form do
8
+ - form_tag do
9
+ .form-area
10
+ = render_region :form_top
11
+ = hidden_field 'layout', 'lock_version'
12
+ - render_region :form do |form|
13
+ - form.edit_title do
14
+ %p.title
15
+ %label{:for=>"layout_name"} Name
16
+ = text_field 'layout', 'name', :maxlength => 100, :class => "textbox"
17
+ - form.edit_extended_metadata do
18
+ #extended-metadata.row{meta_visible(:meta)}
19
+ %table.fieldset{:cellpadding=>"0", :cellspacing=>"0", :border=>"0"}
20
+ %tr
21
+ %th.label
22
+ %label{:for=>"layout_content_type"} Content&#8209;Type
23
+ %td.field
24
+ = text_field 'layout', 'content_type', :maxlength => 40, :class => "textbox"
25
+ = render_region :extended_metadata
26
+ %p.more-or-less
27
+ %small
28
+ %a#more-extended-metadata{meta_visible(:meta_more), :href => "#", :onclick=>toggle_javascript_for('extended-metadata')} More
29
+ %a#less-extended-metadata{meta_visible(:meta_less), :href => "#", :onclick=>toggle_javascript_for('extended-metadata')} Less
30
+ - form.edit_content do
31
+ %p.content
32
+ %label{:for=>"layout_content"} Body
33
+ ~ text_area 'layout', 'content', :size => '40x20', :style => 'width: 100%', :class => "textarea"
34
+ - form.edit_timestamp do
35
+ = updated_stamp @layout
36
+
37
+ = javascript_tag "$('layout_name').activate()"
38
+ - render_region :form_bottom do |form_bottom|
39
+ - form_bottom.edit_buttons do
40
+ %p.buttons
41
+ = save_model_button @layout
42
+ = save_model_and_continue_editing_button @layout
43
+ or
44
+ = link_to "Cancel", layout_index_url
@@ -0,0 +1,25 @@
1
+ %h1 Layouts
2
+
3
+ %p
4
+ Use layouts to apply a visual look to a Web page. Layouts can contain special tags to include
5
+ page content and other elements such as the header or footer. Click on a layout name below to
6
+ edit it or click <code>Remove</code> to delete it.
7
+
8
+ %table#layouts.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0" }
9
+ %thead
10
+ %tr
11
+ %th.layout
12
+ Layout
13
+ %th.modify
14
+ Modify
15
+ %tbody
16
+ - @layouts.each do |layout|
17
+ %tr.node.level-1
18
+ %td.layout
19
+ = image('layout', :alt => 'layout-icon')
20
+ = link_to layout.name, layout_edit_url(:id => layout)
21
+ %td.remove
22
+ = link_to image('remove', :alt => 'Remove Layout'), layout_remove_url(:id => layout)
23
+
24
+ %p
25
+ = link_to image('new-layout', :alt => "New Layout"), layout_new_url
@@ -0,0 +1,16 @@
1
+ %h1 Remove Layout
2
+
3
+ %p Are you sure you want to <strong class="warning">permanently remove</strong> the following layout?
4
+
5
+ %table.index#layouts{:cellpadding=>0, :cellspacing=>0, :border=>0}
6
+ %tbody
7
+ %tr.node.level-1
8
+ %td.layout
9
+ = image('layout', :alt => 'layout-icon')
10
+ = h @layout.name
11
+
12
+ - form_tag do
13
+ %p.buttons
14
+ %input.button{:type=>"submit", :value=>"Delete Layout"}/
15
+ or
16
+ = link_to 'Cancel', layout_index_url
@@ -0,0 +1,6 @@
1
+ %tr
2
+ %th.label
3
+ %label{:for => "page_#{meta_row[:field]}"}
4
+ = meta_row[:label] || meta_row[:field].humanize
5
+ %td.field
6
+ = send(meta_row[:type], 'page', meta_row[:field], *meta_row[:args])
@@ -0,0 +1,25 @@
1
+ %tr.node{:id => "page-#{page.id}", :class =>"level-#{level}#{children_class}#{virtual_class}"}
2
+ - render_region :node, :locals => {:page => page, :level => level, :simple => simple} do |node|
3
+ - node.title_column do
4
+ %td.page{:style => "padding-left: #{padding_left(level)}px"}
5
+ %span.w1
6
+ - if simple
7
+ = icon
8
+ = node_title
9
+ - else
10
+ = expander + link_to("#{icon} #{node_title}", page_edit_url(:id => page), :title => page.url)
11
+ = page_type
12
+ = spinner
13
+ - node.status_column do
14
+ - unless simple
15
+ %td.status{:class => "#{page.status.name.downcase}-status"}= page.status.name
16
+ - node.add_child_column do
17
+ - unless simple
18
+ %td.add-child= link_to image('add-child', :alt => 'add child'), page_new_url(:parent_id => page)
19
+ - node.remove_column do
20
+ - unless simple
21
+ %td.remove= link_to image('remove', :alt => 'remove page'), page_remove_url(:id => page)
22
+
23
+ - if expanded
24
+ - page.children.each do |child|
25
+ = render_node child, :level => level + 1, :simple => simple
@@ -0,0 +1,17 @@
1
+ - @index ||= 0
2
+ .page{:id => "page-#{@index+1}"}
3
+ .part{:id => "part-#{@index+1}"}
4
+ = hidden_field_tag "part[#{@index}][name]", part.name, :id => "part_#{@index}_name"
5
+ %p
6
+ %label{:for => "part_#{@index}_filter_id"} Filter
7
+ = select_tag "part[#{@index}][filter_id]", options_for_select([['<none>', '']] + TextFilter.descendants.map { |s| s.filter_name }.sort, part.filter_id), :id => "part_#{@index}_filter_id"
8
+ %span#reference-links
9
+ Reference:
10
+ %span{:id => "filter-reference-link-#{@index}"}
11
+ = link_to_function "Filter", "load_filter_reference(#{@index});"
12
+ %span{:id => "tag-reference-link-#{@index}"}
13
+ = link_to_function 'Available Tags', "load_tag_reference(#{@index});"
14
+ = render_region :part_controls
15
+ %div
16
+ ~ text_area_tag "part[#{@index}][content]", h(part.content), :class => "textarea", :style => "width: 100%", :id => "part_#{@index}_content"
17
+ - @index += 1
@@ -0,0 +1,3 @@
1
+ .tag-description
2
+ %h4= "&lt;r:#{tag_name} /&gt;"
3
+ %div= description
@@ -0,0 +1,2 @@
1
+ - @parent.children.each do |child|
2
+ = render_node child, :expand => 1, :level => @level + 1
@@ -0,0 +1,114 @@
1
+ - content_for 'page_scripts', page_edit_javascripts
2
+ - content_for 'page_css' do
3
+ :sass
4
+ #content
5
+ #extended-metadata
6
+ .fieldset
7
+ margin-left: 0
8
+ margin-right: 0
9
+ margin-bottom: .5em
10
+ padding: 0
11
+ td.label
12
+ text-align: left
13
+ width: 15%
14
+ .textbox
15
+ width: 90%
16
+ - render_region :main do |main|
17
+ - main.edit_header do
18
+ - if @page.new_record?
19
+ %h1 New Page
20
+ - else
21
+ %h1 Edit Page
22
+ - main.edit_form do
23
+ - form_tag({}, {:multipart => true}) do
24
+ = hidden_field 'page', 'lock_version'
25
+ = render_region :form_top
26
+ .form-area
27
+ - render_region :form do |form|
28
+ - form.edit_title do
29
+ %p.title
30
+ %label{:for=>"page_title"}
31
+ Page Title
32
+ = text_field "page", "title", :class => 'textbox', :maxlength => 255
33
+ - form.edit_extended_metadata do
34
+ #extended-metadata.row{meta_visible(:meta)}
35
+ %table.fieldset
36
+ = render :partial => "meta_row", :collection => @meta
37
+ = render_region :extended_metadata
38
+ %p.more-or-less
39
+ %small
40
+ %a#more-extended-metadata{meta_visible(:meta_more), :href => "#", :onclick=>toggle_javascript_for('extended-metadata')} More
41
+ %a#less-extended-metadata{meta_visible(:meta_less), :href => "#", :onclick=>toggle_javascript_for('extended-metadata')} Less
42
+ - form.edit_page_parts do
43
+ #tab-control
44
+ #tabs.tabs
45
+ #tab-toolbar
46
+ = link_to_function image('plus', :alt => 'plus'), 'toggle_add_part_popup()', :title => 'Add Tab'
47
+ = link_to_function image('minus', :alt => 'minus'), 'if(confirm(\'Delete the current tab?\')) { tabControl.removeTab(tabControl.selected) }', :title => 'Remove Tab'
48
+
49
+ #pages.pages
50
+ = render :partial => 'part', :collection => @page.parts
51
+ - render_region :parts_bottom do |parts_bottom|
52
+ - parts_bottom.edit_layout_and_type do
53
+ .row
54
+ %p
55
+ %label{:for=>"page_layout_id"}
56
+ Layout
57
+ = select "page", "layout_id", [['<inherit>', '']] + Layout.find(:all).map { |s| [s.name, s.id] }
58
+ %p
59
+ %label{:for=>"page_class_name"}
60
+ Page Type
61
+ = select "page", "class_name", [['<normal>', 'Page']] + Page.descendants.map { |p| [p.display_name, p.name] }.sort_by { |p| p.first }
62
+ %p
63
+ %label{:for=>"page_status_id"}
64
+ Status
65
+ = select "page", "status_id", Status.find_all.map { |s| [s.name, s.id] }, {}
66
+ %p#publication-date{:style => "display: none"}
67
+ %label{:for=>"page_published_at"}
68
+ Published At
69
+ = datetime_select "page", "published_at", :disabled => true
70
+ = render_region :layout_row
71
+ %span.clear &nbsp;
72
+ - parts_bottom.edit_timestamp do
73
+ = updated_stamp @page
74
+ - render_region :form_bottom do |form_bottom|
75
+ - form_bottom.edit_buttons do
76
+ - @buttons_partials.each do |partial|
77
+ = render :partial => partial
78
+ %p.buttons
79
+ = save_model_button(@page)
80
+ = save_model_and_continue_editing_button(@page)
81
+ or
82
+ = link_to 'Cancel', page_index_url
83
+ - main.edit_popups do
84
+ - content_for 'popups' do
85
+ #add-part-popup.popup{:style => "display: none"}
86
+ #busy.busy{:style => "display: none"}= image 'spinner.gif'
87
+ %h3 Add Part
88
+ - form_remote_tag(:url => page_add_part_url, :update => "pages", :position => :bottom, :loading => 'part_loading()', :complete => 'part_added()', :condition => 'valid_part_name()') do
89
+ %div
90
+ = hidden_field_tag 'index', @index, :id => 'part-index-field'
91
+ = text_field_tag "part[name]", "", :id => 'part-name-field', :maxlength => 100
92
+ = submit_tag "Add Part", :id => 'add-part-button'
93
+ %p
94
+ = link_to_function 'Close', "$(this).up('.popup').hide()", :class => 'close-link'
95
+
96
+ #tag-reference-popup.popup{ :style => "display:none;" }
97
+ %div{ :style => "float:right" }
98
+ %label{:for=> 'search-tag-reference'} Search Tags:
99
+ %input#search-tag-reference{ :type => "text" }/
100
+ %h3
101
+ Available Tags for
102
+ %span#page-type= @page.class.display_name
103
+ #tag-reference= tag_reference(@page.class.name)
104
+ %p
105
+ = link_to 'Close', '#', :class => 'close'
106
+
107
+ #filter-reference-popup.popup{ :style => "display:none;" }
108
+ %h3
109
+ %span#filter-type= default_filter_name
110
+ Reference
111
+ #filter-reference= filter_reference(default_filter_name)
112
+ %p
113
+ = link_to_function 'Close', "Element.hide('filter-reference-popup')", :class => 'close-link'
114
+ = render_region :popups