radiant 0.6.7 → 0.6.8

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 (96) hide show
  1. data/CHANGELOG +35 -3
  2. data/CONTRIBUTORS +11 -1
  3. data/README +5 -3
  4. data/app/controllers/admin/welcome_controller.rb +7 -0
  5. data/app/migrate/020_add_session_info_to_users.rb +11 -0
  6. data/app/models/page.rb +22 -9
  7. data/app/models/standard_tags.rb +133 -10
  8. data/app/models/user.rb +9 -1
  9. data/app/views/admin/page/edit.html.haml +5 -4
  10. data/app/views/admin/welcome/login.html.haml +42 -24
  11. data/app/views/layouts/application.html.haml +1 -1
  12. data/config/environment.rb +4 -2
  13. data/db/migrate/020_add_session_info_to_users.rb +11 -0
  14. data/db/migrate/021_remove_session_expire_from_users.rb +9 -0
  15. data/db/schema.rb +3 -2
  16. data/lib/generators/instance/instance_generator.rb +2 -1
  17. data/lib/generators/instance/templates/instance_environment.rb +5 -3
  18. data/lib/login_system.rb +13 -0
  19. data/lib/radiant.rb +1 -1
  20. data/lib/radiant/admin_ui.rb +21 -21
  21. data/lib/radiant/extension/script.rb +251 -0
  22. data/lib/radiant/extension_loader.rb +22 -20
  23. data/lib/radiant/initializer.rb +1 -1
  24. data/lib/radiant/setup.rb +2 -0
  25. data/lib/tasks/framework.rake +39 -29
  26. data/public/500.html +1 -1
  27. data/public/javascripts/admin/admin.js +11 -9
  28. data/script/extension +5 -0
  29. data/spec/controllers/admin/user_controller_spec.rb +1 -1
  30. data/spec/controllers/admin/welcome_controller_spec.rb +31 -5
  31. data/spec/controllers/site_controller_spec.rb +15 -2
  32. data/spec/lib/login_system_spec.rb +106 -60
  33. data/spec/lib/radiant/extension/script_spec.rb +349 -0
  34. data/spec/lib/radiant/extension_loader_spec.rb +3 -0
  35. data/spec/models/page_spec.rb +62 -2
  36. data/spec/models/standard_tags_spec.rb +150 -3
  37. data/spec/models/user_spec.rb +28 -0
  38. data/spec/scenarios/file_not_found_scenario.rb +5 -0
  39. data/spec/scenarios/pages_scenario.rb +6 -0
  40. data/spec/scenarios/snippets_scenario.rb +4 -0
  41. data/test/fixtures/users.yml +11 -6
  42. data/vendor/plugins/haml/FAQ +138 -0
  43. data/vendor/plugins/haml/REVISION +1 -0
  44. data/vendor/plugins/haml/Rakefile +54 -62
  45. data/vendor/plugins/haml/VERSION +1 -1
  46. data/vendor/plugins/haml/init.rb +6 -1
  47. data/vendor/plugins/haml/lib/haml.rb +72 -12
  48. data/vendor/plugins/haml/lib/haml/buffer.rb +47 -40
  49. data/vendor/plugins/haml/lib/haml/engine.rb +20 -30
  50. data/vendor/plugins/haml/lib/haml/error.rb +4 -5
  51. data/vendor/plugins/haml/lib/haml/exec.rb +4 -2
  52. data/vendor/plugins/haml/lib/haml/filters.rb +30 -15
  53. data/vendor/plugins/haml/lib/haml/helpers.rb +47 -28
  54. data/vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb +74 -25
  55. data/vendor/plugins/haml/lib/haml/precompiler.rb +92 -51
  56. data/vendor/plugins/haml/lib/haml/template.rb +11 -3
  57. data/vendor/plugins/haml/lib/haml/template/patch.rb +1 -1
  58. data/vendor/plugins/haml/lib/sass.rb +26 -3
  59. data/vendor/plugins/haml/lib/sass/constant.rb +26 -57
  60. data/vendor/plugins/haml/lib/sass/constant/literal.rb +1 -0
  61. data/vendor/plugins/haml/lib/sass/constant/nil.rb +9 -0
  62. data/vendor/plugins/haml/lib/sass/css.rb +17 -2
  63. data/vendor/plugins/haml/lib/sass/engine.rb +11 -5
  64. data/vendor/plugins/haml/test/haml/engine_test.rb +57 -39
  65. data/vendor/plugins/haml/test/haml/helper_test.rb +20 -4
  66. data/vendor/plugins/haml/test/haml/html2haml_test.rb +1 -3
  67. data/vendor/plugins/haml/test/haml/results/content_for_layout.xhtml +1 -2
  68. data/vendor/plugins/haml/test/haml/results/eval_suppressed.xhtml +2 -4
  69. data/vendor/plugins/haml/test/haml/results/filters.xhtml +12 -8
  70. data/vendor/plugins/haml/test/haml/results/helpers.xhtml +2 -5
  71. data/vendor/plugins/haml/test/haml/results/just_stuff.xhtml +1 -3
  72. data/vendor/plugins/haml/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
  73. data/vendor/plugins/haml/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
  74. data/vendor/plugins/haml/test/haml/results/original_engine.xhtml +2 -4
  75. data/vendor/plugins/haml/test/haml/results/tag_parsing.xhtml +1 -6
  76. data/vendor/plugins/haml/test/haml/results/very_basic.xhtml +2 -4
  77. data/vendor/plugins/haml/test/haml/results/whitespace_handling.xhtml +13 -21
  78. data/vendor/plugins/haml/test/haml/template_test.rb +31 -48
  79. data/vendor/plugins/haml/test/haml/templates/filters.haml +13 -0
  80. data/vendor/plugins/haml/test/haml/templates/helpers.haml +1 -1
  81. data/vendor/plugins/haml/test/haml/templates/just_stuff.haml +0 -1
  82. data/vendor/plugins/haml/test/haml/templates/nuke_inner_whitespace.haml +32 -0
  83. data/vendor/plugins/haml/test/haml/templates/nuke_outer_whitespace.haml +144 -0
  84. data/vendor/plugins/haml/test/haml/templates/partials.haml +1 -1
  85. data/vendor/plugins/haml/test/haml/templates/tag_parsing.haml +0 -3
  86. data/vendor/plugins/haml/test/haml/templates/whitespace_handling.haml +10 -10
  87. data/vendor/plugins/haml/test/sass/engine_test.rb +11 -5
  88. data/vendor/plugins/haml/test/sass/plugin_test.rb +2 -6
  89. data/vendor/plugins/haml/test/sass/results/constants.css +2 -0
  90. data/vendor/plugins/haml/test/sass/templates/constants.sass +3 -0
  91. data/vendor/plugins/haml/test/{haml/test_helper.rb → test_helper.rb} +4 -3
  92. metadata +21 -11
  93. data/vendor/plugins/haml/TODO +0 -9
  94. data/vendor/plugins/haml/extra/haml-mode.el +0 -328
  95. data/vendor/plugins/haml/extra/sass-mode.el +0 -88
  96. data/vendor/plugins/haml/test/profile.rb +0 -65
data/CHANGELOG CHANGED
@@ -1,6 +1,38 @@
1
1
  == Change Log
2
2
 
3
- === Edge
3
+ === 0.6.8 Incise
4
+ * Hide page publish date selector unless page.edit.published_date? config is
5
+ set. [Sean Cribbs]
6
+ * Add <r:yield /> tag to support snippets that accept blocks. [Andrew Neil]
7
+ * Fix bug with FileNotFoundPage subclasses and draft status. [cradle]
8
+ * Update radiant:freeze:edge task to support BRANCH, TAG, and REVISION. [John
9
+ Muhl]
10
+ * Update to Haml 2.0.1. [Jim Gay]
11
+ * Fix radiant:update:configs task to properly evaluate environment.rb
12
+ [Sean Cribbs]
13
+ * Fix page subclass loading issues. [Sean Cribbs]
14
+ * Add <r:unless_ancestor_or_self> and <r:unless_self> tags. [Tim Gossett]
15
+ * Add specific installation modes for gzip and bzip2 compression. [Sean Cribbs]
16
+ * Added extension installation scripts. [Sean Cribbs]
17
+ * Added find attr to r:if_content and r:unless_content to expand based on
18
+ finding 'any' or 'all' specified parts [Jim Gay]
19
+ * Added inherit attr to r:if_content and r:unless_content to search for parts
20
+ independently in the page tree. [Jim Gay]
21
+ * Update radiant:freeze:edge task to use git and GitHub. [John Muhl]
22
+ * Update login page layout from prototype. [Sean Cribbs]
23
+ * Change order of extension paths to prefer project extensions over Radiant's.
24
+ [John Muhl]
25
+ * Switch default session store to cookies [Josh French]
26
+ * Add remember-me function to login [Josh French]
27
+ * Allow an inclusive list of parts in r:if_content and r:unless_content [Jim Gay]
28
+ * Added a defaults.page.filter config setting for setting a default page
29
+ filter. [Alex Wayne]
30
+ * Fix Users fixtures for extensions that still use test/unit. [Nick Plante]
31
+ * Don't search for missing Page subclasses before bootstrap. [Sean Cribbs]
32
+ * Added tolerance for missing Page class definitions. [Loren Johnson]
33
+ * Don't require an authenticity token check on the login action. [Sean Cribbs]
34
+ * Make sure region sets are reloaded when activating extensions in development
35
+ mode. [Sean Cribbs]
4
36
  * Fix Haml rendering errors. [Thomas Watson Steen]
5
37
 
6
38
  === 0.6.7 Mordant
@@ -8,11 +40,11 @@
8
40
  * Convert all views to Haml. [Sean Cribbs, John Long]
9
41
  * Avoid authenticity check when listing page children. [Sean Cribbs]
10
42
  * Add radiant:extensions:update_all task. [Josh French]
11
- * Tweak LoginSystem to allow attempted URL redirection after login and
43
+ * Tweak LoginSystem to allow attempted URL redirection after login and
12
44
  auto-redirect from login URL if logged in. [Josh French]
13
45
  * Add per-user salting to password encryption. [Sean Cribbs]
14
46
  * Address CSRF vulnerabilities in forms. [Sean Cribbs]
15
- * Remove clear cache action, always clear cache after saving a page. [Sean
47
+ * Remove clear cache action, always clear cache after saving a page. [Sean
16
48
  Cribbs]
17
49
 
18
50
  === 0.6.6 Chiseled
data/CONTRIBUTORS CHANGED
@@ -4,7 +4,17 @@
4
4
  The following people have submitted changes which have been applied to the
5
5
  core:
6
6
 
7
- === Edge
7
+ === 0.6.8 Incise
8
+ * Andrew Neil
9
+ * cradle
10
+ * Tim Gossett
11
+ * John Muhl
12
+ * Josh French
13
+ * Jim Gay
14
+ * Alex Wayne
15
+ * Nick Plante
16
+ * Loren Johnson
17
+ * Sean Cribbs
8
18
  * Thomas Watson Steen
9
19
 
10
20
  === 0.6.7 Mordant
data/README CHANGED
@@ -22,8 +22,9 @@ Radiant features:
22
22
 
23
23
  == License
24
24
 
25
- Radiant is released under the MIT license and is copyright (c) 2006 John W.
26
- Long. A copy of the MIT license can be found in the LICENSE file.
25
+ Radiant is released under the MIT license and is copyright (c) 2006-2008
26
+ John W. Long and Sean Cribbs. A copy of the MIT license can be found in the
27
+ LICENSE file.
27
28
 
28
29
 
29
30
  == Installation and Setup
@@ -51,4 +52,5 @@ tickets.
51
52
  Enjoy!
52
53
 
53
54
  --
54
- John Long :: http://wiseheartdesign.com
55
+ The Radiant Dev Team
56
+ http://radiantcms.org
@@ -1,5 +1,6 @@
1
1
  class Admin::WelcomeController < ApplicationController
2
2
  no_login_required
3
+ skip_before_filter :verify_authenticity_token
3
4
 
4
5
  def index
5
6
  redirect_to page_index_url
@@ -12,12 +13,18 @@ class Admin::WelcomeController < ApplicationController
12
13
  announce_invalid_user unless self.current_user = User.authenticate(login, password)
13
14
  end
14
15
  if current_user
16
+ if params[:remember_me]
17
+ current_user.remember_me
18
+ set_session_cookie
19
+ end
15
20
  redirect_to (session[:return_to] || welcome_url)
16
21
  session[:return_to] = nil
17
22
  end
18
23
  end
19
24
 
20
25
  def logout
26
+ cookies[:session_token] = { :expires => 1.day.ago }
27
+ self.current_user.forget_me
21
28
  self.current_user = nil
22
29
  announce_logged_out
23
30
  redirect_to login_url
@@ -0,0 +1,11 @@
1
+ class AddSessionInfoToUsers < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :users, :session_token, :string
4
+ add_column :users, :session_expire, :datetime
5
+ end
6
+
7
+ def self.down
8
+ remove_column :users, :session_token
9
+ remove_column :users, :session_expire
10
+ end
11
+ end
data/app/models/page.rb CHANGED
@@ -152,9 +152,10 @@ class Page < ActiveRecord::Base
152
152
  found = child.find_by_url(url, live, clean)
153
153
  return found if found
154
154
  end
155
- file_not_found_types = [FileNotFoundPage] + FileNotFoundPage.descendants
156
- condition = (['class_name = ?'] * file_not_found_types.length).join(' or ')
157
- file_not_found_names = file_not_found_types.map { |x| x.name }.uniq
155
+ file_not_found_types = ([FileNotFoundPage] + FileNotFoundPage.descendants)
156
+ file_not_found_names = file_not_found_types.collect { |x| x.name }
157
+ condition = (['class_name = ?'] * file_not_found_names.length).join(' or ')
158
+ condition = "status_id = #{Status[:published].id} and (#{condition})" if live
158
159
  children.find(:first, :conditions => [condition] + file_not_found_names)
159
160
  end
160
161
  end
@@ -177,14 +178,24 @@ class Page < ActiveRecord::Base
177
178
  n.strip
178
179
  end
179
180
  end
181
+ @display_name = @display_name + " - not installed" if missing? && @display_name !~ /not installed/
182
+ @display_name
180
183
  end
181
184
  def display_name=(string)
182
185
  display_name(string)
183
186
  end
184
187
 
185
188
  def load_subclasses
186
- Dir["#{RADIANT_ROOT}/app/models/*_page.rb"].each do |page|
187
- $1.camelize.constantize if page =~ %r{/([^/]+)\.rb}
189
+ ([RADIANT_ROOT] + Radiant::Extension.descendants.map(&:root)).each do |path|
190
+ Dir["#{path}/app/models/*_page.rb"].each do |page|
191
+ require page
192
+ $1.camelize.constantize if page =~ %r{/([^/]+)\.rb}
193
+ end
194
+ end
195
+ unless Page.connection.tables.empty? # Haven't bootstrapped yet
196
+ Page.connection.select_values("SELECT DISTINCT class_name FROM pages WHERE class_name <> '' AND class_name IS NOT NULL").each do |p|
197
+ eval(%Q{class #{p} < Page; def self.missing?; true end end}, TOPLEVEL_BINDING) unless Object.const_defined?(p)
198
+ end
188
199
  end
189
200
  end
190
201
 
@@ -192,7 +203,7 @@ class Page < ActiveRecord::Base
192
203
  default_parts = config['defaults.page.parts'].to_s.strip.split(/\s*,\s*/)
193
204
  page = new
194
205
  default_parts.each do |name|
195
- page.parts << PagePart.new(:name => name)
206
+ page.parts << PagePart.new(:name => name, :filter_id => config['defaults.page.filter'])
196
207
  end
197
208
  default_status = config['defaults.page.status']
198
209
  page.status = Status[default_status] if default_status
@@ -211,6 +222,10 @@ class Page < ActiveRecord::Base
211
222
  class_name.constantize
212
223
  end
213
224
  end
225
+
226
+ def missing?
227
+ false
228
+ end
214
229
  end
215
230
 
216
231
  private
@@ -265,6 +280,4 @@ class Page < ActiveRecord::Base
265
280
  text = object.filter.filter(text) if object.respond_to? :filter_id
266
281
  text
267
282
  end
268
- end
269
-
270
- Page.load_subclasses
283
+ end
@@ -275,32 +275,75 @@ module StandardTags
275
275
  end
276
276
 
277
277
  desc %{
278
- Renders the containing elements only if the part exists on a page. By default the
279
- @part@ attribute is set to @body@.
278
+ Renders the containing elements if all of the listed parts exist on a page.
279
+ By default the @part@ attribute is set to @body@, but you may list more than one
280
+ part by seprating them with a comma. Setting the optional @inherit@ to true will
281
+ search ancestors independently for each part. By default @inherit@ is set to @false@.
282
+
283
+ When listing more than one part, you may optionally set the @find@ attribute to @any@
284
+ so that it will render the containing elements if any of the listed parts are found.
285
+ By default the @find@ attribute is set to @all@.
280
286
 
281
287
  *Usage:*
282
- <pre><code><r:if_content [part="part_name"]>...</r:if_content></code></pre>
288
+ <pre><code><r:if_content [part="part_name, other_part"] [inherit="true"] [find="any"]>...</r:if_content></code></pre>
283
289
  }
284
290
  tag 'if_content' do |tag|
285
291
  page = tag.locals.page
286
292
  part_name = tag_part_name(tag)
287
- unless page.part(part_name).nil?
288
- tag.expand
293
+ parts_arr = part_name.split(',')
294
+ inherit = boolean_attr_or_error(tag, 'inherit', 'false')
295
+ find = attr_or_error(tag, :attribute_name => 'find', :default => 'all', :values => 'any, all')
296
+ expandable = true
297
+ one_found = false
298
+ part_page = page
299
+ parts_arr.each do |name|
300
+ name.strip!
301
+ if inherit
302
+ while (part_page.part(name).nil? and (not part_page.parent.nil?)) do
303
+ part_page = part_page.parent
304
+ end
305
+ end
306
+ expandable = false if part_page.part(name).nil?
307
+ one_found ||= true if !part_page.part(name).nil?
289
308
  end
309
+ expandable = true if (find == 'any' and one_found)
310
+ tag.expand if expandable
290
311
  end
291
312
 
292
313
  desc %{
293
- The opposite of the @if_content@ tag.
314
+ The opposite of the @if_content@ tag. It renders the contained elements if all of the
315
+ specified parts do not exist. Setting the optional @inherit@ to true will search
316
+ ancestors independently for each part. By default @inherit@ is set to @false@.
317
+
318
+ When listing more than one part, you may optionally set the @find@ attribute to @any@
319
+ so that it will not render the containing elements if any of the listed parts are found.
320
+ By default the @find@ attribute is set to @all@.
294
321
 
295
322
  *Usage:*
296
- <pre><code><r:unless_content [part="part_name"]>...</r:unless_content></code></pre>
323
+ <pre><code><r:unless_content [part="part_name, other_part"] [inherit="true"] [find="any"]>...</r:unless_content></code></pre>
297
324
  }
298
325
  tag 'unless_content' do |tag|
299
326
  page = tag.locals.page
300
327
  part_name = tag_part_name(tag)
301
- if page.part(part_name).nil?
302
- tag.expand
328
+ parts_arr = part_name.split(',')
329
+ inherit = boolean_attr_or_error(tag, 'inherit', true)
330
+ find = attr_or_error(tag, :attribute_name => 'find', :default => 'all', :values => 'any, all')
331
+ expandable, all_found = true, true
332
+ part_page = page
333
+ parts_arr.each do |name|
334
+ name.strip!
335
+ if inherit
336
+ while (part_page.part(name).nil? and (not part_page.parent.nil?)) do
337
+ part_page = part_page.parent
338
+ end
339
+ end
340
+ expandable = false if !part_page.part(name).nil?
341
+ all_found = false if part_page.part(name).nil?
342
+ end
343
+ if all_found == false and find == 'all'
344
+ expandable = true
303
345
  end
346
+ tag.expand if expandable
304
347
  end
305
348
 
306
349
  desc %{
@@ -345,6 +388,18 @@ module StandardTags
345
388
  tag.expand if (tag.globals.page.ancestors + [tag.globals.page]).include?(tag.locals.page)
346
389
  end
347
390
 
391
+ desc %{
392
+ Renders the contained elements unless the current contextual page is either the actual page or one of its parents.
393
+
394
+ This is typically used inside another tag (like &lt;r:children:each&gt;) to add conditional mark-up unless the child element is or descends from the current page.
395
+
396
+ *Usage:*
397
+ <pre><code><r:unless_ancestor_or_self>...</unless_ancestor_or_self></code></pre>
398
+ }
399
+ tag "unless_ancestor_or_self" do |tag|
400
+ tag.expand unless (tag.globals.page.ancestors + [tag.globals.page]).include?(tag.locals.page)
401
+ end
402
+
348
403
  desc %{
349
404
  Renders the contained elements if the current contextual page is also the actual page.
350
405
 
@@ -357,6 +412,18 @@ module StandardTags
357
412
  tag.expand if tag.locals.page == tag.globals.page
358
413
  end
359
414
 
415
+ desc %{
416
+ Renders the contained elements unless the current contextual page is also the actual page.
417
+
418
+ This is typically used inside another tag (like &lt;r:children:each&gt;) to add conditional mark-up unless the child element is the current page.
419
+
420
+ *Usage:*
421
+ <pre><code><r:unless_self>...</unless_self></code></pre>
422
+ }
423
+ tag "unless_self" do |tag|
424
+ tag.expand unless tag.locals.page == tag.globals.page
425
+ end
426
+
360
427
  desc %{
361
428
  Renders the name of the author of the current page.
362
429
  }
@@ -449,10 +516,17 @@ module StandardTags
449
516
 
450
517
  *Usage:*
451
518
  <pre><code><r:snippet name="snippet_name" /></code></pre>
519
+
520
+ When used as a double tag, the part in between both tags may be used within the
521
+ snippet itself, being substituted in place of @<r:yield/>@.
522
+
523
+ *Usage:*
524
+ <pre><code><r:snippet name="snippet_name">Lorem ipsum dolor...</r:snippet></code></pre>
452
525
  }
453
526
  tag 'snippet' do |tag|
454
527
  if name = tag.attr['name']
455
528
  if snippet = Snippet.find_by_name(name.strip)
529
+ tag.locals.yield = tag.expand if tag.double?
456
530
  tag.globals.page.render_snippet(snippet)
457
531
  else
458
532
  raise TagError.new('snippet not found')
@@ -461,7 +535,41 @@ module StandardTags
461
535
  raise TagError.new("`snippet' tag must contain `name' attribute")
462
536
  end
463
537
  end
464
-
538
+
539
+ desc %{
540
+ Used within a snippet as a placeholder for substitution of child content, when
541
+ the snippet is called as a double tag.
542
+
543
+ *Usage (within a snippet):*
544
+ <pre><code>
545
+ <div id="outer">
546
+ <p>before</p>
547
+ <r:yield/>
548
+ <p>after</p>
549
+ </div>
550
+ </code></pre>
551
+
552
+ If the above snippet was named "yielding", you could call it from any Page,
553
+ Layout or Snippet as follows:
554
+
555
+ <pre><code><r:snippet name="yielding">Content within</r:snippet></code></pre>
556
+
557
+ Which would output the following:
558
+
559
+ <pre><code>
560
+ <div id="outer">
561
+ <p>before</p>
562
+ Content within
563
+ <p>after</p>
564
+ </div>
565
+ </code></pre>
566
+
567
+ When called in the context of a Page or a Layout, @<r:yield/>@ outputs nothing.
568
+ }
569
+ tag 'yield' do |tag|
570
+ tag.locals.yield
571
+ end
572
+
465
573
  desc %{
466
574
  Inside this tag all page related tags refer to the page found at the @url@ attribute.
467
575
  @url@s may be relative or absolute paths.
@@ -783,4 +891,19 @@ module StandardTags
783
891
  def page_found?(page)
784
892
  page && !(FileNotFoundPage === page)
785
893
  end
894
+
895
+ def boolean_attr_or_error(tag, attribute_name, default)
896
+ attribute = attr_or_error(tag, :attribute_name => attribute_name, :default => default.to_s, :values => 'true, false')
897
+ (attribute.to_s.downcase == 'true') ? true : false
898
+ end
899
+
900
+ def attr_or_error(tag, options = {})
901
+ attribute_name = options[:attribute_name].to_s
902
+ default = options[:default]
903
+ values = options[:values].split(',').map!(&:strip)
904
+
905
+ attribute = (tag.attr[attribute_name] || default).to_s
906
+ raise TagError.new(%{'#{attribute_name}' attribute of #{tag} tag must be one of: #{values.join(',')}}) unless values.include?(attribute)
907
+ return attribute
908
+ end
786
909
  end
data/app/models/user.rb CHANGED
@@ -44,7 +44,15 @@ class User < ActiveRecord::Base
44
44
  def confirm_password?
45
45
  @confirm_password
46
46
  end
47
-
47
+
48
+ def remember_me
49
+ update_attribute(:session_token, sha1(Time.now + Radiant::Config['session_timeout'].to_i)) unless self.session_token?
50
+ end
51
+
52
+ def forget_me
53
+ update_attribute(:session_token, nil)
54
+ end
55
+
48
56
  private
49
57
 
50
58
  def validate_length_of_password?
@@ -63,10 +63,11 @@
63
63
  %label{:for=>"page_status_id"}
64
64
  Status
65
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
66
+ - if @config['page.edit.published_date?']
67
+ %p#publication-date{:style => "display: none"}
68
+ %label{:for=>"page_published_at"}
69
+ Published At
70
+ = datetime_select "page", "published_at", :disabled => true
70
71
  = render_region :layout_row
71
72
  %span.clear &nbsp;
72
73
  - parts_bottom.edit_timestamp do
@@ -9,36 +9,54 @@
9
9
  margin: 2em
10
10
  margin-left: auto
11
11
  margin-right: auto
12
- padding-left: 20px
12
+ padding: 5px 20px
13
+ padding-right: 22px
14
+ position: relative
13
15
  width: 23.5em
14
16
  h1
15
17
  font-size: 140%
16
18
  margin: 0
17
- margin-top: 18px
18
- margin-bottom: 18px
19
- label
20
- float: left
21
- clear: left
22
- margin-top: 4px
23
- width: 6em
24
- input.textbox
25
- font-size: 100%
26
- width: 16em
27
- .buttons
28
- margin-top: 15px
29
- margin-bottom: 20px
19
+ margin-top: 13px
20
+ table
21
+ width: 100%
22
+ margin: 15px 0 10px 0
23
+ td
24
+ text-align: left
25
+ padding: 6px 0
26
+ &.label
27
+ width: 6em
28
+ &.field
29
+ input.textbox
30
+ font-size: 100%
31
+ width: 98%
32
+ &.checkbox
33
+ font-size: 85%
34
+ &.buttons
35
+ text-align: right
36
+ input
37
+ font-size: 140%
30
38
 
31
39
  #login
32
40
  %h1 Please Login
33
-
41
+
34
42
  - form_tag login_url do
35
- %p
36
- %label{:for=>"user_login"} Username
37
- = text_field "user", "login", :class => 'textbox', :value => '', :maxlength => 40
38
- %p
39
- %label{:for=>"user_password"} Password
40
- = password_field "user", "password", :class => 'textbox', :value => '', :maxlength => 40
41
- %p.buttons
42
- %input.button{:type=>"submit", :value=>"Login"}/
43
-
43
+ %table
44
+ %tr
45
+ %td.label
46
+ %label{:for=>"user_login"} Username
47
+ %td.field{:colspan=>2}
48
+ = text_field "user", "login", :class => 'textbox activate', :value => '', :maxlength => 40, :size => 40
49
+ %tr
50
+ %td.label
51
+ %label{:for=>"user_password"} Password
52
+ %td.field{:colspan=>2}
53
+ = password_field "user", "password", :class => 'textbox', :value => '', :maxlength => 40, :size => 40
54
+ %tr
55
+ %td
56
+ %td.checkbox
57
+ = check_box_tag :remember_me, 1, false, :class => 'checkbox'
58
+ %label.checkbox{:for=>"remember_me"} Remember me
59
+ %td.buttons
60
+ %input.button{:type=>"submit", :value=>"Login"}/
61
+
44
62
  = javascript_tag "$('user_login').activate();"