constructor-cms 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Guardfile +1 -3
  4. data/constructor-cms.gemspec +1 -0
  5. data/core/app/controllers/constructor_core/users_controller.rb +0 -2
  6. data/core/app/views/constructor_core/sessions/new.html.haml +5 -5
  7. data/core/app/views/constructor_core/users/profile.haml +3 -3
  8. data/core/app/views/layouts/constructor_core/application.haml +12 -12
  9. data/core/config/routes.rb +1 -1
  10. data/core/lib/constructor_core/version.rb +1 -1
  11. data/lib/constructor-cms/engine.rb +1 -1
  12. data/pages/app/controllers/constructor_pages/pages_controller.rb +11 -6
  13. data/pages/app/controllers/constructor_pages/templates_controller.rb +2 -1
  14. data/pages/app/helpers/constructor_pages/move_helper.rb +2 -2
  15. data/pages/app/helpers/constructor_pages/pages_helper.rb +2 -0
  16. data/pages/app/helpers/constructor_pages/templates_helper.rb +2 -0
  17. data/pages/app/helpers/constructor_pages/treeview_helper.rb +33 -0
  18. data/pages/app/models/constructor_pages/page.rb +4 -2
  19. data/pages/app/views/constructor_pages/fields/_form.haml +10 -10
  20. data/pages/app/views/constructor_pages/fields/types/_html.haml +1 -1
  21. data/pages/app/views/constructor_pages/fields/types/_image.haml +1 -1
  22. data/pages/app/views/constructor_pages/fields/types/_integer.haml +1 -1
  23. data/pages/app/views/constructor_pages/fields/types/_string.haml +1 -1
  24. data/pages/app/views/constructor_pages/fields/types/_text.haml +1 -1
  25. data/pages/app/views/constructor_pages/pages/_breadcrumbs.haml +2 -2
  26. data/pages/app/views/constructor_pages/pages/_form.haml +30 -30
  27. data/pages/app/views/constructor_pages/pages/index.haml +35 -45
  28. data/pages/app/views/constructor_pages/partials/_arrow_buttons.haml +6 -0
  29. data/pages/app/views/constructor_pages/templates/_form.haml +23 -18
  30. data/pages/app/views/constructor_pages/templates/index.haml +11 -30
  31. data/pages/config/locales/en.yml +1 -0
  32. data/pages/config/locales/ru.yml +1 -0
  33. data/pages/config/routes.rb +16 -21
  34. data/pages/spec/features/constructor_pages/pages_controller_spec.rb +280 -0
  35. data/pages/spec/models/constructor_pages/field_model_spec.rb +12 -16
  36. data/pages/spec/models/constructor_pages/page_model_spec.rb +2 -1
  37. data/pages/spec/models/constructor_pages/template_model_spec.rb +1 -1
  38. data/spec/dummy/config/environment.rb +0 -2
  39. data/spec/spec_helper.rb +5 -0
  40. metadata +23 -7
  41. data/pages/spec/requests/constructor_pages/pages_controller_spec.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3894197afd162e8ab298928453fcb0e86b4933f
4
- data.tar.gz: b5d633caa865982a182375fd9a90a65e94acfdb1
3
+ metadata.gz: 716613644e3e6e549fc919b68851a791c016a817
4
+ data.tar.gz: 35838d41aa4fad5191d097a81075ec45b64d2b4c
5
5
  SHA512:
6
- metadata.gz: 8433a4b604912711015ad5787e12fb55e7c76b653bb045df4cde700a8c18f0f9fa8357aa25dec96370bb752d55a1fb30977f3ba175da5024d5e65d95b6189408
7
- data.tar.gz: 50b6fcd894e3176384f70a40c2eb4fc6d68d9ddfaaa269cdfd85e0fb0ce805649b21d885d36df22dfba8b5079fd9eb7686c7739eeff68893d7815863c6411a7a
6
+ metadata.gz: 1231e211970c6ca15260691debba39ee65d68a0ca48d9533d1679606145d54bd426fbe3bbbe94f06cdee5c8944679755b53bfd220a1c9dc2dd06ca7424de2a03
7
+ data.tar.gz: 1a19d0465eb5dd504bcee87a6b8bae2fb2db4ec7a6e7a0db6c0c7d21745cb4f7e1af10861cabd116a9f5e0ff8ad9f54f5bf5cf53fb0d89991b3e705426f8a1bd
data/Gemfile CHANGED
@@ -2,6 +2,8 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'awesome_nested_set', github: 'ivanzotov/awesome_nested_set'
6
+
5
7
  group :test do
6
8
  gem 'coveralls', require: false
7
9
  gem 'simplecov', :require => false
@@ -17,4 +19,4 @@ group :assets do
17
19
  gem 'uglifier', '>= 1.3.0'
18
20
  end
19
21
 
20
- gem 'jquery-rails'
22
+ gem 'jquery-rails'
data/Guardfile CHANGED
@@ -5,11 +5,9 @@ guard 'rspec', :spec_paths => extensions.map{|e| "#{e}/spec"}, :cli => (['~/.rsp
5
5
  watch(%r{^#{extension}/spec/.+_spec\.rb$})
6
6
  watch(%r{^#{extension}/app/(.+)\.rb$}) { |m| "#{extension}/spec/#{m[1]}_spec.rb" }
7
7
  watch(%r{^#{extension}/lib/(.+)\.rb$}) { |m| "#{extension}/spec/lib/#{m[1]}_spec.rb" }
8
- watch(%r{^#{extension}/app/controllers/(.+)_(controller)\.rb$}) { |m| ["#{extension}/spec/routing/#{m[1]}_routing_spec.rb", "#{extension}/spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "#{extension}/spec/requests/#{m[1]}_spec.rb"] }
8
+ watch(%r{^#{extension}/app/controllers/(.+)_(controller)\.rb$}) { |m| ["#{extension}/spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "#{extension}/spec/features/#{m[1]}_spec.rb"] }
9
9
  watch(%r{^#{extension}/spec/support/(.+)\.rb$}) { "#{extension}/spec" }
10
10
  watch("#{extension}/spec/spec_helper.rb") { "#{extension}/spec" }
11
- watch("#{extension}/config/routes.rb") { "#{extension}/spec/routing" }
12
- watch("#{extension}/app/controllers/application_controller.rb") { "#{extension}/spec/controllers" }
13
11
  # Capybara request specs
14
12
  watch(%r{^#{extension}/app/views/(.+)/.*\.(erb|haml)$}) { |m| "#{extension}/spec/requests/#{m[1]}_spec.rb" }
15
13
  end
@@ -23,4 +23,5 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency 'rspec-rails', '~> 2.12'
24
24
  s.add_development_dependency 'database_cleaner'
25
25
  s.add_development_dependency 'capybara'
26
+ s.add_development_dependency 'launchy'
26
27
  end
@@ -2,8 +2,6 @@
2
2
 
3
3
  module ConstructorCore
4
4
  class UsersController < ConstructorCore::ApplicationController
5
- layout 'constructor_core/application'
6
-
7
5
  def profile
8
6
  @user = current_user
9
7
  end
@@ -1,22 +1,22 @@
1
1
  - content_for :page_title do
2
2
  =t :login
3
3
 
4
- = form_for(resource, :as => resource_name, :url => '/login') do |f|
4
+ = form_for(resource, as: resource_name, url: '/login') do |f|
5
5
  .form-horizontal
6
6
  .control-group
7
- = f.label :email, :class => 'control-label'
7
+ = f.label :email, class: 'control-label'
8
8
  .controls
9
9
  = f.email_field :email
10
10
  .control-group
11
- = f.label :password, :class => 'control-label'
11
+ = f.label :password, class: 'control-label'
12
12
  .controls
13
13
  = f.password_field :password
14
14
 
15
15
  - if devise_mapping.rememberable?
16
16
  .control-group
17
17
  .controls
18
- %label.checkbox.inline{:for => 'remember_me'}
18
+ %label.checkbox.inline{for: 'remember_me'}
19
19
  = f.check_box :remember_me
20
20
  =t :remember_me
21
21
  .controls
22
- = f.submit t(:login), :class => "btn btn-primary"
22
+ = f.submit t(:login), class: 'btn btn-primary'
@@ -4,13 +4,13 @@
4
4
  = form_for @current_user, method: :post do |f|
5
5
  .form-horizontal
6
6
  .control-group
7
- = f.label :password, :class => 'control-label'
7
+ = f.label :password, class: 'control-label'
8
8
  .controls
9
9
  = f.password_field :password, required: true
10
10
  .control-group
11
- = f.label :password_confirmation, :class => 'control-label'
11
+ = f.label :password_confirmation, class: 'control-label'
12
12
  .controls
13
13
  = f.password_field :password_confirm, required: true
14
14
  .control-group
15
15
  .controls
16
- = f.submit t(:save_password), :class => "btn btn-primary"
16
+ = f.submit t(:save_password), class: 'btn btn-primary'
@@ -1,12 +1,12 @@
1
1
  !!!
2
- %html{:lang => 'ru'}
2
+ %html{lang: 'ru'}
3
3
  %head
4
- %meta{:charset => 'utf-8'}/
5
- %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}/
4
+ %meta{charset: 'utf-8'}/
5
+ %meta{'http-equiv' => 'X-UA-Compatible', content: 'IE=edge,chrome=1'}/
6
6
  %title=t :dashboard
7
7
 
8
8
  / [if lt IE 9]
9
- %script{:src => 'http://html5shim.googlecode.com/svn/trunk/html5.js'}
9
+ %script{src: 'http://html5shim.googlecode.com/svn/trunk/html5.js'}
10
10
 
11
11
  :javascript
12
12
  var CKEDITOR_BASEPATH = '/assets/ckeditor/'
@@ -16,15 +16,15 @@
16
16
  = csrf_meta_tag
17
17
  = favicon_link_tag
18
18
 
19
- %link{:rel => 'apple-touch-icon', :href => 'images/apple-touch-icon.png'}
20
- %link{:rel => 'apple-touch-icon', :sizes => '72x72', :href => 'images/apple-touch-icon-72x72.png'}
21
- %link{:rel => 'apple-touch-icon', :sizes => '114x114', :href => 'images/apple-touch-icon-114x114.png'}
19
+ %link{rel: 'apple-touch-icon', href: 'images/apple-touch-icon.png'}
20
+ %link{rel: 'apple-touch-icon', sizes: '72x72', href: 'images/apple-touch-icon-72x72.png'}
21
+ %link{rel: 'apple-touch-icon', sizes: '114x114', href: 'images/apple-touch-icon-114x114.png'}
22
22
 
23
23
  %body
24
24
  .navbar.navbar-constructor
25
25
  .navbar-inner
26
26
  .container-fluid
27
- = link_to t(:homepage), '/', :class => 'brand'
27
+ = link_to t(:homepage), '/', class: 'brand'
28
28
  %a.btn.btn-navbar{'data-toggle' => 'collapse', 'data-target' => '.nav-collapse'}
29
29
  %span.icon-bar
30
30
  %span.icon-bar
@@ -63,7 +63,7 @@
63
63
  %i.icon-question-sign
64
64
  =t :help
65
65
  %li
66
- = link_to core.destroy_user_session_path, method: :delete do
66
+ = link_to core.logout_path, method: :delete do
67
67
  %i.icon-signout
68
68
  =t :logout
69
69
 
@@ -75,11 +75,11 @@
75
75
  .span4
76
76
  - unless notice.nil?
77
77
  .alert.fade.in
78
- = link_to '×', '#', :class => 'close', 'data-dismiss' => 'alert'
78
+ = link_to '×', '#', class: 'close', 'data-dismiss' => 'alert'
79
79
  = notice
80
80
  - unless alert.nil?
81
81
  .alert.alert-error.fade.in
82
- = link_to '×', '#', :class => 'close', 'data-dismiss' => 'alert'
82
+ = link_to '×', '#', class: 'close', 'data-dismiss' => 'alert'
83
83
  = alert
84
84
 
85
85
  = yield :actions
@@ -88,6 +88,6 @@
88
88
  = yield
89
89
 
90
90
  / [if lt IE 7 ]
91
- %script{:src => '//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js'}
91
+ %script{src: '//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js'}
92
92
  %script
93
93
  window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})
@@ -13,6 +13,6 @@ ConstructorCore::Engine.routes.draw do
13
13
  get '/admin' => 'sessions#new'
14
14
  get '/login' => 'sessions#new'
15
15
  post '/login' => 'sessions#create'
16
- delete '/logout' => 'sessions#destroy'
16
+ delete '/logout' => 'sessions#destroy', as: :logout
17
17
  end
18
18
  end
@@ -1,3 +1,3 @@
1
1
  module ConstructorCore
2
- VERSION = '0.6.1'
2
+ VERSION = '0.6.2'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  module ConstructorCms
2
- class Engine < Rails::Engine
2
+ class Engine < ::Rails::Engine
3
3
  engine_name "constructor-cms"
4
4
  isolate_namespace ConstructorCms
5
5
  end
@@ -6,6 +6,11 @@ module ConstructorPages
6
6
 
7
7
  before_filter {@roots = Page.roots}
8
8
 
9
+ def index
10
+ @template_exists = Template.count > 0
11
+ flash.notice = 'Create at least one template' unless @template_exists
12
+ end
13
+
9
14
  def new
10
15
  @page, @template_id, @multipart = Page.new, Template.first.id, false
11
16
 
@@ -15,7 +20,7 @@ module ConstructorPages
15
20
  end
16
21
 
17
22
  def show
18
- @page = Page.find_by_request_or_first('/' + params[:all])
23
+ @page = Page.find_by_request_or_first("/#{params[:all]}")
19
24
 
20
25
  error_404 and return if @page.nil? or !@page.active?
21
26
 
@@ -102,12 +107,12 @@ module ConstructorPages
102
107
  def update
103
108
  @page = Page.find params[:id]
104
109
 
105
- if @page.template.id != params[:page][:template_id].to_i
106
- @page.remove_fields_values
107
- end
110
+ _template_changed = @page.template.id != params[:page][:template_id].to_i
111
+
112
+ @page.remove_fields_values if _template_changed
108
113
 
109
114
  if @page.update page_params
110
- @page.create_fields_values
115
+ @page.create_fields_values if _template_changed
111
116
  @page.update_fields_values params[:fields]
112
117
 
113
118
  redirect_to pages_url, notice: t(:page_success_updated, name: @page.name)
@@ -123,7 +128,7 @@ module ConstructorPages
123
128
  redirect_to pages_url, notice: t(:page_success_removed, name: _name)
124
129
  end
125
130
 
126
- %w{up down}.each {|m| define_method "move_#{m}" do move_to :page, m.to_sym end}
131
+ %w{up down}.each {|m| define_method "move_#{m}" do move_to :page, params[:id], m.to_sym end}
127
132
 
128
133
  private
129
134
 
@@ -3,6 +3,7 @@
3
3
  module ConstructorPages
4
4
  class TemplatesController < ConstructorCore::ApplicationController
5
5
  include MoveHelper
6
+ include TreeviewHelper
6
7
 
7
8
  before_filter {@roots = Template.roots}
8
9
 
@@ -41,7 +42,7 @@ module ConstructorPages
41
42
  redirect_to templates_url, notice: t(:template_success_removed, name: name)
42
43
  end
43
44
 
44
- %w{up down}.each {|m| define_method "move_#{m}" do move_to :template, m.to_sym end}
45
+ %w{up down}.each {|m| define_method "move_#{m}" do move_to :template, params[:id], m.to_sym end}
45
46
 
46
47
  private
47
48
 
@@ -1,7 +1,7 @@
1
1
  module ConstructorPages
2
2
  module MoveHelper
3
- def move_to(what, to)
4
- from = ('constructor_pages/'+what.to_s).classify.constantize.find(params[:id])
3
+ def move_to(what, id, to)
4
+ from = ('constructor_pages/'+what.to_s).classify.constantize.find(id)
5
5
  to_sibling = to == :up ? from.left_sibling : from.right_sibling
6
6
 
7
7
  if not to_sibling.nil? and from.move_possible?(to_sibling)
@@ -1,5 +1,7 @@
1
1
  module ConstructorPages
2
2
  module PagesHelper
3
+ include TreeviewHelper
4
+
3
5
  def for_select(roots)
4
6
  result = []
5
7
  roots.each do |r|
@@ -1,5 +1,7 @@
1
1
  module ConstructorPages
2
2
  module TemplatesHelper
3
+ include TreeviewHelper
4
+
3
5
  def for_select(roots)
4
6
  result = []
5
7
  roots.each do |r|
@@ -0,0 +1,33 @@
1
+ module ConstructorPages
2
+ module TreeviewHelper
3
+ def render_tree(roots, &block)
4
+ output = '<ul>'
5
+
6
+ roots.each do |root|
7
+ level, last = root.level, nil
8
+
9
+ root.self_and_descendants.each do |item|
10
+ if item.level > level
11
+ output += '<ul>'
12
+ elsif item.level < level
13
+ output += '</li>'
14
+ output += '</ul></li>' * (level-item.level)
15
+ elsif !item.root?
16
+ output += '</li>'
17
+ end
18
+
19
+ output += '<li>'
20
+
21
+ output += capture(item, &block)
22
+
23
+ level, last = item.level, item
24
+ end
25
+
26
+ output += '</li>'
27
+ output += '</ul></li>' * last.level
28
+ end
29
+
30
+ output.html_safe
31
+ end
32
+ end
33
+ end
@@ -24,10 +24,10 @@ module ConstructorPages
24
24
 
25
25
  acts_as_nested_set
26
26
 
27
- # Used for find page by request. It return first page if no request given
27
+ # Used for find page by request. It return first page if no request given or request is home page
28
28
  # @param request for example <tt>'/conditioners/split-systems/zanussi'</tt>
29
29
  def self.find_by_request_or_first(request = nil)
30
- request.nil? ? Page.first : Page.where(full_url: request).first
30
+ request.nil? || request == '/' ? Page.first : Page.where(full_url: request).first
31
31
  end
32
32
 
33
33
  # Generate full_url from parent id and url
@@ -72,6 +72,8 @@ module ConstructorPages
72
72
  # @param params should looks like <tt>{price: 500, content: 'Hello'}</tt>
73
73
  # @param reset_booleans reset all boolean fields to false before assign params
74
74
  def update_fields_values(params, reset_booleans = true)
75
+ return if params.nil?
76
+
75
77
  fields.each do |field|
76
78
  value = params[field.code_name.to_sym]
77
79
 
@@ -1,28 +1,28 @@
1
1
  = form_for @field do |f|
2
2
  - if @field.errors.any?
3
3
  .alert.alert-error.fade.in.span12
4
- = link_to "×", "#", :class => "close", 'data-dismiss' => 'alert'
4
+ = link_to '×', '#', class: 'close', 'data-dismiss' => 'alert'
5
5
  - @field.errors.full_messages.each do |m|
6
6
  = m
7
7
 
8
8
  .form-horizontal
9
9
  .control-group
10
- = f.label :name, :class => 'control-label'
11
- .controls= f.text_field :name, :class => "span4"
10
+ = f.label :name, class: 'control-label'
11
+ .controls= f.text_field :name, class: 'span4'
12
12
 
13
13
  .control-group
14
- = f.label :code_name, :class => 'control-label'
15
- .controls= f.text_field :code_name, :class => "span4"
16
- = f.hidden_field :template_id, :value => @field.template.id, :class => "span4"
14
+ = f.label :code_name, class: 'control-label'
15
+ .controls= f.text_field :code_name, class: 'span4'
16
+ = f.hidden_field :template_id, value: @field.template.id, class: 'span4'
17
17
 
18
18
  - unless @field.type_value == 'image'
19
19
  .control-group
20
- = f.label :type_value, :class => 'control-label'
20
+ = f.label :type_value, class: 'control-label'
21
21
  .controls
22
- = f.select :type_value, options_for_select(types_value, :selected => @field.type_value), :class => "span4"
22
+ = f.select :type_value, options_for_select(types_value, selected: @field.type_value), class: 'span4'
23
23
 
24
24
  .row-fluid
25
25
  .span12
26
26
  .form-actions
27
- = f.submit :class => "btn btn-primary"
28
- = link_to t(:cancel), edit_template_url(@field.template), :class => "btn"
27
+ = f.submit class: 'btn btn-primary'
28
+ = link_to t(:cancel), edit_template_url(@field.template), class: 'btn'
@@ -1 +1 @@
1
- = text_area_tag "fields[#{field.code_name}]", page.get_field_value(field.code_name), :rows => 10, :class => 'span9 ckeditor'
1
+ = text_area_tag "fields[#{field.code_name}]", page.get_field_value(field.code_name), rows: 10, class: 'span9 ckeditor'
@@ -4,4 +4,4 @@
4
4
  = image_tag image.value.thumb('200x200').url
5
5
 
6
6
  %br/
7
- = file_field_tag "fields[#{field.code_name}]", :class => 'span6'
7
+ = file_field_tag "fields[#{field.code_name}]", class: 'span6'
@@ -1 +1 @@
1
- = text_field_tag "fields[#{field.code_name}]", page.get_field_value(field.code_name), :class => 'span2'
1
+ = text_field_tag "fields[#{field.code_name}]", page.get_field_value(field.code_name), class: 'span2'
@@ -1 +1 @@
1
- = text_field_tag "fields[#{field.code_name}]", page.get_field_value(field.code_name), :class => 'span6'
1
+ = text_field_tag "fields[#{field.code_name}]", page.get_field_value(field.code_name), class: 'span6'
@@ -1 +1 @@
1
- = text_area_tag "fields[#{field.code_name}]", page.get_field_value(field.code_name), :rows => 10, :class => 'span6'
1
+ = text_area_tag "fields[#{field.code_name}]", page.get_field_value(field.code_name), rows: 10, class: 'span6'
@@ -3,5 +3,5 @@
3
3
  - page.ancestors.each do |i|
4
4
  - if i.in_nav
5
5
  %li
6
- = link_to i.name, i.full_url, :title => i.name, :class => 'b-page-json'
7
- %span{:class => "divider"} /
6
+ = link_to i.name, i.full_url, title: i.name, class: 'b-page-json'
7
+ %span{class: 'divider'} /
@@ -1,97 +1,97 @@
1
- = form_for @page, :html => {:multipart => @multipart} do |f|
1
+ = form_for @page, html: {multipart: @multipart} do |f|
2
2
  - if @page.errors.any?
3
3
  .alert.alert-error.fade.in.span12
4
- = link_to "×", "#", :class => "close", 'data-dismiss' => 'alert'
4
+ = link_to '×', '#', class: 'close', 'data-dismiss' => 'alert'
5
5
  - @page.errors.full_messages.each do |m|
6
6
  = m
7
7
 
8
8
  .form-horizontal
9
9
  .control-group
10
- = f.label :active, :class => 'control-label'
11
- .controls= f.check_box :active, :class => "span6"
10
+ = f.label :active, class: 'control-label'
11
+ .controls= f.check_box :active, class: 'span6'
12
12
 
13
13
  .control-group
14
- = f.label :name, :class => 'control-label'
15
- .controls= f.text_field :name, :class => "span4"
14
+ = f.label :name, class: 'control-label'
15
+ .controls= f.text_field :name, class: 'span4'
16
16
 
17
17
  .control-group.auto_url
18
- = f.label :auto_url, :class => 'control-label'
18
+ = f.label :auto_url, class: 'control-label'
19
19
  .controls
20
- = f.check_box :auto_url, :class => "span9"
20
+ = f.check_box :auto_url, class: 'span9'
21
21
 
22
22
  .control-group.url
23
- = f.label :url, :class => 'control-label'
23
+ = f.label :url, class: 'control-label'
24
24
  .controls
25
25
  .full_url
26
26
  %span.path>= @page.parent.full_url unless @page.parent.nil?
27
27
  \/
28
28
  %span.address>= @page.url
29
- = f.text_field :url, :class => "span3"
29
+ = f.text_field :url, class: 'span3'
30
30
  %i.address_icon.icon-pencil
31
31
 
32
32
  - unless @page.new_record?
33
33
  - @page.template.fields.each do |field|
34
34
  .control-group
35
- = label_tag "", field.name, :class => 'control-label'
35
+ = label_tag "fields[#{field.code_name}]", field.name, class: 'control-label'
36
36
  .controls
37
- = render :partial => "constructor_pages/fields/types/#{field.type_value}", :locals => {:field => field, :page => @page}
37
+ = render :partial => "constructor_pages/fields/types/#{field.type_value}", locals: {field: field, page: @page}
38
38
 
39
39
  .accordion
40
40
  .accordion-group
41
41
  .accordion-heading.text-center
42
- = link_to t(:settings), '#collapse', :class => 'accordion-toggle', 'data-toggle' => 'collapse'
42
+ = link_to t(:settings), '#collapse', class: 'accordion-toggle', 'data-toggle' => 'collapse'
43
43
  .accordion-body.in.collapse#collapse
44
44
  .accordion-inner
45
45
  .control-group
46
- = f.label :parent, :class => 'control-label'
46
+ = f.label :parent_id, class: 'control-label'
47
47
  .controls
48
- = f.select :parent_id, options_for_select(for_select(@roots), :selected => @page.parent_id, :disabled => @page.self_and_descendants.map{|p| p.id}), :include_blank => t(:no)
48
+ = f.select :parent_id, options_for_select(for_select(@roots), selected: @page.parent_id), disabled: @page.self_and_descendants.map(&:id), include_blank: t(:no)
49
49
 
50
50
  .control-group
51
- = f.label :template, :class => 'control-label'
51
+ = f.label :template_id, :class => 'control-label'
52
52
  .controls
53
- = f.select :template_id, options_for_select(templates, :selected => @template_id)
53
+ = f.select :template_id, options_for_select(templates, selected: @template_id)
54
54
  .control-group
55
- = f.label :link, :class => 'control-label'
55
+ = f.label :link, class: 'control-label'
56
56
  .controls
57
- = f.text_field :link, :class => "span9"
57
+ = f.text_field :link, class: 'span9'
58
58
  .control-group
59
59
  %label.control-label=t :display_in
60
60
  .controls
61
- %label.checkbox.inline.span2{:for => 'in_menu'}
61
+ %label.checkbox.inline.span2{for: 'in_menu'}
62
62
  = f.check_box :in_menu
63
63
  =t :menu
64
64
 
65
- %label.checkbox.inline.span2{:for => 'in_map'}
65
+ %label.checkbox.inline.span2{for: 'in_map'}
66
66
  = f.check_box :in_map
67
67
  =t :sitemap
68
68
 
69
- %label.checkbox.inline.span2{:for => 'in_nav'}
69
+ %label.checkbox.inline.span2{for: 'in_nav'}
70
70
  = f.check_box :in_nav
71
71
  =t :breadcrumbs
72
72
 
73
73
  .accordion
74
74
  .accordion-group
75
75
  .accordion-heading.text-center
76
- = link_to t(:seo), '#collapse-three', :class => 'accordion-toggle', 'data-toggle' => 'collapse'
76
+ = link_to t(:seo), '#collapse-three', class: 'accordion-toggle', 'data-toggle' => 'collapse'
77
77
  .accordion-body.in.collapse#collapse-three
78
78
  .accordion-inner
79
79
  .control-group
80
- = f.label :title, :class => 'control-label'
80
+ = f.label :title, class: 'control-label'
81
81
  .controls
82
- = f.text_field :title, :class => "span9"
82
+ = f.text_field :title, class: 'span9'
83
83
  .control-group
84
- = f.label :keywords, :class => 'control-label'
84
+ = f.label :keywords, class: 'control-label'
85
85
  .controls
86
- = f.text_field :keywords, :class => "span9"
86
+ = f.text_field :keywords, class: 'span9'
87
87
  .control-group
88
- = f.label :description, :class => 'control-label'
88
+ = f.label :description, class: 'control-label'
89
89
  .controls
90
- = f.text_area :description, :class => "span9", :rows => 8
90
+ = f.text_area :description, class: 'span9', rows: 8
91
91
 
92
92
  .row-fluid
93
93
  .span12
94
94
  .form-actions
95
- = f.submit :class => "btn btn-primary"
95
+ = f.submit class: 'btn btn-primary'
96
96
  = link_to t(:cancel), pages_url, class: 'btn'
97
97
  = link_to t(:delete_page), @page, method: :delete, data: {confirm: t(:are_you_sure?)}, class: 'btn btn-danger pull-right' unless @page.new_record?