Skip to content

Commit

Permalink
Replace bento layout by Bootstrap one
Browse files Browse the repository at this point in the history
For the new staging workflow also sets the layout by default.

Co-authored-by: David Kang <dkang@suse.com>
  • Loading branch information
saraycp and David Kang committed Sep 13, 2019
1 parent b29a462 commit 023e1fc
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 191 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module Webui
module Staging
class ExcludedRequestsController < WebuiController
layout 'webui2/webui'

before_action :require_login, except: [:index]
# NOTE: remove when bootstrap migration is done (related to switch_to_webui2)
before_action :set_webui2_views
Expand Down
2 changes: 0 additions & 2 deletions src/api/app/controllers/webui/staging/projects_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module Webui
module Staging
class ProjectsController < WebuiController
layout 'webui2/webui'

before_action :require_login
before_action :set_staging_workflow
after_action :verify_authorized, except: :show
Expand Down
2 changes: 0 additions & 2 deletions src/api/app/controllers/webui/staging/workflows_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class Webui::Staging::WorkflowsController < Webui::WebuiController
layout 'webui2/webui'

before_action :require_login, except: [:show]
before_action :set_webui2_views
before_action :set_project, only: [:new, :create]
Expand Down
18 changes: 5 additions & 13 deletions src/api/app/controllers/webui/webui_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require_dependency 'authenticator'

class Webui::WebuiController < ActionController::Base
layout :choose_layout
layout 'webui/webui'

helper_method :valid_xml_id

Expand Down Expand Up @@ -310,25 +310,17 @@ def render_dialog(dialog_init = nil, locals = {})
render partial: 'dialog', content_type: 'application/javascript'
end

# TODO: disable bootstrap flip in production after migrating all the controllers
def switch_to_webui2?
if Rails.env.test?
# In test environment we want to enable the
# bootstrap theme independent from the user
# The feature switch depends on the user (e.g. Admin or Staff)
ENV['BOOTSTRAP'].present?
else
Flipper.enabled?(:bootstrap, User.possibly_nobody)
end
end

def choose_layout
@switch_to_webui2 ? 'webui2/webui' : 'webui/webui'
true
end

# TODO: remove and replace where used after migrating all the controllers
def ui_namespace
switch_to_webui2? ? 'webui2' : 'webui'
end

# TODO: remove after migrating all the controller
def switch_to_webui2
if switch_to_webui2?
@switch_to_webui2 = true
Expand Down
172 changes: 0 additions & 172 deletions src/api/app/views/layouts/webui/webui.html.erb

This file was deleted.

0 comments on commit 023e1fc

Please sign in to comment.