minimalist_cms 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,83 @@
1
+ MinimalistCms
2
+ =============
3
+
4
+ The simplest CMS ever. This project is a mix between [frontendeditor_ckeditor](https://github.com/GCorbel/frontendeditor_ckeditor) and [acts_as_page](https://github.com/GCorbel/acts_as_page).
5
+
6
+ What this cms is not doing for
7
+ ------------------------------
8
+
9
+ This gem is a very simple CMS. If you want a complete CMS interface, use [RefineryCMS](https://github.com/refinery/refinerycms). If you want a simple multisite manager, use [locomotivecms](https://github.com/locomotivecms/engine). If you want to use a huge, terrible and horrible monster, use Joomla! (No, seriously, don’t use Joomla! Never).
10
+
11
+ What this cms is doing for
12
+ --------------------------
13
+
14
+ This gem is integrable with any tool. It is just a page model with an editor. See the section Tool suggested to have some ideas.
15
+
16
+ The goal is to use a simple CMS which simply manage pages and use the powerful of rails to manage other part of a website like the contact page, images, etc. It's also good to use the strength of other tool.
17
+
18
+ Installation
19
+ ------------
20
+
21
+ 1. Add `minimalist_cms` in your Gemfile;
22
+ 2. Run `rake minimalist_cms_engine:install:migrations db:migrate`;
23
+ 3. Create a new file `app\assets\javascripts\minimalist_cms` like this :
24
+
25
+ ```
26
+ //= require jquery
27
+ //= require jquery_ujs
28
+ //= require underscore
29
+ //= require backbone
30
+ //= require jquery.ui.effect-highlight.js
31
+ //= require ckeditor/init_ckeditor
32
+ //= require frontend_editor/frontend_editor
33
+ //= require minimalist_cms/minimalist_cms
34
+ ```
35
+ You must to add only the libraries you don't have included yet;
36
+
37
+ 4. The the css file minamlist_cms/minimalist_cms to have access to the editor. Include them when the use is an admin;
38
+
39
+ Usage
40
+ -----
41
+
42
+ You can create a page which your favorite administration tool.
43
+
44
+ This is an example :
45
+
46
+ 1. Run `rails console`;
47
+ 2. Execute `Page.create(title: 'welcome', body: 'this is a welcome page')`;
48
+
49
+ Now, you can go to this address : `localhost:3000/welcome` To edit the page, include the css and javascript file a mark in the installation section. You should have a toolbar which hillight the editable section. When you click on a section, an editor appear. Modify the text like you want;
50
+
51
+ If you whant to mark a page as the home page you can do execte `page.update_attribute('home', true)`. Your page should be accessible at this address `http://localhost:3000/`.
52
+
53
+ You can mark a page as a draft. To hide the page, you must to change your code.
54
+
55
+ Customize the model
56
+ -------------------
57
+
58
+ You can override the page model with `rails generate model Page`. You must to add the line `acts_as_page` in you new model.
59
+
60
+ Customize the view
61
+ ------------------
62
+
63
+ To customize the view you can override the file `app/views/pages/show.html.erb`. To have the editable zone you must to add this line `<%= editable @page { @page.body } %>`.
64
+ Add a page in an existing page
65
+
66
+ You can add your page anywhere you want.
67
+
68
+ Add something like this in you controller :
69
+
70
+ class WelcomeController < ApplicationController
71
+ def index
72
+ @page = Page.where(home: true).first
73
+ end
74
+ end
75
+
76
+ Now, you can edit the file `app/views/welcome/index.html` and add this :
77
+
78
+ <%= editable @page { @page.body } %>
79
+
80
+ Tool suggested
81
+ --------------
82
+
83
+ With this gem, you can use [ActiveAdmin](https://github.com/gregbell/active_admin) and [activeadmin-globalize3](https://github.com/stefanoverna/activeadmin-globalize3). You can also use [cancan](https://github.com/ryanb/cancan). Your free to use anything you want.
@@ -0,0 +1,9 @@
1
+ class PagePartsController < ApplicationController
2
+ respond_to :json
3
+
4
+ def update
5
+ @part = PagePart.find(params[:id])
6
+ @part.update_attributes(params[:page_part])
7
+ render json: @part
8
+ end
9
+ end
@@ -1,7 +1,4 @@
1
1
  class PagesController < ApplicationController
2
-
3
- respond_to :json
4
-
5
2
  def show
6
3
  @page = if params[:id].present?
7
4
  Page.find_by_slug(params[:id])
@@ -10,10 +7,4 @@ class PagesController < ApplicationController
10
7
  end
11
8
  raise ActionController::RoutingError.new('Page Not Found') if @page.nil?
12
9
  end
13
-
14
- def update
15
- @page = Page.find(params[:id])
16
- @page.update_attributes(params[:page])
17
- render json: @page
18
- end
19
10
  end
@@ -1,3 +1,3 @@
1
- <div class="editable-long-text" data-object="pages" data-id="<%= @page.id %>" data-attribute="body">
2
- <%= raw @page.body %>
1
+ <div class="editable-long-text" data-object="page_parts" data-id="<%= @page.body.id %>" data-attribute="body">
2
+ <%= raw @page.body.body %>
3
3
  </div>
data/config/routes.rb CHANGED
@@ -2,4 +2,5 @@ Rails.application.routes.draw do
2
2
  root to: "pages#show"
3
3
  get ':id', to: "pages#show"
4
4
  resources :pages
5
+ resources :page_parts
5
6
  end
@@ -6,7 +6,8 @@ class CreatePages < ActiveRecord::Migration
6
6
  t.boolean :home
7
7
  t.boolean :draft, default: true
8
8
  end
9
- Page.create_translation_table! title: :string, body: :text, slug: :string, meta_keywords: :string, meta_description: :text
9
+ Page.create_translation_table! title: :string, slug: :string,
10
+ meta_keywords: :string, meta_description: :text
10
11
  end
11
12
 
12
13
  def down
@@ -0,0 +1,14 @@
1
+ class CreatePageParts < ActiveRecord::Migration
2
+ def up
3
+ create_table :page_parts do |t|
4
+ t.timestamps
5
+ t.references :page
6
+ end
7
+ PagePart.create_translation_table! title: :string, body: :text
8
+ end
9
+
10
+ def down
11
+ drop_table :page_parts
12
+ PagePart.drop_translation_table!
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
- require 'acts_as_page'
2
1
  require 'frontendeditor_ckeditor'
2
+ require 'acts_as_page'
3
3
 
4
4
  module MinimalistCms
5
5
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module MinimalistCms
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimalist_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-20 00:00:00.000000000 Z
12
+ date: 2013-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -147,6 +147,7 @@ extensions: []
147
147
  extra_rdoc_files: []
148
148
  files:
149
149
  - app/controllers/pages_controller.rb
150
+ - app/controllers/page_parts_controller.rb
150
151
  - app/views/pages/show.html.erb
151
152
  - app/views/pages/_form.html.erb
152
153
  - app/views/pages/edit.js.erb
@@ -157,13 +158,14 @@ files:
157
158
  - app/models/page.rb
158
159
  - config/routes.rb
159
160
  - db/migrate/20121216194550_create_pages.rb
161
+ - db/migrate/20130324132057_create_page_parts.rb
160
162
  - lib/minimalist_cms/version.rb
161
163
  - lib/minimalist_cms/engine.rb
162
164
  - lib/tasks/minimalist_cms_tasks.rake
163
165
  - lib/minimalist_cms.rb
164
166
  - MIT-LICENSE
165
167
  - Rakefile
166
- - README.rdoc
168
+ - README.md
167
169
  homepage: https://github.com/GCorbel/minimalist_cms
168
170
  licenses: []
169
171
  post_install_message:
data/README.rdoc DELETED
@@ -1,3 +0,0 @@
1
- = MinimalistCms
2
-
3
- This project rocks and uses MIT-LICENSE.