diff --git a/app/controllers/advisories_controller.rb b/app/controllers/advisories_controller.rb index 9e579f7fa..3e2388636 100644 --- a/app/controllers/advisories_controller.rb +++ b/app/controllers/advisories_controller.rb @@ -1,6 +1,4 @@ class AdvisoriesController < ApplicationController - layout 'bootstrap' - before_filter :authenticate_user! skip_before_filter :authenticate_user! if APP_CONFIG['anonymous_access'] load_resource find_by: :advisory_id diff --git a/app/controllers/groups/base_controller.rb b/app/controllers/groups/base_controller.rb index 5af91222e..7428bfbe4 100644 --- a/app/controllers/groups/base_controller.rb +++ b/app/controllers/groups/base_controller.rb @@ -1,6 +1,4 @@ class Groups::BaseController < ApplicationController - layout 'bootstrap' - before_filter :authenticate_user! before_filter :find_group diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index bc56f0848..deafe35bf 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,5 +1,4 @@ class HomeController < ApplicationController - layout 'bootstrap' before_filter :authenticate_user!, only: [:activity, :issues, :pull_requests] def root diff --git a/app/controllers/platforms/contents_controller.rb b/app/controllers/platforms/contents_controller.rb index fd2824732..183a06f27 100644 --- a/app/controllers/platforms/contents_controller.rb +++ b/app/controllers/platforms/contents_controller.rb @@ -1,6 +1,5 @@ class Platforms::ContentsController < Platforms::BaseController include PaginateHelper - layout 'bootstrap' before_filter :authenticate_user! skip_before_filter :authenticate_user!, only: :index if APP_CONFIG['anonymous_access'] diff --git a/app/controllers/platforms/key_pairs_controller.rb b/app/controllers/platforms/key_pairs_controller.rb index 84c043583..f381f6e14 100644 --- a/app/controllers/platforms/key_pairs_controller.rb +++ b/app/controllers/platforms/key_pairs_controller.rb @@ -1,6 +1,4 @@ class Platforms::KeyPairsController < Platforms::BaseController - layout 'bootstrap' - before_filter :authenticate_user! load_and_authorize_resource :platform diff --git a/app/controllers/platforms/maintainers_controller.rb b/app/controllers/platforms/maintainers_controller.rb index c72d2d2c7..8a3af467c 100644 --- a/app/controllers/platforms/maintainers_controller.rb +++ b/app/controllers/platforms/maintainers_controller.rb @@ -1,6 +1,4 @@ class Platforms::MaintainersController < ApplicationController - layout 'bootstrap' - before_filter :authenticate_user! skip_before_filter :authenticate_user!, only: [:index] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :platform diff --git a/app/controllers/platforms/mass_builds_controller.rb b/app/controllers/platforms/mass_builds_controller.rb index 1ac10528d..b09330b09 100644 --- a/app/controllers/platforms/mass_builds_controller.rb +++ b/app/controllers/platforms/mass_builds_controller.rb @@ -1,6 +1,5 @@ class Platforms::MassBuildsController < Platforms::BaseController include DatatableHelper - layout 'bootstrap' before_filter :authenticate_user! skip_before_filter :authenticate_user!, only: [:index, :get_list] if APP_CONFIG['anonymous_access'] diff --git a/app/controllers/platforms/platforms_controller.rb b/app/controllers/platforms/platforms_controller.rb index f3cb83ea7..50956cce9 100644 --- a/app/controllers/platforms/platforms_controller.rb +++ b/app/controllers/platforms/platforms_controller.rb @@ -1,6 +1,5 @@ class Platforms::PlatformsController < Platforms::BaseController include FileStoreHelper - layout 'bootstrap' before_filter :authenticate_user! skip_before_filter :authenticate_user!, only: [:advisories, :members, :show] if APP_CONFIG['anonymous_access'] diff --git a/app/controllers/platforms/product_build_lists_controller.rb b/app/controllers/platforms/product_build_lists_controller.rb index 09bf2d461..365539235 100644 --- a/app/controllers/platforms/product_build_lists_controller.rb +++ b/app/controllers/platforms/product_build_lists_controller.rb @@ -1,6 +1,5 @@ class Platforms::ProductBuildListsController < Platforms::BaseController include FileStoreHelper - layout 'bootstrap' before_filter :authenticate_user! skip_before_filter :authenticate_user!, only: [:index, :show, :log] if APP_CONFIG['anonymous_access'] diff --git a/app/controllers/platforms/products_controller.rb b/app/controllers/platforms/products_controller.rb index b6baa483d..8ef77acbf 100644 --- a/app/controllers/platforms/products_controller.rb +++ b/app/controllers/platforms/products_controller.rb @@ -1,6 +1,5 @@ class Platforms::ProductsController < Platforms::BaseController include GitHelper - layout 'bootstrap' before_filter :authenticate_user! skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] diff --git a/app/controllers/platforms/repositories_controller.rb b/app/controllers/platforms/repositories_controller.rb index 18b950e0a..3691b3308 100644 --- a/app/controllers/platforms/repositories_controller.rb +++ b/app/controllers/platforms/repositories_controller.rb @@ -4,8 +4,6 @@ class Platforms::RepositoriesController < Platforms::BaseController include RepositoriesHelper include PaginateHelper - layout 'bootstrap' - before_filter :authenticate_user! skip_before_filter :authenticate_user!, only: [:index, :show, :projects_list] if APP_CONFIG['anonymous_access'] diff --git a/app/controllers/platforms/tokens_controller.rb b/app/controllers/platforms/tokens_controller.rb index 26816deb2..636f626a3 100644 --- a/app/controllers/platforms/tokens_controller.rb +++ b/app/controllers/platforms/tokens_controller.rb @@ -1,6 +1,4 @@ class Platforms::TokensController < Platforms::BaseController - layout 'bootstrap' - before_filter :authenticate_user! load_resource :platform diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index 574dcdcc6..6b775de96 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -2,8 +2,6 @@ class Projects::BuildListsController < Projects::BaseController include FileStoreHelper include BuildListsHelper - layout 'bootstrap' - NESTED_ACTIONS = [:index, :new, :create] before_filter :authenticate_user! diff --git a/app/controllers/projects/git/blobs_controller.rb b/app/controllers/projects/git/blobs_controller.rb index 69bba3c24..a8c6c16f1 100644 --- a/app/controllers/projects/git/blobs_controller.rb +++ b/app/controllers/projects/git/blobs_controller.rb @@ -1,6 +1,4 @@ class Projects::Git::BlobsController < Projects::Git::BaseController - layout 'bootstrap', only: [:show] - before_filter :set_blob before_filter -> {authorize! :write, @project}, only: [:edit, :update] diff --git a/app/controllers/projects/git/commits_controller.rb b/app/controllers/projects/git/commits_controller.rb index d9a2eaa18..80f1b7cb3 100644 --- a/app/controllers/projects/git/commits_controller.rb +++ b/app/controllers/projects/git/commits_controller.rb @@ -1,5 +1,4 @@ class Projects::Git::CommitsController < Projects::Git::BaseController - layout 'bootstrap', only: [:index] def index if @path.present? diff --git a/app/controllers/projects/git/trees_controller.rb b/app/controllers/projects/git/trees_controller.rb index eb414455d..3f7829b9f 100644 --- a/app/controllers/projects/git/trees_controller.rb +++ b/app/controllers/projects/git/trees_controller.rb @@ -1,5 +1,4 @@ class Projects::Git::TreesController < Projects::Git::BaseController - layout 'bootstrap', only: [:show, :branches, :tags] before_filter -> {redirect_to @project if params[:treeish] == @project.default_branch and params[:path].blank?}, only: :show skip_before_filter :set_branch_and_tree, :set_treeish_and_path, only: :archive diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index c67fada79..1192a4b7e 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -3,8 +3,6 @@ class Projects::HooksController < Projects::BaseController load_and_authorize_resource :project load_and_authorize_resource :hook, through: :project - layout 'bootstrap' - def index authorize! :edit, @project @name = params[:name] diff --git a/app/controllers/projects/projects_controller.rb b/app/controllers/projects/projects_controller.rb index 94ba89685..a21553b40 100644 --- a/app/controllers/projects/projects_controller.rb +++ b/app/controllers/projects/projects_controller.rb @@ -1,7 +1,7 @@ class Projects::ProjectsController < Projects::BaseController include DatatableHelper include ProjectsHelper - layout 'bootstrap', only: [:index, :new, :create, :edit, :update, :sections] + before_filter :authenticate_user! load_and_authorize_resource id_param: :name_with_owner # to force member actions load before_filter :who_owns, only: [:new, :create, :mass_import, :run_mass_import] diff --git a/app/controllers/statistics_controller.rb b/app/controllers/statistics_controller.rb index e3e324789..26f80263a 100644 --- a/app/controllers/statistics_controller.rb +++ b/app/controllers/statistics_controller.rb @@ -1,6 +1,4 @@ class StatisticsController < ApplicationController - layout 'bootstrap' - RANGES = [ RANGE_TWENTY_FOUR_HOURS = 'twenty_four_hours', RANGE_LAST_7_DAYS = 'last_7_days', diff --git a/app/controllers/users/base_controller.rb b/app/controllers/users/base_controller.rb index dd15179f5..1a8e47d92 100644 --- a/app/controllers/users/base_controller.rb +++ b/app/controllers/users/base_controller.rb @@ -1,6 +1,4 @@ class Users::BaseController < ApplicationController - layout 'bootstrap' - before_filter :authenticate_user! before_filter :find_user diff --git a/app/controllers/users/settings_controller.rb b/app/controllers/users/settings_controller.rb index 53d03ed63..5f196bccf 100644 --- a/app/controllers/users/settings_controller.rb +++ b/app/controllers/users/settings_controller.rb @@ -1,6 +1,6 @@ class Users::SettingsController < Users::BaseController include AvatarHelper - layout 'bootstrap' + before_filter :set_current_user def profile diff --git a/app/controllers/users/ssh_keys_controller.rb b/app/controllers/users/ssh_keys_controller.rb index fc81617d9..e5a4ec887 100644 --- a/app/controllers/users/ssh_keys_controller.rb +++ b/app/controllers/users/ssh_keys_controller.rb @@ -1,5 +1,4 @@ class Users::SshKeysController < Users::BaseController - layout 'bootstrap' before_filter :set_current_user def index diff --git a/app/models/ability.rb b/app/models/ability.rb index 70bda01ab..53649350a 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -12,7 +12,7 @@ class Ability @user = user # Shared rights between guests and registered users - can [:show, :archive], Project, visibility: 'open' + can [:show, :archive, :read], Project, visibility: 'open' can :get_id, Project, visibility: 'open' # api can(:refs_list, Project) {|project| can? :show, project} can :read, Issue, project: { visibility: 'open' } diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml deleted file mode 100644 index 5232d25b3..000000000 --- a/app/views/layouts/application.html.haml +++ /dev/null @@ -1,61 +0,0 @@ -!!! -%html - %head - %meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"} - = stylesheet_link_tag 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css', media: 'screen, projection' - = stylesheet_link_tag "application" - /[if lt IE 9] - = javascript_include_tag 'https://html5shiv.googlecode.com/svn/trunk/html5.js' - = javascript_include_tag 'application' - = javascript_include_tag 'moment/ru.js' if I18n.locale == :ru - = csrf_meta_tag - = display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-' - - if user_signed_in? - = auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name']) - - %body{'ng-app' => 'RosaABF', 'ng-controller' => 'RosaABFController', 'ng-init' => "init('#{I18n.locale}', #{!!current_user.try(:sound_notifications)})"} - .wrap{class: content_for?(:sidebar) ? 'columns' : ''} - %header - .left - .middle - %menu - .logo= link_to image_tag('logo-mini.png', alt: 'logo'), root_path - = render 'layouts/menu/top', which_menu: 'top_menu' - .information - = render 'search/form' - - if current_user - .user - .avatar= image_tag avatar_url(current_user), alt: 'avatar', height: "30" - .profile - %a{href: "#"} - = current_user.uname - = image_tag 'expand-white.png', alt: 'ex' - .both - .both - .droplist-wrap - #droplist.droplist - .a= link_to current_user.uname, current_user - .a= link_to t('layout.settings.label'), profile_settings_path - .a= link_to t('layout.logout'), destroy_user_session_path, method: :delete - - else - .user - .profile= link_to t("layout.devise.shared_links.sign_up"), new_register_request_path - .profile= link_to t("layout.devise.shared_links.sign_in"), new_user_session_path - .right - .both - - if content_for?(:submenu) - .sub-menu= yield :submenu - - if content_for?(:feed_tabs) - = yield :feed_tabs - .both - = render 'layouts/noscript' - = render "layouts/flashes" - = render "layouts/notifies" - %article - - if content_for?(:sidebar) - %aside= yield :sidebar - %div{class: layout_class}= yield - .both - - %footer= render "layouts/menu/bottom" - = render 'layouts/counters' if !current_user.try(:admin?) && Rails.env.production? diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim new file mode 100644 index 000000000..188d94448 --- /dev/null +++ b/app/views/layouts/application.html.slim @@ -0,0 +1,35 @@ +doctype html +html + head + meta name="viewport" content="width=device-width, initial-scale=1.0" + meta content="text/html; charset=utf-8" http-equiv="Content-Type" + == csrf_meta_tag + = display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-' + - if user_signed_in? + = auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name']) + == stylesheet_link_tag 'new_application' + + body[ ng-app='RosaABF' ng-controller='RosaABFController' + ng-init="init('#{I18n.locale}', #{!!current_user.try(:sound_notifications)})" ] + == render 'layouts/menu/new_top' + == yield :submenu if content_for?(:submenu) + + - if current_user || APP_CONFIG['anonymous_access'] + - if (flash_notify = FlashNotify.published.first) && flash_notify.should_show?(cookies[:flash_notify_hash]) + javascript: + var FLASH_HASH_ID = "#{flash_notify.hash_id}"; + .notify.alert.alert-dismissable.text-center class=alert_class(flash_notify.status) + button.close type='button' data-dismiss='alert' aria-hidden=true + = flash_notify.body(I18n.locale).html_safe + + == render 'layouts/noscript' + == render "layouts/flashes" + + article.container-fluid.offset20 + == yield + == render 'layouts/menu/new_bottom' + == javascript_include_tag 'new_application' + - if I18n.locale == :ru + == javascript_include_tag 'moment/ru.js' + == javascript_include_tag 'angular-locale_ru-ru' + == yield :additional_scripts if content_for?(:additional_scripts) diff --git a/app/views/layouts/bootstrap.html.haml b/app/views/layouts/bootstrap.html.haml deleted file mode 100644 index 0f667382c..000000000 --- a/app/views/layouts/bootstrap.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -!!! -%html - %head - %meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"} - = csrf_meta_tag - = display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-' - - if user_signed_in? - = auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name']) - = stylesheet_link_tag 'new_application' - - %body{ 'ng-app' => 'RosaABF', 'ng-controller' => 'RosaABFController', - 'ng-init' => "init('#{I18n.locale}', #{!!current_user.try(:sound_notifications)})" } - = render 'layouts/menu/new_top' - = yield :submenu if content_for?(:submenu) - - - if current_user || APP_CONFIG['anonymous_access'] - - if (flash_notify = FlashNotify.published.first) && flash_notify.should_show?(cookies[:flash_notify_hash]) - :javascript - var FLASH_HASH_ID = "#{flash_notify.hash_id}"; - .notify.alert.alert-dismissable.text-center{ class: alert_class(flash_notify.status) } - %button.close{ type: 'button', 'data-dismiss' => 'alert', 'aria-hidden' => true } × - = flash_notify.body(I18n.locale).html_safe - - = render 'layouts/noscript' - = render "layouts/flashes" - - %article.container-fluid.offset20 - = yield - = render 'layouts/menu/new_bottom' - = javascript_include_tag 'new_application' - - if I18n.locale == :ru - = javascript_include_tag 'moment/ru.js' - = javascript_include_tag 'angular-locale_ru-ru' - = yield :additional_scripts if content_for?(:additional_scripts)