Skip to content

Commit

Permalink
ARI-119 #time 8h - Landing pages created.
Browse files Browse the repository at this point in the history
  • Loading branch information
esref.viduslu committed Nov 30, 2017
1 parent 3fb4c48 commit 941958b
Show file tree
Hide file tree
Showing 16 changed files with 190 additions and 13 deletions.
10 changes: 5 additions & 5 deletions bin/build_app
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
echo "Build cybele gem"
./bin/build_gem

# Remove dummy_app
echo "Remove dummy_app"
rm -rf tmp/dummy_app
# Remove example
echo "Remove test"
rm -rf tmp/example

# Disable spring
export DISABLE_SPRING=1
# or you can run this command
# ps ax | grep spring | grep dummy_app | cut -f1 -d' ' | xargs kill

# Create dummy_app
echo "Create dummy_app"
cybele tmp/dummy_app --skip-create-database
echo "Create example"
cybele tmp/example --skip-ask
1 change: 1 addition & 0 deletions lib/cybele.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
require 'cybele/helpers/view_files/assets_files'
require 'cybele/helpers/view_files/view_gems'
require 'cybele/helpers/pronto'
require 'cybele/helpers/landing_pages'
require 'cybele/app_builder'
1 change: 1 addition & 0 deletions lib/cybele/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class AppBuilder < Rails::AppBuilder
include Cybele::Helpers::ViewFiles::ViewGems
include Cybele::Helpers::Docker
include Cybele::Helpers::Pronto
include Cybele::Helpers::LandingPages

def readme
template 'README.md.erb',
Expand Down
15 changes: 10 additions & 5 deletions lib/cybele/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,6 @@ def customize_view_files
build :customize_assets_files
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
Expand All @@ -261,6 +256,16 @@ def setup_pronto_config
build :configure_pronto
end

def setup_landing_pages
say 'Generate Landing Pages'
build :generate_landing_pages
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
Expand Down
28 changes: 28 additions & 0 deletions lib/cybele/helpers/landing_pages.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

module Cybele
module Helpers
module LandingPages
def generate_landing_pages
# Edit application file
template 'landing_pages/application.html.haml.erb',
'app/views/layouts/application.html.haml', force: true

# Welcome_controller route
inject_into_file 'config/routes.rb',
template_content('landing_pages/landing_route.erb'),
before: ' if Rails.env.production? || Rails.env.staging?'

# Welcome_controller and welcome/index.html.haml
copy_file 'landing_pages/welcome_controller.rb', 'app/controllers/welcome_controller.rb'
template 'landing_pages/welcome_index.html.haml.erb', 'app/views/welcome/index.html.haml', force: true
template 'landing_pages/about.html.haml.erb', 'app/views/welcome/about.html.haml', force: true
template 'landing_pages/contact.html.haml.erb', 'app/views/welcome/contact.html.haml', force: true

# Partials
template 'landing_pages/partials/_warnings.html.haml.erb',
'app/views/layouts/partials/_warnings.html.haml', force: true
end
end
end
end
14 changes: 13 additions & 1 deletion templates/config/locales/view.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@ en:
view:
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."
not_found: "We are sorry. Page was not found. It may have been moved."
navbar:
settings: Settings
signup: Signup
signin: Signin
sign_out: Sign Out
edit_login_info: Edit Login Info
edit_profile_info: Edit Profile Info
home_page: Home Page
admin_portal: Admin Portal
profile: Profile
about: About
contact: Contact
14 changes: 13 additions & 1 deletion templates/config/locales/view.tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@ tr:
view:
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."
not_found: "Üzgünüz. Bu sayfa bulunamadı. Taşınmış olabilir. Buraya gitmek istediğinizden emin olun."
navbar:
settings: Ayarlar
signup: Kayıt ol
signin: Giriş Yap
sign_out: Çıkış yap
edit_login_info: Giriş bilgilerini güncelle
edit_profile_info: Profil bilgilerini güncelle
home_page: Anasayfa
admin_portal: Yönetici Portalı
profile: Profil
about: Hakkında
contact: İletişim
2 changes: 1 addition & 1 deletion templates/docker/docker_env_local.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ REDISTOGO_URL=redis://redis:6379/0

# Set Rails/Rack environment
RACK_ENV=development
POSTGRESQL_HOST=postgres
# POSTGRESQL_HOST=postgres
REDIS_HOST=redis
3 changes: 3 additions & 0 deletions templates/landing_pages/about.html.haml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.row.about-contact
%h4 About
%p Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.
34 changes: 34 additions & 0 deletions templates/landing_pages/application.html.haml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
!!!
%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('navbar.about')
%li.nav-item
%a.nav-link{href: contact_welcome_index_path}
= t('navbar.contact')
= yield
.footer
%p Dummy_app Copyright &copy; #{Time.zone.now.year} Tüm Hakları Saklıdır.
3 changes: 3 additions & 0 deletions templates/landing_pages/contact.html.haml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.row.about-contact
%h4 Contact
%p Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.
9 changes: 9 additions & 0 deletions templates/landing_pages/landing_route.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Common pages
root to: 'welcome#index'

resources :welcome, path: '', only: :index do
get :about, on: :collection
get :contact, on: :collection
end

3 changes: 3 additions & 0 deletions templates/landing_pages/partials/_warnings.html.haml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- if Rails.env.staging?
#warnings.alert.alert-warning.panel-reset.text-center{style: 'margin-bottom: 10px;' }
= t('staging_warning').html_safe
10 changes: 10 additions & 0 deletions templates/landing_pages/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class WelcomeController < ApplicationController
def index
end

def about
end

def contact
end
end
16 changes: 16 additions & 0 deletions templates/landing_pages/welcome_index.html.haml.erb
Original file line number Diff line number Diff line change
@@ -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'
40 changes: 40 additions & 0 deletions templates/view_files/app/assets/stylesheets/application.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 941958b

Please sign in to comment.