cms-fortress 1.2.2 → 1.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/.gitignore +66 -0
  2. data/Gemfile +2 -17
  3. data/Gemfile.lock +80 -90
  4. data/README.rdoc +11 -0
  5. data/Rakefile +9 -39
  6. data/app/controllers/cms/fortress/admin_controller.rb +5 -0
  7. data/app/controllers/cms/fortress/roles_controller.rb +11 -21
  8. data/app/controllers/cms/fortress/users_controller.rb +48 -31
  9. data/app/helpers/cms/fortress/application_helper.rb +37 -5
  10. data/app/helpers/comfy/admin/cms/pages_helper.rb +22 -0
  11. data/app/models/cms/fortress/error.rb +17 -0
  12. data/app/models/cms/fortress/role.rb +2 -1
  13. data/app/models/cms/fortress/settings.rb +17 -0
  14. data/app/models/cms/fortress/user.rb +17 -0
  15. data/app/models/cms_ability.rb +29 -22
  16. data/app/views/cms/fortress/admin/dashboard.html.haml +12 -0
  17. data/app/views/cms/fortress/shared/_dashboard_widget.html.haml +29 -0
  18. data/app/views/cms/fortress/shared/_menu.html.haml +26 -26
  19. data/app/views/cms/fortress/shared/_navbar.html.haml +1 -1
  20. data/app/views/cms/fortress/shared/_page_extend.html.haml +3 -5
  21. data/app/views/cms/fortress/shared/_page_extend_js.html.haml +2 -14
  22. data/app/views/cms/fortress/themes/wide/_body.html.haml +9 -8
  23. data/app/views/cms/fortress/themes/wide/_menu.html.haml +70 -37
  24. data/app/views/cms/fortress/users/_form.html.haml +6 -1
  25. data/app/views/cms/fortress/users/edit.html.haml +1 -2
  26. data/app/views/cms/fortress/users/index.html.haml +14 -5
  27. data/app/views/cms/fortress/users/new.html.haml +1 -2
  28. data/app/views/comfy/admin/cms/pages/_form.html.haml +10 -4
  29. data/app/views/comfy/admin/cms/pages/edit.html.haml +25 -0
  30. data/app/views/layouts/comfy/admin/cms/_head.html.haml +1 -1
  31. data/app/views/layouts/comfy/admin/cms/_left.html.haml +15 -12
  32. data/bin/bundle +3 -0
  33. data/bin/rails +4 -0
  34. data/bin/rake +4 -0
  35. data/cms-fortress.gemspec +32 -171
  36. data/config.ru +4 -0
  37. data/config/application.rb +34 -0
  38. data/config/boot.rb +5 -0
  39. data/config/cms/fortress/global_settings.yml +12 -0
  40. data/config/cms_routes.rb +7 -0
  41. data/config/database.yml +11 -0
  42. data/config/environment.rb +5 -0
  43. data/config/environments/development.rb +29 -0
  44. data/config/environments/test.rb +36 -0
  45. data/config/initializers/devise.rb +256 -0
  46. data/config/initializers/secret_token.rb +14 -0
  47. data/config/locales/de.yml +28 -1
  48. data/config/locales/devise.en.yml +59 -0
  49. data/config/locales/en.yml +37 -1
  50. data/config/roles.yml +1 -0
  51. data/config/secrets.yml +14 -0
  52. data/db/migrate/06_add_type_to_users.rb +11 -0
  53. data/db/migrate/07_integrate_workflow_into_cms_pages.rb +37 -0
  54. data/db/schema.rb +182 -0
  55. data/lib/assets/.keep +0 -0
  56. data/lib/cms-fortress.rb +10 -1
  57. data/lib/cms/fortress/application_controller_methods.rb +5 -2
  58. data/lib/cms/fortress/page_methods.rb +52 -2
  59. data/lib/cms/fortress/pages_controller_methods.rb +17 -0
  60. data/lib/cms/fortress/rails/engine.rb +12 -3
  61. data/lib/cms/fortress/routes/admin.rb +9 -1
  62. data/lib/cms/fortress/site_methods.rb +29 -0
  63. data/lib/cms/fortress/sites_controller_methods.rb +22 -0
  64. data/lib/generators/cms/comfy/comfy_generator.rb +18 -0
  65. data/lib/generators/cms/fortress/fortress_generator.rb +30 -6
  66. data/lib/generators/cms/fortress/upgrade/USAGE +8 -0
  67. data/lib/generators/cms/fortress/upgrade/upgrade_generator.rb +24 -0
  68. data/lib/tasks/.keep +0 -0
  69. data/test/{functional → controllers}/cms/fortress/roles_controller_test.rb +9 -4
  70. data/test/{functional → controllers}/cms/fortress/users_controller_test.rb +10 -11
  71. data/test/controllers/comfy/admin/cms/pages_controller_test.rb +115 -0
  72. data/test/fixtures/cms/fortress/role_details.yml +89 -8
  73. data/test/fixtures/cms/fortress/roles.yml +17 -0
  74. data/test/fixtures/cms/fortress/users.yml +14 -0
  75. data/test/fixtures/comfy/cms/blocks.yml +12 -0
  76. data/test/fixtures/comfy/cms/categories.yml +4 -0
  77. data/test/fixtures/comfy/cms/categorizations.yml +3 -0
  78. data/test/fixtures/comfy/cms/files.yml +9 -0
  79. data/test/fixtures/comfy/cms/layouts.yml +40 -0
  80. data/test/fixtures/comfy/cms/pages.yml +105 -0
  81. data/test/fixtures/comfy/cms/revisions.yml +21 -0
  82. data/test/fixtures/comfy/cms/sites.yml +6 -0
  83. data/test/fixtures/comfy/cms/snippets.yml +6 -0
  84. data/test/integration/cms/fortress/users_controller_test.rb +16 -0
  85. data/test/models/comfy/cms/page_test.rb +84 -0
  86. data/test/models/comfy/cms/settings_test.rb +16 -0
  87. data/test/test_helper.rb +25 -0
  88. metadata +157 -23
  89. data/app/models/cms/page_workflow.rb +0 -44
  90. data/app/models/error/missing_role_configuration_file.rb +0 -12
  91. data/lib/generators/comfy/cms/cms_generator.rb +0 -60
  92. data/test/fixtures/cms/page_workflows.yml +0 -11
  93. data/test/helper.rb +0 -18
  94. data/test/test_cms-fortress.rb +0 -7
  95. data/test/unit/cms/fortress/role_detail_test.rb +0 -7
  96. data/test/unit/cms/fortress/role_test.rb +0 -7
  97. data/test/unit/cms/fortress/role_user_test.rb +0 -7
  98. data/test/unit/helpers/cms/fortress/roles_helper_test.rb +0 -4
  99. data/test/unit/helpers/cms/fortress/users_helper_test.rb +0 -4
@@ -1,57 +1,60 @@
1
1
  class Cms::Fortress::UsersController < Comfy::Admin::Cms::BaseController
2
- before_filter do
2
+ before_action do
3
3
  authorize! :manage, Cms::Fortress::User
4
4
  end
5
+ before_action :set_user, :valid_super, only: [:show, :edit, :update, :destroy]
6
+ before_action :check_super, only: [:super, :new_super]
5
7
 
6
8
  # GET /cms/fortress/users
7
9
  # GET /cms/fortress/users.json
8
10
  def index
9
- @cms_fortress_users = Cms::Fortress::User.all
11
+ @super_user = false
12
+ @cms_fortress_users = @site.users
13
+ end
10
14
 
11
- respond_to do |format|
12
- format.html # index.html.erb
13
- format.json { render json: @cms_fortress_users }
14
- end
15
+ def super
16
+ @super_user = true
17
+ @cms_fortress_users = Cms::Fortress::User.all_super
18
+ render action: :index
15
19
  end
16
20
 
17
21
  # GET /cms/fortress/users/1
18
22
  # GET /cms/fortress/users/1.json
19
23
  def show
20
- @cms_fortress_user = Cms::Fortress::User.find(params[:id])
21
-
22
- respond_to do |format|
23
- format.html # show.html.erb
24
- format.json { render json: @cms_fortress_user }
25
- end
26
24
  end
27
25
 
28
26
  # GET /cms/fortress/users/new
29
27
  # GET /cms/fortress/users/new.json
30
28
  def new
31
- @cms_fortress_user = Cms::Fortress::User.new
29
+ @super_user = false
30
+ @cms_fortress_user = @site.users.build(type_id: 2)
31
+ end
32
32
 
33
- respond_to do |format|
34
- format.html # new.html.erb
35
- format.json { render json: @cms_fortress_user }
36
- end
33
+ def new_super
34
+ @super_user = true
35
+ @cms_fortress_user = Cms::Fortress::User.new(type_id: 1)
36
+ render action: :new
37
37
  end
38
38
 
39
39
  # GET /cms/fortress/users/1/edit
40
40
  def edit
41
- @cms_fortress_user = Cms::Fortress::User.find(params[:id])
42
41
  end
43
42
 
44
43
  # POST /cms/fortress/users
45
44
  # POST /cms/fortress/users.json
46
45
  def create
47
- @cms_fortress_user = Cms::Fortress::User.new(user_params)
48
-
49
- respond_to do |format|
50
- if @cms_fortress_user.save
51
- flash[:success] = "User was successfully created."
52
- format.html { redirect_to cms_fortress_users_path }
46
+ @cms_fortress_user = @site.users.build(user_params)
47
+ raise CanCan::AccessDenied.new("Your are not allowed to create a super user.") if @cms_fortress_user.type.eql?(:super_user) && !current_cms_fortress_user.type.eql?(:super_user)
48
+ @cms_fortress_user.site_id = nil if @cms_fortress_user.type.eql?(:super_user)
49
+
50
+ if @cms_fortress_user.save
51
+ flash[:success] = "User was successfully created."
52
+ respond_to do |format|
53
+ format.html { redirect_to @cms_fortress_user.type.eql?(:super_user) ? super_cms_fortress_users_path : cms_fortress_users_path }
53
54
  format.json { render json: @cms_fortress_user, status: :created, location: @cms_fortress_user }
54
- else
55
+ end
56
+ else
57
+ respond_to do |format|
55
58
  format.html { render action: "new" }
56
59
  format.json { render json: @cms_fortress_user.errors, status: :unprocessable_entity }
57
60
  end
@@ -61,9 +64,10 @@ class Cms::Fortress::UsersController < Comfy::Admin::Cms::BaseController
61
64
  # PUT /cms/fortress/users/1
62
65
  # PUT /cms/fortress/users/1.json
63
66
  def update
64
- @cms_fortress_user = Cms::Fortress::User.find(params[:id])
65
-
66
67
  user = user_params
68
+
69
+ raise CanCan::AccessDenied.new("Your are not allowed to create a super user.") if user[:type_id].eql?(1) && !current_cms_fortress_user.type.eql?(:super_user)
70
+
67
71
  if user[:password].blank?
68
72
  user.delete(:password)
69
73
  user.delete(:password_confirmation) if user[:password_confirmation].blank?
@@ -72,7 +76,7 @@ class Cms::Fortress::UsersController < Comfy::Admin::Cms::BaseController
72
76
  respond_to do |format|
73
77
  if @cms_fortress_user.update_attributes(user)
74
78
  flash[:success] = "User was successfully updated."
75
- format.html { redirect_to cms_fortress_users_path }
79
+ format.html { redirect_to @cms_fortress_user.type.eql?(:super_user) ? super_cms_fortress_users_path : cms_fortress_users_path }
76
80
  format.json { head :no_content }
77
81
  else
78
82
  format.html { render action: "edit" }
@@ -84,18 +88,31 @@ class Cms::Fortress::UsersController < Comfy::Admin::Cms::BaseController
84
88
  # DELETE /cms/fortress/users/1
85
89
  # DELETE /cms/fortress/users/1.json
86
90
  def destroy
87
- @cms_fortress_user = Cms::Fortress::User.find(params[:id])
88
91
  @cms_fortress_user.destroy
89
92
 
90
93
  respond_to do |format|
91
- format.html { redirect_to cms_fortress_users_url }
94
+ format.html { redirect_to @cms_fortress_user.type.eql?(:super_user) ? super_cms_fortress_users_path : cms_fortress_users_path }
92
95
  format.json { head :no_content }
93
96
  end
94
97
  end
95
98
 
96
99
  private
97
100
 
101
+ def valid_super
102
+ raise CanCan::AccessDenied.new("Your are not authorised to execute this process.") if @cms_fortress_user.type.eql?(:super_user) && !current_cms_fortress_user.type.eql?(:super_user)
103
+ @super_user = @cms_fortress_user.type.eql?(:super_user)
104
+ end
105
+
106
+ def check_super
107
+ raise CanCan::AccessDenied.new("Your are not authorised to execute this process.") unless current_cms_fortress_user.type.eql?(:super_user)
108
+ # @super_user = current_cms_fortress_user.type.eql?(:super_user)
109
+ end
110
+
111
+ def set_user
112
+ @cms_fortress_user = Cms::Fortress::User.find(params[:id]) # @site.users.where(id: params[:id]).first
113
+ end
114
+
98
115
  def user_params
99
- params.require(:cms_fortress_user).permit(:last_name, :first_name, :email, :role_id, :password, :password_confirmation)
116
+ params.require(:cms_fortress_user).permit(:last_name, :first_name, :email, :type_id, :role_id, :password, :password_confirmation)
100
117
  end
101
118
  end
@@ -1,4 +1,12 @@
1
+ require 'cms/fortress/settings'
2
+ require 'cms/fortress/error'
3
+
1
4
  module Cms::Fortress::ApplicationHelper
5
+
6
+ def dashboard_widget(title, collection)
7
+ render partial: "cms/fortress/shared/dashboard_widget", locals: {title: title, collection: collection}
8
+ end
9
+
2
10
  def role_display(command)
3
11
  res = command.split(".")
4
12
  raw "#{content_tag(:strong, t("cms.fortress.roles.#{res.first}")) } / #{ res[1..-1].map {|r| t("cms.fortress.roles.#{r}")}.join(" - ") }"
@@ -19,18 +27,38 @@ module Cms::Fortress::ApplicationHelper
19
27
  def back_path
20
28
  case controller_name
21
29
  when "pages"
22
- comfy_admin_cms_site_pages_path
30
+ comfy_admin_cms_site_pages_path(@site)
23
31
  when "files"
24
- comfy_admin_cms_site_files_path
32
+ comfy_admin_cms_site_files_path(@site)
25
33
  when "layouts"
26
- comfy_admin_cms_site_layouts_path
34
+ comfy_admin_cms_site_layouts_path(@site)
27
35
  when "snippets"
28
- comfy_admin_cms_site_snippets_path
36
+ comfy_admin_cms_site_snippets_path(@site)
29
37
  else
30
38
  ""
31
39
  end
32
40
  end
33
41
 
42
+ def topnav_resource_item(key, resource)
43
+ if ["divider", "dropdown-header"].include?(resource[:name])
44
+ title = resource[:title].nil? ? "" : t(resource[:title], site_name: @site.label)
45
+ content_tag(:li, title, class: resource[:name], role: "presentation")
46
+ else
47
+ if can? :view, "#{ key }.#{ resource[:name] }"
48
+ if path = resource_path(resource[:path])
49
+ topnav_item t(resource[:title]), path, current_page?(path)
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ def resource_path(path)
56
+ begin
57
+ eval(path)
58
+ rescue
59
+ end
60
+ end
61
+
34
62
  def media_files_path(type)
35
63
  if params[:site_id]
36
64
  if type.eql?(:image)
@@ -59,7 +87,7 @@ module Cms::Fortress::ApplicationHelper
59
87
 
60
88
  def topnav_item(title, path, is_current = false)
61
89
  css_class = is_current ? "active" : ""
62
- content_tag(:li, link_to(title, path), class: css_class)
90
+ content_tag(:li, link_to(title, path), class: css_class, role: "presentation")
63
91
  end
64
92
 
65
93
  def leftnav_item(title, path, options = {})
@@ -85,5 +113,9 @@ module Cms::Fortress::ApplicationHelper
85
113
  map { |resource| resource[:name] }.
86
114
  include?(controller_name)
87
115
  end
116
+
117
+ def settings
118
+ Cms::Fortress::Settings.new(:global_settings)
119
+ end
88
120
  end
89
121
 
@@ -0,0 +1,22 @@
1
+ module Comfy::Admin::Cms::PagesHelper
2
+ def page_actions(page)
3
+ states = page.aasm.permissible_events
4
+ states.select! do |state|
5
+ can?(:manage, 'contents.page.'+state.to_s)
6
+ end
7
+ states
8
+ end
9
+
10
+ def cached_timeout_for_select
11
+ {
12
+ "Uncached" => 0,
13
+ "15 minutes" => 15.minutes,
14
+ "30 minutes" => 30.minutes,
15
+ "1 hour" => 1.hour,
16
+ "3 hours" => 3.hours,
17
+ "24 hours" => 1.day,
18
+ "15 days" => 15.days,
19
+ "30 days" => 30.days
20
+ }.map {|k,v| [k, v.to_i] }
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ module Cms::Fortress::Error
2
+ def self.log_error(name, message)
3
+ Rails.logger.fatal("[ERROR:] in #{name} with message: #{message}\n\n")
4
+ end
5
+
6
+ class MissingRoleConfigFile < StandardError
7
+ def initialize
8
+ Cms::Fortress::Error.log_error(self, "missing the roles.yml file in config/roles.yml")
9
+ end
10
+ end
11
+
12
+ class MissingSettingsFile < StandardError
13
+ def initialize
14
+ Cms::Fortress::Error.log_error(self, "missing cms-fortress settings file")
15
+ end
16
+ end
17
+ end
@@ -4,6 +4,7 @@ class Cms::Fortress::Role < ActiveRecord::Base
4
4
  # attr_accessible :description, :name
5
5
  has_many :users
6
6
  has_many :role_details
7
+ belongs_to :site, class_name: "Comfy::Cms::Site", foreign_key: :site_id
7
8
  accepts_nested_attributes_for :role_details, allow_destroy: true
8
9
 
9
10
  def load_defaults
@@ -12,7 +13,7 @@ class Cms::Fortress::Role < ActiveRecord::Base
12
13
  load_from_file(file)
13
14
  else
14
15
  errors[:base] << I18n.t('cms.fortress.admin.errors.missing_roles_yaml_file')
15
- raise Error::MissingRoleConfigurationFile
16
+ raise Cms::Fortress::Error::MissingRoleConfigurationFile
16
17
  end
17
18
  end
18
19
 
@@ -0,0 +1,17 @@
1
+ class Cms::Fortress::Settings < OpenStruct
2
+ def initialize(config_file_base_name)
3
+ @config_file_base_name = config_file_base_name
4
+ super(load_settings)
5
+ end
6
+
7
+ private
8
+
9
+ def load_settings
10
+ raise Cms::Fortress::Error::MissingSettingsFile unless config_file_exists?
11
+ YAML.load(ERB.new(File.read(Rails.root.join("config/cms/fortress", "#{@config_file_base_name}.yml"))).result)[Rails.env]
12
+ end
13
+
14
+ def config_file_exists?
15
+ File.exist?(File.join(Rails.root, "config/cms/fortress", "#{@config_file_base_name}.yml"))
16
+ end
17
+ end
@@ -9,5 +9,22 @@ class Cms::Fortress::User < ActiveRecord::Base
9
9
  :recoverable, :rememberable, :trackable, :validatable, :timeoutable
10
10
 
11
11
  belongs_to :role
12
+ belongs_to :site, class_name: "Comfy::Cms::Site", foreign_key: :site_id
12
13
 
14
+ scope :all_super, -> { where(type_id: 1) }
15
+
16
+ def self.types
17
+ {
18
+ 1 => :super_user,
19
+ 2 => :site_user
20
+ }
21
+ end
22
+
23
+ def type
24
+ self.class.types[type_id]
25
+ end
26
+
27
+ def display_name
28
+ "#{ email } (#{ type.to_s.titleize })"
29
+ end
13
30
  end
@@ -16,32 +16,39 @@ class CmsAbility
16
16
 
17
17
  def initialize(user)
18
18
 
19
- if user && user.role && user.role.role_details
20
- user.role.role_details.each do |role_detail|
21
- can :view, role_detail.command if role_detail.can_view?
22
- can :manage, role_detail.command if role_detail.can_manage?
19
+ if user
20
+ if user.type.eql?(:super_user)
21
+ can :manage, :all
22
+ else
23
+ if user.role && user.role.role_details
24
+ user.role.role_details.each do |role_detail|
25
+ can :view, role_detail.command if role_detail.can_view?
26
+ can :manage, role_detail.command if role_detail.can_manage?
23
27
 
24
- if role_detail.can_manage?
25
- case role_detail.command
26
- when 'settings.roles'
27
- can :manage, Cms::Fortress::Role
28
- when 'settings.sites'
29
- can :manage, Comfy::Cms::Site
30
- when 'settings.users'
31
- can :manage, Cms::Fortress::User
32
- when 'contents.pages'
33
- can :manage, Comfy::Cms::Page
34
- when 'contents.files'
35
- can :manage, Comfy::Cms::File
36
- when 'designs.layouts'
37
- can :manage, Comfy::Cms::Layout
38
- when 'designs.snippets'
39
- can :manage, Comfy::Cms::Snippet
40
- else
41
- setup_role(role_detail, user) if defined?(setup_role)
28
+ if role_detail.can_manage?
29
+ case role_detail.command
30
+ when 'settings.roles'
31
+ can :manage, Cms::Fortress::Role, site_id: user.site_id
32
+ when 'settings.sites'
33
+ can :update, Comfy::Cms::Site, site_id: user.site_id
34
+ when 'settings.users'
35
+ can :manage, Cms::Fortress::User, site_id: user.site_id
36
+ when 'contents.pages'
37
+ can :manage, Comfy::Cms::Page, site_id: user.site_id
38
+ when 'contents.files'
39
+ can :manage, Comfy::Cms::File, site_id: user.site_id
40
+ when 'designs.layouts'
41
+ can :manage, Comfy::Cms::Layout, site_id: user.site_id
42
+ when 'designs.snippets'
43
+ can :manage, Comfy::Cms::Snippet, site_id: user.site_id
44
+ else
45
+ setup_role(role_detail, user) if defined?(setup_role)
46
+ end
47
+ end
42
48
  end
43
49
  end
44
50
  end
51
+
45
52
  end
46
53
 
47
54
  end
@@ -0,0 +1,12 @@
1
+ .page-header
2
+ %h2
3
+ = "#{ t(".title") } /"
4
+ = @site.label
5
+
6
+ .container-fluid
7
+ .row
8
+ .col-sm-6
9
+ = dashboard_widget t(".draft_widget"), @site.pages.drafted.order(updated_at: :desc).limit(5)
10
+ = dashboard_widget t(".updated_pages"), @site.pages.order(updated_at: :desc).limit(5)
11
+ .col-sm-6
12
+ = dashboard_widget t(".reviewed_widget"), @site.pages.reviewed.order(updated_at: :desc).limit(5)
@@ -0,0 +1,29 @@
1
+ .panel-group(id="accordion-#{ title.parameterize }")
2
+ .panel.panel-default
3
+ .panel-heading
4
+ = title
5
+ %a.btn.btn-xs.btn-default.pull-right(data-toggle="collapse" href="#cl-#{ title.parameterize }" data-parent="#accordion-#{ title.parameterize }")
6
+ %span.glyphicon.glyphicon-minus
7
+
8
+ .panel-collapse.collapse.in(id="cl-#{ title.parameterize }")
9
+ .panel-body
10
+ %ul.list-group
11
+ - collection.each do |c|
12
+ %li.list-group-item
13
+ .row
14
+ .col-xs-6
15
+ = c.label
16
+ %br
17
+ %small
18
+ (
19
+ = c.full_path
20
+ )
21
+ .col-xs-6
22
+ = link_to edit_comfy_admin_cms_site_page_path(@site, c), class: "btn btn-xs btn-default" do
23
+ %span.glyphicon.glyphicon-edit
24
+ Edit
25
+
26
+ = link_to comfy_admin_cms_site_page_path(@site, c, preview: true), target: "_blank", method: :put, class: "btn btn-xs btn-default" do
27
+ %span.glyphicon.glyphicon-search
28
+ Preview
29
+
@@ -1,17 +1,19 @@
1
- %nav.navbar.navbar-default(role="navigation")
2
- .container-fluid
3
- .navbar-header
4
- %button.navbar-toggle(type="button" data-toggle="collapse" data-target="#main-nav")
5
- %span.sr-only= t('cms.fortress.toggle_navigation')
6
- %span.icon-bar
7
- %span.icon-bar
8
- %span.icon-bar
9
- %a.navbar-brand(href="#")= t('cms.fortress.title')
10
-
11
- .collapse.navbar-collapse#main-nav
12
- %ul.nav.navbar-nav
13
- - if default_theme?
1
+ - if default_theme?
2
+ %nav.navbar.navbar-default(role="navigation")
3
+ .container-fluid
4
+ .navbar-header
5
+ %button.navbar-toggle(type="button" data-toggle="collapse" data-target="#main-nav")
6
+ %span.sr-only= t('cms.fortress.toggle_navigation')
7
+ %span.icon-bar
8
+ %span.icon-bar
9
+ %span.icon-bar
10
+ = link_to settings.title, settings.title_link, class: 'navbar-brand'
11
+
12
+ .collapse.navbar-collapse#main-nav
13
+ %ul.nav.navbar-nav
14
14
  - if @site && !@site.new_record?
15
+ %li= topnav_item "Dashboard", dashboard_site_path, current_page?(dashboard_site_path)
16
+
15
17
  - if Cms::Fortress.configuration.content_resources.any? {|resource| can? :view, "contents.#{resource[:name]}" }
16
18
  = topnav_item t("cms.fortress.contents"), |
17
19
  @site && !@site.new_record? ? comfy_admin_cms_site_pages_path(@site) : comfy_admin_cms_sites_pages_path, |
@@ -25,19 +27,17 @@
25
27
  - if Cms::Fortress.configuration.settings_resources.any? {|resource| can? :view, "settings.#{resource[:name]}" }
26
28
  = topnav_item t("cms.fortress.settings"), comfy_admin_cms_sites_path, admin_page?
27
29
 
28
- - else
29
- = themed_partial('menu')
30
-
31
- = render 'cms/fortress/admin/topnav'
32
-
33
- - if current_cms_fortress_user
34
- .btn-group.pull-right(style="margin-top: 8px;")
35
- %button.btn.btn-default.dropdown-toggle(type="button" data-toggle="dropdown")
36
- = current_cms_fortress_user.email
37
- %span.caret
38
- %ul.dropdown-menu(role="menu")
39
- %li
40
- = link_to t('cms.fortress.logout'), destroy_cms_fortress_user_session_path, :method => 'delete'
30
+ = render 'cms/fortress/admin/topnav'
41
31
 
32
+ - if current_cms_fortress_user
33
+ .btn-group.pull-right(style="margin-top: 8px;")
34
+ %button.btn.btn-default.dropdown-toggle(type="button" data-toggle="dropdown")
35
+ = current_cms_fortress_user.display_name
36
+ %span.caret
37
+ %ul.dropdown-menu(role="menu")
38
+ %li
39
+ = link_to t('cms.fortress.logout'), destroy_cms_fortress_user_session_path, :method => 'delete'
42
40
 
41
+ - else
42
+ = themed_partial('menu')
43
43