zammad/app/controllers/mobile_controller.rb

39 lines
1.3 KiB
Ruby
Raw Permalink Normal View History

# Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
Feature: Mobile - Added main tool chain for the new tech stack (with vite as the build tool). Added Vite with the `vite_rails` ruby gem: `bundle install`, `bundle exec vite install` and vite.config.ts Added Vue.js: `yarn add vue@next vue-router@next` and `yarn add -D @vitejs/plugin-vue`. Added Typescript: `yarn add -D typescript vue-tsc` and `tsconfig.json`. Added Prettier: `yarn add -D prettier --exact` and `.prettierrc.json`. Added ESLint and ESLint-Plugins: `yarn add -D eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser @vue/eslint-config-prettier @vue/eslint-config-typescript eslint-config-airbnb-base eslint-config-prettier eslint-import-resolver-alias eslint-plugin-import eslint-plugin-prettier eslint-plugin-vue eslint-plugin-prettier-vue` and `.eslintrc.js`. Added Jest: `yarn add -D jest @types/jest @vue/test-utils eslint-plugin-jest jest-serializer-vue jest-transform-stub ts-jest @vue/vue3-jest` and `jest.config.js`. Added TailwindCSS: `yarn add -D tailwindcss@next @tailwindcss/forms@next postcss autoprefixer` and `npx tailwindcss init -p` Added GraphQL for the frontend: `yarn add @vue/apollo-option @apollo/client @vue/apollo-composable graphql-ruby-client` Added GraphQL for the backend: `gem 'graphql'` and `gem 'graphql-batch', require: 'graphql/batch'` Added Actioncable: `yarn add actioncable` Adding GraphQL Code-Generator: `yarn add -D @graphql-codegen/cli @graphql-codegen/introspection @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/typescript-vue-apollo`
2021-10-21 05:21:51 +00:00
class MobileController < ApplicationController
def index
render(layout: 'layouts/mobile', locals: { locale: current_user&.preferences&.dig(:locale) })
Feature: Mobile - Added main tool chain for the new tech stack (with vite as the build tool). Added Vite with the `vite_rails` ruby gem: `bundle install`, `bundle exec vite install` and vite.config.ts Added Vue.js: `yarn add vue@next vue-router@next` and `yarn add -D @vitejs/plugin-vue`. Added Typescript: `yarn add -D typescript vue-tsc` and `tsconfig.json`. Added Prettier: `yarn add -D prettier --exact` and `.prettierrc.json`. Added ESLint and ESLint-Plugins: `yarn add -D eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser @vue/eslint-config-prettier @vue/eslint-config-typescript eslint-config-airbnb-base eslint-config-prettier eslint-import-resolver-alias eslint-plugin-import eslint-plugin-prettier eslint-plugin-vue eslint-plugin-prettier-vue` and `.eslintrc.js`. Added Jest: `yarn add -D jest @types/jest @vue/test-utils eslint-plugin-jest jest-serializer-vue jest-transform-stub ts-jest @vue/vue3-jest` and `jest.config.js`. Added TailwindCSS: `yarn add -D tailwindcss@next @tailwindcss/forms@next postcss autoprefixer` and `npx tailwindcss init -p` Added GraphQL for the frontend: `yarn add @vue/apollo-option @apollo/client @vue/apollo-composable graphql-ruby-client` Added GraphQL for the backend: `gem 'graphql'` and `gem 'graphql-batch', require: 'graphql/batch'` Added Actioncable: `yarn add actioncable` Adding GraphQL Code-Generator: `yarn add -D @graphql-codegen/cli @graphql-codegen/introspection @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/typescript-vue-apollo`
2021-10-21 05:21:51 +00:00
end
def service_worker
render(file: Rails.root.join("public/#{ViteRuby.config.public_output_dir}/sw.js"), layout: false)
end
def manifest
name = Setting.get('organization').presence || Setting.get('product_name').presence || 'Zammad'
render(
layout: false,
json: {
id: '/mobile/',
short_name: 'Zammad',
name: name,
# TODO
# dir: "ltr",
# lang: "en-US",
orientation: 'portrait',
background_color: '#191919',
theme_color: '#191919',
display: 'standalone',
start_url: '/mobile/',
icons: [
2023-11-30 11:03:30 +00:00
# files are relative to manifest.webmanifest and are stored in public/assets/frontend
{ src: '../assets/frontend/app-icon-512.png', sizes: '512x512', type: 'image/png' },
{ src: '../assets/frontend/app-icon-192.png', sizes: '192x192', type: 'image/png' },
]
},
content_type: 'application/manifest+json'
)
end
Feature: Mobile - Added main tool chain for the new tech stack (with vite as the build tool). Added Vite with the `vite_rails` ruby gem: `bundle install`, `bundle exec vite install` and vite.config.ts Added Vue.js: `yarn add vue@next vue-router@next` and `yarn add -D @vitejs/plugin-vue`. Added Typescript: `yarn add -D typescript vue-tsc` and `tsconfig.json`. Added Prettier: `yarn add -D prettier --exact` and `.prettierrc.json`. Added ESLint and ESLint-Plugins: `yarn add -D eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser @vue/eslint-config-prettier @vue/eslint-config-typescript eslint-config-airbnb-base eslint-config-prettier eslint-import-resolver-alias eslint-plugin-import eslint-plugin-prettier eslint-plugin-vue eslint-plugin-prettier-vue` and `.eslintrc.js`. Added Jest: `yarn add -D jest @types/jest @vue/test-utils eslint-plugin-jest jest-serializer-vue jest-transform-stub ts-jest @vue/vue3-jest` and `jest.config.js`. Added TailwindCSS: `yarn add -D tailwindcss@next @tailwindcss/forms@next postcss autoprefixer` and `npx tailwindcss init -p` Added GraphQL for the frontend: `yarn add @vue/apollo-option @apollo/client @vue/apollo-composable graphql-ruby-client` Added GraphQL for the backend: `gem 'graphql'` and `gem 'graphql-batch', require: 'graphql/batch'` Added Actioncable: `yarn add actioncable` Adding GraphQL Code-Generator: `yarn add -D @graphql-codegen/cli @graphql-codegen/introspection @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/typescript-vue-apollo`
2021-10-21 05:21:51 +00:00
end