optimacms 0.2.9 → 0.2.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0be75386d17ef3c6403aa53c239c11440698fe3c
4
- data.tar.gz: bfcad7a9a7a72326e0d3e3d55dffd8a475966241
3
+ metadata.gz: 40ffe286ec9f760db4b9ea7ebb55e672c283c2a5
4
+ data.tar.gz: 11fb4168ed4c9edc704c8caa1a3d44eefe700f51
5
5
  SHA512:
6
- metadata.gz: dd8a6076c22c6f6e775ec8490365a52e4d31c31baa67a5d6eb2406b07a6d8a91cfbb3cce893087ccbace295b150a4f1559175e71fd8c3b25d6b6557b51db1093
7
- data.tar.gz: 1df12ff86fa12e0f000f523bcd2a4040ae565846b91b7142eefda6af5ac05da8abe7b6db27ad9802001adcb16b82e84183a89acd23721f43c093dbf02ff423a6
6
+ metadata.gz: 69af8da4f41fee3d65d8117fc70ee943783382c4e5c0a5e66786d9f97250378086b641ade84f10c3dbf0020774230744cd788891bff1f4e281d0631222260ef5
7
+ data.tar.gz: c17ed4122b21acf0120a9072245b6080842b763a760ff00a7f82f7dfa0fecb4131641e82553632d1d7db1266fb859eab56d4a3f06958726035f5537a4fda4a7a
@@ -159,7 +159,37 @@ module Optimacms
159
159
  #format.json { render json: @item, status: :created, location: user_clients_url(:action => 'index') }
160
160
  format.js {}
161
161
  else
162
- format.html { render :new }
162
+ format.html { render :newlayout }
163
+ #format.json { render json: @item.errors, status: :unprocessable_entity }
164
+ format.js {}
165
+ end
166
+ end
167
+ end
168
+
169
+
170
+ ### block
171
+
172
+
173
+ def newblock
174
+ @item = model.new({:tpl_format=>Optimacms::Template::EXTENSION_DEFAULT, :type_id=>TemplateType::TYPE_BLOCKVIEW})
175
+ item_init_parent
176
+ @item.set_basedirpath_from_parent
177
+
178
+ @url_back = url_list
179
+ end
180
+
181
+
182
+ def createblock
183
+ @item = model.new(item_params)
184
+ @res = @item.save
185
+
186
+ respond_to do |format|
187
+ if @res
188
+ format.html { redirect_to edit_template_path(@item), success: 'Successfully created' }
189
+ #format.json { render json: @item, status: :created, location: user_clients_url(:action => 'index') }
190
+ format.js {}
191
+ else
192
+ format.html { render :newblock }
163
193
  #format.json { render json: @item.errors, status: :unprocessable_entity }
164
194
  format.js {}
165
195
  end
@@ -63,7 +63,7 @@
63
63
  #content_tag(:meta, nil, content: desc, name: 'description')
64
64
  end
65
65
 
66
- def block(name)
66
+ def block(name, opts={})
67
67
  x = Dir.pwd
68
68
  #y = File.expand_path File.dirname(__FILE__)
69
69
  d = File.dirname(@optimacms_tpl)
@@ -96,6 +96,11 @@
96
96
  # try 2
97
97
  names.each do |p|
98
98
  extensions.each do |ext|
99
+ # with lang
100
+ f = File.join(Dir.pwd, 'app', 'views', p[0], p[1]+'.'+@pagedata.lang.to_s+ext)
101
+ (return render file: f) if File.exists? f
102
+
103
+ # without lang
99
104
  f = File.join(Dir.pwd, 'app', 'views', p[0], p[1]+ext)
100
105
  (return render file: f) if File.exists? f
101
106
  end
@@ -14,11 +14,13 @@
14
14
  %button(type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
15
15
  New... <span class="caret"></span>
16
16
  %ul.dropdown-menu
17
+ %li=link_to 'New block', newblock_templates_path(:parent_id=>@parent_id)
17
18
  %li=link_to 'Attach template', newattach_templates_path(:parent_id=>@parent_id)
18
19
  %li=link_to 'New layout', newlayout_templates_path(:parent_id=>@parent_id)
19
20
 
20
21
 
21
22
 
23
+
22
24
  .filter
23
25
  = inline_filter_form_for(@filter)
24
26
 
@@ -0,0 +1,33 @@
1
+ .page-header
2
+ .row
3
+ .col-md-6
4
+ %h1
5
+ New block
6
+ %small
7
+ <i class="ace-icon fa fa-angle-double-right"></i>
8
+ select path and create file
9
+ .col-md-4
10
+ =link_to 'Back to templates', templates_path
11
+
12
+
13
+ .row
14
+ .col-md-12
15
+ = horizontal_simple_form_for @item, {url: createlayout_templates_path, :html => { :class => "form-horizontal", :role => "form" }}.merge((@modal==1 ? {remote: true}: {})) do |f|
16
+
17
+ = render 'optimacms/admin/shared/form_errors', :object=>@item
18
+
19
+ = hidden_field_tag :modal, @modal
20
+
21
+ = f.input :basename, label: "Name", :hint=>'ex: index, show'
22
+ = f.input :title, label: "Title"
23
+
24
+ = f.input :basedirpath, readonly: true, label: 'Folder', hint: "ex: news/"
25
+
26
+ = f.input :type_id, as: :hidden
27
+ = f.input :tpl_format, label: "Format", :collection=>Optimacms::Template::EXTENSIONS.keys
28
+
29
+ = f.input :is_translated, label: "Translate?"
30
+
31
+ = f.button :submit_cancel, 'Save', :cancel=>@url_back
32
+
33
+
data/config/routes.rb CHANGED
@@ -46,6 +46,9 @@ Optimacms::Engine.routes.draw do
46
46
 
47
47
  get :newlayout
48
48
  post :createlayout
49
+
50
+ get :newblock
51
+ post :createblock
49
52
  end
50
53
 
51
54
  member do
@@ -1,3 +1,3 @@
1
1
  module Optimacms
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.11"
3
3
  end
@@ -39532,3 +39532,126 @@ Processing by Optimacms::Admin::TemplatesController#index as HTML
39532
39532
  Rendered W:/myrails/cms/site/app/views/optimacms/admin/layouts/application.html.haml (73.0ms)
39533
39533
  Rendered W:/myrails/cms/site/app/views/optimacms/admin/layouts/basic.html.haml (369.0ms)
39534
39534
  Completed 200 OK in 672ms (Views: 667.2ms | ActiveRecord: 1.0ms)
39535
+
39536
+
39537
+ Started GET "/admin/templates" for 127.0.0.1 at 2016-06-05 21:04:34 +0300
39538
+ Processing by Optimacms::Admin::TemplatesController#index as HTML
39539
+ Optimacms::CmsAdminUser Load (1.0ms) SELECT `cms_users`.* FROM `cms_users` WHERE `cms_users`.`id` = 4 ORDER BY `cms_users`.`id` ASC LIMIT 1
39540
+ Optimacms::Template Load (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 128 LIMIT 1
39541
+ Optimacms::Template Load (1.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 128 LIMIT 1
39542
+ Rendered D:/Ruby22x64/lib/ruby/gems/2.2.0/gems/simple_search_filter-0.0.31/app/views/simple_search_filter/fields_simple_form/_text.html.haml (7.0ms)
39543
+ Rendered D:/Ruby22x64/lib/ruby/gems/2.2.0/gems/simple_search_filter-0.0.31/app/views/simple_search_filter/_field_simple_form.html.haml (56.0ms)
39544
+ Rendered D:/Ruby22x64/lib/ruby/gems/2.2.0/gems/simple_search_filter-0.0.31/app/views/simple_search_filter/fields_simple_form/_hidden.html.haml (5.0ms)
39545
+ Rendered D:/Ruby22x64/lib/ruby/gems/2.2.0/gems/simple_search_filter-0.0.31/app/views/simple_search_filter/_field_simple_form.html.haml (60.0ms)
39546
+ Rendered D:/Ruby22x64/lib/ruby/gems/2.2.0/gems/simple_search_filter-0.0.31/app/views/simple_search_filter/_fields.html.haml (200.0ms)
39547
+ Rendered D:/Ruby22x64/lib/ruby/gems/2.2.0/gems/simple_search_filter-0.0.31/app/views/simple_search_filter/_buttons_apply_clear.html.haml (0.0ms)
39548
+ Rendered D:/Ruby22x64/lib/ruby/gems/2.2.0/gems/simple_search_filter-0.0.31/app/views/simple_search_filter/_buttons_apply_clear_inline.html.haml (50.0ms)
39549
+ Rendered D:/Ruby22x64/lib/ruby/gems/2.2.0/gems/simple_search_filter-0.0.31/app/views/simple_search_filter/_form_inline.html.haml (343.0ms)
39550
+ Rendered D:/Ruby22x64/lib/ruby/gems/2.2.0/gems/simple_search_filter-0.0.31/app/views/simple_search_filter/_form.html.haml (398.0ms)
39551
+ Optimacms::Template Load (1.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE 1=0 ORDER BY (case when cms_templates.ancestry is null then 0 else 1 end), cms_templates.ancestry
39552
+ Optimacms::Template Load (1.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`ancestry` = '128' AND (1=1 ) ORDER BY title asc LIMIT 10 OFFSET 0
39553
+  (0.0ms) SELECT COUNT(*) FROM `cms_templates` WHERE `cms_templates`.`ancestry` = '128' AND (1=1 )
39554
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/templates/index.html.haml within optimacms/admin/layouts/main (563.0ms)
39555
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_top.html.haml (1.0ms)
39556
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_leftmenu.html.haml (126.0ms)
39557
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_breadcrumbs.html.haml (0.0ms)
39558
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_flash.html.haml (0.0ms)
39559
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_version.html.haml (0.0ms)
39560
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_footer.html.haml (130.0ms)
39561
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/layouts/application.html.haml (748.0ms)
39562
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/layouts/basic.html.haml (1995.1ms)
39563
+ Completed 200 OK in 3172ms (Views: 3053.3ms | ActiveRecord: 4.0ms)
39564
+
39565
+
39566
+ Started GET "/assets/optimacms/admin.self-84e36b0189cfc4ac18c624ad198afcefbbd618cce7a3809360431d6d8b6fd71c.css?body=1" for 127.0.0.1 at 2016-06-05 21:04:40 +0300
39567
+
39568
+
39569
+ Started GET "/assets/optimacms/admin_tpl.self-3552518fc3641d7e2cce03ff12090a8288cfdabbeb2263909a89f56757898dfd.css?body=1" for 127.0.0.1 at 2016-06-05 21:04:40 +0300
39570
+
39571
+
39572
+ Started GET "/assets/optimacms/application.self-fb28094035fc8f155b896e47c199355db7c84fc9d6214ed9800f1022ac2ece52.js?body=1" for 127.0.0.1 at 2016-06-05 21:04:40 +0300
39573
+
39574
+
39575
+ Started GET "/assets/jquery2.self-a4777c1acac0a74340755725342901a54ed000955bf6f5320491b8b2514c86ec.js?body=1" for 127.0.0.1 at 2016-06-05 21:04:41 +0300
39576
+
39577
+
39578
+ Started GET "/assets/jquery_ujs.self-d456baa54c1fa6be2ec3711f0a72ddf7a5b2f34a6b4f515f33767d6207b7d4b3.js?body=1" for 127.0.0.1 at 2016-06-05 21:04:41 +0300
39579
+
39580
+
39581
+ Started GET "/assets/bootstrap.self-d0e973a52d36a01036265aeefaf2d1ae3499d2cb231a9be3bd846432daf231de.js?body=1" for 127.0.0.1 at 2016-06-05 21:04:41 +0300
39582
+
39583
+
39584
+ Started GET "/assets/bootstrap3-typeahead.min.self-78fcb50a4b38a41b52a51f8662133e39712218bbacbb337469c3ed64bb88ae9d.js?body=1" for 127.0.0.1 at 2016-06-05 21:04:41 +0300
39585
+
39586
+
39587
+ Started GET "/assets/bootstrap3-autocomplete-input.min.self-ce3ca04e5eed6a1c7c2a10589a176cee121808f99dd9b917dd3bf62ce710f211.js?body=1" for 127.0.0.1 at 2016-06-05 21:04:41 +0300
39588
+
39589
+
39590
+ Started GET "/assets/optimacms/admin.self-7c370d9536d7d0d6a0f7cd7f9826692acd93e4fb05ba46f7b630b879740343d3.js?body=1" for 127.0.0.1 at 2016-06-05 21:04:41 +0300
39591
+
39592
+
39593
+ Started GET "/admin/templates/newblock?parent_id=128" for 127.0.0.1 at 2016-06-05 21:06:22 +0300
39594
+ Processing by Optimacms::Admin::TemplatesController#newblock as HTML
39595
+ Parameters: {"parent_id"=>"128"}
39596
+ Optimacms::CmsAdminUser Load (1.0ms) SELECT `cms_users`.* FROM `cms_users` WHERE `cms_users`.`id` = 4 ORDER BY `cms_users`.`id` ASC LIMIT 1
39597
+ Optimacms::Template Load (1.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 128 LIMIT 1
39598
+ CACHE (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 128 LIMIT 1 [["id", 128]]
39599
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_form_errors.html.haml (0.0ms)
39600
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/templates/newblock.html.haml within optimacms/admin/layouts/main (226.0ms)
39601
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_top.html.haml (2.0ms)
39602
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_leftmenu.html.haml (112.0ms)
39603
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_breadcrumbs.html.haml (1.0ms)
39604
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_flash.html.haml (1.0ms)
39605
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_version.html.haml (0.0ms)
39606
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_footer.html.haml (150.0ms)
39607
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/layouts/application.html.haml (331.0ms)
39608
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/layouts/basic.html.haml (1577.1ms)
39609
+ Completed 200 OK in 2292ms (Views: 2282.3ms | ActiveRecord: 2.0ms)
39610
+
39611
+
39612
+ Started POST "/admin/templates/createlayout" for 127.0.0.1 at 2016-06-05 21:16:13 +0300
39613
+ Processing by Optimacms::Admin::TemplatesController#createlayout as HTML
39614
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"wNADpioG/BGEIeF7wIPfYkiHI4fE4ScD5wBpZiydt3jvKVaKZthMs1+fZYNAuYph4xeV4+CM35dwOgklLxXsAA==", "modal"=>"0", "template"=>{"basename"=>"home_news_data", "title"=>"news data", "basedirpath"=>"layouts/", "type_id"=>"4", "tpl_format"=>"haml", "is_translated"=>"0"}, "commit"=>"Save"}
39615
+ Optimacms::CmsAdminUser Load (0.0ms) SELECT `cms_users`.* FROM `cms_users` WHERE `cms_users`.`id` = 4 ORDER BY `cms_users`.`id` ASC LIMIT 1
39616
+  (1.0ms) BEGIN
39617
+ Optimacms::Template Load (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`is_folder` = 1 AND `cms_templates`.`basepath` = 'layouts' ORDER BY `cms_templates`.`id` ASC LIMIT 1
39618
+ Optimacms::Template Load (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 128 LIMIT 1
39619
+ CACHE (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 128 LIMIT 1 [["id", 128]]
39620
+ CACHE (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 128 LIMIT 1 [["id", 128]]
39621
+ Optimacms::Template Exists (1.0ms) SELECT 1 AS one FROM `cms_templates` WHERE (`cms_templates`.`basepath` = BINARY 'layouts/home_news_data' AND `cms_templates`.`is_folder` = 0) LIMIT 1
39622
+ SQL (0.0ms) INSERT INTO `cms_templates` (`basename`, `title`, `basedirpath`, `type_id`, `tpl_format`, `ancestry`, `basepath`, `created_at`, `updated_at`) VALUES ('home_news_data', 'news data', 'layouts/', 4, 'haml', '128', 'layouts/home_news_data', '2016-06-05 18:16:14', '2016-06-05 18:16:14')
39623
+  (18.0ms) COMMIT
39624
+ Redirected to http://localhost:3001/admin/templates/161/edit
39625
+ Completed 302 Found in 46ms (ActiveRecord: 35.0ms)
39626
+
39627
+
39628
+ Started GET "/admin/templates/161/edit" for 127.0.0.1 at 2016-06-05 21:16:14 +0300
39629
+ Processing by Optimacms::Admin::TemplatesController#edit as HTML
39630
+ Parameters: {"id"=>"161"}
39631
+ Optimacms::CmsAdminUser Load (0.0ms) SELECT `cms_users`.* FROM `cms_users` WHERE `cms_users`.`id` = 4 ORDER BY `cms_users`.`id` ASC LIMIT 1
39632
+ Optimacms::Template Load (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 161 LIMIT 1
39633
+ Optimacms::Language Load (0.0ms) SELECT `cms_languages`.* FROM `cms_languages` WHERE (1=1) ORDER BY pos asc
39634
+ Optimacms::TemplateTranslation Load (0.0ms) SELECT `cms_templates_translation`.* FROM `cms_templates_translation` WHERE `cms_templates_translation`.`item_id` = 161
39635
+  (0.0ms) BEGIN
39636
+ Optimacms::Template Load (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 128 LIMIT 1
39637
+ CACHE (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 128 LIMIT 1 [["id", 128]]
39638
+ Optimacms::Template Exists (1.0ms) SELECT 1 AS one FROM `cms_templates` WHERE (`cms_templates`.`basepath` = BINARY 'layouts/home_news_data' AND `cms_templates`.`id` != 161 AND `cms_templates`.`is_folder` = 0) LIMIT 1
39639
+ SQL (0.0ms) INSERT INTO `cms_templates_translation` (`lang`, `item_id`) VALUES ('', 161)
39640
+  (7.0ms) COMMIT
39641
+ Optimacms::Template Load (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 161 LIMIT 1
39642
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_form_errors.html.haml (0.0ms)
39643
+ Optimacms::TemplateTranslation Load (0.0ms) SELECT `cms_templates_translation`.* FROM `cms_templates_translation` WHERE `cms_templates_translation`.`item_id` = 161
39644
+ CACHE (0.0ms) SELECT `cms_templates`.* FROM `cms_templates` WHERE `cms_templates`.`id` = 161 LIMIT 1 [["id", 161]]
39645
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/common/_js_ace.html.haml (0.0ms)
39646
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/templates/_form_content_translation.html.haml (109.0ms)
39647
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/templates/_form.html.haml (321.0ms)
39648
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/templates/edit.html.haml within optimacms/admin/layouts/main (405.0ms)
39649
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_top.html.haml (0.0ms)
39650
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_leftmenu.html.haml (18.0ms)
39651
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_breadcrumbs.html.haml (0.0ms)
39652
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_flash.html.haml (0.0ms)
39653
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_version.html.haml (0.0ms)
39654
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/shared/_footer.html.haml (58.0ms)
39655
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/layouts/application.html.haml (512.0ms)
39656
+ Rendered W:/myrails/cms/site/app/views/optimacms/admin/layouts/basic.html.haml (1087.1ms)
39657
+ Completed 200 OK in 1885ms (Views: 1770.6ms | ActiveRecord: 19.0ms)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimacms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Ivak
@@ -399,6 +399,7 @@ files:
399
399
  - app/views/optimacms/admin/templates/index.html.haml
400
400
  - app/views/optimacms/admin/templates/new.html.haml
401
401
  - app/views/optimacms/admin/templates/newattach.html.haml
402
+ - app/views/optimacms/admin/templates/newblock.html.haml
402
403
  - app/views/optimacms/admin/templates/newfolder.html.haml
403
404
  - app/views/optimacms/admin/templates/newlayout.html.haml
404
405
  - app/views/optimacms/articles/_form.html.erb