diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 12434f81..b8162617 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,15 +33,6 @@ module ApplicationHelper !current_user.nil? && ((current_user == user) || current_user.mod?) end - def ios_web_app? - user_agent = request.env["HTTP_USER_AGENT"] || "Mozilla/5.0" - # normal MobileSafari.app UA: Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B435 Safari/600.1.4 - # webapp UA: Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B435 - return true if user_agent.match(/^Mozilla\/\d+\.\d+ \(i(?:Phone|Pad|Pod); CPU(?:.*) like Mac OS X\)(?:.*) Mobile(?:\S*)$/) - - false - end - def rails_admin_path_for_resource(resource) [rails_admin_path, resource.model_name.param_key, resource.id].join("/") end diff --git a/app/views/navigation/_desktop.html.haml b/app/views/navigation/_desktop.html.haml index 4678d684..ef832825 100644 --- a/app/views/navigation/_desktop.html.haml +++ b/app/views/navigation/_desktop.html.haml @@ -1,5 +1,5 @@ %nav.navbar.navbar-themed.navbar-expand-lg.bg-primary.fixed-top.d-lg-block.d-none.d-print-none{ role: :navigation } - .container{ class: ios_web_app? ? 'ios-web-app' : '' } + .container %a.navbar-brand{ href: '/', title: APP_CONFIG["site_name"] } - if APP_CONFIG["use_svg_logo"] = render inline: Rails.application.config.justask_svg_logo diff --git a/app/views/navigation/_guest.html.haml b/app/views/navigation/_guest.html.haml index 282fbcab..bdcfdb86 100644 --- a/app/views/navigation/_guest.html.haml +++ b/app/views/navigation/_guest.html.haml @@ -1,5 +1,5 @@ %nav.navbar.navbar-themed.navbar-expand-lg.bg-primary.fixed-top{ role: :navigation } - .container{ class: ios_web_app? ? 'ios-web-app' : '' } + .container %a.navbar-brand{ href: '/', title: APP_CONFIG["site_name"] } - if APP_CONFIG["use_svg_logo"] = render inline: Rails.application.config.justask_svg_logo diff --git a/app/views/navigation/_mobile.html.haml b/app/views/navigation/_mobile.html.haml index 0cd8a89f..37bec6d4 100644 --- a/app/views/navigation/_mobile.html.haml +++ b/app/views/navigation/_mobile.html.haml @@ -2,7 +2,7 @@ = render 'navigation/dropdown/notifications', notifications: notifications, size: "mobile" - notifications_icon = notification_count.nil? ? 'bell-o' : 'bell' %nav.navbar.navbar-themed.bg-primary.fixed-bottom.d-lg-none.d-block.d-print-none#rs-mobile-nav{ role: :navigation } - .container{ class: ios_web_app? ? 'ios-web-app' : '' } + .container %ul.nav.navbar-nav.navbar-icon-row = nav_entry t("navigation.timeline"), root_path, icon: 'home', icon_only: true = nav_entry t("navigation.inbox"), '/inbox', diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 3889f50a..abec3188 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -87,32 +87,6 @@ describe ApplicationHelper, type: :helper do end end - describe "#ios_web_app" do - context "Non-iOS device" do - it "should not return true" do - controller.request.user_agent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2;" - - expect(helper.ios_web_app?).to eq(false) - end - end - - context "iOS device (not in web app mode)" do - it "should not return true" do - controller.request.user_agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B435 Safari/600.1.4" - - expect(helper.ios_web_app?).to eq(false) - end - end - - context "iOS device" do - it "should return true" do - controller.request.user_agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B435" - - expect(helper.ios_web_app?).to eq(true) - end - end - end - describe "#rails_admin_path_for_resource" do context "user resource" do let(:resource) { FactoryBot.create(:user) }