From e6049adc52b8ca9a32265c925055c13c567f8b4c Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Fri, 24 May 2019 15:11:53 +0200 Subject: [PATCH] Fix gigitty link The modal didn't really work on mobiles. On mobiles you also need the schedule link because it's hard to point your mobile to a QR code on your mobile... --- .haml-lint_todo.yml | 2 +- app/controllers/schedules_controller.rb | 7 ++--- app/models/ability.rb | 2 +- app/views/schedules/_qr_code_modal.html.haml | 27 -------------------- app/views/schedules/app.html.haml | 19 ++++++++++++++ app/views/schedules/show.html.haml | 4 ++- config/routes.rb | 3 +++ 7 files changed, 31 insertions(+), 33 deletions(-) delete mode 100644 app/views/schedules/_qr_code_modal.html.haml create mode 100644 app/views/schedules/app.html.haml diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml index 633cf2e5..7bcb33d4 100644 --- a/.haml-lint_todo.yml +++ b/.haml-lint_todo.yml @@ -228,7 +228,7 @@ linters: - "app/views/schedules/_schedule.html.haml" - "app/views/schedules/_schedule_item.html.haml" - "app/views/schedules/_schedule_tabs.html.haml" - - "app/views/schedules/_qr_code_modal.html.haml" + - "app/views/schedules/app.html.haml" - "app/views/schedules/events.html.haml" - "app/views/schedules/show.html.haml" - "app/views/schedules/show.xml.haml" diff --git a/app/controllers/schedules_controller.rb b/app/controllers/schedules_controller.rb index 14c8888b..2d3f22ef 100644 --- a/app/controllers/schedules_controller.rb +++ b/app/controllers/schedules_controller.rb @@ -43,9 +43,6 @@ class SchedulesController < ApplicationController end @selected_schedules_ids.compact! @event_schedules_by_room_id = event_schedules.select { |s| @selected_schedules_ids.include?(s.schedule_id) }.group_by(&:room_id) - @qr_code = RQRCode::QRCode.new(conference_schedule_url).as_svg(offset: 20, color: '000', - shape_rendering: 'crispEdges', - module_size: 11) end end end @@ -63,6 +60,10 @@ class SchedulesController < ApplicationController @tag = day.strftime('%Y-%m-%d') if day end + def app + @qr_code = RQRCode::QRCode.new(conference_schedule_url).as_svg(offset: 20, color: '000', shape_rendering: 'crispEdges', module_size: 11) + end + private def respond_to_options diff --git a/app/models/ability.rb b/app/models/ability.rb index 85fe9cf8..a4731816 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -31,7 +31,7 @@ class Ability event.state == 'confirmed' end - can [:show, :events], Schedule do |schedule| + can [:show, :events, :app], Schedule do |schedule| schedule.program.schedule_public end diff --git a/app/views/schedules/_qr_code_modal.html.haml b/app/views/schedules/_qr_code_modal.html.haml deleted file mode 100644 index fbafb0d6..00000000 --- a/app/views/schedules/_qr_code_modal.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -/ Button trigger modal -%button.btn.btn-link.btn-lg.pull-right{ 'data-target': '#schedule-modal', - 'data-toggle': 'modal', - type: 'button' } - Get the mobile app! -/ Modal -.modal.fade#schedule-modal{ 'aria-labelledby': 'schedule-modal-label', role: 'dialog', tabindex: '-1' } - .modal-dialog{ role: 'document' } - .modal-content - .modal-header - %button.close{ 'aria-label': 'Close', 'data-dismiss': 'modal', type: 'button' } - %span{ 'aria-hidden': 'true' } - %h4.modal-title#schedule-modal-label - Get the schedule on your mobile with Giggity! - .modal-body.center-block.text-center - = link_to 'https://f-droid.org/packages/net.gaast.giggity' do - %img.img-responsive{ alt: 'Get it on F-Droid', src: 'https://fdroid.gitlab.io/artwork/badge/get-it-on.png' } - %p - \...and point your phone at the QR code... - .img-responsive - = raw qr_code - .modal-footer - %p.small.text-muted.pull-left - Not free of surveilance capitalism yet? Try the - = link_to 'https://play.google.com/store/apps/details?id=net.gaast.giggity' do - google play store... - %button.btn.btn-default{ 'data-dismiss': 'modal', type: 'button' } Close diff --git a/app/views/schedules/app.html.haml b/app/views/schedules/app.html.haml new file mode 100644 index 00000000..75e7c07c --- /dev/null +++ b/app/views/schedules/app.html.haml @@ -0,0 +1,19 @@ +.container + .page-header + %h1 + Get the schedule on your mobile with Giggity! + = link_to 'https://f-droid.org/packages/net.gaast.giggity' do + %img.img-responsive.center-block{ alt: 'Get it on F-Droid', src: 'https://fdroid.gitlab.io/artwork/badge/get-it-on.png' } + %p + The schedule URL: + %p.lead.text-center + = link_to conference_schedule_url(format: :xml) do + = conference_schedule_url(format: :xml) + %p + Or point your phone at the QR code: + .img-responsive.text-center + = raw @qr_code + %p.text-muted + Not free of surveilance capitalism yet? Use the + = link_to 'https://play.google.com/store/apps/details?id=net.gaast.giggity' do + google play store... diff --git a/app/views/schedules/show.html.haml b/app/views/schedules/show.html.haml index a8f15af4..355cafad 100644 --- a/app/views/schedules/show.html.haml +++ b/app/views/schedules/show.html.haml @@ -26,7 +26,9 @@ .visible-md-inline.visible-lg-inline = render partial: 'carousel', locals: { date: date, hrs_per_slide: 3 } - = render partial: 'qr_code_modal', locals: { qr_code: @qr_code } + %p.pull-right + = link_to app_conference_schedule_path do + Get the mobile app! :javascript // change of active tab and the button title when a date is clicked diff --git a/config/routes.rb b/config/routes.rb index 44577f77..57bfa630 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -193,6 +193,9 @@ Osem::Application.routes.draw do resources :physical_tickets, only: [:index, :show] resource :subscriptions, only: [:create, :destroy] resource :schedule, only: [:show] do + collection do + get 'app' + end member do get :events end