forked from saurabh/orbit4-5
now names saved in all locales while signup. added orbit site logo and also now favicon is rendered and orbit bar logo rendered.
This commit is contained in:
parent
2d54b50cf8
commit
23aef52422
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -15,6 +15,7 @@ if($.support.touch) {
|
|||
!function ($) {
|
||||
// Set sidebarState
|
||||
sidebarState = function (v) {
|
||||
console.log(v)
|
||||
if(v) {
|
||||
window.localStorage.setItem('sidebarState', 1);
|
||||
} else {
|
||||
|
|
|
@ -55,10 +55,10 @@ $(function() {
|
|||
}
|
||||
$('.set-sidebar-state').on({
|
||||
change: function() {
|
||||
if($(this).prop('checked')) {
|
||||
sidebarState(1);
|
||||
} else {
|
||||
if($(this).parent().hasClass("disable")) {
|
||||
sidebarState(0);
|
||||
} else {
|
||||
sidebarState(1);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -311,10 +311,16 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
|
|||
.orbit-bar-logo {
|
||||
@extend .orbitMenuLink;
|
||||
padding: 0;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url('<%= asset_path 'orbit-logo.svg' %>');
|
||||
background-image: url('<%= asset_path 'orbit-logo.png' %>')\9;
|
||||
text-align: center;
|
||||
img {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
height: 85%;
|
||||
}
|
||||
// background-position: center;
|
||||
// background-repeat: no-repeat;
|
||||
// background-image: url('<%= asset_path 'orbit-logo.svg' %>');
|
||||
// background-image: url('<%= asset_path 'orbit-logo.png' %>')\9;
|
||||
& + ul {
|
||||
left: 0;
|
||||
}
|
||||
|
@ -384,10 +390,10 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
|
|||
margin-left: -45%;
|
||||
.login-body {
|
||||
form {
|
||||
width: 100%;
|
||||
width: 85%;
|
||||
}
|
||||
.input-prepend {
|
||||
.input-xlarge {
|
||||
.prepend {
|
||||
.input {
|
||||
width: 80%;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,6 +218,8 @@ class PagesController < ApplicationController
|
|||
viewarea = doc.css("*[data-content='true']")[0]
|
||||
viewarea.inner_html = render_to_string(original_view)
|
||||
end
|
||||
link = doc.css("link")[0]
|
||||
link.attributes["href"].value = current_site.favicon.url.nil? ? "/assets/favicon.ico" : current_site.favicon.url
|
||||
doc.to_html
|
||||
|
||||
else
|
||||
|
|
|
@ -7,8 +7,16 @@ class SessionsController < ApplicationController
|
|||
def create
|
||||
user = User.find_by(user_name: params[:user_name]) rescue nil
|
||||
if (user && user.authenticate(params[:password]) && user.is_confirmed?.eql?(true))
|
||||
session[:user_id] = user.id
|
||||
redirect_to admin_dashboards_path, :notice => "Logged in!"
|
||||
if user.is_approved?
|
||||
session[:user_id] = user.id
|
||||
redirect_to admin_dashboards_path, :notice => "Logged in!"
|
||||
elsif user.is_admin?
|
||||
session[:user_id] = user.id
|
||||
redirect_to admin_dashboards_path, :notice => "Logged in!"
|
||||
else
|
||||
flash.now.alert = "User not approved."
|
||||
render "new"
|
||||
end
|
||||
else
|
||||
flash.now.alert = "Invalid username or password"
|
||||
render "new"
|
||||
|
|
|
@ -5,8 +5,15 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
firstname = {}
|
||||
lastname = {}
|
||||
@site_valid_locales.each do |locale|
|
||||
firstname[locale] = params[:first_name]
|
||||
lastname[locale] = params[:last_name]
|
||||
end
|
||||
|
||||
@user = User.new(user_params)
|
||||
@member = MemberProfile.new(email: params[:email], first_name: params[:first_name], last_name: params[:last_name])
|
||||
@member = MemberProfile.new(email: params[:email], first_name_translations: firstname, last_name_translations: lastname)
|
||||
if @user.save
|
||||
@member.save
|
||||
@user.update_attributes(member_profile_id: @member.id)
|
||||
|
@ -49,7 +56,7 @@ class UsersController < ApplicationController
|
|||
def basic_info_update
|
||||
@user = User.find(params[:id])
|
||||
member_profile = @user.member_profile
|
||||
if member_profile.update_attributes(basic_info_params)
|
||||
if member_profile.update_attributes(p)
|
||||
redirect_to users_role_page_path(:user_id => @user.id.to_s)
|
||||
else
|
||||
render :action=> "form_page"
|
||||
|
@ -76,21 +83,15 @@ class UsersController < ApplicationController
|
|||
response = {}
|
||||
case params[:type]
|
||||
when "user_id"
|
||||
response["success"] = User.where(:user_id => params[:value]).count > 0 ? false : true
|
||||
response["success"] = User.where(:user_name => params[:value]).count > 0 ? false : true
|
||||
when "user_email"
|
||||
response["success"] = User.where(:email => params[:value]).count > 0? false : true
|
||||
response["success"] = MemberProfile.where(:email => params[:value]).count > 0 ? false : true
|
||||
end
|
||||
render :json => response.to_json
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def email_template(token)
|
||||
html = "<p>Thank you for registering your site with Orbit! Please click on the following link and confirm. This is to make sure we could provide you with a spam free experience. Thanks a lot.</p>"
|
||||
html = html + "<a href='#{confirm_user_users_url(:token => token)} /> Please click here </a>"
|
||||
html
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def user_params
|
||||
params.require(:user).permit(:password, :password_confirmation, :user_name, :member_profile_id, :email, :first_name, :last_name)
|
||||
|
|
|
@ -25,7 +25,7 @@ module ApplicationHelper
|
|||
sub_menu_html = site.sub_menu
|
||||
html = header.to_s
|
||||
html = html.gsub("{{site_name}}",site.title)
|
||||
html = html.gsub("%7B%7Blogo_url%7D%7D",(site.default_image.file.url rescue "http://placehold.it/50x50"))
|
||||
html = html.gsub("%7B%7Blogo_url%7D%7D",(site.site_logo.url.nil? ? "/assets/site-logo.png" : site.site_logo.url))
|
||||
if site.sitemap_menu_in_header
|
||||
sub_menu_html = sub_menu_html + "<a href='/#{I18n.locale.to_s}#{site.site_map_link}'>Sitemap</a>"
|
||||
end
|
||||
|
|
|
@ -33,6 +33,7 @@ class Site
|
|||
|
||||
|
||||
mount_uploader :default_image, ImageUploader
|
||||
mount_uploader :site_logo, ImageUploader
|
||||
mount_uploader :favicon, ImageUploader
|
||||
mount_uploader :mobile_icon, ImageUploader
|
||||
def to_param
|
||||
|
|
|
@ -91,6 +91,10 @@ class User
|
|||
end
|
||||
end
|
||||
|
||||
def is_approved?
|
||||
self.approved
|
||||
end
|
||||
|
||||
def is_manager?(module_app)
|
||||
if ((module_app.user_module_managers.include?(self.id) rescue nil) && (!self.is_admin?))
|
||||
true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<link rel="shortcut icon" href="/assets/images/favicon.ico" />
|
||||
<link rel="shortcut icon" href="" />
|
||||
<title>Orbit Classic</title>
|
||||
<%= stylesheet_link_tag "default"%>
|
||||
<%= javascript_include_tag "lib/jquery-1.11.0.min"%>
|
||||
|
|
|
@ -238,6 +238,37 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted">Orbit <%= t('preferences.site_logo') %></label>
|
||||
<div class="controls">
|
||||
<!-- if this page editing please add class "fileupload-edit" -->
|
||||
<div class="fileupload fileupload-new clearfix" data-provides="fileupload">
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if @site.site_logo.file.present? %>
|
||||
<%= image_tag( @site.site_logo, :size=>"120x120") rescue ''%>
|
||||
<% else %>
|
||||
<%= image_tag "site-logo.png", :class => "pull-left upload-picture"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||
<% if @site.site_logo.file.present?%>
|
||||
<span class="btn btn-file">
|
||||
<%= f.file_field :site_logo, :id => "input-upload", :class => 'fileupload-new', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %><%= t('preferences.change') %>
|
||||
</span>
|
||||
<%= f.check_box :remove_site_logo %>
|
||||
<%= t(:remove) %> <%= t('preferences.site_logo') %>
|
||||
<%else%>
|
||||
<span class="btn btn-file">
|
||||
<%= f.file_field :site_logo, :id => "input-upload", :class => 'fileupload-new', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %><%= t('preferences.select_image') %>
|
||||
</span>
|
||||
<%end%>
|
||||
|
||||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
<div class="submit">
|
||||
<button type="submit"><%= t(:login) %></button>
|
||||
</div>
|
||||
<div>Or</div>
|
||||
<a href="/users/new">Sign up</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -38,7 +40,9 @@
|
|||
</h1>
|
||||
<ul class="orbit-bar-menu">
|
||||
<li>
|
||||
<span class="orbit-bar-logo"></span>
|
||||
<span class="orbit-bar-logo">
|
||||
<img src="<%= current_site.default_image.url.nil? ? '/assets/orbit-logo.png' : current_site.default_image.url %>" />
|
||||
</span>
|
||||
<% if !current_user.nil? %>
|
||||
<ul>
|
||||
<li>
|
||||
|
|
|
@ -406,6 +406,7 @@ en:
|
|||
classification: Classification
|
||||
frontend_open: "If Checked, the frontend will be open for all users."
|
||||
favicon: Favicon
|
||||
site_logo: Site Logo
|
||||
icon: Icon
|
||||
language: Language
|
||||
lang_detection: Enable User Language Detection
|
||||
|
|
Loading…
Reference in New Issue