Skip to content

Commit

Permalink
KBP-119 #time 5m - Conflict resolved.
Browse files Browse the repository at this point in the history
  • Loading branch information
esref.viduslu committed Dec 5, 2017
2 parents 8dd3651 + 9905a08 commit 7647fcc
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 6 deletions.
16 changes: 11 additions & 5 deletions lib/cybele/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lib/cybele/helpers/app_files/controller_files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lib/cybele/helpers/app_files/view_files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/cybele/helpers/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions spec/features/new_default_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions spec/features/new_not_default_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions templates/app_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
10 changes: 10 additions & 0 deletions templates/app_files/app/controllers/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
35 changes: 35 additions & 0 deletions templates/app_files/app/views/layouts/application.html.haml.erb
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions templates/app_files/app/views/welcome/about.html.haml
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.
3 changes: 3 additions & 0 deletions templates/app_files/app/views/welcome/contact.html.haml
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.
16 changes: 16 additions & 0 deletions templates/app_files/app/views/welcome/index.html.haml
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'
5 changes: 5 additions & 0 deletions templates/config/locales/view.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 &copy; %{year} All Rights Reserved."
devise:
session:
title: "%{model} Log in"
Expand Down
7 changes: 6 additions & 1 deletion templates/config/locales/view.tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 &copy; %{year} Tüm Hakları Saklıdır."
devise:
session:
title: '%{model} Girişi'
Expand Down Expand Up @@ -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
button: Parolamı Değiştir
8 changes: 8 additions & 0 deletions templates/config/routes.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7647fcc

Please sign in to comment.