inkling_cms 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.txt ADDED
@@ -0,0 +1,12 @@
1
+ A CMS based on the Inkling Content Framework (in development).
2
+
3
+ A work in progress. This will be a CMS extension for Inkling - typical CMS functionality.
4
+
5
+ Content types:
6
+
7
+ Page (in progress)
8
+ Image
9
+ Attachment
10
+
11
+
12
+ Possibly include tags.
@@ -0,0 +1,4 @@
1
+ class Inkling::ContentTypes::PagesController < Inkling::BaseController
2
+ inherit_resources
3
+ defaults :resource_class => Inkling::ContentTypes::Page, :instance_name => 'inkling_content_types_page'
4
+ end
@@ -0,0 +1,8 @@
1
+ class Inkling::PagesController < Inkling::BaseController
2
+
3
+ layout 'content'
4
+
5
+ def show
6
+ @page = Inkling::ContentTypes::Page.find(params[:id])
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ require 'inkling'
2
+ require 'inkling/content'
3
+
4
+ class Inkling::ContentTypes::Page < ActiveRecord::Base
5
+ acts_as_content "Page"
6
+ end
@@ -0,0 +1,17 @@
1
+ <% if resource.errors.any? %>
2
+ <h2><%= pluralize(resource.errors.count, "error") %> prohibited this testa from being saved:</h2>
3
+ <ul>
4
+ <% resource.errors.full_messages.each do |msg| %>
5
+ <li><%= msg %></li>
6
+ <% end %>
7
+ </ul>
8
+ <% end %>
9
+
10
+ <% semantic_form_for [@inkling_content_types_page] do |form| %>
11
+ <%= form.input :name %>
12
+ <%= form.input :body %>
13
+
14
+ <% form.buttons do %>
15
+ <%= form.commit_button %>
16
+ <% end %>
17
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render(:partial => "form") %>
@@ -0,0 +1,11 @@
1
+ <%= link_to "Add a page", new_inkling_content_types_page_path %>
2
+
3
+ <p>
4
+
5
+ Pages: <%= @pages.size %>
6
+
7
+ <p>
8
+
9
+ <% for page in @pages %>
10
+ <%= page.name %> <br/>
11
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render(:partial => "form") %>
@@ -0,0 +1,11 @@
1
+ <table>
2
+ <% @inkling_content_types_page.attributes.each do |a| %>
3
+ <tr>
4
+ <th><%= a[0] %></th>
5
+ <td><%= a[1] %></td>
6
+ </tr>
7
+ <% end %>
8
+ </table>
9
+
10
+ <p><%= link_to "Edit", edit_polymorphic_path(@inkling_content_types_page) %></p>
11
+ <p><%= link_to "Back", polymorphic_path(@inkling_content_types_page) %></p>
@@ -0,0 +1,9 @@
1
+ <h2>CMS</h2>
2
+
3
+ <table width=100%>
4
+ <tr>
5
+ <td width=70%><%= link_to 'Pages', inkling_content_types_pages_path %></td>
6
+ <td width=30%><%= Inkling::ContentTypes::Page.all.size %></td>
7
+ </tr>
8
+ </table>
9
+
@@ -0,0 +1,3 @@
1
+ <%= @page.name %>
2
+ <p>
3
+ <%= @page.body %>
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html>
3
+ <head>
4
+ <title>Inkling</title>
5
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
+ <meta name="keywords" content="" />
7
+ <meta name="description" content="" />
8
+
9
+ <%= csrf_meta_tag %>
10
+ <%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js",
11
+ "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js",
12
+ 'rails.js' %>
13
+ </head>
14
+ <body>
15
+
16
+ <div id="header">
17
+ <div id="logo">
18
+ <h1>inkling CMS</h1>
19
+ </div>
20
+ </div>
21
+
22
+ <p class="notice"><%= notice %></p>
23
+ <p class="alert"><%= alert %></p>
24
+
25
+ <br/>
26
+
27
+ <%= yield %>
28
+ </body>
29
+ </html>
@@ -0,0 +1,4 @@
1
+ require 'inkling/content_types/page'
2
+ require 'generators/inkling_generator'
3
+
4
+ # InklingGenerator::inkling_migrations << [['create_inkling_content_tables.rb', 'db/migrate/create_inkling_content_tables.rb']]
data/config/routes.rb ADDED
@@ -0,0 +1,8 @@
1
+ Rails.application.routes.draw do |map|
2
+ namespace :inkling do
3
+ namespace :content_types do
4
+ resources :pages
5
+ end
6
+ constraints Inkling::Routing::ContentTypeConstraint.new("Inkling::ContentTypes::Page") do match '/*path' => "pages#show" end
7
+ end
8
+ end
@@ -0,0 +1,19 @@
1
+ require 'rails/generators'
2
+
3
+ class InklingCmsGenerator < Rails::Generators::Base
4
+ include Rails::Generators::Migration
5
+
6
+ source_root File.expand_path("../templates", __FILE__)
7
+
8
+ def self.next_migration_number(dirname)
9
+ if ActiveRecord::Base.timestamped_migrations
10
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
11
+ else
12
+ "%.3d" % (current_migration_number(dirname) + 1)
13
+ end
14
+ end
15
+
16
+ def create_migration_file
17
+ migration_template 'create_inkling_cms_tables.rb', 'db/migrate/create_inkling_cms_tables.rb'
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ class CreateInklingCmsTables < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :pages do |t|
4
+ t.string :name, :null => false
5
+ t.text :body
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :pages
12
+ end
13
+ end
@@ -0,0 +1,2 @@
1
+ require 'inkling_cms/engine' if defined?(Rails)
2
+
@@ -0,0 +1,13 @@
1
+ require "inkling"
2
+ require "inkling/content"
3
+ require "rails"
4
+
5
+ module InklingCms
6
+ class Engine < Rails::Engine
7
+ config.inkling_cms = InklingCms
8
+
9
+ initializer "static assets" do |app|
10
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ namespace :inkling do
2
+ task :init => ["inkling_cms:init"]
3
+ end
4
+
5
+
6
+ namespace :inkling_cms do
7
+ desc "Create a default user with login 'admin' and password 'admin'"
8
+ task :default_content_editor => [:environment] do
9
+ user = Inkling::User.create!(:email => "editor@localhost.com", :password => "test123", :password_confirmation => "test123")
10
+ Inkling::RoleMembership.create!(:user => user, :role => Inkling::Role.find_by_name("content_editor"))
11
+ end
12
+
13
+ desc "Initializes inkling content data."
14
+ task :init => [:environment] do
15
+ Inkling::Role.create!(:name => "content_editor")
16
+ Rake::Task["inkling_cms:default_content_editor"].execute
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Inkling::Page do
4
+
5
+ it "should" do
6
+ page = Inkling::Page.new
7
+ page.name = "foo"
8
+ page.save.should == true
9
+
10
+ end
11
+ end
@@ -0,0 +1,25 @@
1
+ # This file is copied to ~/spec when you run 'ruby script/generate rspec'
2
+ # from the project root directory.
3
+ ENV["RAILS_ENV"] ||= 'test'
4
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment") #nf patching generated spec_helper
5
+ #require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails)
6
+ require 'rspec/rails'
7
+
8
+ # Requires supporting files with custom matchers and macros, etc,
9
+ # in ./support/ and its subdirectories.
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
11
+
12
+ Rspec.configure do |config|
13
+ # == Mock Framework
14
+ #
15
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
16
+ #
17
+ # config.mock_with :mocha
18
+ # config.mock_with :flexmock
19
+ # config.mock_with :rr
20
+ config.mock_with :rspec
21
+
22
+ # If you'd prefer not to run each of your examples within a transaction,
23
+ # uncomment the following line.
24
+ # config.use_transactional_examples = false
25
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: inkling_cms
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors: []
13
+
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-30 00:00:00 +10:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: inherited_resources
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: formtastic
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ description:
50
+ email:
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files:
56
+ - README.txt
57
+ files:
58
+ - app/controllers/inkling/content_types/pages_controller.rb
59
+ - app/controllers/inkling/pages_controller.rb
60
+ - app/models/inkling/content_types/page.rb
61
+ - app/views/inkling/content_types/pages/_form.html.erb
62
+ - app/views/inkling/content_types/pages/edit.html.erb
63
+ - app/views/inkling/content_types/pages/index.html.erb
64
+ - app/views/inkling/content_types/pages/new.html.erb
65
+ - app/views/inkling/content_types/pages/show.html.erb
66
+ - app/views/inkling/home/_content_dashboard.html.erb
67
+ - app/views/inkling/pages/show.html.erb
68
+ - app/views/layouts/content.html.erb
69
+ - config/initializers/content_types.rb
70
+ - config/routes.rb
71
+ - lib/generators/inkling_cms_generator.rb
72
+ - lib/generators/templates/create_inkling_cms_tables.rb
73
+ - lib/inkling_cms.rb
74
+ - lib/inkling_cms/engine.rb
75
+ - lib/tasks/inkling_cms.rake
76
+ - README.txt
77
+ - spec/models/page_spec.rb
78
+ - spec/spec_helper.rb
79
+ has_rdoc: true
80
+ homepage:
81
+ licenses: []
82
+
83
+ post_install_message:
84
+ rdoc_options:
85
+ - --charset=UTF-8
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 3
94
+ segments:
95
+ - 0
96
+ version: "0"
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ requirements: []
107
+
108
+ rubyforge_project:
109
+ rubygems_version: 1.3.7
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: A CMS extension for Inkling
113
+ test_files:
114
+ - spec/models/page_spec.rb
115
+ - spec/spec_helper.rb