ordinary_cms 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de5c0a8f213c36b4fbd052230581ce452c434c78
4
- data.tar.gz: ecf6071c5f1d2a4edae3afd9d2edc7377ec894f2
3
+ metadata.gz: 79eb461dc4d6ae9cd9eae761a10753de26bb7090
4
+ data.tar.gz: 597744d3c2aa79015464f99f3a8b919ea0be1989
5
5
  SHA512:
6
- metadata.gz: 4ead1963c7b4a75401af42f6f345f3ac3553bfa14e530b94fe36217e0e09dc3ee3c3da26f97329aa355d7a1e40b13327dd3248f53d199330afc8240bc82a5583
7
- data.tar.gz: 4e910f9a2f4039b42e617c2ba0fef678cd7ff7581502d45ebdc285414380a811484a7b786d71dabd3657d5330fd4a3a1dafd6a563931deb6aaf88224dd06fb44
6
+ metadata.gz: 51ec231450da7476db24d82df3538b8dbd95812a0d797bf5f05f8c844817a95358fb8d96d173e84ea11f8b451f7a2e6fc597107067997981fbd6dcabd813ab14
7
+ data.tar.gz: 4897d93bc44e2d1ee61dfbeec6cf61efcd46564c24e24d265b457446f6337de97f908b8ed5328e85cf7b878be27910e0f932d89d0743d4e71875a7c1e702d3bf
@@ -1,6 +1,6 @@
1
1
  ActiveAdmin.register OrdinaryCms::Page do
2
2
 
3
- permit_params :name, seo_attributes: [ :id, :title, :description, :keywords ],
3
+ permit_params :name, :factory_id, seo_attributes: [ :id, :title, :description, :keywords ],
4
4
  sections_attributes: [:id, :name, :text, :_destroy]
5
5
 
6
6
  member_action :set_as_root, method: :patch do
@@ -0,0 +1,25 @@
1
+ module OrdinaryCms
2
+ module Mercury
3
+ class ImagesController < MercuryController
4
+
5
+ respond_to :json
6
+
7
+ # POST /images.json
8
+ def create
9
+
10
+ @image = Mercury::Image.new(params.require(:image).permit(:image))
11
+
12
+ @image.save
13
+ respond_with @image
14
+ end
15
+
16
+ # DELETE /images/1.json
17
+ def destroy
18
+ @image = Mercury::Image.find(params[:id])
19
+ @image.destroy
20
+ respond_with @image
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -8,7 +8,7 @@ module OrdinaryCms
8
8
  before_action ActiveAdmin.application.authentication_method, only: :update
9
9
 
10
10
  def show
11
- smart_render(@page.name)
11
+ smart_render(@page.slug)
12
12
  end
13
13
 
14
14
  def update
@@ -6,11 +6,14 @@ module OrdinaryCms
6
6
  field :name
7
7
 
8
8
  embeds_many :sections, class_name: 'OrdinaryCms::Factories::Section'
9
+ has_many :pages, class_name: 'OrdinaryCms::Page'
10
+
9
11
  validates :name, presence: true, uniqueness: true
10
12
 
11
13
  def build(params = {})
12
14
  page = OrdinaryCms::Page.new params
13
15
  sections.each {|s| page.sections << s.build}
16
+ page.factory = self
14
17
  page
15
18
  end
16
19
  end
@@ -0,0 +1,23 @@
1
+ module OrdinaryCms
2
+ module Mercury
3
+ class Image
4
+ include Mongoid::Document
5
+ include Mongoid::Paperclip
6
+
7
+ has_mongoid_attached_file :image
8
+
9
+
10
+ validates_presence_of :image
11
+ validates_attachment_content_type :image, content_type: %w(image/jpg image/jpeg image/png)
12
+
13
+ delegate :url, :to => :image
14
+
15
+ def serializable_hash(options = nil)
16
+ options ||= {}
17
+ options[:methods] ||= []
18
+ options[:methods] << :url
19
+ super(options)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -4,11 +4,18 @@ ru:
4
4
 
5
5
  mongoid: &mongoid
6
6
  models:
7
+ admin_user:
8
+ one: Администратор
9
+ few: Администратора
10
+ many: Администраторов
11
+ other: Администраторы
12
+
7
13
  ordinary_cms/page:
8
14
  one: Страница
9
15
  few: Страницы
10
16
  many: Страниц
11
17
  other: Страницы
18
+
12
19
  ordinary_cms/section:
13
20
  one: Раздел
14
21
  few: Раздела
@@ -21,4 +28,8 @@ ru:
21
28
  ordinary_cms/section:
22
29
  name: Имя
23
30
  alias: Псевдоним
24
- content: Контент
31
+ content: Контент
32
+
33
+
34
+ activerecord:
35
+ <<: *mongoid
data/config/routes.rb CHANGED
@@ -2,5 +2,9 @@ OrdinaryCms::Engine.routes.draw do
2
2
 
3
3
  resources :pages, only: [:show, :update]
4
4
 
5
+ namespace :mercury do
6
+ resources :images
7
+ end
8
+
5
9
  root 'root#show'
6
10
  end
@@ -1,3 +1,3 @@
1
1
  module OrdinaryCms
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ordinary_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - max-konin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-21 00:00:00.000000000 Z
11
+ date: 2014-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -88,7 +88,6 @@ extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
90
  - MIT-LICENSE
91
- - README.rdoc
92
91
  - Rakefile
93
92
  - app/admin/ordinary_cms/page.rb
94
93
  - app/assets/javascripts/mercury.js
@@ -96,12 +95,14 @@ files:
96
95
  - app/assets/stylesheets/ordinary_cms/application.css
97
96
  - app/controllers/ordinary_cms/application_controller.rb
98
97
  - app/controllers/ordinary_cms/concerns/smart_pages_render.rb
98
+ - app/controllers/ordinary_cms/mercury/images_controller.rb
99
99
  - app/controllers/ordinary_cms/pages_controller.rb
100
100
  - app/controllers/ordinary_cms/root_controller.rb
101
101
  - app/helpers/ordinary_cms/application_helper.rb
102
102
  - app/helpers/ordinary_cms/pages_helper.rb
103
103
  - app/models/ordinary_cms/factories/page.rb
104
104
  - app/models/ordinary_cms/factories/section.rb
105
+ - app/models/ordinary_cms/mercury/image.rb
105
106
  - app/models/ordinary_cms/page.rb
106
107
  - app/models/ordinary_cms/section.rb
107
108
  - app/views/layouts/ordinary_cms/application.html.erb
data/README.rdoc DELETED
@@ -1,3 +0,0 @@
1
- = OrdinaryCms
2
-
3
- This project rocks and uses MIT-LICENSE.