ordinary_cms 0.3.1 → 0.4.0
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.
- checksums.yaml +4 -4
- data/app/admin/ordinary_cms/page.rb +1 -1
- data/app/controllers/ordinary_cms/mercury/images_controller.rb +25 -0
- data/app/controllers/ordinary_cms/pages_controller.rb +1 -1
- data/app/models/ordinary_cms/factories/page.rb +3 -0
- data/app/models/ordinary_cms/mercury/image.rb +23 -0
- data/config/locales/ru.yml +12 -1
- data/config/routes.rb +4 -0
- data/lib/ordinary_cms/version.rb +1 -1
- metadata +4 -3
- data/README.rdoc +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79eb461dc4d6ae9cd9eae761a10753de26bb7090
|
4
|
+
data.tar.gz: 597744d3c2aa79015464f99f3a8b919ea0be1989
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -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
|
data/config/locales/ru.yml
CHANGED
@@ -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
data/lib/ordinary_cms/version.rb
CHANGED
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.
|
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-
|
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