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.
- data/MIT-LICENSE +20 -0
- data/{README.md → README.rdoc} +13 -12
- data/Rakefile +40 -1
- data/app/assets/images/feather_cms/images/edit.png +0 -0
- data/app/assets/images/feather_cms/images/fullscreen.png +0 -0
- data/app/assets/images/feather_cms/images/preview.png +0 -0
- data/app/assets/javascripts/feather_cms/application.js +14 -0
- data/app/assets/javascripts/feather_cms/editor.js +21 -0
- data/app/assets/javascripts/feather_cms/epiceditor.js +716 -0
- data/app/assets/javascripts/feather_cms/epiceditor.min.js +4 -0
- data/app/assets/stylesheets/feather_cms/application.css.sass +37 -0
- data/{lib/generators/feather_cms/templates → app/assets/stylesheets/feather_cms}/bootstrap.css +0 -0
- data/app/assets/stylesheets/feather_cms/themes/base/epiceditor.css +31 -0
- data/app/assets/stylesheets/feather_cms/themes/editor/epic-dark.css +47 -0
- data/app/assets/stylesheets/feather_cms/themes/editor/epic-light.css +48 -0
- data/app/assets/stylesheets/feather_cms/themes/preview/github.css +82 -0
- data/app/assets/stylesheets/feather_cms/themes/preview/preview-dark.css +113 -0
- data/app/controllers/feather_cms/application_controller.rb +4 -0
- data/app/controllers/feather_cms/pages_controller.rb +84 -0
- data/app/helpers/feather_cms/application_helper.rb +4 -0
- data/app/models/feather_cms/page.rb +11 -0
- data/app/views/feather_cms/pages/_form.html.haml +24 -0
- data/app/views/feather_cms/pages/edit.html.haml +17 -0
- data/app/views/feather_cms/pages/index.html.haml +22 -0
- data/app/views/feather_cms/pages/new.html.haml +4 -0
- data/app/views/layouts/feather_layout.html.haml +30 -0
- data/config/routes.rb +7 -0
- data/lib/feather_cms/config.rb +6 -18
- data/lib/feather_cms/engine.rb +5 -0
- data/lib/feather_cms/version.rb +1 -1
- data/lib/feather_cms.rb +1 -13
- data/lib/generators/feather_cms/USAGE +3 -8
- data/lib/generators/feather_cms/feather_cms_generator.rb +5 -39
- data/lib/generators/feather_cms/templates/initializer.rb +0 -5
- data/lib/generators/feather_cms/templates/migration.rb +2 -3
- data/lib/tasks/feather_cms_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/feather_cms_test.rb +7 -0
- data/test/fixtures/feather_cms/pages.yml +11 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/feather_cms/page_test.rb +9 -0
- metadata +123 -26
- data/.gitignore +0 -4
- data/Gemfile +0 -4
- data/feather_cms.gemspec +0 -24
- data/lib/feather_cms/model.rb +0 -59
- data/lib/feather_cms/railtie.rb +0 -13
- data/lib/feather_cms/template_cache.rb +0 -52
- data/lib/generators/feather_cms/templates/controller.rb +0 -40
- data/lib/generators/feather_cms/templates/form.html.erb +0 -40
- data/lib/generators/feather_cms/templates/helper.rb +0 -18
- data/lib/generators/feather_cms/templates/index.html.erb +0 -11
- data/lib/generators/feather_cms/templates/layout.html.erb +0 -52
- 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,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>
|