From 6848cd9ff6dbc567d1900e7f8cdcefe0c3bd5202 Mon Sep 17 00:00:00 2001 From: Luc Donnet Date: Thu, 6 Nov 2014 12:15:19 +0100 Subject: Update devise sign in and sign up design --- app/assets/stylesheets/application.css.scss.erb | 2 + app/assets/stylesheets/main/layout.css.scss | 71 +------------------- app/assets/stylesheets/modules/devise.css.scss | 75 +++++++++++++++++++++ app/assets/stylesheets/partials/header.css.scss | 27 ++++---- app/assets/stylesheets/vendor/simple_form.css.scss | 6 ++ app/controllers/application_controller.rb | 2 +- app/controllers/registrations_controller.rb | 1 - app/models/organisation.rb | 3 +- app/models/user.rb | 10 +-- app/views/devise/passwords/new.html.erb | 20 +++--- app/views/devise/registrations/new.html.erb | 40 ++++++----- app/views/devise/sessions/new.html.erb | 78 +++++++++++++++++----- app/views/layouts/devise.html.erb | 40 +++++++++++ app/views/layouts/without_sidebar.html.erb | 38 ----------- app/views/shared/_header.erb | 4 +- 15 files changed, 242 insertions(+), 175 deletions(-) create mode 100644 app/assets/stylesheets/modules/devise.css.scss create mode 100644 app/assets/stylesheets/vendor/simple_form.css.scss create mode 100644 app/views/layouts/devise.html.erb delete mode 100644 app/views/layouts/without_sidebar.html.erb (limited to 'app') diff --git a/app/assets/stylesheets/application.css.scss.erb b/app/assets/stylesheets/application.css.scss.erb index 3ea2b36ed..b510fc524 100644 --- a/app/assets/stylesheets/application.css.scss.erb +++ b/app/assets/stylesheets/application.css.scss.erb @@ -12,6 +12,7 @@ $body-bg: #eee; @import "modules/search"; @import "modules/index_item"; @import "modules/icons"; +@import "modules/devise"; // Partials @import "partials/header"; @@ -36,6 +37,7 @@ $body-bg: #eee; @import "vendor/token-input"; @import "vendor/typeahead"; @import "vendor/bootstrap_changes"; +@import "vendor/simple_form"; // Main css @import "main/*"; diff --git a/app/assets/stylesheets/main/layout.css.scss b/app/assets/stylesheets/main/layout.css.scss index 90da0cc6d..0a9ade3a8 100644 --- a/app/assets/stylesheets/main/layout.css.scss +++ b/app/assets/stylesheets/main/layout.css.scss @@ -1,5 +1,5 @@ body { - padding-top: 55px; + padding-top: 50px; } h1{ color: white;} @@ -17,75 +17,6 @@ ol.breadcrumb{ margin-top: 10px; } -#header { - - .navbar-brand{ - padding-top: 5px; - padding-bottom: 5px; - line-height: 40px; - - img { - height: 40px; - } - - .brand_name{ - margin-left: 3px; - margin-right: 3px; - font-size: 20px; - font-family: monospace; - font-weight: bold; - } - - .version - { - vertical-align: text-top; - color: white; - font-size: 12px; - } - } - - background: $brand_primary url(image-path('header.png')) no-repeat; - - .gravatar { - margin-right: 5px; - img{ - width: 25px; - height: 25px; - } - } - - .dropdown.languages{ - .dropdown-menu{ - min-width: 56px; - } - } - - .dropdown.datas{ - .dropdown-menu{ - - .badge{ - background-color: #DADADA - } - } - } -} - -#footer{ - padding: 20px; - background-color: $gray-darker; - color: $gray-light; - font-size: 12px; - min-height: 200px; - - a { color: $gray-light; } - - h4 { color: $gray-lighter; } - - .logo > img { - margin-left: 20px; - } -} - #middle{ min-height: 500px; -webkit-box-shadow: 0 0 5px 2px rgba(0, 0, 0, .2); diff --git a/app/assets/stylesheets/modules/devise.css.scss b/app/assets/stylesheets/modules/devise.css.scss new file mode 100644 index 000000000..83b2b3fec --- /dev/null +++ b/app/assets/stylesheets/modules/devise.css.scss @@ -0,0 +1,75 @@ +#devise{ + background-color: $gray-light; + + .front_bg{ + //background: url(image-path('intro.jpg')) no-repeat center center; + //background-size: cover; + + #devise_middle{ + min-height: 620px; + padding: 30px 20px 0px 20px; + + #registrations_new{ + + .form-group{ + margin-bottom: 5px; + } + + } + + #sessions_new{ + + .btn{ + font-weight: bold; + } + + .product_summary{ + padding: 30px 60px 0 60px; + + color: white; + text-shadow: 0 0 1px rgba(0,0,0,.6); + + p{ + font-size: 21px; + } + + ul > li{ font-size: 21px; } + } + + .login{ + padding-top: 30px; + + .form-group{ + margin-bottom: 5px; + } + + .options{ + .new_password{ + padding-top: 7px; + } + + .checkbox{ + font-weight: normal; + + input[type="checkbox"]{ + margin-left: 0px !important; + position: relative; + margin: 0px 4px 0px 0px; + } + } + + .form-group{ + margin-bottom: 0px; + } + + font-size: 12px; + } + } + } + } + + #footer{ + background-color: rgba(0, 0, 0, 0.8); + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/partials/header.css.scss b/app/assets/stylesheets/partials/header.css.scss index cc0e4a711..6f7b777f1 100644 --- a/app/assets/stylesheets/partials/header.css.scss +++ b/app/assets/stylesheets/partials/header.css.scss @@ -7,14 +7,25 @@ img { height: 40px; - } + } + } + .navbar-text{ + margin-top: 10px; + margin-bottom: 10px; + margin-left: 0px; + + .brand_name{ + color: white; + font-weight: bold; + font-size: 20px; + } + .version { - margin-left: 3px; - vertical-align: text-top; + margin-left: 5px; color: white; - font-size: 13px; + font-size: 12px; } } @@ -34,12 +45,4 @@ } } - .dropdown.datas{ - .dropdown-menu{ - - .badge{ - background-color: #333 - } - } - } } \ No newline at end of file diff --git a/app/assets/stylesheets/vendor/simple_form.css.scss b/app/assets/stylesheets/vendor/simple_form.css.scss new file mode 100644 index 000000000..ea5e4d528 --- /dev/null +++ b/app/assets/stylesheets/vendor/simple_form.css.scss @@ -0,0 +1,6 @@ +.simple_form{ + + .help-inline{ + color:#cc0000; + } +} \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 64a706557..04dd281d5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -21,6 +21,6 @@ class ApplicationController < ActionController::Base # Overwriting the sign_out redirect path method def after_sign_out_path_for(resource_or_scope) new_user_session_path - end + end end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index f0ac420ce..b02d3217a 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -5,7 +5,6 @@ private def accept_user_creation - puts "J'y passe" if !Rails.application.config.accept_user_creation redirect_to root_path return false diff --git a/app/models/organisation.rb b/app/models/organisation.rb index 17cf9a8f2..f4b2e35f8 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -3,6 +3,5 @@ class Organisation < ActiveRecord::Base has_many :users, :dependent => :destroy has_many :referentials, :dependent => :destroy - validates_presence_of :name - validates_uniqueness_of :name + validates :name, :presence => true, :uniqueness => true end diff --git a/app/models/user.rb b/app/models/user.rb index 1889a3bf0..6c14b93fb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,11 +11,11 @@ class User < ActiveRecord::Base belongs_to :organisation accepts_nested_attributes_for :organisation - - validates_presence_of :email - validates_presence_of :name - validates_presence_of :password - validates_presence_of :password_confirmation + + validates :organisation, :presence => true + validates :email, :presence => true, :uniqueness => true + validates :name, :presence => true + validates :password, :presence => true, :confirmation => true before_validation(:on => :create) do self.password ||= Devise.friendly_token.first(6) diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index f285a0f6d..68fd8c22a 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,13 +1,13 @@ -<%= title_tag t('.title') %> +
+
<%= t('.title') %>
+
+ <%= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |form| %> + <%= form.input :email %> -<%= semantic_form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |form| %> - <%= form.inputs :email %> - - <%= form.actions do %> - <%= form.action :submit, :as => :button, :label => t('.commit') %> - <%= form.action :cancel, :as => :link %> - <% end %> + <%= link_to t("cancel"), root_path, :class => "btn btn-default" %> + <%= form.button :submit, :value => t("devise.passwords.new.commit") %> + <% end %> +
+
-<% end %> -<%= render "links" %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 79edcb53b..9c780cba3 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,22 +1,26 @@ -<%= title_tag t('.title') %> +
-<%= semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |form| %> - <%= form.inputs do %> - <%= form.semantic_fields_for :organisation, Organisation.new do |organisation| %> - <%= organisation.input :name, :label => t("helpers.label.user.organisation_name") %> + <% if Rails.application.config.accept_user_creation %> +
+
<%= t("devise.registrations.new.title") %>
+
+ <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :wrapper => "form_without_label" ) do |form| %> + <%= form.simple_fields_for :organisation, Organisation.new do |organisation| %> + <%= organisation.input :name, :label => false, :placeholder => t("helpers.label.user.organisation_name"), input_html: { :class => "form-control" } %> + <% end %> + <% if resource.respond_to?( :name) %> + <%= form.input :name, :label => false, :placeholder => t("helpers.label.user.name"), input_html: { :class => "form-control" } %> + <% end %> + <%= form.input :email, :label => false, :placeholder => t("helpers.label.user.email"), input_html: { :class => "form-control" } %> + <%= form.input :password, :as => :password, :label => false, :placeholder => t("helpers.label.user.password"), input_html: { :class => "form-control" } %> + <%= form.input :password_confirmation, :as => :password, :label => false, :placeholder => t("helpers.label.user.password_confirmation"), input_html: { :class => "form-control" } %> + + <%= form.button :submit, :class => "btn-primary" %> + <% end %> +
+
<% end %> - <% if resource.respond_to?( :name) %> - <%= form.input :name %> - <% end %> - <%= form.input :email %> - <%= form.input :password, :as => :password %> - <%= form.input :password_confirmation, :as => :password %> - <% end %> + +
- <%= form.actions do %> - <%= form.action :submit, :as => :button, :label => t('.commit') %> - <%= form.action :cancel, :as => :link %> - <% end %> -<% end %> -<%= render "links" %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index a6c13df5d..768efdd9f 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,19 +1,65 @@ -<%= title_tag t('.title') %> +
+
+

Bienvenue sur Chouette

+

+ Chouette est un logiciel Open Source de saisie, de visualisation et d'échange d'offre de transport public planifiée. +

+

+ Ce logiciel est déployé en mode Saas et se veut ouvert : +

+ +
+
+
+
+ <%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), :wrapper => "form_without_label" ) do |form| %> + <%= form.input :email, :label => false, :placeholder => t("helpers.label.user.email"), input_html: { :class => "form-control" } %> +
+
+ <%= form.input :password, :as => :password, :label => false, :placeholder => t("helpers.label.user.password"), input_html: { :class => "form-control" } %> +
+
+ <%= form.button :submit, t("devise.sessions.new.commit"), :class => "btn-primary" %> +
+
+
+
+ <% if devise_mapping.rememberable? %> + <%= form.input :remember_me, :as => :boolean, :label => false, :inline_label => t("helpers.label.user.remember_me") if devise_mapping.rememberable? %> + <% end %> +
+
+ <%= link_to t("devise.links.new_password"), new_password_path(resource_name) %> +
+
+ <% end %> +
+
-<%= semantic_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |form| %> - <%= form.inputs do %> - <%= form.input :email %> - <%= form.input :password, :as => :password %> - - <% if devise_mapping.rememberable? -%> - <%= form.input :remember_me, :as => :boolean %> + <% if Rails.application.config.accept_user_creation %> +
+
<%= t("devise.registrations.new.title") %>
+
+ <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :wrapper => "form_without_label" ) do |form| %> + <%= form.simple_fields_for :organisation, Organisation.new do |organisation| %> + <%= organisation.input :name, :label => false, :placeholder => t("helpers.label.user.organisation_name"), input_html: { :class => "form-control" } %> + <% end %> + <% if resource.respond_to?( :name) %> + <%= form.input :name, :label => false, :placeholder => t("helpers.label.user.name"), input_html: { :class => "form-control" } %> + <% end %> + <%= form.input :email, :label => false, :placeholder => t("helpers.label.user.email"), input_html: { :class => "form-control" } %> + <%= form.input :password, :as => :password, :label => false, :placeholder => t("helpers.label.user.password"), input_html: { :class => "form-control" } %> + <%= form.input :password_confirmation, :as => :password, :label => false, :placeholder => t("helpers.label.user.password_confirmation"), input_html: { :class => "form-control" } %> + + <%= form.button :submit, :class => "btn-default" %> + <% end %> +
+
<% end %> - <% end %> - - - <%= form.actions do %> - <%= form.action :submit, :as => :button, :label => t('.commit') %> - <% end %> -<% end %> + +
+
-<%= render "links" %> diff --git a/app/views/layouts/devise.html.erb b/app/views/layouts/devise.html.erb new file mode 100644 index 000000000..60c531780 --- /dev/null +++ b/app/views/layouts/devise.html.erb @@ -0,0 +1,40 @@ + + + + Chouette V2 - <%= title %> + <%= stylesheet_link_tag :application %> + <%= javascript_include_tag :application %> + <% if defined?( @map) %> + + + + <% end %> + <%= analytics_init if Rails.env.production? %> + <%= csrf_meta_tag %> + + + + + +
+
+
+
+
+ <%= render partial: "shared/flash_messages", flash: flash %> + <%= render partial: "shared/breadcrumb" %> + <%= yield %> +
+
+
+
+ +
+ + diff --git a/app/views/layouts/without_sidebar.html.erb b/app/views/layouts/without_sidebar.html.erb deleted file mode 100644 index c61dc6b25..000000000 --- a/app/views/layouts/without_sidebar.html.erb +++ /dev/null @@ -1,38 +0,0 @@ - - - - Chouette V2 - <%= title %> - <%= stylesheet_link_tag :application %> - <%= javascript_include_tag :application %> - <% if defined?( @map) %> - - - - <% end %> - <%= analytics_init if Rails.env.production? %> - <%= csrf_meta_tag %> - - - - - -
-
-
-
- <%= render partial: "shared/flash_messages", flash: flash %> - <%= render partial: "shared/breadcrumb" %> - <%= yield %> -
-
-
-
- - - diff --git a/app/views/shared/_header.erb b/app/views/shared/_header.erb index 3b7c90926..380f5b520 100644 --- a/app/views/shared/_header.erb +++ b/app/views/shared/_header.erb @@ -10,10 +10,10 @@ <%= APP_VERSION %> <%= link_to referentials_path, :class =>"navbar-brand" do %> - <%= image_tag("logo_chouette.png") %>CHOUETTE<%= APP_VERSION %> + <%= image_tag("logo_chouette.png") %> <% end %> + - -- cgit v1.2.3