cortex-reaver 0.0.9 → 0.1.0

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 (77) hide show
  1. data/bin/cortex_reaver +7 -2
  2. data/lib/cortex_reaver.rb +51 -71
  3. data/lib/cortex_reaver/config.rb +23 -7
  4. data/lib/cortex_reaver/controller/admin.rb +6 -8
  5. data/lib/cortex_reaver/controller/comment.rb +17 -17
  6. data/lib/cortex_reaver/controller/config.rb +3 -2
  7. data/lib/cortex_reaver/controller/controller.rb +22 -0
  8. data/lib/cortex_reaver/controller/documentation.rb +1 -3
  9. data/lib/cortex_reaver/controller/journal.rb +13 -12
  10. data/lib/cortex_reaver/controller/main.rb +36 -29
  11. data/lib/cortex_reaver/controller/page.rb +15 -11
  12. data/lib/cortex_reaver/controller/photograph.rb +21 -15
  13. data/lib/cortex_reaver/controller/project.rb +16 -13
  14. data/lib/cortex_reaver/controller/tag.rb +16 -14
  15. data/lib/cortex_reaver/controller/user.rb +11 -13
  16. data/lib/cortex_reaver/helper/attachments.rb +18 -12
  17. data/lib/cortex_reaver/helper/auth.rb +2 -2
  18. data/lib/cortex_reaver/helper/canonical.rb +2 -2
  19. data/lib/cortex_reaver/helper/crud.rb +78 -38
  20. data/lib/cortex_reaver/helper/feeds.rb +2 -5
  21. data/lib/cortex_reaver/helper/form.rb +1 -1
  22. data/lib/cortex_reaver/helper/navigation.rb +1 -1
  23. data/lib/cortex_reaver/helper/photographs.rb +12 -3
  24. data/lib/cortex_reaver/helper/template.rb +37 -0
  25. data/lib/cortex_reaver/{view/blank_layout.rhtml → layout/blank.rhtml} +1 -1
  26. data/lib/cortex_reaver/{view/text_layout.rhtml → layout/text.rhtml} +1 -1
  27. data/lib/cortex_reaver/migrations/013_draft.rb +17 -0
  28. data/lib/cortex_reaver/model/comment.rb +64 -53
  29. data/lib/cortex_reaver/model/journal.rb +23 -21
  30. data/lib/cortex_reaver/model/model.rb +9 -0
  31. data/lib/cortex_reaver/model/page.rb +24 -42
  32. data/lib/cortex_reaver/model/photograph.rb +17 -17
  33. data/lib/cortex_reaver/model/project.rb +21 -18
  34. data/lib/cortex_reaver/model/tag.rb +12 -8
  35. data/lib/cortex_reaver/model/user.rb +79 -41
  36. data/lib/cortex_reaver/public/css/main.css +4 -0
  37. data/lib/cortex_reaver/snippets/numeric.rb +15 -0
  38. data/lib/cortex_reaver/snippets/ramaze/cache/memcached.rb +14 -0
  39. data/lib/cortex_reaver/support/attachments.rb +113 -105
  40. data/lib/cortex_reaver/support/cached_rendering.rb +65 -62
  41. data/lib/cortex_reaver/support/canonical.rb +82 -85
  42. data/lib/cortex_reaver/support/comments.rb +57 -51
  43. data/lib/cortex_reaver/support/cortex_reaver_validation_helpers.rb +13 -0
  44. data/lib/cortex_reaver/support/sequenceable.rb +202 -203
  45. data/lib/cortex_reaver/support/tags.rb +103 -94
  46. data/lib/cortex_reaver/support/timestamps.rb +27 -21
  47. data/lib/cortex_reaver/support/viewable.rb +17 -0
  48. data/lib/cortex_reaver/version.rb +3 -3
  49. data/lib/cortex_reaver/view/admin/index.rhtml +2 -2
  50. data/lib/cortex_reaver/view/comments/comment.rhtml +4 -1
  51. data/lib/cortex_reaver/view/comments/list.rhtml +1 -1
  52. data/lib/cortex_reaver/view/comments/post_form.rhtml +1 -1
  53. data/lib/cortex_reaver/view/journals/form.rhtml +3 -1
  54. data/lib/cortex_reaver/view/journals/journal.rhtml +6 -4
  55. data/lib/cortex_reaver/view/journals/list.rhtml +2 -2
  56. data/lib/cortex_reaver/view/journals/show.rhtml +1 -1
  57. data/lib/cortex_reaver/view/pages/form.rhtml +2 -1
  58. data/lib/cortex_reaver/view/pages/list.rhtml +2 -2
  59. data/lib/cortex_reaver/view/pages/show.rhtml +1 -1
  60. data/lib/cortex_reaver/view/photographs/form.rhtml +7 -3
  61. data/lib/cortex_reaver/view/photographs/list.rhtml +1 -1
  62. data/lib/cortex_reaver/view/photographs/show.rhtml +7 -7
  63. data/lib/cortex_reaver/view/projects/form.rhtml +1 -0
  64. data/lib/cortex_reaver/view/projects/list.rhtml +3 -3
  65. data/lib/cortex_reaver/view/projects/show.rhtml +5 -2
  66. data/lib/cortex_reaver/view/tags/list.rhtml +6 -2
  67. data/lib/cortex_reaver/view/tags/show.rhtml +10 -5
  68. data/lib/cortex_reaver/view/users/form.rhtml +1 -1
  69. data/lib/cortex_reaver/view/users/list.rhtml +5 -2
  70. data/lib/cortex_reaver/view/users/login.rhtml +1 -1
  71. data/lib/cortex_reaver/view/users/show.rhtml +5 -1
  72. metadata +159 -149
  73. data/lib/cortex_reaver/public/dispatch.fcgi +0 -11
  74. data/lib/cortex_reaver/snippets/ramaze/dispatcher/file.rb +0 -37
  75. data/lib/cortex_reaver/support/pagination.rb +0 -38
  76. data/lib/cortex_reaver/view/error.rhtml +0 -72
  77. data/lib/cortex_reaver/view/photographs/short.rhtml +0 -3
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'ramaze'
5
-
6
- # FCGI doesn't like you writing to stdout
7
- Ramaze::Log.loggers = [ Ramaze::Informer.new( File.join(__DIR__, '..', 'ramaze.fcgi.log') ) ]
8
- Ramaze::Global.adapter = :fcgi
9
-
10
- $0 = File.join(__DIR__, '..', 'start.rb')
11
- require $0
@@ -1,37 +0,0 @@
1
- module Ramaze
2
- class Dispatcher
3
-
4
- # Monkeypatch to add support for multiple public_roots.
5
- # Stolen from Thoth :)
6
- class File
7
- class << self
8
- def in_public?(path)
9
- path = expand(path)
10
-
11
- @expanded ||= {
12
- :default => expand(Ramaze::Global.public_root),
13
- :custom => expand(CortexReaver.config[:public_root])
14
- }
15
-
16
- path.start_with?(@expanded[:default]) ||
17
- path.start_with?(@expanded[:custom])
18
- end
19
-
20
- def resolve_path(path)
21
- joined = ::File.join(CortexReaver.config[:public_root], path)
22
-
23
- unless ::File.exist?(joined)
24
- joined = ::File.join(Ramaze::Global.public_root, path)
25
- end
26
-
27
- if ::File.directory?(joined)
28
- Dir[::File.join(joined, "{#{INDICES.join(',')}}")].first || joined
29
- else
30
- joined
31
- end
32
- end
33
- end
34
- end
35
-
36
- end
37
- end
@@ -1,38 +0,0 @@
1
- module CortexReaver
2
- module Model
3
- # Defines class-level accessors for page size, order attribute, etc.
4
- module Pagination
5
- DEFAULT_SIZE = 16
6
- DEFAULT_ORDER = 'created_on'
7
- DEFAULT_REVERSE = false
8
-
9
- def self.included(base)
10
- base.class_eval do
11
- class << self
12
- attr_accessor :page_size, :page_order, :page_reverse
13
- end
14
-
15
- @page_size ||= CortexReaver::Model::Pagination::DEFAULT_SIZE
16
- @page_order ||= CortexReaver::Model::Pagination::DEFAULT_ORDER
17
- @page_reverse ||= CortexReaver::Model::Pagination::DEFAULT_REVERSE
18
- end
19
-
20
- # Returns a paginated dataset at page number. Optionally, filters on
21
- # dataset instead of the whole model.
22
- def page(number, dataset = self.dataset)
23
- if reverse
24
- dataset = dataset.reverse
25
- end
26
-
27
- dataset.order(@order).paginate(number, @page_size)
28
- end
29
- end
30
-
31
- # Returns the page number for this model. Optionally, filters on dataset
32
- # rather than the whole model.
33
- def page_number(dataset = self.class.dataset)
34
-
35
- end
36
- end
37
- end
38
- end
@@ -1,72 +0,0 @@
1
- <% if user.admin? %>
2
- <link rel="stylesheet" href="/css/ramaze_error.css" />
3
- <script type="text/javascript" src="/js/jquery.js"></script>
4
-
5
- <p>The backtrace gives filenames and line numbers for all parts of the call stack.<br />
6
- Click on any of them to view the surrounding source code.</p>
7
-
8
- <h2><%=h @title %></h2>
9
-
10
- <p>Current controller: <%= h Controller.current %></p>
11
-
12
- <table class="main">
13
- <tr class="head">
14
- <td>File</td><td>Line</td><td>Method</td>
15
- </tr>
16
- <% @backtrace.each do |lines, hash, file, lineno, meth| %>
17
- <tr class="line" id="<%= attr_h hash %>">
18
- <td><%= h file %></td><td class="lineno"><%= lineno %></td><td><pre><%= h meth %></pre></td>
19
- </tr>
20
- <tr id="source_<%= attr_h hash %>" style="display:none;">
21
- <td colspan="3">
22
- <div class="source">
23
- <table style="width:100%;">
24
- <tr>
25
- <td class="editor" colspan="2">
26
- <%=h @editor %> <%= h file %> +<%= lineno %>
27
- <div style="float: right">
28
- <a href="txmt://open?url=file://<%=attr_h file %>&line=<%= lineno %>">open in textmate</a>
29
- </div>
30
- </td>
31
- </tr>
32
- <% lines.each do |llineno, lcode, lcurrent| %>
33
- <tr class="source" <%= 'style="background:#faa;"' if lcurrent %>>
34
- <td class="lineno"><%= llineno %></td>
35
- <td class="code"><pre><%=h lcode.to_s.rstrip %></pre></td>
36
- </tr>
37
- <% end %>
38
- </table>
39
- </div>
40
- </td>
41
- </tr>
42
- <% end %>
43
- </table>
44
-
45
- <%
46
- { 'Session' => Thread.current[:session],
47
- 'Request' => Thread.current[:request],
48
- 'Response' => Thread.current[:response],
49
- 'Global' => Global,
50
- }.each do |title, content|
51
- hash = [title, content].object_id.abs
52
- %>
53
- <div class="additional">
54
- <h3 id="<%=hash%>"><%= h title %></h3>
55
- <pre style="display:none" id="is_<%= hash %>"><%= CGI.escapeHTML(content.pretty_inspect) %></pre>
56
- </div>
57
- <% end %>
58
-
59
- <script type="text/javascript">
60
- $("tr.line").click(function(){
61
- $("tr#source_"+this.id).toggle()
62
- });
63
-
64
- $("div.additional > h3").click(function(){
65
- $("pre#is_"+this.id).toggle()
66
- });
67
- </script>
68
- <% else %>
69
- <% @title = "Cortex Reaver Error" %>
70
- <h2><%=h @title %></h2>
71
- <p>Cortex Reaver doesn't know how to deal with your request. For now.</p>
72
- <% end %>
@@ -1,3 +0,0 @@
1
- <div class="short journal">
2
- (<%= @journal.created_on.strftime('%D/%M/%Y') %>) <a href="<%= @journal.url %>"><%=h @journal.title %></a>
3
- </div>