feather_cms 0.0.4 → 0.0.5

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 (82) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/{README.md → README.rdoc} +13 -12
  3. data/Rakefile +40 -1
  4. data/app/assets/images/feather_cms/images/edit.png +0 -0
  5. data/app/assets/images/feather_cms/images/fullscreen.png +0 -0
  6. data/app/assets/images/feather_cms/images/preview.png +0 -0
  7. data/app/assets/javascripts/feather_cms/application.js +14 -0
  8. data/app/assets/javascripts/feather_cms/editor.js +21 -0
  9. data/app/assets/javascripts/feather_cms/epiceditor.js +716 -0
  10. data/app/assets/javascripts/feather_cms/epiceditor.min.js +4 -0
  11. data/app/assets/stylesheets/feather_cms/application.css.sass +37 -0
  12. data/{lib/generators/feather_cms/templates → app/assets/stylesheets/feather_cms}/bootstrap.css +0 -0
  13. data/app/assets/stylesheets/feather_cms/themes/base/epiceditor.css +31 -0
  14. data/app/assets/stylesheets/feather_cms/themes/editor/epic-dark.css +47 -0
  15. data/app/assets/stylesheets/feather_cms/themes/editor/epic-light.css +48 -0
  16. data/app/assets/stylesheets/feather_cms/themes/preview/github.css +82 -0
  17. data/app/assets/stylesheets/feather_cms/themes/preview/preview-dark.css +113 -0
  18. data/app/controllers/feather_cms/application_controller.rb +4 -0
  19. data/app/controllers/feather_cms/pages_controller.rb +84 -0
  20. data/app/helpers/feather_cms/application_helper.rb +4 -0
  21. data/app/models/feather_cms/page.rb +11 -0
  22. data/app/views/feather_cms/pages/_form.html.haml +24 -0
  23. data/app/views/feather_cms/pages/edit.html.haml +17 -0
  24. data/app/views/feather_cms/pages/index.html.haml +22 -0
  25. data/app/views/feather_cms/pages/new.html.haml +4 -0
  26. data/app/views/layouts/feather_layout.html.haml +30 -0
  27. data/config/routes.rb +7 -0
  28. data/lib/feather_cms/config.rb +6 -18
  29. data/lib/feather_cms/engine.rb +5 -0
  30. data/lib/feather_cms/version.rb +1 -1
  31. data/lib/feather_cms.rb +1 -13
  32. data/lib/generators/feather_cms/USAGE +3 -8
  33. data/lib/generators/feather_cms/feather_cms_generator.rb +5 -39
  34. data/lib/generators/feather_cms/templates/initializer.rb +0 -5
  35. data/lib/generators/feather_cms/templates/migration.rb +2 -3
  36. data/lib/tasks/feather_cms_tasks.rake +4 -0
  37. data/test/dummy/README.rdoc +261 -0
  38. data/test/dummy/Rakefile +7 -0
  39. data/test/dummy/app/assets/javascripts/application.js +15 -0
  40. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  41. data/test/dummy/app/controllers/application_controller.rb +3 -0
  42. data/test/dummy/app/helpers/application_helper.rb +2 -0
  43. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  44. data/test/dummy/config/application.rb +59 -0
  45. data/test/dummy/config/boot.rb +10 -0
  46. data/test/dummy/config/database.yml +25 -0
  47. data/test/dummy/config/environment.rb +5 -0
  48. data/test/dummy/config/environments/development.rb +37 -0
  49. data/test/dummy/config/environments/production.rb +67 -0
  50. data/test/dummy/config/environments/test.rb +37 -0
  51. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  52. data/test/dummy/config/initializers/inflections.rb +15 -0
  53. data/test/dummy/config/initializers/mime_types.rb +5 -0
  54. data/test/dummy/config/initializers/secret_token.rb +7 -0
  55. data/test/dummy/config/initializers/session_store.rb +8 -0
  56. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  57. data/test/dummy/config/locales/en.yml +5 -0
  58. data/test/dummy/config/routes.rb +4 -0
  59. data/test/dummy/config.ru +4 -0
  60. data/test/dummy/public/404.html +26 -0
  61. data/test/dummy/public/422.html +26 -0
  62. data/test/dummy/public/500.html +25 -0
  63. data/test/dummy/public/favicon.ico +0 -0
  64. data/test/dummy/script/rails +6 -0
  65. data/test/feather_cms_test.rb +7 -0
  66. data/test/fixtures/feather_cms/pages.yml +11 -0
  67. data/test/integration/navigation_test.rb +10 -0
  68. data/test/test_helper.rb +15 -0
  69. data/test/unit/feather_cms/page_test.rb +9 -0
  70. metadata +123 -26
  71. data/.gitignore +0 -4
  72. data/Gemfile +0 -4
  73. data/feather_cms.gemspec +0 -24
  74. data/lib/feather_cms/model.rb +0 -59
  75. data/lib/feather_cms/railtie.rb +0 -13
  76. data/lib/feather_cms/template_cache.rb +0 -52
  77. data/lib/generators/feather_cms/templates/controller.rb +0 -40
  78. data/lib/generators/feather_cms/templates/form.html.erb +0 -40
  79. data/lib/generators/feather_cms/templates/helper.rb +0 -18
  80. data/lib/generators/feather_cms/templates/index.html.erb +0 -11
  81. data/lib/generators/feather_cms/templates/layout.html.erb +0 -52
  82. data/lib/generators/feather_cms/templates/model.rb +0 -5
@@ -1,52 +0,0 @@
1
- module FeatherCms
2
- class TemplateCache
3
- class << self
4
-
5
- def init(options = {})
6
- @@_cache ||= {}
7
- @@options = options
8
- end
9
-
10
- def [](key)
11
- @@_cache[key.to_s]
12
- end
13
-
14
- def []=(k,v)
15
- @@_cache[k.to_s] = v
16
- end
17
-
18
- def cache_file(name)
19
- return self[name] if exist?(name)
20
-
21
- file = _file_path(name)
22
- self[file] = File.read(file) if File.exist?(file)
23
- end
24
-
25
- def write_to_file_and_cache(content, file)
26
- return if cache_file(file) == content
27
- self[file] = content
28
- File.open(_file_path(file), 'wb') {|f| f.write(content) }
29
- end
30
-
31
- def exist?(name)
32
- @@_cache.key?(name.to_s)
33
- end
34
-
35
- def clear(name = nil)
36
- name ? @@_cache.delete(name.to_s) : @@_cache.clear
37
- end
38
-
39
- def delete_file(name)
40
- file = _file_path(name)
41
- File.delete(file) if File.exist?(file)
42
- @@_cache.delete(name)
43
- end
44
-
45
- private
46
- def _file_path(name)
47
- File.join([Config.template_store_path, name])
48
- end
49
- end
50
-
51
- end
52
- end
@@ -1,40 +0,0 @@
1
- class FeathersController < ApplicationController
2
-
3
- if FeatherCms::Config.authentication.kind_of?(Hash)
4
- http_basic_authenticate_with FeatherCms::Config.authentication.merge(except: :published)
5
- else
6
- before_filter FeatherCms::Config.authentication.to_sym, except: :published
7
- end
8
-
9
- before_filter :find_page, only: [:page, :preivew]
10
-
11
- layout 'feather_layout', except: [:preivew, :published]
12
-
13
- def index
14
- @pages = FeatherPage.all
15
- end
16
-
17
- def page
18
- if request.put? or request.post?
19
- @feather_page.attributes = params[:feather_page]
20
- @feather_page.name = params[:type]
21
- @feather_page.save
22
- end
23
- render action: @feather_page.name
24
- end
25
-
26
- def preivew
27
- render inline: @feather_page.content, type: 'html', layout: @feather_page.layout
28
- end
29
-
30
- def published
31
- @feather_page = FeatherPage.where(name: params[:type], status: 'published').first
32
- render inline: @feather_page.content, type: 'html', layout: @feather_page.layout
33
- end
34
-
35
- def find_page
36
- status = params[:feather_page] ? params[:feather_page][:status] : (params[:status] || 'draft')
37
- @feather_page = FeatherPage.where(name: params[:type], status: status)
38
- @feather_page = @feather_page.first || @feather_page.new
39
- end
40
- end
@@ -1,40 +0,0 @@
1
- <header>
2
- <%% status = params[:status] || @feather_page.status %>
3
- <div class="subnav">
4
- <ul class="nav nav-pills">
5
- <li class='<%%= status == 'published' ? 'active ' : '' %>'>
6
- <%%= link_to 'Published Page', feather_page_path('<%= @type %>',:published) %>
7
- </li>
8
- <li class='<%%= status == 'draft' ? 'active ' : '' %>'>
9
- <%%= link_to 'Draft Page', feather_page_path('<%= @type %>', :draft) %>
10
- </li>
11
- <li>
12
- <%%= link_to 'Preview', feather_page_preview_path('<%= @type %>', status), target: '_blank' unless @feather_page.new_record? %>
13
- </li>
14
- </ul>
15
- </div>
16
- <hr>
17
- </header>
18
- <div class="row">
19
- <div class="span12">
20
- <%%= form_for(@feather_page, :url => feather_page_path('<%= @type %>')) do |f| %>
21
- <div class="control-group">
22
- <label class="control-label" for="status">Status</label>
23
- <div class="controls">
24
- <%%= f.select :status, [:draft, :published] %>
25
- </div>
26
- <label class="control-label" for="layout">Layout</label>
27
- <div class="controls">
28
- <%%= f.select :layout, FeatherCms::Config.layouts %>
29
- </div>
30
- </div>
31
- <div class="control-group">
32
- <label class="control-label" for="textarea">Content</label>
33
- <div class="controls">
34
- <%%= f.text_area :content, :class => 'codemirror_feather_cms input-xlarge span12', :row => "20" %>
35
- </div>
36
- </div>
37
- <%%= f.submit "Save", :class => 'btn btn-primary btn-large' %>
38
- <%% end %>
39
- </div>
40
- </div>
@@ -1,18 +0,0 @@
1
- module FeathersHelper
2
- def feather_cms_include_tag
3
- javascript_include_tag('codemirror', 'modes/htmlmixed', 'modes/javascript',
4
- 'modes/xml', 'modes/css', 'feather_cms') +
5
- stylesheet_link_tag('codemirror')
6
- end
7
-
8
- def feather_cms_template(object_name, method, options = {})
9
- options[:class] = "#{options[:class]} codemirror_feather_cms"
10
- text_area(object_name, method, options = {})
11
- end
12
-
13
- def feather_cms_template_tag(name, content = nil, options = {})
14
- options[:class] = "#{options[:class]} codemirror_feather_cms"
15
- text_area_tag(name, content = nil, options = {})
16
- end
17
-
18
- end
@@ -1,11 +0,0 @@
1
- <div class="row">
2
- <ol>
3
- <%% @pages.each do |page| %>
4
- <li>
5
- <strong>
6
- <%%= link_to "#{page.name.humanize}(#{page.status})", feather_page_path(page.name, page.status) %>
7
- </strong>
8
- </li>
9
- <%% end %>
10
- </ol>
11
- </div>
@@ -1,52 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>Feather CMS</title>
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <meta name="description" content="">
8
- <meta name="author" content="">
9
-
10
- <!-- Le styles -->
11
- <%%= stylesheet_link_tag 'bootstrap' %>
12
- <%%= javascript_include_tag 'jquery' %>
13
- <%%= feather_cms_include_tag %>
14
- <style type="text/css">
15
- body {
16
- padding-top: 60px;
17
- padding-bottom: 40px;
18
- }
19
- </style>
20
-
21
- <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
22
- <!--[if lt IE 9]>
23
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
24
- <![endif]-->
25
-
26
- </head>
27
-
28
- <body>
29
-
30
- <div class="navbar navbar-fixed-top">
31
- <div class="navbar-inner">
32
- <div class="container">
33
- <%%= link_to 'Feather CMS', feather_pages_path, :class => 'brand' %>
34
- <div class="nav-collapse">
35
- <ul class="nav">
36
- <%- @pages.each do |page| -%>
37
- <li class="<%%= params[:type] == '<%=page%>' ? 'active' : '' %>">
38
- <%%= link_to '<%= page.humanize %>' , feather_page_path('<%= page %>') %>
39
- </li>
40
- <%- end -%>
41
- </ul>
42
- </div><!--/.nav-collapse -->
43
- </div>
44
- </div>
45
- </div>
46
-
47
- <div class="container">
48
- <%%= yield %>
49
- </div>
50
-
51
- </body>
52
- </html>
@@ -1,5 +0,0 @@
1
- class FeatherPage < ActiveRecord::Base
2
- include FeatherCms
3
-
4
- attr_accessible :status, :layout, :content
5
- end