diff --git a/lib/cybele/generators/app_generator.rb b/lib/cybele/generators/app_generator.rb index 96ad4d5..604a694 100644 --- a/lib/cybele/generators/app_generator.rb +++ b/lib/cybele/generators/app_generator.rb @@ -238,11 +238,6 @@ def configure_error_pages build :configure_error_pages end - def setup_git_and_git_flow - say 'Initialize git and git flow' - build :git_and_git_flow_commands - end - def docker_development_env return if @options[:skip_docker] say 'Setup docker development environment', :green @@ -259,6 +254,12 @@ def setup_audited build :configure_audited end + def customize_view_files + return if @options[:skip_view_files] + say 'Customize view files', :green + build :customize_assets_files + end + def customize_app_files build :customize_model_files build :customize_mailer_files @@ -276,6 +277,11 @@ def customize_app_files build :add_devise_authenticate_admin end + def setup_git_and_git_flow + say 'Initialize git and git flow' + build :git_and_git_flow_commands + end + def goodbye say 'Congratulations! That\'s all...', :green end diff --git a/lib/cybele/helpers/app_files/controller_files.rb b/lib/cybele/helpers/app_files/controller_files.rb index 2bf1631..b65f970 100644 --- a/lib/cybele/helpers/app_files/controller_files.rb +++ b/lib/cybele/helpers/app_files/controller_files.rb @@ -7,6 +7,9 @@ module ControllerFiles def customize_controller_files # HQ controller files directory 'app_files/app/controllers/hq', 'app/controllers/hq' + + # Welcome controller + copy_file 'app_files/app/controllers/welcome_controller.rb', 'app/controllers/welcome_controller.rb' end end end diff --git a/lib/cybele/helpers/app_files/view_files.rb b/lib/cybele/helpers/app_files/view_files.rb index 460c1f9..4607609 100644 --- a/lib/cybele/helpers/app_files/view_files.rb +++ b/lib/cybele/helpers/app_files/view_files.rb @@ -9,6 +9,9 @@ def customize_view_files_with_option directory 'app_files/app/views/hq', 'app/views/hq' directory 'app_files/app/views/layouts/hq', 'app/views/layouts/hq' directory 'app_files/app/views/layouts/partials', 'app/views/layouts/partials' + directory 'app_files/app/views/welcome', 'app/views/welcome' + template 'app_files/app/views/layouts/application.html.haml.erb', + 'app/views/layouts/application.html.haml', force: true end def customize_default_view_files diff --git a/lib/cybele/helpers/routes.rb b/lib/cybele/helpers/routes.rb index 563077b..47ab897 100644 --- a/lib/cybele/helpers/routes.rb +++ b/lib/cybele/helpers/routes.rb @@ -11,6 +11,7 @@ def configure_routes inject_into_file 'config/routes.rb', template_content('config/routes.rb.erb'), before: 'if Rails.env.production? || Rails.env.staging?' + end end end diff --git a/spec/features/new_default_project_spec.rb b/spec/features/new_default_project_spec.rb index 368a323..9e10521 100644 --- a/spec/features/new_default_project_spec.rb +++ b/spec/features/new_default_project_spec.rb @@ -309,6 +309,11 @@ expect(File).to exist(file_project_path('app/views/devise/sessions')) expect(File).to exist(file_project_path('app/views/devise/shared')) expect(File).to exist(file_project_path('app/views/devise/unlocks')) + + # Welcome view files + expect(File).to exist(file_project_path('app/views/welcome/about.html.haml')) + expect(File).to exist(file_project_path('app/views/welcome/contact.html.haml')) + expect(File).to exist(file_project_path('app/views/welcome/index.html.haml')) end it 'uses default view files' do diff --git a/spec/features/new_not_default_project_spec.rb b/spec/features/new_not_default_project_spec.rb index 21f01ae..32e7407 100644 --- a/spec/features/new_not_default_project_spec.rb +++ b/spec/features/new_not_default_project_spec.rb @@ -250,6 +250,12 @@ expect(File).not_to exist(file_project_path('app/views/devise/sessions')) expect(File).not_to exist(file_project_path('app/views/devise/shared')) expect(File).not_to exist(file_project_path('app/views/devise/unlocks')) + + # Welcome view files + expect(File).not_to exist(file_project_path('app/views/welcome/about.html.haml')) + expect(File).not_to exist(file_project_path('app/views/devise/contact.html.haml')) + expect(File).not_to exist(file_project_path('app/views/devise/index.html.haml')) + end it 'uses default view files' do diff --git a/templates/app_files/app/assets/stylesheets/application.css.sass b/templates/app_files/app/assets/stylesheets/application.css.sass index 19997ee..b9b5932 100644 --- a/templates/app_files/app/assets/stylesheets/application.css.sass +++ b/templates/app_files/app/assets/stylesheets/application.css.sass @@ -11,3 +11,43 @@ *= require_self @import "bootstrap" + +/* Custom container + +body + padding-top: 1.5rem + padding-bottom: 1.5rem + +.container-narrow + margin: 0 auto + max-width: 700px + > hr + margin: 30px 0 + +/* Main marketing message and sign up button +.jumbotron + margin: 60px 0 + text-align: center + h1 + font-size: 72px + line-height: 1 + .btn + font-size: 21px + padding: 14px 24px + +.header + padding-bottom: 1rem + color: #777 + border-bottom: .05rem solid #e5e5e5 + +.footer + padding-top: 1.5rem + color: #777 + border-top: .05rem solid #e5e5e5 + +/* Supporting marketing content + +.about-contact + margin: 60px 0 + p + h4 + margin-top: 28px \ No newline at end of file diff --git a/templates/app_files/app/controllers/welcome_controller.rb b/templates/app_files/app/controllers/welcome_controller.rb new file mode 100644 index 0000000..23178ac --- /dev/null +++ b/templates/app_files/app/controllers/welcome_controller.rb @@ -0,0 +1,10 @@ +class WelcomeController < ApplicationController + def index + end + + def about + end + + def contact + end +end \ No newline at end of file diff --git a/templates/app_files/app/views/layouts/application.html.haml.erb b/templates/app_files/app/views/layouts/application.html.haml.erb new file mode 100644 index 0000000..52e4e55 --- /dev/null +++ b/templates/app_files/app/views/layouts/application.html.haml.erb @@ -0,0 +1,35 @@ +!!! +%html{lang: I18n.locale} + %head + %title= content_for?(:title) ? "#{yield(:title)} - <%= app_name.capitalize %>" : '<%= app_name.capitalize %>' + %meta(http-equiv="content-type" content="text/html" charset="utf-8") + %meta(http-equiv="x-ua-compatible" content="ie=edge,chrome=1") + %meta(name="description" content="<%= app_name.capitalize %>") + %meta(name="author" content="<%= app_name.capitalize %>") + %link(rel="shortcut icon" href="/images/favicon.png") + + = stylesheet_link_tag 'application', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', + media: 'all', 'data-turbolinks-track' => true + = javascript_include_tag 'application', 'data-turbolinks-track' => true + = csrf_meta_tags + = yield :headls + %body + = render 'layouts/partials/warnings' + .container-narrow + .header + %nav + / Brand and toggle get grouped for better mobile display + = link_to root_path, class: 'navbar-brand' do + %i.fa.fa-home + = "<%= app_name.capitalize %>" + %ul.nav.nav-pills.float-right + %li.nav-item + %a.nav-link{href: about_welcome_index_path} + = t('view.welcome.navbar.about') + %li.nav-item + %a.nav-link{href: contact_welcome_index_path} + = t('view.welcome.navbar.contact') + = yield + .footer + %p + = t('view.welcome.footer', app_name: "<%= app_name.capitalize %>", year: Time.zone.now.year) \ No newline at end of file diff --git a/templates/app_files/app/views/welcome/about.html.haml b/templates/app_files/app/views/welcome/about.html.haml new file mode 100644 index 0000000..ef4805f --- /dev/null +++ b/templates/app_files/app/views/welcome/about.html.haml @@ -0,0 +1,3 @@ +.row.about-contact + %h4 About + %p Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum. \ No newline at end of file diff --git a/templates/app_files/app/views/welcome/contact.html.haml b/templates/app_files/app/views/welcome/contact.html.haml new file mode 100644 index 0000000..ef19e73 --- /dev/null +++ b/templates/app_files/app/views/welcome/contact.html.haml @@ -0,0 +1,3 @@ +.row.about-contact + %h4 Contact + %p Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum. diff --git a/templates/app_files/app/views/welcome/index.html.haml b/templates/app_files/app/views/welcome/index.html.haml new file mode 100644 index 0000000..4d980e6 --- /dev/null +++ b/templates/app_files/app/views/welcome/index.html.haml @@ -0,0 +1,16 @@ +.jumbotron + %h1 Welcome to <%= app_name.capitalize %> + - if current_user + = link_to t('navbar.sign_out'), destroy_user_session_path, class: 'btn btn-large', method: :delete + .row-fluid.marketing + %p + %strong Name: + = current_user.name + %p + %strong Email: + = current_user.email + = link_to t('navbar.edit_login_info'), edit_user_registration_path, class: 'btn btn-large' + = link_to t('navbar.profile'), user_profile_path(current_user), class: 'btn btn-link' + - else + = link_to t('navbar.signup'), new_user_registration_path, class: 'btn btn-large btn-success' + = link_to t('navbar.signin'), new_user_session_path, class: 'btn btn-large' \ No newline at end of file diff --git a/templates/config/locales/view.en.yml b/templates/config/locales/view.en.yml index 1ae0d9c..e9c16f2 100644 --- a/templates/config/locales/view.en.yml +++ b/templates/config/locales/view.en.yml @@ -66,6 +66,11 @@ en: error: internal_server_error: "We are sorry. An error occured. Our engineers are working on it. We will solve it as soon as possible." not_found: "We are sorry. Page was not found. It may have been moved." + welcome: + navbar: + about: About + contact: Contact + footer: "%{app_name} Copyright © %{year} All Rights Reserved." devise: session: title: "%{model} Log in" diff --git a/templates/config/locales/view.tr.yml b/templates/config/locales/view.tr.yml index 7751b09..d630e21 100644 --- a/templates/config/locales/view.tr.yml +++ b/templates/config/locales/view.tr.yml @@ -61,6 +61,11 @@ tr: error: internal_server_error: "Üzgünüz. Şu anda bir hata var. Mühendislerimiz bu hata üzerinde çalışma yapıyorlar. En kısa sürede çözeceğiz." not_found: "Üzgünüz. Bu sayfa bulunamadı. Taşınmış olabilir. Buraya gitmek istediğinizden emin olun." + welcome: + navbar: + about: Hakkında + contact: İletişim + footer: "%{app_name} Copyright © %{year} Tüm Hakları Saklıdır." devise: session: title: '%{model} Girişi' @@ -101,4 +106,4 @@ tr: title: Parolanızı Değiştiriniz new_password: Yeni parolanız confirmation: Yeni parola doğrulması - button: Parolamı Değiştir \ No newline at end of file + button: Parolamı Değiştir diff --git a/templates/config/routes.rb.erb b/templates/config/routes.rb.erb index 3d465d1..0afdea9 100644 --- a/templates/config/routes.rb.erb +++ b/templates/config/routes.rb.erb @@ -21,3 +21,11 @@ resources :audits, only: [:index, :show] end + # Common pages + root to: 'welcome#index' + + resources :welcome, path: '', only: :index do + get :about, on: :collection + get :contact, on: :collection + end +